libcsdbg  1.28
C++ exception (and generic) stack trace debug library
process.hpp
Go to the documentation of this file.
1 #ifndef _CSDBG_PROCESS
2 #define _CSDBG_PROCESS 1
3 
10 #include "./thread.hpp"
11 #include "./symtab.hpp"
12 
13 namespace csdbg {
14 
29 class process: virtual public object
30 {
31 protected:
32 
33  /* Protected variables */
34 
35  pid_t m_pid;
44  /* Protected generic methods */
45 
46  virtual process& cache_add(mem_addr_t, const i8*);
47 
48  virtual const symbol* cache_lookup(mem_addr_t) const;
49 
50 public:
51 
52  /* Constructors, copy constructors and destructor */
53 
54  process();
55 
56  process(const process&);
57 
58  virtual ~process();
59 
60  virtual process* clone() const;
61 
62 
63  /* Accessor methods */
64 
65  virtual pid_t pid() const;
66 
67 
68  /* Operator overloading methods */
69 
70  virtual process& operator=(const process&);
71 
72 
73  /* Generic methods */
74 
75  /* Module (symtab) handling methods */
76 
77  virtual u32 symbol_count() const;
78 
79  virtual u32 module_count() const;
80 
81  virtual process& add_module(const i8*, mem_addr_t);
82 
83  virtual const i8* lookup(mem_addr_t);
84 
85  virtual const i8* ilookup(mem_addr_t, mem_addr_t&) const;
86 
87 
88  /* Thread handling methods */
89 
90  virtual u32 thread_count() const;
91 
92  virtual thread* current_thread();
93 
94  virtual thread* get_thread(pthread_t) const;
95 
96  virtual thread* get_thread(const i8*) const;
97 
98  virtual thread* get_thread(u32) const;
99 
100  virtual process& cleanup_thread(pthread_t);
101 };
102 
103 }
104 
105 #endif
106 
virtual process & operator=(const process &)
Assignment operator.
Definition: process.cpp:173
virtual ~process()
Object destructor.
Definition: process.cpp:126
virtual u32 thread_count() const
Get the active thread count.
Definition: process.cpp:321
This abstract class serves as the root of the class hierarchy tree.
Definition: object.hpp:17
virtual process & cleanup_thread(pthread_t)
Cleanup libcsdbg-related thread resources upon thread cancellation.
Definition: process.cpp:463
chain< thread > * m_threads
Instrumented thread list.
Definition: process.hpp:37
This class represents a program/library function symbol.
Definition: symbol.hpp:17
virtual const i8 * lookup(mem_addr_t)
Lookup an address to resolve a symbol.
Definition: process.cpp:266
chain< symtab > * m_modules
Symbol table list.
Definition: process.hpp:39
virtual pid_t pid() const
Get the process ID.
Definition: process.cpp:158
Lightweight, templated, doubly-linked list (using XOR linking)
Definition: chain.hpp:33
char i8
8-bit signed integer
Definition: config.hpp:72
Class csdbg::symtab definition.
virtual process & cache_add(mem_addr_t, const i8 *)
Add a symbol to the lookup cache.
Definition: process.cpp:21
virtual thread * get_thread(pthread_t) const
Get a thread by ID.
Definition: process.cpp:376
virtual u32 symbol_count() const
Get the number of symbols.
Definition: process.cpp:201
This class represents a thread of execution in the instrumented process.
Definition: thread.hpp:27
Class csdbg::thread definition.
chain< symbol > * m_symcache
Lookup cache.
Definition: process.hpp:41
This class represents a process, its entire namespace and thread group.
Definition: process.hpp:29
virtual process * clone() const
Object virtual copy constructor.
Definition: process.cpp:147
process()
Object default constructor.
Definition: process.cpp:73
virtual process & add_module(const i8 *, mem_addr_t)
Add a symbol table to the namespace. The symbol table is loaded from a non stripped objective code fi...
Definition: process.cpp:236
unsigned int u32
32-bit unsigned integer
Definition: config.hpp:102
virtual const i8 * ilookup(mem_addr_t, mem_addr_t &) const
Inverse lookup. Find the module (executable or DSO library) that defines a symbol and return its path...
Definition: process.cpp:300
virtual const symbol * cache_lookup(mem_addr_t) const
Perform a cache lookup.
Definition: process.cpp:47
unsigned long long mem_addr_t
64-bit memory address
Definition: config.hpp:120
virtual thread * current_thread()
Get the currently executing thread.
Definition: process.cpp:339
virtual u32 module_count() const
Get the number of modules.
Definition: process.cpp:216
pid_t m_pid
Process ID.
Definition: process.hpp:35