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

Go to the source code of this file.

Macros

#define NTOSAPI
 
#define NDEBUG
 

Functions

static int _dwarfnametounit (Dwarf *d, char *name, DwarfBlock *bl, DwarfSym *s)
 
int dwarflookupname (Dwarf *d, char *name, DwarfSym *sym)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 6 of file dwarfpubnames.c.

◆ NTOSAPI

#define NTOSAPI

Definition at line 1 of file dwarfpubnames.c.

Function Documentation

◆ _dwarfnametounit()

static int _dwarfnametounit ( Dwarf d,
char name,
DwarfBlock bl,
DwarfSym s 
)
static

Definition at line 12 of file dwarfpubnames.c.

13 {
14  int vers;
15  ulong len, unit, off;
16  uchar *next;
17  char *str;
18  DwarfBuf b;
19 
20  b.d = d;
21  b.p = bl->data;
22  b.ep = b.p + bl->len;
23 
24  while(b.p < b.ep){
25  len = dwarfget4(&b);
26  if(len > b.ep-b.p){
27  werrstr("bad length in dwarf name header");
28  return -1;
29  }
30  next = b.p + len;
31  vers = dwarfget2(&b);
32  if(vers != 1 && vers != 2){
33  werrstr("bad version %d in dwarf name header", vers);
34  return -1;
35  }
36  unit = dwarfget4(&b);
37  dwarfget4(&b); /* unit length */
38  while(b.p < next){
39  off = dwarfget4(&b);
40  if(off == 0)
41  break;
42  str = dwarfgetstring(&b);
43  if(strcmp(str, name) == 0){
44  if(dwarfenumunit(d, unit, s) < 0)
45  return -1;
46  if(unit + off >= s->b.ep - d->info.data){
47  werrstr("bad offset in name entry");
48  return -1;
49  }
50  s->b.p = d->info.data + unit + off;
51  if(dwarfnextsym(d, s) < 0)
52  return -1;
53  if(s->attrs.name==nil || strcmp(s->attrs.name, name)!=0){
54  werrstr("unexpected name %#q in lookup for %#q", s->attrs.name, name);
55  return -1;
56  }
57  return 0;
58  }
59  }
60  b.p = next;
61  }
62  werrstr("unknown name '%s'", name);
63  return -1;
64 }
#define werrstr(str,...)
Definition: compat.h:34
int dwarfnextsym(Dwarf *, DwarfSym *)
Definition: dwarfinfo.c:251
unsigned char uchar
Definition: Unfrag.h:59
char * dwarfgetstring(DwarfBuf *)
Definition: dwarfget.c:55
ulong dwarfget4(DwarfBuf *)
Definition: dwarfget.c:96
uchar * data
Definition: dwarf.h:202
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
const WCHAR * str
int dwarfenumunit(Dwarf *, ulong, DwarfSym *)
Definition: dwarfinfo.c:202
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
ulong len
Definition: dwarf.h:203
ulong dwarfget2(DwarfBuf *)
Definition: dwarfget.c:82
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
unsigned long ulong
Definition: linux.h:275
static unsigned __int64 next
Definition: rand_nt.c:6
#define nil
Definition: compat.h:23
Definition: name.c:36
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
off
Definition: i386-dis.c:3909

Referenced by dwarflookupname().

◆ dwarflookupname()

int dwarflookupname ( Dwarf d,
char name,
DwarfSym sym 
)

Definition at line 67 of file dwarfpubnames.c.

68 {
69  return _dwarfnametounit(d, name, &d->pubnames, sym);
70 }
#define d
Definition: ke_i.h:81
Definition: name.c:36
static int _dwarfnametounit(Dwarf *d, char *name, DwarfBlock *bl, DwarfSym *s)
Definition: dwarfpubnames.c:12