OLD | NEW |
1 // Derived from Inferno utils/6l/obj.c and utils/6l/span.c | 1 // Derived from Inferno utils/6l/obj.c and utils/6l/span.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/obj.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/obj.c |
3 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c | 3 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c |
4 // | 4 // |
5 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 5 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
6 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 6 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
7 // Portions Copyright © 1997-1999 Vita Nuova Limited | 7 // Portions Copyright © 1997-1999 Vita Nuova Limited |
8 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) | 8 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) |
9 // Portions Copyright © 2004,2006 Bruce Ellis | 9 // Portions Copyright © 2004,2006 Bruce Ellis |
10 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 10 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 uint32 *havepc, *havefunc; | 2371 uint32 *havepc, *havefunc; |
2372 Sym *ftab, *s; | 2372 Sym *ftab, *s; |
2373 int32 npcdata, nfuncdata, off, end; | 2373 int32 npcdata, nfuncdata, off, end; |
2374 int64 funcdata_bytes; | 2374 int64 funcdata_bytes; |
2375 ········ | 2375 ········ |
2376 funcdata_bytes = 0; | 2376 funcdata_bytes = 0; |
2377 ftab = lookup("pclntab", 0); | 2377 ftab = lookup("pclntab", 0); |
2378 ftab->type = SPCLNTAB; | 2378 ftab->type = SPCLNTAB; |
2379 ftab->reachable = 1; | 2379 ftab->reachable = 1; |
2380 | 2380 |
2381 if(debug['s']) | |
2382 return; | |
2383 | |
2384 // See golang.org/s/go12symtab for the format. Briefly: | 2381 // See golang.org/s/go12symtab for the format. Briefly: |
2385 // 8-byte header | 2382 // 8-byte header |
2386 // nfunc [PtrSize bytes] | 2383 // nfunc [PtrSize bytes] |
2387 // function table, alternating PC and offset to func struct [each e
ntry PtrSize bytes] | 2384 // function table, alternating PC and offset to func struct [each e
ntry PtrSize bytes] |
2388 // end PC [PtrSize bytes] | 2385 // end PC [PtrSize bytes] |
2389 // offset to file table [4 bytes] | 2386 // offset to file table [4 bytes] |
2390 nfunc = 0; | 2387 nfunc = 0; |
2391 for(cursym = textp; cursym != nil; cursym = cursym->next) | 2388 for(cursym = textp; cursym != nil; cursym = cursym->next) |
2392 nfunc++; | 2389 nfunc++; |
2393 symgrow(ftab, 8+PtrSize+nfunc*2*PtrSize+PtrSize+4); | 2390 symgrow(ftab, 8+PtrSize+nfunc*2*PtrSize+PtrSize+4); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2523 symgrow(ftab, start+(nhistfile+1)*4); | 2520 symgrow(ftab, start+(nhistfile+1)*4); |
2524 setuint32(ftab, start, nhistfile); | 2521 setuint32(ftab, start, nhistfile); |
2525 for(s = filesyms; s != S; s = s->next) | 2522 for(s = filesyms; s != S; s = s->next) |
2526 setuint32(ftab, start + s->value*4, ftabaddstring(ftab, s->name)
); | 2523 setuint32(ftab, start + s->value*4, ftabaddstring(ftab, s->name)
); |
2527 | 2524 |
2528 ftab->size = ftab->np; | 2525 ftab->size = ftab->np; |
2529 ········ | 2526 ········ |
2530 if(debug['v']) | 2527 if(debug['v']) |
2531 Bprint(&bso, "%5.2f pclntab=%lld bytes, funcdata total %lld byte
s\n", cputime(), (vlong)ftab->size, (vlong)funcdata_bytes); | 2528 Bprint(&bso, "%5.2f pclntab=%lld bytes, funcdata total %lld byte
s\n", cputime(), (vlong)ftab->size, (vlong)funcdata_bytes); |
2532 }······· | 2529 }······· |
OLD | NEW |