-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpstack.h
70 lines (57 loc) · 1.47 KB
/
pstack.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* $Yahoo: //depot/yahoo/ybsd_common/usr.local/pstack/pstack.h#1 $ */
#ifndef __PSTACK_H__
#define __PSTACK_H__
struct StackFrame {
STAILQ_ENTRY(StackFrame) link;
Elf_Addr ip;
Elf_Addr bp;
int argCount;
Elf_Word args[1];
};
STAILQ_HEAD(StackFrameList, StackFrame);
struct Thread {
int running;
struct Thread *next;
struct StackFrameList stack;
int id;
};
struct MappedPage {
const char *data;
Elf_Addr address; /* Valid only if data != NULL */
int lastAccess;
};
#define PAGECACHE_SIZE 4
struct PageCache {
struct MappedPage pages[PAGECACHE_SIZE];
int accessGeneration;
};
struct thread_ops;
struct Process {
pid_t pid;
void *threadInfo;
int objectCount;
struct ElfObject *objectList;
struct ElfObject *execImage;
struct ElfObject *coreImage;
int threadCount;
struct Thread *threadList;
const char *abiPrefix;
struct PageCache pageCache;
struct thread_ops *threadOps;
};
struct thread_ops {
void (*startup)(void);
int (*probe)(struct Process *);
void (*read_threads)(struct Process *);
void (*free)(struct Process *);
};
extern struct thread_ops thread_db_ops;
size_t procReadMem(struct Process *proc, void *ptr, Elf_Addr remoteAddr,
size_t size);
int procReadVar(struct Process *proc, struct ElfObject *obj,
const char *name, int *value);
struct Thread *procReadThread(struct Process *proc, Elf_Addr bp,
Elf_Addr ip);
size_t procWriteMem(struct Process *proc, const void *ptr, Elf_Addr remoteAddr,
size_t size);
#endif