// fixed size of struct, checked below
off = funcstart;
- end = funcstart + PtrSize + 6*4 + 5*4 + npcdata*4 + nfuncdata*PtrSize;
+ end = funcstart + PtrSize + 3*4 + 5*4 + npcdata*4 + nfuncdata*PtrSize;
if(nfuncdata > 0 && (end&(PtrSize-1)))
end += 4;
symgrow(ftab, end);
off = setuint32(ftab, off, ArgsSizeUnknown);
else
off = setuint32(ftab, off, cursym->args);
-
- // Dead space. TODO: Delete (and update all parsers).
- off = setuint32(ftab, off, 0);
// frame int32
// TODO: Remove entirely. The pcsp table is more precise.
else
off = setuint32(ftab, off, (uint32)cursym->text->to.offset+PtrSize);
- // Dead space. TODO: Delete (and update all parsers).
- off = setuint32(ftab, off, 0);
- off = setuint32(ftab, off, 0);
-
// pcsp table (offset int32)
off = addpctab(ftab, off, cursym, "pctospadj", pctospadj, 0);
// Go 1.2 pcln table
// See golang.org/s/go12symtab.
+// Func layout
+#define FuncEntry (0)
+#define FuncName (pcptrsize)
+#define FuncArgs (pcptrsize+4)
+#define FuncFrame (pcptrsize+2*4)
+#define FuncPCSP (pcptrsize+3*4)
+#define FuncPCFile (pcptrsize+4*4)
+#define FuncPCLine (pcptrsize+5*4)
+
static int32 pcquantum;
static int32 pcptrsize;
static uvlong (*pcswav)(uvlong);
f = go12findfunc(pc);
if(f == nil)
return ~(uvlong)0;
- entry = pcuintptr(f);
- off = pcswal(*(uint32*)(f+pcptrsize+6*4));
+ entry = pcuintptr(f+FuncEntry);
+ off = pcswal(*(uint32*)(f+FuncPCSP));
sp = pcvalue(off, entry, pc);
if(sp < 0)
return ~(uvlong)0;
f = go12findfunc(pc);
if(f == nil)
return 0;
- entry = pcuintptr(f);
- fileoff = pcswal(*(uint32*)(f+pcptrsize+7*4));
- lineoff = pcswal(*(uint32*)(f+pcptrsize+8*4));
+ entry = pcuintptr(f+FuncEntry);
+ fileoff = pcswal(*(uint32*)(f+FuncPCFile));
+ lineoff = pcswal(*(uint32*)(f+FuncPCLine));
lno = pcvalue(lineoff, entry, pc);
fno = pcvalue(fileoff, entry, pc);
if(lno < 0 || fno <= 0 || fno >= nfiletab) {
// quick.
for(i=0; i<nfunctab; i++) {
func = pcline + pcuintptr(functab+i*2*pcptrsize+pcptrsize);
- entry = pcuintptr(func);
- fp = pcline + pcswal(*(uint32*)(func+pcptrsize+7*4));
- lp = pcline + pcswal(*(uint32*)(func+pcptrsize+8*4));
+ entry = pcuintptr(func+FuncEntry);
+ fp = pcline + pcswal(*(uint32*)(func+FuncPCFile));
+ lp = pcline + pcswal(*(uint32*)(func+FuncPCLine));
fval = lval = -1;
fpc = lpc = entry;
fstartpc = fpc;
return -1
}
entry := t.uintptr(f)
- linetab := t.binary.Uint32(f[t.ptrsize+8*4:])
+ linetab := t.binary.Uint32(f[t.ptrsize+5*4:])
return int(t.pcvalue(linetab, entry, pc))
}
return ""
}
entry := t.uintptr(f)
- filetab := t.binary.Uint32(f[t.ptrsize+7*4:])
+ filetab := t.binary.Uint32(f[t.ptrsize+4*4:])
fno := t.pcvalue(filetab, entry, pc)
if fno <= 0 {
return ""
for i := uint32(0); i < t.nfunctab; i++ {
f := t.Data[t.uintptr(t.functab[2*t.ptrsize*i+t.ptrsize:]):]
entry := t.uintptr(f)
- filetab := t.binary.Uint32(f[t.ptrsize+7*4:])
- linetab := t.binary.Uint32(f[t.ptrsize+8*4:])
+ filetab := t.binary.Uint32(f[t.ptrsize+4*4:])
+ linetab := t.binary.Uint32(f[t.ptrsize+5*4:])
pc := t.findFileLine(entry, filetab, linetab, int32(filenum), int32(line))
if pc != 0 {
return pc
uintptr entry; // start pc
int32 nameoff; // function name
- // TODO: Remove these fields.
+ // TODO: Perhaps remove these fields.
int32 args; // in/out args size
- int32 x1; // locals size
int32 frame; // legacy frame size; use pcsp if possible
- int32 x2;
- int32 x3;
int32 pcsp;
int32 pcfile;