blob: 8e9f2e76f8ac2a72bc5ff26c18f3a287084883c0 (
plain)
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
|
aggr Rdebug
{
'X' 0 version;
'X' 4 map;
};
aggr Rmap
{
'X' 0 addr;
'X' 4 name;
'X' 8 dynsect;
'X' 12 next;
'X' 16 prev;
};
defn
rdebug()
{
local a;
a = _DYNAMIC;
while *a != 0 do {
if *a == 21 then // 21 == DT_DEBUG
return *(a+4);
a = a+8;
}
return 0;
}
defn
rlink()
{
local r, m, n;
r = rdebug();
if r == 0 then
return {};
complex Rdebug r;
print("version ", r.version, "\n");
m = r.map;
n = 0;
while m != 0 && n < 100 do {
complex Rmap m;
print("map ", m\X, " base ", m.addr\X, " next ", m.next\X, " name ");
if m.name then
print(*(m.name\s));
else
print("''");
print("\n");
m = m.next;
n = n+1;
}
}
|