#include <ntddk.h>
#include <reactos/rossym.h>
#include "rossympriv.h"
#include <ntimage.h>
#include <debug.h>
#include "dwarf.h"
Go to the source code of this file.
|
static int | findfde (Dwarf *, ulong, State *, DwarfBuf *) |
|
static int | dexec (DwarfBuf *, State *, int) |
|
int | dwarfunwind (Dwarf *d, ulong pc, DwarfExpr *cfa, DwarfExpr *ra, DwarfExpr *r, int nr) |
|
static int | checkreg (State *s, long r) |
|
◆ NDEBUG
◆ NTOSAPI
◆ trace
◆ State
◆ checkreg()
Definition at line 180 of file dwarfcfa.c.
181{
182 if(r < 0 || r >=
s->nr){
183 werrstr(
"bad register number 0x%lux",
r);
184 return -1;
185 }
186 return 0;
187}
GLdouble GLdouble GLdouble r
Referenced by dexec().
◆ dexec()
Definition at line 190 of file dwarfcfa.c.
191{
195
196 for(;;){
200 return 0;
201 }
204 werrstr(
"ran out of instructions during cfa program");
206 return -1;
207 }
210 case 1:
214 s->loc +=
arg1 *
s->iquantum;
215 if(locstop)
216 return 0;
217 continue;
218
219 case 2:
225 return -1;
228 continue;
229
230 case 3:
232 restore:
235 return -1;
237 continue;
238 }
239
241 case 0:
243 continue;
244
245 case 0x01:
248 if(locstop)
249 return 0;
250 continue;
251
252 case 0x02:
255
256 case 0x03:
259
260 case 0x04:
263
264 case 0x05:
268
269 case 0x06:
271 goto restore;
272
273 case 0x07:
277 return -1;
279 continue;
280
281 case 0x08:
285 return -1;
287 continue;
288
289 case 0x09:
294 return -1;
297 continue;
298
299 case 0x0A:
303 return -1;
304 void *newstack =
malloc(
s->nstack*
sizeof(
s->stack[0]));
306 if (newstack) {
309 } else {
311 return -1;
312 }
315 return -1;
316 }
317 s->stack[
s->nstack++] =
e;
319 continue;
320
321 case 0x0B:
324 werrstr(
"restore state underflow");
325 return -1;
326 }
327 e =
s->stack[
s->nstack-1];
331 continue;
332
333 case 0x0C:
336 defcfa:
339 return -1;
342 s->cfa->offset =
arg2;
343 continue;
344
345 case 0x0D:
349 werrstr(
"change CFA register but CFA not in register+offset form");
350 return -1;
351 }
353 return -1;
355 continue;
356
357 case 0x0E:
359 cfaoffset:
362 werrstr(
"change CFA offset but CFA not in register+offset form");
363 return -1;
364 }
365 s->cfa->offset =
arg1;
366 continue;
367
368 case 0x0F:
373 continue;
374
375 case 0x10:
379 return -1;
383 continue;
384
385 case 0x11:
389
390 case 0x12:
393 goto defcfa;
394
395 case 0x13:
397 goto cfaoffset;
398
399 default:
400 werrstr(
"unknown opcode 0x%ux in cfa program",
c);
401 return -1;
402 }
403 }
404
405}
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
GLuint GLuint GLuint GLuint arg1
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
GLboolean GLboolean GLboolean b
#define memmove(s1, s2, n)
static int checkreg(State *s, long r)
ulong dwarfget128(DwarfBuf *)
ulong dwarfget2(DwarfBuf *)
ulong dwarfget1(DwarfBuf *)
long dwarfget128s(DwarfBuf *)
ulong dwarfgetaddr(DwarfBuf *)
uchar * dwarfgetnref(DwarfBuf *, ulong)
ulong dwarfget4(DwarfBuf *)
#define RtlMoveMemory(Destination, Source, Length)
Referenced by dwarfunwind().
◆ dwarfunwind()
Definition at line 48 of file dwarfcfa.c.
49{
54
56 if(initr == 0)
57 return -1;
58
65
68 return -1;
69 }
70
74 if(
trace)
werrstr(
"s.init %p-%p, fde %p-%p\n",
s.init.p,
s.init.ep, fde.
p, fde.
ep);
78
81
87 }
89
92
97 for(
i=0;
i<
s.nstack;
i++)
101}
GLuint GLuint GLsizei GLenum type
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static int findfde(Dwarf *, ulong, State *, DwarfBuf *)
static int dexec(DwarfBuf *, State *, int)
Referenced by dwarfregunwind().
◆ findfde()
Definition at line 110 of file dwarfcfa.c.
111{
112 static int nbad;
113 char *aug;
118
119 if(
d->frame.data ==
nil){
120 werrstr(
"no frame debugging information");
121 return -1;
122 }
125 b.ep =
b.p +
d->frame.len;
126 b.addrsize =
d->addrsize;
129
131 if((
i = (
b.p -
d->frame.data) %
b.addrsize))
132 b.p +=
b.addrsize -
i;
135 werrstr(
"bad length in cie/fde header");
136 return -1;
137 }
140 if(id == 0xFFFFFFFF){
142 if(vers != 1 && vers != 2 && vers != 3){
143 if(++nbad == 1)
144 werrstr(
"unknown cie version %d (wanted 1-3)\n", vers);
145 continue;
146 }
148 if(aug && *aug){
149 if(++nbad == 1)
150 werrstr(
"unknown augmentation: %s\n", aug);
151 continue;
152 }
156 if(
s->rareg >
s->nr){
157 werrstr(
"return address is register %d but only have %d registers",
159 return -1;
160 }
163 }else{
171 return 0;
172 }
173 }
174 werrstr(
"cannot find call frame information for pc 0x%lux", pc);
175 return -1;
176
177}
static unsigned __int64 next
char * dwarfgetstring(DwarfBuf *)
Referenced by dwarfunwind().