diff options
| author | Luuk van Dijk <lvd@golang.org> | 2010-10-07 11:13:06 +0200 |
|---|---|---|
| committer | Luuk van Dijk <lvd@golang.org> | 2010-10-07 11:13:06 +0200 |
| commit | 2ad521c19a3ba0184349fe3272db1433c8d07138 (patch) | |
| tree | 4401965c8a991a0eecfb9262d5ec115a1118a79e /src/cmd/ld/dwarf.c | |
| parent | cc5c2ee0ec93bc75560ea2e635f14e5a2453f97b (diff) | |
| download | go-2ad521c19a3ba0184349fe3272db1433c8d07138.tar.xz | |
[568]a: precise linenumbers for statements.
R=rsc, ken2, r, rsc1
CC=golang-dev
https://golang.org/cl/2297042
Diffstat (limited to 'src/cmd/ld/dwarf.c')
| -rw-r--r-- | src/cmd/ld/dwarf.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cmd/ld/dwarf.c b/src/cmd/ld/dwarf.c index 0c255544de..500c2fea80 100644 --- a/src/cmd/ld/dwarf.c +++ b/src/cmd/ld/dwarf.c @@ -436,7 +436,7 @@ decodez(char *s) * The line history itself */ -static char **histfile; // [0] holds the empty string. +static char **histfile; // [0] holds "<eof>", DW_LNS_set_file arguments must be > 0. static int histfilesize; static int histfilecap; @@ -445,7 +445,7 @@ clearhistfile(void) { int i; - // [0] holds the empty string. + // [0] holds "<eof>" for (i = 1; i < histfilesize; i++) free(histfile[i]); histfilesize = 0; @@ -756,12 +756,17 @@ writelines(void) newattr(dwinfo->child, DW_AT_low_pc, DW_CLS_ADDRESS, p->pc, 0); for(q = p; q != P && (q == p || q->as != ATEXT); q = q->link) { - epc = q->pc; + epc = q->pc; lh = searchhist(q->line); if (lh == nil) { diag("corrupt history or bad absolute line: %P", q); continue; } + if (lh->file < 1) { // 0 is the past-EOF entry. + diag("instruction with linenumber past EOF in %s: %P", unitname, q); + continue; + } + lline = lh->line + q->line - lh->absline; if (debug['v'] > 1) print("%6llux %s[%lld] %P\n", q->pc, histfile[lh->file], lline, q); |
