ReactOS  0.4.14-dev-376-gaedba84
dwarfopen.c File Reference
#include <ntddk.h>
#include <reactos/rossym.h>
#include "rossympriv.h"
#include <ntimage.h>
#include <debug.h>
#include "dwarf.h"
#include "pe.h"
Include dependency graph for dwarfopen.c:

Go to the source code of this file.

Macros

#define NTOSAPI
 
#define NDEBUG
 

Functions

Dwarfdwarfopen (Pe *pe)
 
void dwarfclose (Dwarf *d)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 7 of file dwarfopen.c.

◆ NTOSAPI

#define NTOSAPI

Definition at line 1 of file dwarfopen.c.

Function Documentation

◆ dwarfclose()

void dwarfclose ( Dwarf d)

Definition at line 57 of file dwarfopen.c.

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 }
#define free
Definition: debug_ros.c:5
#define d
Definition: ke_i.h:81
void pefree(Pe *pe)
Definition: pe.c:109

◆ dwarfopen()

Dwarf* dwarfopen ( Pe pe)

Definition at line 16 of file dwarfopen.c.

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 }
#define werrstr(str,...)
Definition: compat.h:34
#define free
Definition: debug_ros.c:5
#define mallocz(x, y)
Definition: compat.h:36
void DPRINT(...)
Definition: polytest.cpp:61
int(* loadsection)(struct _Pe *pe, char *name, struct DwarfBlock *b)
Definition: pe.h:22
#define d
Definition: ke_i.h:81
#define err(...)
Definition: dwarf.h:436
#define nil
Definition: compat.h:23