ReactOS  0.4.15-dev-1197-g8081ba9
dwarfget.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for dwarfget.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

ulong dwarfget1 (DwarfBuf *b)
 
int dwarfgetn (DwarfBuf *b, uchar *a, int n)
 
uchardwarfgetnref (DwarfBuf *b, ulong n)
 
chardwarfgetstring (DwarfBuf *b)
 
void dwarfskip (DwarfBuf *b, int n)
 
ulong dwarfget2 (DwarfBuf *b)
 
ulong dwarfget4 (DwarfBuf *b)
 
uvlong dwarfget8 (DwarfBuf *b)
 
ulong dwarfgetaddr (DwarfBuf *b)
 
ulong dwarfget128 (DwarfBuf *b)
 
long dwarfget128s (DwarfBuf *b)
 

Variables

int n1
 
int n2
 
int n3
 
int n4
 
int n5
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 7 of file dwarfget.c.

Function Documentation

◆ dwarfget1()

ulong dwarfget1 ( DwarfBuf b)

Definition at line 11 of file dwarfget.c.

12 {
13  if(b->p==nil || b->p+1 > b->ep){
14  b->p = nil;
15  return 0;
16  }
17  return *b->p++;
18 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define nil
Definition: compat.h:23

Referenced by constblock(), dexec(), dwarfaddrtounit(), dwarfenumunit(), dwarfgetarg(), dwarfpctoline(), findfde(), getblock(), getuchar(), getulong(), and parseabbrevs().

◆ dwarfget128()

ulong dwarfget128 ( DwarfBuf b)

Definition at line 146 of file dwarfget.c.

147 {
148  static int nbad;
149  ulong c, d;
150 
151  if(b->p == nil)
152  return 0;
153  c = *b->p++;
154  if(!(c&0x80))
155 {n1++;
156  return c;
157 }
158  c &= ~0x80;
159  d = *b->p++;
160  c |= (d&0x7F)<<7;
161  if(!(d&0x80))
162 {n2++;
163  return c;
164 }
165  d = *b->p++;
166  c |= (d&0x7F)<<14;
167  if(!(d&0x80))
168 {n3++;
169  return c;
170 }
171  d = *b->p++;
172  c |= (d&0x7F)<<21;
173  if(!(d&0x80))
174 {n4++;
175  return c;
176 }
177  d = *b->p++;
178  c |= (d&0x7F)<<28;
179  if(!(d&0x80))
180 {n5++;
181  return c;
182 }
183  while(b->p<b->ep && *b->p&0x80)
184  b->p++;
185  if(++nbad == 1)
186  werrstr("dwarf: overflow during parsing of uleb128 integer");
187  return c;
188 }
#define werrstr(str,...)
Definition: compat.h:34
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
int n3
Definition: dwarfget.c:148
const GLubyte * c
Definition: glext.h:8905
int n1
Definition: dwarfget.c:148
unsigned long ulong
Definition: linux.h:275
int n2
Definition: dwarfget.c:148
int n4
Definition: dwarfget.c:148
#define nil
Definition: compat.h:23
int n5
Definition: dwarfget.c:148
#define c
Definition: ke_i.h:80

Referenced by constblock(), dexec(), dwarfgetarg(), dwarfnextsym(), dwarfpctoline(), findfde(), getblock(), getulong(), parseabbrevs(), and parseattrs().

◆ dwarfget128s()

long dwarfget128s ( DwarfBuf b)

Definition at line 191 of file dwarfget.c.

192 {
193  int nb, c;
194  ulong v;
195  static int nbad;
196 
197  v = 0;
198  nb = 0;
199  if(b->p==nil)
200  return 0;
201  while(b->p<b->ep){
202  c = *b->p++;
203  v |= (c & 0x7F)<<nb;
204  nb += 7;
205  if(!(c&0x80))
206  break;
207  }
208  if(v&(1<<(nb-1)))
209  v |= ~(((ulong)1<<nb)-1);
210  if(nb > 8*sizeof(ulong)){
211  if(0)
212  if(++nbad == 1)
213  werrstr("dwarf: overflow during parsing of sleb128 integer: got %d bits", nb);
214  }
215  return v;
216 }
#define werrstr(str,...)
Definition: compat.h:34
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
const GLubyte * c
Definition: glext.h:8905
unsigned long ulong
Definition: linux.h:275
const GLdouble * v
Definition: gl.h:2040
#define nil
Definition: compat.h:23
#define c
Definition: ke_i.h:80

Referenced by constblock(), dexec(), dwarfgetarg(), dwarfpctoline(), findfde(), and getulong().

◆ dwarfget2()

ulong dwarfget2 ( DwarfBuf b)

Definition at line 75 of file dwarfget.c.

76 {
77  ulong v;
78 
79  if(b->p==nil || b->p+2 > b->ep){
80  b->p = nil;
81  return 0;
82  }
83  v = b->d->pe->e2(b->p);
84  b->p += 2;
85  return v;
86 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
unsigned long ulong
Definition: linux.h:275
const GLdouble * v
Definition: gl.h:2040
#define nil
Definition: compat.h:23

Referenced by _dwarfnametounit(), constblock(), dexec(), dwarfaddrtounit(), dwarfargvalue(), dwarfenumunit(), dwarfgetarg(), dwarfpctoline(), getblock(), and getulong().

◆ dwarfget4()

ulong dwarfget4 ( DwarfBuf b)

Definition at line 89 of file dwarfget.c.

90 {
91  ulong v;
92 
93  if(b->p==nil || b->p+4 > b->ep){
94  b->p = nil;
95  return 0;
96  }
97  v = b->d->pe->e4(b->p);
98  b->p += 4;
99  return v;
100 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
unsigned long ulong
Definition: linux.h:275
const GLdouble * v
Definition: gl.h:2040
#define nil
Definition: compat.h:23

Referenced by _dwarfnametounit(), constblock(), dexec(), dwarfaddrtounit(), dwarfargvalue(), dwarfenumunit(), dwarfgetarg(), dwarfpctoline(), findfde(), getblock(), getstring(), and getulong().

◆ dwarfget8()

uvlong dwarfget8 ( DwarfBuf b)

Definition at line 103 of file dwarfget.c.

104 {
105  uvlong v;
106 
107  if(b->p==nil || b->p+8 > b->ep){
108  b->p = nil;
109  return 0;
110  }
111  v = b->d->pe->e8(b->p);
112  b->p += 8;
113  return v;
114 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
const GLdouble * v
Definition: gl.h:2040
#define nil
Definition: compat.h:23
unsigned long long uvlong
Definition: compat.h:9

Referenced by constblock(), and getulong().

◆ dwarfgetaddr()

ulong dwarfgetaddr ( DwarfBuf b)

Definition at line 117 of file dwarfget.c.

118 {
119  static int nbad;
120 
121  if(b->addrsize == 0)
122  b->addrsize = b->d->addrsize;
123 
124  switch(b->addrsize){
125  case 1:
126  return dwarfget1(b);
127  case 2:
128  return dwarfget2(b);
129  case 4:
130  return dwarfget4(b);
131  case 8:
132  return dwarfget8(b);
133  default:
134  if(++nbad == 1)
135  werrstr("dwarf: unexpected address size %lud in dwarfgetaddr", b->addrsize);
136  b->p = nil;
137  return 0;
138  }
139 }
#define werrstr(str,...)
Definition: compat.h:34
ulong dwarfget2(DwarfBuf *b)
Definition: dwarfget.c:82
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
uvlong dwarfget8(DwarfBuf *b)
Definition: dwarfget.c:110
ulong dwarfget4(DwarfBuf *b)
Definition: dwarfget.c:96
ulong dwarfget1(DwarfBuf *b)
Definition: dwarfget.c:18
#define nil
Definition: compat.h:23

Referenced by constblock(), dexec(), dwarfaddrtounit(), dwarfpctoline(), findfde(), and getulong().

◆ dwarfgetn()

int dwarfgetn ( DwarfBuf b,
uchar a,
int  n 
)

Definition at line 21 of file dwarfget.c.

22 {
23  if(b->p==nil || b->p+n > b->ep){
24  b->p = nil;
25  memset(a, 0, n);
26  return -1;
27  }
28  memmove(a, b->p, n);
29  b->p += n;
30  return 0;
31 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
GLdouble n
Definition: glext.h:7729
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define nil
Definition: compat.h:23
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define memset(x, y, z)
Definition: compat.h:39

◆ dwarfgetnref()

uchar* dwarfgetnref ( DwarfBuf b,
ulong  n 
)

Definition at line 34 of file dwarfget.c.

35 {
36  uchar *p;
37 
38  if(b->p==nil || b->p+n > b->ep){
39  b->p = nil;
40  return nil;
41  }
42  p = b->p;
43  b->p += n;
44  return p;
45 }
unsigned char uchar
Definition: Unfrag.h:59
GLdouble n
Definition: glext.h:7729
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define nil
Definition: compat.h:23
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by dexec(), dwarfpctoline(), and getblock().

◆ dwarfgetstring()

char* dwarfgetstring ( DwarfBuf b)

Definition at line 48 of file dwarfget.c.

49 {
50  char *s;
51 
52  if(b->p == nil)
53  return nil;
54  s = (char*)b->p;
55  while(b->p < b->ep && *b->p)
56  b->p++;
57  if(b->p >= b->ep){
58  b->p = nil;
59  return nil;
60  }
61  b->p++;
62  return s;
63 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLdouble s
Definition: gl.h:2039
#define nil
Definition: compat.h:23

Referenced by _dwarfnametounit(), dwarfpctoline(), findfde(), and getstring().

◆ dwarfskip()

void dwarfskip ( DwarfBuf b,
int  n 
)

Definition at line 66 of file dwarfget.c.

67 {
68  if(b->p==nil || b->p+n > b->ep)
69  b->p = nil;
70  else
71  b->p += n;
72 }
GLdouble n
Definition: glext.h:7729
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define nil
Definition: compat.h:23

Variable Documentation

◆ n1

int n1

Definition at line 141 of file dwarfget.c.

◆ n2

int n2

Definition at line 141 of file dwarfget.c.

◆ n3

int n3

Definition at line 141 of file dwarfget.c.

◆ n4

int n4

Definition at line 141 of file dwarfget.c.

◆ n5

int n5

Definition at line 141 of file dwarfget.c.