ReactOS
0.4.16-dev-197-g92996da
dwarfopen.c
Go to the documentation of this file.
1
2
#include <ntddk.h>
3
#include <
reactos/rossym.h
>
4
#include "
rossympriv.h
"
5
#include <
ntimage.h
>
6
7
#define NDEBUG
8
#include <debug.h>
9
10
#include "
dwarf.h
"
11
#include "
pe.h
"
12
13
/* Adapted for PE */
14
15
Dwarf
*
16
dwarfopen
(
Pe
*pe)
17
{
18
Dwarf
*
d
;
19
20
if
(pe ==
nil
){
21
werrstr
(
"nil pe passed to dwarfopen"
);
22
return
nil
;
23
}
24
25
d
=
mallocz
(
sizeof
(
Dwarf
), 1);
26
if
(
d
==
nil
)
27
return
nil
;
28
29
d
->pe = pe;
30
if
(pe->
loadsection
(pe,
".debug_abbrev"
, &
d
->abbrev) < 0
31
|| pe->
loadsection
(pe,
".debug_aranges"
, &
d
->aranges) < 0
32
|| pe->
loadsection
(pe,
".debug_line"
, &
d
->line) < 0
33
|| pe->
loadsection
(pe,
".debug_pubnames"
, &
d
->pubnames) < 0
34
|| pe->
loadsection
(pe,
".debug_info"
, &
d
->info) < 0)
35
goto
err
;
36
pe->
loadsection
(pe,
".debug_frame"
, &
d
->frame);
37
pe->
loadsection
(pe,
".debug_ranges"
, &
d
->ranges);
38
pe->
loadsection
(pe,
".debug_str"
, &
d
->str);
39
40
return
d
;
41
42
err
:
43
DPRINT
(
"Failed to open dwarf\n"
);
44
free
(
d
->abbrev.data);
45
free
(
d
->aranges.data);
46
free
(
d
->frame.data);
47
free
(
d
->line.data);
48
free
(
d
->pubnames.data);
49
free
(
d
->ranges.data);
50
free
(
d
->str.data);
51
free
(
d
->info.data);
52
free
(
d
);
53
return
nil
;
54
}
55
56
void
57
dwarfclose
(
Dwarf
*
d
)
58
{
59
free
(
d
->abbrev.data);
60
free
(
d
->aranges.data);
61
free
(
d
->frame.data);
62
free
(
d
->line.data);
63
free
(
d
->pubnames.data);
64
free
(
d
->ranges.data);
65
free
(
d
->str.data);
66
free
(
d
->info.data);
67
pefree
(
d
->pe);
68
free
(
d
);
69
}
70
free
#define free
Definition:
debug_ros.c:5
d
#define d
Definition:
ke_i.h:81
ntimage.h
err
#define err(...)
Definition:
reactos_support_code.h:30
dwarfopen
Dwarf * dwarfopen(Pe *pe)
Definition:
dwarfopen.c:16
dwarfclose
void dwarfclose(Dwarf *d)
Definition:
dwarfopen.c:57
pefree
void pefree(Pe *pe)
Definition:
pe.c:109
rossym.h
pe.h
rossympriv.h
werrstr
#define werrstr(str,...)
Definition:
compat.h:34
nil
#define nil
Definition:
compat.h:23
mallocz
#define mallocz(x, y)
Definition:
compat.h:36
dwarf.h
DPRINT
#define DPRINT
Definition:
sndvol32.h:73
Dwarf
Definition:
dwarf.h:437
_Pe
Definition:
pe.h:14
_Pe::loadsection
int(* loadsection)(struct _Pe *pe, char *name, struct DwarfBlock *b)
Definition:
pe.h:22
sdk
lib
rossym
dwarfopen.c
Generated on Wed Oct 30 2024 06:13:34 for ReactOS by
1.9.6