ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

dwarfaranges.c
Go to the documentation of this file.
00001 /*
00002  * Dwarf address ranges parsing code.
00003  */
00004 
00005 #include <precomp.h>
00006 
00007 #define NDEBUG
00008 #include <debug.h>
00009 
00010 int
00011 dwarfaddrtounit(Dwarf *d, ulong addr, ulong *unit)
00012 {
00013     DwarfBuf b;
00014     int segsize, i;
00015     ulong len, id, off, base, size;
00016     uchar *start, *end;
00017 
00018     memset(&b, 0, sizeof b);
00019     b.d = d;
00020     b.p = d->aranges.data;
00021     b.ep = b.p + d->aranges.len;
00022 
00023     while(b.p < b.ep){
00024         start = b.p;
00025         len = dwarfget4(&b);
00026         if (!len) { b.ep = b.p - 4; return -1; }
00027         if((id = dwarfget2(&b)) != 2){
00028             if(b.p == nil){
00029             underflow:
00030                 werrstr("buffer underflow reading address ranges header");
00031             }else
00032                 werrstr("bad dwarf version 0x%x in address ranges header", id);
00033             return -1;
00034         }
00035         off = dwarfget4(&b);
00036         b.addrsize = dwarfget1(&b);
00037         if(d->addrsize == 0)
00038             d->addrsize = b.addrsize;
00039         segsize = dwarfget1(&b);
00040         USED(segsize);  /* what am i supposed to do with this? */
00041         if(b.p == nil)
00042             goto underflow;
00043         if((i = (b.p-start) % (2*b.addrsize)) != 0)
00044             b.p += 2*b.addrsize - i;
00045         end = start+4+len;
00046         while(b.p!=nil && b.p<end){
00047             base = dwarfgetaddr(&b);
00048             size = dwarfgetaddr(&b);
00049             if (!size) continue;
00050             if(b.p == nil)
00051                 goto underflow;
00052             if(base <= addr && addr < base+size){
00053                 *unit = off;
00054                 return 0;
00055             }
00056         }
00057         if(b.p == nil)
00058             goto underflow;
00059         b.p = end;
00060     }
00061     werrstr("address 0x%lux is not listed in dwarf debugging symbols", addr);
00062     return -1;
00063 }

Generated on Mon May 28 2012 04:36:10 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.