]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/ld: give acid a fighting chance at unwinding the stack
authorAnthony Martin <ality@pbrane.org>
Thu, 13 Mar 2014 01:10:31 +0000 (18:10 -0700)
committerAnthony Martin <ality@pbrane.org>
Thu, 13 Mar 2014 01:10:31 +0000 (18:10 -0700)
Acid can't produce a stack trace without .frame symbols.

Of course, it can only unwind through linear stacks but
this is still better than nothing. (I wrote an acid func
to do the full unwind a long time ago but lost it and
haven't worked up the courage to write it again).

Note that these will only be present in the native symbol
table for Plan 9 binaries.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/72450045

src/cmd/ld/lib.c

index e0fcd15da5ea88e404541d0967aa99d9f79251af..20383de1e1702e0910048ce341fbb5f5569c41c6 100644 (file)
@@ -1341,6 +1341,9 @@ genasmsym(void (*put)(LSym*, char*, int, vlong, vlong, int, LSym*))
        for(s = ctxt->textp; s != nil; s = s->next) {
                put(s, s->name, 'T', s->value, s->size, s->version, s->gotype);
 
+               // NOTE(ality): acid can't produce a stack trace without .frame symbols
+               put(nil, ".frame", 'm', s->locals+PtrSize, 0, 0, 0);
+
                for(a=s->autom; a; a=a->link) {
                        // Emit a or p according to actual offset, even if label is wrong.
                        // This avoids negative offsets, which cannot be encoded.