ReactOS  0.4.15-dev-3299-gbe8e5fc
dwarfpubnames.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for dwarfpubnames.c:

Go to the source code of this file.

Macros

#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 3 of file dwarfpubnames.c.

Function Documentation

◆ _dwarfnametounit()

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

Definition at line 7 of file dwarfpubnames.c.

8 {
9  int vers;
10  ulong len, unit, off;
11  uchar *next;
12  char *str;
13  DwarfBuf b;
14 
15  b.d = d;
16  b.p = bl->data;
17  b.ep = b.p + bl->len;
18 
19  while(b.p < b.ep){
20  len = dwarfget4(&b);
21  if(len > b.ep-b.p){
22  werrstr("bad length in dwarf name header");
23  return -1;
24  }
25  next = b.p + len;
26  vers = dwarfget2(&b);
27  if(vers != 1 && vers != 2){
28  werrstr("bad version %d in dwarf name header", vers);
29  return -1;
30  }
31  unit = dwarfget4(&b);
32  dwarfget4(&b); /* unit length */
33  while(b.p < next){
34  off = dwarfget4(&b);
35  if(off == 0)
36  break;
37  str = dwarfgetstring(&b);
38  if(strcmp(str, name) == 0){
39  if(dwarfenumunit(d, unit, s) < 0)
40  return -1;
41  if(unit + off >= s->b.ep - d->info.data){
42  werrstr("bad offset in name entry");
43  return -1;
44  }
45  s->b.p = d->info.data + unit + off;
46  if(dwarfnextsym(d, s) < 0)
47  return -1;
48  if(s->attrs.name==nil || strcmp(s->attrs.name, name)!=0){
49  werrstr("unexpected name %#q in lookup for %#q", s->attrs.name, name);
50  return -1;
51  }
52  return 0;
53  }
54  }
55  b.p = next;
56  }
57  werrstr("unknown name '%s'", name);
58  return -1;
59 }
#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
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:38
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define d
Definition: ke_i.h:81

Referenced by dwarflookupname().

◆ dwarflookupname()

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

Definition at line 62 of file dwarfpubnames.c.

63 {
64  return _dwarfnametounit(d, name, &d->pubnames, sym);
65 }
static int _dwarfnametounit(Dwarf *d, char *name, DwarfBlock *bl, DwarfSym *s)
Definition: dwarfpubnames.c:7
Definition: name.c:38
#define d
Definition: ke_i.h:81