#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
◆ trace
◆ State
◆ checkreg()
Definition at line 179 of file dwarfcfa.c.
180{
181 if(r < 0 || r >=
s->nr){
182 werrstr(
"bad register number 0x%lux",
r);
183 return -1;
184 }
185 return 0;
186}
GLdouble GLdouble GLdouble r
Referenced by dexec().
◆ dexec()
Definition at line 189 of file dwarfcfa.c.
190{
194
195 for(;;){
199 return 0;
200 }
203 werrstr(
"ran out of instructions during cfa program");
205 return -1;
206 }
209 case 1:
213 s->loc +=
arg1 *
s->iquantum;
214 if(locstop)
215 return 0;
216 continue;
217
218 case 2:
224 return -1;
227 continue;
228
229 case 3:
231 restore:
234 return -1;
236 continue;
237 }
238
240 case 0:
242 continue;
243
244 case 0x01:
247 if(locstop)
248 return 0;
249 continue;
250
251 case 0x02:
254
255 case 0x03:
258
259 case 0x04:
262
263 case 0x05:
267
268 case 0x06:
270 goto restore;
271
272 case 0x07:
276 return -1;
278 continue;
279
280 case 0x08:
284 return -1;
286 continue;
287
288 case 0x09:
293 return -1;
296 continue;
297
298 case 0x0A:
302 return -1;
303 void *newstack =
malloc(
s->nstack*
sizeof(
s->stack[0]));
305 if (newstack) {
308 } else {
310 return -1;
311 }
314 return -1;
315 }
316 s->stack[
s->nstack++] =
e;
318 continue;
319
320 case 0x0B:
323 werrstr(
"restore state underflow");
324 return -1;
325 }
326 e =
s->stack[
s->nstack-1];
330 continue;
331
332 case 0x0C:
335 defcfa:
338 return -1;
341 s->cfa->offset =
arg2;
342 continue;
343
344 case 0x0D:
348 werrstr(
"change CFA register but CFA not in register+offset form");
349 return -1;
350 }
352 return -1;
354 continue;
355
356 case 0x0E:
358 cfaoffset:
361 werrstr(
"change CFA offset but CFA not in register+offset form");
362 return -1;
363 }
364 s->cfa->offset =
arg1;
365 continue;
366
367 case 0x0F:
372 continue;
373
374 case 0x10:
378 return -1;
382 continue;
383
384 case 0x11:
388
389 case 0x12:
392 goto defcfa;
393
394 case 0x13:
396 goto cfaoffset;
397
398 default:
399 werrstr(
"unknown opcode 0x%ux in cfa program",
c);
400 return -1;
401 }
402 }
403
404}
_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 47 of file dwarfcfa.c.
48{
53
55 if(initr == 0)
56 return -1;
57
64
67 return -1;
68 }
69
73 if(
trace)
werrstr(
"s.init %p-%p, fde %p-%p\n",
s.init.p,
s.init.ep, fde.
p, fde.
ep);
77
80
86 }
88
91
96 for(
i=0;
i<
s.nstack;
i++)
100}
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 109 of file dwarfcfa.c.
110{
111 static int nbad;
112 char *aug;
117
118 if(
d->frame.data ==
nil){
119 werrstr(
"no frame debugging information");
120 return -1;
121 }
124 b.ep =
b.p +
d->frame.len;
125 b.addrsize =
d->addrsize;
128
130 if((
i = (
b.p -
d->frame.data) %
b.addrsize))
131 b.p +=
b.addrsize -
i;
134 werrstr(
"bad length in cie/fde header");
135 return -1;
136 }
139 if(id == 0xFFFFFFFF){
141 if(vers != 1 && vers != 2 && vers != 3){
142 if(++nbad == 1)
143 werrstr(
"unknown cie version %d (wanted 1-3)\n", vers);
144 continue;
145 }
147 if(aug && *aug){
148 if(++nbad == 1)
149 werrstr(
"unknown augmentation: %s\n", aug);
150 continue;
151 }
155 if(
s->rareg >
s->nr){
156 werrstr(
"return address is register %d but only have %d registers",
158 return -1;
159 }
162 }else{
170 return 0;
171 }
172 }
173 werrstr(
"cannot find call frame information for pc 0x%lux", pc);
174 return -1;
175
176}
static unsigned __int64 next
char * dwarfgetstring(DwarfBuf *)
Referenced by dwarfunwind().