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

Generated on Sat May 26 2012 04:35:19 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.