aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libmach/dwarf386.c4
-rw-r--r--src/libmach/dwarfabbrev.c5
-rw-r--r--src/libmach/dwarfinfo.c3
-rw-r--r--src/libmach/symdwarf.c5
4 files changed, 11 insertions, 6 deletions
diff --git a/src/libmach/dwarf386.c b/src/libmach/dwarf386.c
index d5cc9b71..3cefeea2 100644
--- a/src/libmach/dwarf386.c
+++ b/src/libmach/dwarf386.c
@@ -15,10 +15,8 @@ dwarf386regs[] =
"BP",
"SI",
"DI",
- "LR",
- "CFA",
};
-int dwarf386nregs = 10;
+int dwarf386nregs = nelem(dwarf386regs);
diff --git a/src/libmach/dwarfabbrev.c b/src/libmach/dwarfabbrev.c
index 2db418dd..503d5149 100644
--- a/src/libmach/dwarfabbrev.c
+++ b/src/libmach/dwarfabbrev.c
@@ -113,6 +113,7 @@ findabbrev(DwarfAbbrev *a, int na, ulong num)
for(i=0; i<na; i++)
if(a[i].num == num)
return &a[i];
+ werrstr("abbrev not found");
return nil;
}
@@ -122,8 +123,10 @@ dwarfgetabbrev(Dwarf *d, ulong off, ulong num)
DwarfAbbrev *a;
int na;
- if((na = loadabbrevs(d, off, &a)) < 0)
+ if((na = loadabbrevs(d, off, &a)) < 0){
+ werrstr("loadabbrevs: %r");
return nil;
+ }
return findabbrev(a, na, num);
}
diff --git a/src/libmach/dwarfinfo.c b/src/libmach/dwarfinfo.c
index ef994ec5..61c58dd4 100644
--- a/src/libmach/dwarfinfo.c
+++ b/src/libmach/dwarfinfo.c
@@ -267,7 +267,8 @@ top:
a = dwarfgetabbrev(d, s->aoff, num);
if(a == nil){
- fprint(2, "getabbrev %ud: %r\n", num);
+ fprint(2, "getabbrev %ud %ud for %ud,%ud: %r\n", s->aoff, num, s->unit, s->uoff);
+ abort();
return -1;
}
if(parseattrs(&s->b, s->unit, a, &s->attrs) < 0)
diff --git a/src/libmach/symdwarf.c b/src/libmach/symdwarf.c
index 8c41d127..eeafa8dc 100644
--- a/src/libmach/symdwarf.c
+++ b/src/libmach/symdwarf.c
@@ -112,6 +112,9 @@ dwarflenum(Fhdr *fhdr, Symbol *p, char *name, uint j, Loc l, Symbol *s)
if(p == nil)
return -1;
+ if(p->u.dwarf.unit == 0 && p->u.dwarf.uoff == 0)
+ return -1;
+
if(dwarfseeksym(fhdr->dwarf, p->u.dwarf.unit, p->u.dwarf.uoff, &ds) < 0)
return -1;
@@ -200,7 +203,7 @@ dwarfsyminit(Fhdr *fp)
if(dwarfenum(d, &s) < 0)
return;
- dwarfnextsymat(d, &s, 0);
+ while(dwarfnextsymat(d, &s, 0) == 1)
while(dwarfnextsymat(d, &s, 1) == 1){
if(s.attrs.name == nil)
continue;