2008-11-23 18:08:55 -07:00
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
// Runtime symbol table access. Work in progress.
|
|
|
|
// The Plan 9 symbol table is not in a particularly convenient form.
|
|
|
|
// The routines here massage it into a more usable form; eventually
|
|
|
|
// we'll change 6l to do this for us, but it is easier to experiment
|
|
|
|
// here than to change 6l and all the other tools.
|
|
|
|
//
|
|
|
|
// The symbol table also needs to be better integrated with the type
|
|
|
|
// strings table in the future. This is just a quick way to get started
|
|
|
|
// and figure out exactly what we want.
|
2008-11-23 18:08:55 -07:00
|
|
|
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
#include "runtime.h"
|
2010-01-06 18:58:55 -07:00
|
|
|
#include "defs.h"
|
|
|
|
#include "os.h"
|
2010-04-05 13:51:09 -06:00
|
|
|
#include "arch.h"
|
2008-11-23 18:08:55 -07:00
|
|
|
|
2009-03-30 01:01:07 -06:00
|
|
|
// TODO(rsc): Move this *under* the text segment.
|
|
|
|
// Then define names for these addresses instead of hard-coding magic ones.
|
2010-02-04 13:46:11 -07:00
|
|
|
#define SYMCOUNTS ((int32*)(0x99LL<<24)) // known to 6l, 8l; see src/cmd/ld/lib.h
|
2009-03-30 01:01:07 -06:00
|
|
|
#define SYMDATA ((byte*)(0x99LL<<24) + 8)
|
|
|
|
|
2008-11-23 18:08:55 -07:00
|
|
|
typedef struct Sym Sym;
|
|
|
|
struct Sym
|
|
|
|
{
|
2009-03-30 01:01:07 -06:00
|
|
|
uintptr value;
|
2008-11-23 18:08:55 -07:00
|
|
|
byte symtype;
|
|
|
|
byte *name;
|
2009-08-12 17:14:53 -06:00
|
|
|
// byte *gotype;
|
2008-11-23 18:08:55 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
// Walk over symtab, calling fn(&s) for each symbol.
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
static void
|
2008-11-23 18:08:55 -07:00
|
|
|
walksymtab(void (*fn)(Sym*))
|
|
|
|
{
|
|
|
|
int32 *v;
|
|
|
|
byte *p, *ep, *q;
|
|
|
|
Sym s;
|
|
|
|
|
2009-09-22 17:28:32 -06:00
|
|
|
// TODO(rsc): Remove once TODO at top of file is done.
|
|
|
|
if(goos != nil && strcmp((uint8*)goos, (uint8*)"nacl") == 0)
|
|
|
|
return;
|
2010-01-13 20:51:59 -07:00
|
|
|
if(goos != nil && strcmp((uint8*)goos, (uint8*)"pchw") == 0)
|
|
|
|
return;
|
2009-09-22 17:28:32 -06:00
|
|
|
|
2010-01-06 18:58:55 -07:00
|
|
|
#ifdef __MINGW__
|
|
|
|
v = get_symdat_addr();
|
|
|
|
p = (byte*)v+8;
|
|
|
|
#else
|
2008-11-23 18:08:55 -07:00
|
|
|
v = SYMCOUNTS;
|
|
|
|
p = SYMDATA;
|
2010-01-06 18:58:55 -07:00
|
|
|
#endif
|
2008-11-23 18:08:55 -07:00
|
|
|
ep = p + v[0];
|
|
|
|
while(p < ep) {
|
|
|
|
if(p + 7 > ep)
|
|
|
|
break;
|
|
|
|
s.value = ((uint32)p[0]<<24) | ((uint32)p[1]<<16) | ((uint32)p[2]<<8) | ((uint32)p[3]);
|
|
|
|
if(!(p[4]&0x80))
|
|
|
|
break;
|
|
|
|
s.symtype = p[4] & ~0x80;
|
|
|
|
p += 5;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
s.name = p;
|
2008-11-23 18:08:55 -07:00
|
|
|
if(s.symtype == 'z' || s.symtype == 'Z') {
|
|
|
|
// path reference string - skip first byte,
|
|
|
|
// then 2-byte pairs ending at two zeros.
|
|
|
|
q = p+1;
|
|
|
|
for(;;) {
|
|
|
|
if(q+2 > ep)
|
|
|
|
return;
|
|
|
|
if(q[0] == '\0' && q[1] == '\0')
|
|
|
|
break;
|
|
|
|
q += 2;
|
|
|
|
}
|
|
|
|
p = q+2;
|
|
|
|
}else{
|
|
|
|
q = mchr(p, '\0', ep);
|
|
|
|
if(q == nil)
|
|
|
|
break;
|
|
|
|
p = q+1;
|
|
|
|
}
|
2009-08-12 17:14:53 -06:00
|
|
|
p += 4; // go type
|
2008-11-23 18:08:55 -07:00
|
|
|
fn(&s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Symtab walker; accumulates info about functions.
|
|
|
|
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
static Func *func;
|
|
|
|
static int32 nfunc;
|
|
|
|
|
|
|
|
static byte **fname;
|
|
|
|
static int32 nfname;
|
2008-11-23 18:08:55 -07:00
|
|
|
|
2009-12-07 16:52:14 -07:00
|
|
|
static Lock funclock;
|
|
|
|
|
2008-11-23 18:08:55 -07:00
|
|
|
static void
|
|
|
|
dofunc(Sym *sym)
|
|
|
|
{
|
|
|
|
Func *f;
|
|
|
|
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
switch(sym->symtype) {
|
|
|
|
case 't':
|
|
|
|
case 'T':
|
2010-04-05 13:51:09 -06:00
|
|
|
case 'l':
|
|
|
|
case 'L':
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
if(strcmp(sym->name, (byte*)"etext") == 0)
|
|
|
|
break;
|
|
|
|
if(func == nil) {
|
|
|
|
nfunc++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
f = &func[nfunc++];
|
|
|
|
f->name = gostring(sym->name);
|
|
|
|
f->entry = sym->value;
|
2010-04-05 13:51:09 -06:00
|
|
|
if(sym->symtype == 'L' || sym->symtype == 'l')
|
|
|
|
f->frame = -sizeof(uintptr);
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
break;
|
|
|
|
case 'm':
|
|
|
|
if(nfunc > 0 && func != nil)
|
2010-04-05 13:51:09 -06:00
|
|
|
func[nfunc-1].frame += sym->value;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
break;
|
2008-11-25 18:17:54 -07:00
|
|
|
case 'p':
|
|
|
|
if(nfunc > 0 && func != nil) {
|
|
|
|
f = &func[nfunc-1];
|
|
|
|
// args counts 32-bit words.
|
|
|
|
// sym->value is the arg's offset.
|
|
|
|
// don't know width of this arg, so assume it is 64 bits.
|
|
|
|
if(f->args < sym->value/4 + 2)
|
|
|
|
f->args = sym->value/4 + 2;
|
|
|
|
}
|
|
|
|
break;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
case 'f':
|
|
|
|
if(fname == nil) {
|
|
|
|
if(sym->value >= nfname)
|
|
|
|
nfname = sym->value+1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
fname[sym->value] = sym->name;
|
|
|
|
break;
|
2008-11-23 18:08:55 -07:00
|
|
|
}
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// put together the path name for a z entry.
|
|
|
|
// the f entries have been accumulated into fname already.
|
|
|
|
static void
|
|
|
|
makepath(byte *buf, int32 nbuf, byte *path)
|
|
|
|
{
|
|
|
|
int32 n, len;
|
|
|
|
byte *p, *ep, *q;
|
|
|
|
|
|
|
|
if(nbuf <= 0)
|
2008-11-23 18:08:55 -07:00
|
|
|
return;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
|
|
|
|
p = buf;
|
|
|
|
ep = buf + nbuf;
|
|
|
|
*p = '\0';
|
|
|
|
for(;;) {
|
|
|
|
if(path[0] == 0 && path[1] == 0)
|
|
|
|
break;
|
|
|
|
n = (path[0]<<8) | path[1];
|
|
|
|
path += 2;
|
|
|
|
if(n >= nfname)
|
|
|
|
break;
|
|
|
|
q = fname[n];
|
|
|
|
len = findnull(q);
|
|
|
|
if(p+1+len >= ep)
|
|
|
|
break;
|
|
|
|
if(p > buf && p[-1] != '/')
|
|
|
|
*p++ = '/';
|
|
|
|
mcpy(p, q, len+1);
|
|
|
|
p += len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// walk symtab accumulating path names for use by pc/ln table.
|
|
|
|
// don't need the full generality of the z entry history stack because
|
2009-08-14 15:36:49 -06:00
|
|
|
// there are no includes in go (and only sensible includes in our c);
|
|
|
|
// assume code only appear in top-level files.
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
static void
|
|
|
|
dosrcline(Sym *sym)
|
|
|
|
{
|
|
|
|
static byte srcbuf[1000];
|
2009-08-14 15:36:49 -06:00
|
|
|
static struct {
|
|
|
|
String srcstring;
|
|
|
|
int32 aline;
|
|
|
|
int32 delta;
|
|
|
|
} files[200];
|
|
|
|
static int32 incstart;
|
|
|
|
static int32 nfunc, nfile, nhist;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
Func *f;
|
2009-08-14 15:36:49 -06:00
|
|
|
int32 i;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
|
|
|
|
switch(sym->symtype) {
|
|
|
|
case 't':
|
|
|
|
case 'T':
|
2008-12-15 11:50:41 -07:00
|
|
|
if(strcmp(sym->name, (byte*)"etext") == 0)
|
|
|
|
break;
|
2009-08-14 15:36:49 -06:00
|
|
|
f = &func[nfunc++];
|
|
|
|
// find source file
|
|
|
|
for(i = 0; i < nfile - 1; i++) {
|
|
|
|
if (files[i+1].aline > f->ln0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
f->src = files[i].srcstring;
|
|
|
|
f->ln0 -= files[i].delta;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
break;
|
|
|
|
case 'z':
|
|
|
|
if(sym->value == 1) {
|
|
|
|
// entry for main source file for a new object.
|
|
|
|
makepath(srcbuf, sizeof srcbuf, sym->name+1);
|
|
|
|
nhist = 0;
|
2009-08-14 15:36:49 -06:00
|
|
|
nfile = 0;
|
|
|
|
if(nfile == nelem(files))
|
2009-08-14 15:41:50 -06:00
|
|
|
return;
|
2009-08-14 15:36:49 -06:00
|
|
|
files[nfile].srcstring = gostring(srcbuf);
|
|
|
|
files[nfile].aline = 0;
|
|
|
|
files[nfile++].delta = 0;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
} else {
|
|
|
|
// push or pop of included file.
|
|
|
|
makepath(srcbuf, sizeof srcbuf, sym->name+1);
|
|
|
|
if(srcbuf[0] != '\0') {
|
|
|
|
if(nhist++ == 0)
|
|
|
|
incstart = sym->value;
|
2009-08-14 15:36:49 -06:00
|
|
|
if(nhist == 0 && nfile < nelem(files)) {
|
|
|
|
// new top-level file
|
|
|
|
files[nfile].srcstring = gostring(srcbuf);
|
|
|
|
files[nfile].aline = sym->value;
|
|
|
|
// this is "line 0"
|
|
|
|
files[nfile++].delta = sym->value - 1;
|
|
|
|
}
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
}else{
|
|
|
|
if(--nhist == 0)
|
2009-08-14 15:36:49 -06:00
|
|
|
files[nfile-1].delta += sym->value - incstart;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Interpret pc/ln table, saving the subpiece for each func.
|
|
|
|
static void
|
|
|
|
splitpcln(void)
|
|
|
|
{
|
|
|
|
int32 line;
|
2009-03-30 01:01:07 -06:00
|
|
|
uintptr pc;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
byte *p, *ep;
|
|
|
|
Func *f, *ef;
|
|
|
|
int32 *v;
|
2010-04-05 13:51:09 -06:00
|
|
|
int32 pcquant;
|
|
|
|
|
|
|
|
switch(thechar) {
|
|
|
|
case '5':
|
|
|
|
pcquant = 4;
|
|
|
|
break;
|
|
|
|
default: // 6, 8
|
|
|
|
pcquant = 1;
|
|
|
|
break;
|
|
|
|
}
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
|
2009-09-22 17:28:32 -06:00
|
|
|
// TODO(rsc): Remove once TODO at top of file is done.
|
|
|
|
if(goos != nil && strcmp((uint8*)goos, (uint8*)"nacl") == 0)
|
|
|
|
return;
|
2010-01-13 20:51:59 -07:00
|
|
|
if(goos != nil && strcmp((uint8*)goos, (uint8*)"pchw") == 0)
|
|
|
|
return;
|
2009-09-22 17:28:32 -06:00
|
|
|
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
// pc/ln table bounds
|
2010-01-06 18:58:55 -07:00
|
|
|
#ifdef __MINGW__
|
|
|
|
v = get_symdat_addr();
|
|
|
|
p = (byte*)v+8;
|
|
|
|
#else
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
v = SYMCOUNTS;
|
|
|
|
p = SYMDATA;
|
2010-01-06 18:58:55 -07:00
|
|
|
#endif
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
p += v[0];
|
|
|
|
ep = p+v[1];
|
|
|
|
|
|
|
|
f = func;
|
|
|
|
ef = func + nfunc;
|
|
|
|
pc = func[0].entry; // text base
|
2009-05-15 18:26:08 -06:00
|
|
|
f->pcln.array = p;
|
2010-04-05 13:51:09 -06:00
|
|
|
f->pc0 = pc - pcquant;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
line = 0;
|
|
|
|
for(; p < ep; p++) {
|
2009-08-14 15:36:49 -06:00
|
|
|
if(f < ef && pc > (f+1)->entry) {
|
2009-08-25 16:54:25 -06:00
|
|
|
f->pcln.len = p - f->pcln.array;
|
|
|
|
f->pcln.cap = f->pcln.len;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
f++;
|
|
|
|
f->pcln.array = p;
|
|
|
|
f->pc0 = pc;
|
|
|
|
f->ln0 = line;
|
|
|
|
}
|
|
|
|
if(*p == 0) {
|
|
|
|
// 4 byte add to line
|
|
|
|
line += (p[1]<<24) | (p[2]<<16) | (p[3]<<8) | p[4];
|
|
|
|
p += 4;
|
|
|
|
} else if(*p <= 64) {
|
|
|
|
line += *p;
|
|
|
|
} else if(*p <= 128) {
|
|
|
|
line -= *p - 64;
|
|
|
|
} else {
|
2010-04-05 13:51:09 -06:00
|
|
|
pc += pcquant*(*p - 129);
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
}
|
2010-04-05 13:51:09 -06:00
|
|
|
pc += pcquant;
|
2008-11-23 18:08:55 -07:00
|
|
|
}
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
if(f < ef) {
|
2009-08-25 16:54:25 -06:00
|
|
|
f->pcln.len = p - f->pcln.array;
|
|
|
|
f->pcln.cap = f->pcln.len;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Return actual file line number for targetpc in func f.
|
|
|
|
// (Source file is f->src.)
|
2010-03-24 10:40:09 -06:00
|
|
|
// NOTE(rsc): If you edit this function, also edit extern.go:/FileLine
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
int32
|
|
|
|
funcline(Func *f, uint64 targetpc)
|
|
|
|
{
|
|
|
|
byte *p, *ep;
|
2009-03-30 01:01:07 -06:00
|
|
|
uintptr pc;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
int32 line;
|
2010-04-05 13:51:09 -06:00
|
|
|
int32 pcquant;
|
|
|
|
|
|
|
|
switch(thechar) {
|
|
|
|
case '5':
|
|
|
|
pcquant = 4;
|
|
|
|
break;
|
|
|
|
default: // 6, 8
|
|
|
|
pcquant = 1;
|
|
|
|
break;
|
|
|
|
}
|
2008-11-23 18:08:55 -07:00
|
|
|
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
p = f->pcln.array;
|
2009-08-25 16:54:25 -06:00
|
|
|
ep = p + f->pcln.len;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
pc = f->pc0;
|
|
|
|
line = f->ln0;
|
2009-08-14 15:36:49 -06:00
|
|
|
for(; p < ep && pc <= targetpc; p++) {
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
if(*p == 0) {
|
|
|
|
line += (p[1]<<24) | (p[2]<<16) | (p[3]<<8) | p[4];
|
|
|
|
p += 4;
|
|
|
|
} else if(*p <= 64) {
|
|
|
|
line += *p;
|
|
|
|
} else if(*p <= 128) {
|
|
|
|
line -= *p - 64;
|
|
|
|
} else {
|
2010-04-05 13:51:09 -06:00
|
|
|
pc += pcquant*(*p - 129);
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
}
|
2010-04-05 13:51:09 -06:00
|
|
|
pc += pcquant;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
}
|
|
|
|
return line;
|
2008-11-23 18:08:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
buildfuncs(void)
|
|
|
|
{
|
|
|
|
extern byte etext[];
|
|
|
|
|
|
|
|
if(func != nil)
|
|
|
|
return;
|
2010-03-24 10:40:09 -06:00
|
|
|
|
|
|
|
// Memory profiling uses this code;
|
|
|
|
// can deadlock if the profiler ends
|
|
|
|
// up back here.
|
|
|
|
m->nomemprof++;
|
|
|
|
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
// count funcs, fnames
|
2008-11-23 18:08:55 -07:00
|
|
|
nfunc = 0;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
nfname = 0;
|
2008-11-23 18:08:55 -07:00
|
|
|
walksymtab(dofunc);
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
|
|
|
|
// initialize tables
|
2008-11-23 18:08:55 -07:00
|
|
|
func = mal((nfunc+1)*sizeof func[0]);
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
func[nfunc].entry = (uint64)etext;
|
|
|
|
fname = mal(nfname*sizeof fname[0]);
|
2008-11-23 18:08:55 -07:00
|
|
|
nfunc = 0;
|
|
|
|
walksymtab(dofunc);
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
|
|
|
|
// split pc/ln table by func
|
|
|
|
splitpcln();
|
|
|
|
|
|
|
|
// record src file and line info for each func
|
|
|
|
walksymtab(dosrcline);
|
2010-03-24 10:40:09 -06:00
|
|
|
|
|
|
|
m->nomemprof--;
|
2008-11-23 18:08:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
Func*
|
2009-03-30 01:01:07 -06:00
|
|
|
findfunc(uintptr addr)
|
2008-11-23 18:08:55 -07:00
|
|
|
{
|
|
|
|
Func *f;
|
use pc/ln table to print source lines in traceback
r45=; 6.out
oops
panic PC=0x400316
0x400316?zi /home/rsc/go/src/runtime/rt0_amd64_linux.s:83
main·g(4195177, 0, 4205661, ...)
main·g(0x400369, 0x402c5d, 0x403e49, ...)
0x40034c?zi /home/rsc/go/src/runtime/x.go:24
main·f(4205661, 0, 4210249, ...)
main·f(0x402c5d, 0x403e49, 0x1, ...)
0x400368?zi /home/rsc/go/src/runtime/x.go:37
main·main(4210249, 0, 1, ...)
main·main(0x403e49, 0x1, 0x7fff9d894bd8, ...)
0x402c5c?zi /home/rsc/go/src/runtime/rt0_amd64.s:70
mainstart(1, 0, 2643020760, ...)
mainstart(0x1, 0x7fff9d894bd8, 0x0, ...)
r45=;
R=r
DELTA=251 (198 added, 25 deleted, 28 changed)
OCL=19965
CL=19979
2008-11-25 10:23:36 -07:00
|
|
|
int32 nf, n;
|
2008-11-23 18:08:55 -07:00
|
|
|
|
2009-12-07 16:52:14 -07:00
|
|
|
lock(&funclock);
|
2008-11-23 18:08:55 -07:00
|
|
|
if(func == nil)
|
|
|
|
buildfuncs();
|
2009-12-07 16:52:14 -07:00
|
|
|
unlock(&funclock);
|
|
|
|
|
2008-11-23 18:08:55 -07:00
|
|
|
if(nfunc == 0)
|
|
|
|
return nil;
|
|
|
|
if(addr < func[0].entry || addr >= func[nfunc].entry)
|
|
|
|
return nil;
|
|
|
|
|
|
|
|
// binary search to find func with entry <= addr.
|
|
|
|
f = func;
|
|
|
|
nf = nfunc;
|
|
|
|
while(nf > 0) {
|
|
|
|
n = nf/2;
|
|
|
|
if(f[n].entry <= addr && addr < f[n+1].entry)
|
|
|
|
return &f[n];
|
|
|
|
else if(addr < f[n].entry)
|
|
|
|
nf = n;
|
|
|
|
else {
|
|
|
|
f += n+1;
|
|
|
|
nf -= n+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// can't get here -- we already checked above
|
|
|
|
// that the address was in the table bounds.
|
|
|
|
// this can only happen if the table isn't sorted
|
|
|
|
// by address or if the binary search above is buggy.
|
|
|
|
prints("findfunc unreachable\n");
|
|
|
|
return nil;
|
|
|
|
}
|