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

dwarfpubnames.c
Go to the documentation of this file.
00001 
00002 #include <precomp.h>
00003 #define NDEBUG
00004 #include <debug.h>
00005 
00006 static int
00007 _dwarfnametounit(Dwarf *d, char *name, DwarfBlock *bl, DwarfSym *s)
00008 {
00009     int vers;
00010     ulong len, unit, off;
00011     uchar *next;
00012     char *str;
00013     DwarfBuf b;
00014 
00015     b.d = d;
00016     b.p = bl->data;
00017     b.ep = b.p + bl->len;
00018 
00019     while(b.p < b.ep){
00020         len = dwarfget4(&b);
00021         if(len > b.ep-b.p){
00022             werrstr("bad length in dwarf name header");
00023             return -1;
00024         }
00025         next = b.p + len;
00026         vers = dwarfget2(&b);
00027         if(vers != 1 && vers != 2){
00028             werrstr("bad version %d in dwarf name header", vers);
00029             return -1;
00030         }
00031         unit = dwarfget4(&b);
00032         dwarfget4(&b);  /* unit length */
00033         while(b.p < next){
00034             off = dwarfget4(&b);
00035             if(off == 0)
00036                 break;
00037             str = dwarfgetstring(&b);
00038             if(strcmp(str, name) == 0){
00039                 if(dwarfenumunit(d, unit, s) < 0)
00040                     return -1;
00041                 if(unit + off >= s->b.ep - d->info.data){
00042                     werrstr("bad offset in name entry");
00043                     return -1;
00044                 }
00045                 s->b.p = d->info.data + unit + off;
00046                 if(dwarfnextsym(d, s) < 0)
00047                     return -1;
00048                 if(s->attrs.name==nil || strcmp(s->attrs.name, name)!=0){
00049                     werrstr("unexpected name %#q in lookup for %#q", s->attrs.name, name);
00050                     return -1;
00051                 }
00052                 return 0;
00053             }
00054         }
00055         b.p = next;
00056     }
00057     werrstr("unknown name '%s'", name);
00058     return -1;
00059 }
00060 
00061 int
00062 dwarflookupname(Dwarf *d, char *name, DwarfSym *sym)
00063 {
00064     return _dwarfnametounit(d, name, &d->pubnames, sym);
00065 }
00066 
00067 /*
00068 
00069 int
00070 dwarflookuptype(Dwarf *d, char *name, DwarfSym *sym)
00071 {
00072     return _dwarfnametounit(d, name, &d->pubtypes, sym);
00073 }
00074 
00075  */
00076 

Generated on Fri May 25 2012 04:34:47 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.