diff mbox

libgo patch committed: Remove confusion about split-stack backtrace

Message ID mcrboc5uoe0.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Jan. 31, 2013, 7:46 p.m. UTC
In an earlier patch I tried to remove confusion about split-stack
functions in backtraces, but it still doesn't work in conjunction with
skipping functions.  Both runtime.Callers and backtrace_full can skip
stack frames.  backtrace_full will count split-stack frames in the skip
count, but runtime.Callers should not.  In order to keep this
consistent, this patch moves all the skip count handling to
runtime.Callers.  Bootstrapped and ran Go testsuite in
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r c205459490e5 libgo/runtime/go-callers.c
--- a/libgo/runtime/go-callers.c	Thu Jan 31 09:24:55 2013 -0800
+++ b/libgo/runtime/go-callers.c	Thu Jan 31 11:42:48 2013 -0800
@@ -16,6 +16,7 @@ 
 struct callers_data
 {
   Location *locbuf;
+  int skip;
   int index;
   int max;
 };
@@ -41,6 +42,12 @@ 
 	return 0;
     }
 
+  if (arg->skip > 0)
+    {
+      --arg->skip;
+      return 0;
+    }
+
   loc = &arg->locbuf[arg->index];
   loc->pc = pc;
 
@@ -75,10 +82,11 @@ 
   struct callers_data data;
 
   data.locbuf = locbuf;
+  data.skip = skip + 1;
   data.index = 0;
   data.max = m;
-  backtrace_full (__go_get_backtrace_state (), skip + 1, callback,
-		  error_callback, &data);
+  backtrace_full (__go_get_backtrace_state (), 0, callback, error_callback,
+		  &data);
   return data.index;
 }