1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Purpose: Kernel-side tracking of process state |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef D_PROCESS_TRACKER_H |
|
19 #define D_PROCESS_TRACKER_H |
|
20 |
|
21 #include "d_target_process.h" |
|
22 |
|
23 // The global class which tracks all debugged processes. |
|
24 // |
|
25 // Note that multiple debug agents may attach to a process, |
|
26 // as the security server will ensure only one is an 'active' |
|
27 // agent, preventing conflicts. Other agents will be 'passive', |
|
28 // typically interested only in recording events. |
|
29 // |
|
30 // The above requirement generates the requirement for the class |
|
31 // to track the agent IDs, as multiple debug agents may be interested |
|
32 // in a process. |
|
33 |
|
34 class DProcessTracker : public DBase |
|
35 { |
|
36 public: |
|
37 DProcessTracker(); |
|
38 ~DProcessTracker(); |
|
39 |
|
40 TInt AttachProcess(const TDesC8& aProcessName, TUint64 aAgentId); |
|
41 |
|
42 TInt DetachProcess(const TDesC8& aProcessName, TUint64 aAgentId); |
|
43 |
|
44 TInt DetachAgent(TUint64 aAgentId); |
|
45 |
|
46 DTargetProcess* FindProcess(const TDesC8& aProcessName) const; |
|
47 DTargetProcess* FuzzyFindProcess(const TDesC8& aProcessName); |
|
48 |
|
49 DDebugAgent* GetCurrentAgentAttachedToAll() const; |
|
50 DDebugAgent* FindAgentForProcessAndId(const TDesC8& aProcessName, TUint64 aAgentId) const; |
|
51 TBool NotifyAgentsForProcessEvent(const TDesC8& aProcessName, const TDriverEventInfo& aEvent, TBool aAllowFuzzy=EFalse); |
|
52 |
|
53 TInt SuspendThread(DThread* aTargetThread, TBool aFreezeThread=EFalse); |
|
54 TInt ResumeThread(DThread* aTargetThread); |
|
55 void FSWait(); |
|
56 TInt ResumeFrozenThread(DThread* aThread); |
|
57 TInt FreezeThread(); |
|
58 |
|
59 private: |
|
60 TInt RemoveSuspendedThread(DThread* aThread); |
|
61 TInt AddSuspendedThread(DThread* aThread); |
|
62 const TDesC8* GetFileName(DThread* aThread) const; |
|
63 |
|
64 private: |
|
65 RPointerArray<DTargetProcess> iProcesses; |
|
66 RPointerArray<DDebugAgent> iAgentsAttachedToAll; |
|
67 RPointerArray<NFastSemaphore> iFrozenThreadSemaphores; |
|
68 }; |
|
69 |
|
70 // static global object |
|
71 extern DProcessTracker TheDProcessTracker; |
|
72 |
|
73 #endif // D_PROCESS_TRACKER_H |
|