From c75884185332458242c03b17014bc3801977f684 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 19 Jul 2013 18:52:35 -0400 Subject: [PATCH] cmd/ld, runtime: remove unused fields from Func R=golang-dev, r CC=golang-dev https://golang.org/cl/11604043 --- src/cmd/ld/lib.c | 9 +-------- src/libmach/sym.c | 25 +++++++++++++++++-------- src/pkg/debug/gosym/pclntab.go | 8 ++++---- src/pkg/runtime/runtime.h | 5 +---- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index 674a1297759..49f2bc304c8 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -2400,7 +2400,7 @@ pclntab(void) // 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); @@ -2417,9 +2417,6 @@ pclntab(void) 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. @@ -2432,10 +2429,6 @@ pclntab(void) 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); diff --git a/src/libmach/sym.c b/src/libmach/sym.c index d8cd8ea1d9e..b9732012f2c 100644 --- a/src/libmach/sym.c +++ b/src/libmach/sym.c @@ -1563,6 +1563,15 @@ dumphist(char *name) // 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); @@ -1788,8 +1797,8 @@ go12pc2sp(uvlong pc) 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; @@ -1807,9 +1816,9 @@ go12fileline(char *str, int n, uvlong pc) 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) { @@ -1845,9 +1854,9 @@ havefile: // quick. for(i=0; i