1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/drivers/debug/rmdebug/d_process_tracker.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,68 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Purpose: Kernel-side tracking of process state
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef D_PROCESS_TRACKER_H
1.22 +#define D_PROCESS_TRACKER_H
1.23 +
1.24 +#include "d_target_process.h"
1.25 +
1.26 +// The global class which tracks all debugged processes.
1.27 +//
1.28 +// Note that multiple debug agents may attach to a process,
1.29 +// as the security server will ensure only one is an 'active'
1.30 +// agent, preventing conflicts. Other agents will be 'passive',
1.31 +// typically interested only in recording events.
1.32 +//
1.33 +// The above requirement generates the requirement for the class
1.34 +// to track the agent IDs, as multiple debug agents may be interested
1.35 +// in a process.
1.36 +
1.37 +class DProcessTracker : public DBase
1.38 +{
1.39 +public:
1.40 + DProcessTracker();
1.41 + ~DProcessTracker();
1.42 +
1.43 + TInt AttachProcess(const TDesC8& aProcessName, TUint64 aAgentId);
1.44 +
1.45 + TInt DetachProcess(const TDesC8& aProcessName, TUint64 aAgentId);
1.46 +
1.47 + TInt DetachAgent(TUint64 aAgentId);
1.48 +
1.49 + DTargetProcess* FindProcess(const TDesC8& aProcessName);
1.50 +
1.51 + DTargetProcess* FuzzyFindProcess(const TDesC8& aProcessName);
1.52 +
1.53 + TBool CheckSuspended(const TUint64 aTargetThreadId) const;
1.54 + TBool CheckSuspended(DThread* aTargetThread) const;
1.55 + TInt SuspendThread(DThread* aTargetThread, TBool aFreezeThread=EFalse);
1.56 + TInt ResumeThread(DThread* aTargetThread);
1.57 + void FSWait();
1.58 +
1.59 +private:
1.60 + TInt RemoveSuspendedThread(DThread* aThread);
1.61 + TInt AddSuspendedThread(DThread* aThread);
1.62 + HBuf* GetFileName(DThread* aThread) const;
1.63 +
1.64 +private:
1.65 + RPointerArray<DTargetProcess> iProcesses;
1.66 +};
1.67 +
1.68 +// static global object
1.69 +extern DProcessTracker TheDProcessTracker;
1.70 +
1.71 +#endif // D_PROCESS_TRACKER_H