ReactOS 0.4.16-dev-122-g325d74c
dwarfaranges.c File Reference
#include <ntddk.h>
#include <reactos/rossym.h>
#include "rossympriv.h"
#include <ntimage.h>
#include <debug.h>
#include "dwarf.h"
Include dependency graph for dwarfaranges.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

int dwarfaddrtounit (Dwarf *d, ulong addr, ulong *unit)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file dwarfaranges.c.

Function Documentation

◆ dwarfaddrtounit()

int dwarfaddrtounit ( Dwarf d,
ulong  addr,
ulong unit 
)

Definition at line 16 of file dwarfaranges.c.

17{
18 DwarfBuf b;
19 int segsize, i;
20 ulong len, id, off, base, size;
21 uchar *start, *end;
22
23 memset(&b, 0, sizeof b);
24 b.d = d;
25 b.p = d->aranges.data;
26 b.ep = b.p + d->aranges.len;
27
28 while(b.p < b.ep){
29 start = b.p;
30 len = dwarfget4(&b);
31 if (!len) { b.ep = b.p - 4; return -1; }
32 if((id = dwarfget2(&b)) != 2){
33 if(b.p == nil){
34 underflow:
35 werrstr("buffer underflow reading address ranges header");
36 }else
37 werrstr("bad dwarf version 0x%x in address ranges header", id);
38 return -1;
39 }
40 off = dwarfget4(&b);
41 b.addrsize = dwarfget1(&b);
42 if(d->addrsize == 0)
43 d->addrsize = b.addrsize;
44 segsize = dwarfget1(&b);
45 USED(segsize); /* what am i supposed to do with this? */
46 if(b.p == nil)
47 goto underflow;
48 if((i = (b.p-start) % (2*b.addrsize)) != 0)
49 b.p += 2*b.addrsize - i;
50 end = start+4+len;
51 while(b.p!=nil && b.p<end){
54 if (!size) continue;
55 if(b.p == nil)
56 goto underflow;
57 if(base <= addr && addr < base+size){
58 *unit = off;
59 return 0;
60 }
61 }
62 if(b.p == nil)
63 goto underflow;
64 b.p = end;
65 }
66 werrstr("address 0x%lux is not listed in dwarf debugging symbols", addr);
67 return -1;
68}
unsigned char uchar
Definition: Unfrag.h:59
unsigned long ulong
Definition: linux.h:275
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLsizei len
Definition: glext.h:6722
GLuint id
Definition: glext.h:5910
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
Definition: glfuncs.h:248
#define d
Definition: ke_i.h:81
#define b
Definition: ke_i.h:79
png_const_structrp png_const_inforp int * unit
Definition: png.h:2159
#define werrstr(str,...)
Definition: compat.h:34
#define USED(x)
Definition: compat.h:38
#define nil
Definition: compat.h:23
#define memset(x, y, z)
Definition: compat.h:39
ulong dwarfget2(DwarfBuf *)
Definition: dwarfget.c:81
ulong dwarfget1(DwarfBuf *)
Definition: dwarfget.c:17
ulong dwarfgetaddr(DwarfBuf *)
Definition: dwarfget.c:123
ulong dwarfget4(DwarfBuf *)
Definition: dwarfget.c:95