diff options
author | Josh Bleecher Snyder <josharian@gmail.com> | 2014-02-28 11:08:32 -0800 |
---|---|---|
committer | Josh Bleecher Snyder <josharian@gmail.com> | 2014-02-28 11:08:32 -0800 |
commit | 72616e207c8d18a960fbcf13751b3b69d0f32209 (patch) | |
tree | e6f11bd3f30600d6054b37ed2f3574f055d89b62 | |
parent | e83ecb0d9c327abaaca7fe6bec31eae856b40491 (diff) | |
download | go-72616e207c8d18a960fbcf13751b3b69d0f32209.tar.gz |
cmd/ld: fix misgenerated pcln file numbers
The pcln file number was being encoded incorrectly. The recorded delta was always against -1, not against the previous value.
Update issue 7369
This CL fixes the bad DWARF file numbers. It does not, however, fix the gdb continue-to-end bug.
LGTM=iant
R=rsc, minux.ma, iant
CC=golang-codereviews, graham
https://codereview.appspot.com/68960046
Committer: Ian Lance Taylor <iant@golang.org>
-rw-r--r-- | src/cmd/ld/pcln.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/cmd/ld/pcln.c b/src/cmd/ld/pcln.c index 71587f778..42916ed09 100644 --- a/src/cmd/ld/pcln.c +++ b/src/cmd/ld/pcln.c @@ -89,6 +89,7 @@ renumberfiles(LSym **files, int nfiles, Pcdata *d) val = files[oldval]->value; } dv = val - newval; + newval = val; v = (uint32)(dv<<1) ^ (uint32)(int32)(dv>>31); addvarint(&out, v); @@ -114,6 +115,7 @@ pclntab(void) int32 off, end; int64 funcdata_bytes; Pcln *pcln; + Pciter it; static Pcln zpcln; funcdata_bytes = 0; @@ -173,8 +175,18 @@ pclntab(void) // and then remove this. off = setuint32(ctxt, ftab, off, ctxt->cursym->locals + PtrSize); - if(pcln != &zpcln) + if(pcln != &zpcln) { renumberfiles(pcln->file, pcln->nfile, &pcln->pcfile); + if(0) { + // Sanity check the new numbering + for(pciterinit(&it, &pcln->pcfile); !it.done; pciternext(&it)) { + if(it.value < 1 || it.value > ctxt->nhistfile) { + diag("bad file number in pcfile: %d not in range [1, %d]\n", it.value, 1, ctxt->nhistfile); + errorexit(); + } + } + } + } // pcdata off = addpctab(ftab, off, &pcln->pcsp); |