ReactOS  0.4.14-dev-50-g13bb5e2
dwarfget.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 dwarfget.c:

Go to the source code of this file.

Macros

#define NTOSAPI
 
#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 11 of file dwarfget.c.

◆ NTOSAPI

#define NTOSAPI

Definition at line 5 of file dwarfget.c.

Function Documentation

◆ dwarfget1()

ulong dwarfget1 ( DwarfBuf b)

Definition at line 18 of file dwarfget.c.

19 {
20  if(b->p==nil || b->p+1 > b->ep){
21  b->p = nil;
22  return 0;
23  }
24  return *b->p++;
25 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define nil
Definition: compat.h:23

Referenced by dwarfgetaddr().

◆ dwarfget128()

ulong dwarfget128 ( DwarfBuf b)

Definition at line 153 of file dwarfget.c.

154 {
155  static int nbad;
156  ulong c, d;
157 
158  if(b->p == nil)
159  return 0;
160  c = *b->p++;
161  if(!(c&0x80))
162 {n1++;
163  return c;
164 }
165  c &= ~0x80;
166  d = *b->p++;
167  c |= (d&0x7F)<<7;
168  if(!(d&0x80))
169 {n2++;
170  return c;
171 }
172  d = *b->p++;
173  c |= (d&0x7F)<<14;
174  if(!(d&0x80))
175 {n3++;
176  return c;
177 }
178  d = *b->p++;
179  c |= (d&0x7F)<<21;
180  if(!(d&0x80))
181 {n4++;
182  return c;
183 }
184  d = *b->p++;
185  c |= (d&0x7F)<<28;
186  if(!(d&0x80))
187 {n5++;
188  return c;
189 }
190  while(b->p<b->ep && *b->p&0x80)
191  b->p++;
192  if(++nbad == 1)
193  werrstr("dwarf: overflow during parsing of uleb128 integer\n");
194  return c;
195 }
#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

◆ dwarfget128s()

long dwarfget128s ( DwarfBuf b)

Definition at line 198 of file dwarfget.c.

199 {
200  int nb, c;
201  ulong v;
202  static int nbad;
203 
204  v = 0;
205  nb = 0;
206  if(b->p==nil)
207  return 0;
208  while(b->p<b->ep){
209  c = *b->p++;
210  v |= (c & 0x7F)<<nb;
211  nb += 7;
212  if(!(c&0x80))
213  break;
214  }
215  if(v&(1<<(nb-1)))
216  v |= ~(((ulong)1<<nb)-1);
217  if(nb > 8*sizeof(ulong)){
218  if(0)
219  if(++nbad == 1)
220  werrstr("dwarf: overflow during parsing of sleb128 integer: got %d bits", nb);
221  }
222  return v;
223 }
#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

◆ dwarfget2()

ulong dwarfget2 ( DwarfBuf b)

Definition at line 82 of file dwarfget.c.

83 {
84  ulong v;
85 
86  if(b->p==nil || b->p+2 > b->ep){
87  b->p = nil;
88  return 0;
89  }
90  v = b->d->pe->e2(b->p);
91  b->p += 2;
92  return v;
93 }
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 dwarfgetaddr().

◆ dwarfget4()

ulong dwarfget4 ( DwarfBuf b)

Definition at line 96 of file dwarfget.c.

97 {
98  ulong v;
99 
100  if(b->p==nil || b->p+4 > b->ep){
101  b->p = nil;
102  return 0;
103  }
104  v = b->d->pe->e4(b->p);
105  b->p += 4;
106  return v;
107 }
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 dwarfgetaddr().

◆ dwarfget8()

uvlong dwarfget8 ( DwarfBuf b)

Definition at line 110 of file dwarfget.c.

111 {
112  uvlong v;
113 
114  if(b->p==nil || b->p+8 > b->ep){
115  b->p = nil;
116  return 0;
117  }
118  v = b->d->pe->e8(b->p);
119  b->p += 8;
120  return v;
121 }
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 dwarfgetaddr().

◆ dwarfgetaddr()

ulong dwarfgetaddr ( DwarfBuf b)

Definition at line 124 of file dwarfget.c.

125 {
126  static int nbad;
127 
128  if(b->addrsize == 0)
129  b->addrsize = b->d->addrsize;
130 
131  switch(b->addrsize){
132  case 1:
133  return dwarfget1(b);
134  case 2:
135  return dwarfget2(b);
136  case 4:
137  return dwarfget4(b);
138  case 8:
139  return dwarfget8(b);
140  default:
141  if(++nbad == 1)
142  werrstr("dwarf: unexpected address size %lud in dwarfgetaddr\n", b->addrsize);
143  b->p = nil;
144  return 0;
145  }
146 }
#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

◆ dwarfgetn()

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

Definition at line 28 of file dwarfget.c.

29 {
30  if(b->p==nil || b->p+n > b->ep){
31  b->p = nil;
32  memset(a, 0, n);
33  return -1;
34  }
35  memmove(a, b->p, n);
36  b->p += n;
37  return 0;
38 }
#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 41 of file dwarfget.c.

42 {
43  uchar *p;
44 
45  if(b->p==nil || b->p+n > b->ep){
46  b->p = nil;
47  return nil;
48  }
49  p = b->p;
50  b->p += n;
51  return p;
52 }
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

◆ dwarfgetstring()

char* dwarfgetstring ( DwarfBuf b)

Definition at line 55 of file dwarfget.c.

56 {
57  char *s;
58 
59  if(b->p == nil)
60  return nil;
61  s = (char*)b->p;
62  while(b->p < b->ep && *b->p)
63  b->p++;
64  if(b->p >= b->ep){
65  b->p = nil;
66  return nil;
67  }
68  b->p++;
69  return s;
70 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLdouble s
Definition: gl.h:2039
#define nil
Definition: compat.h:23

◆ dwarfskip()

void dwarfskip ( DwarfBuf b,
int  n 
)

Definition at line 73 of file dwarfget.c.

74 {
75  if(b->p==nil || b->p+n > b->ep)
76  b->p = nil;
77  else
78  b->p += n;
79 }
GLdouble n
Definition: glext.h:7729
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define nil
Definition: compat.h:23

Variable Documentation

◆ n1

◆ n2

◆ n3

◆ n4

int n4

Definition at line 148 of file dwarfget.c.

Referenced by dwarfget128(), handle_method(), symbol_demangle(), and test_timer_queue().

◆ n5

int n5

Definition at line 148 of file dwarfget.c.

Referenced by dwarfget128(), and test_timer_queue().