forked from Stichting-MINIX-Research-Foundation/minix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrace.c
More file actions
51 lines (45 loc) · 895 Bytes
/
Copy pathtrace.c
File metadata and controls
51 lines (45 loc) · 895 Bytes
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
/*
* trace.c for mdb
*/
#include "mdb.h"
#include <stdio.h>
#include <sys/ptrace.h>
#include "proto.h"
/* mdbtrace()
* Call ptrace and check for error if debugging running process
* Otherwise read 'core' file
*/
PUBLIC long mdbtrace(req, pid, addr, data)
int req, pid;
long addr, data;
{
long val;
int i;
int segment;
#ifdef DEBUG
if (debug) Printf("ptrace: req=%d pid=%d addr=%lx data=%lx\n",
req, pid, addr, data);
#endif
if (corepid < 0)
{
errno = 0;
/* Call normal ptrace and check for error */
val = ptrace(req, pid, addr, data);
if (errno != 0) {
do_error("mdb ptrace error ");
mdb_error("\n");
}
#ifdef DEBUG
if (debug) Printf("ptrace: val=>%lx\n", val);
#endif
return val;
}
else
return read_core(req, addr, data);
}
/* Used by disassembler */
PUBLIC u32_t peek_dword(addr)
off_t addr;
{
return mdbtrace(T_GETINS, curpid, addr, 0L);
}