|
1 // Copyright (c) 2006-2009 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); |
|
47 |
|
48 DTargetProcess* FuzzyFindProcess(const TDesC8& aProcessName); |
|
49 |
|
50 TBool CheckSuspended(const TUint64 aTargetThreadId) const; |
|
51 TBool CheckSuspended(DThread* aTargetThread) const; |
|
52 TInt SuspendThread(DThread* aTargetThread, TBool aFreezeThread=EFalse); |
|
53 TInt ResumeThread(DThread* aTargetThread); |
|
54 void FSWait(); |
|
55 |
|
56 private: |
|
57 TInt RemoveSuspendedThread(DThread* aThread); |
|
58 TInt AddSuspendedThread(DThread* aThread); |
|
59 HBuf* GetFileName(DThread* aThread) const; |
|
60 |
|
61 private: |
|
62 RPointerArray<DTargetProcess> iProcesses; |
|
63 }; |
|
64 |
|
65 // static global object |
|
66 extern DProcessTracker TheDProcessTracker; |
|
67 |
|
68 #endif // D_PROCESS_TRACKER_H |