summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-01-30 17:10:10 -0800
committerRuss Cox <rsc@golang.org>2009-01-30 17:10:10 -0800
commitea3f861f1a632db1145d3acc63b59291b8d59ce5 (patch)
treeff5dfa03f5c728636dce9bec60bcfd68730789dc
parentd9cb40590eb76fad2042b537ebf5b98279322fe0 (diff)
downloadgolang-ea3f861f1a632db1145d3acc63b59291b8d59ce5.tar.gz
keep line number history even when
throwing away dead code at end of file. also fix an uninitialized memory error found by valgrind. R=r DELTA=7 (5 added, 2 deleted, 0 changed) OCL=23991 CL=23994
-rw-r--r--src/cmd/6l/obj.c3
-rw-r--r--src/cmd/6l/span.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/6l/obj.c b/src/cmd/6l/obj.c
index 076809aa2..a23e030f5 100644
--- a/src/cmd/6l/obj.c
+++ b/src/cmd/6l/obj.c
@@ -757,6 +757,7 @@ addhist(int32 line, int type)
u->link = curhist;
curhist = u;
+ s->name[0] = 0;
j = 1;
for(i=0; i<histfrogp; i++) {
k = histfrog[i]->value;
@@ -764,6 +765,8 @@ addhist(int32 line, int type)
s->name[j+1] = k;
j += 2;
}
+ s->name[j] = 0;
+ s->name[j+1] = 0;
}
void
diff --git a/src/cmd/6l/span.c b/src/cmd/6l/span.c
index 8ac0543a8..fea4979e4 100644
--- a/src/cmd/6l/span.c
+++ b/src/cmd/6l/span.c
@@ -240,8 +240,6 @@ asmsym(void)
for(p=textp; p!=P; p=p->pcond) {
s = p->from.sym;
- if(s->type != STEXT)
- continue;
/* filenames first */
for(a=p->to.autom; a; a=a->link)
@@ -251,6 +249,8 @@ asmsym(void)
if(a->type == D_FILE1)
putsymb(a->asym->name, 'Z', a->aoffset, 0, nil);
+ if(s->type != STEXT)
+ continue;
putsymb(s->name, 'T', s->value, s->version, gotypefor(s->name));
/* frame, auto and param after */