Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libgo / runtime / go-traceback.c
index c1571a3..f397f07 100644 (file)
@@ -7,36 +7,31 @@
 #include "config.h"
 
 #include "runtime.h"
-#include "go-string.h"
 
 /* Print a stack trace for the current goroutine.  */
 
 void
 runtime_traceback ()
 {
-  uintptr pcbuf[100];
+  Location locbuf[100];
   int32 c;
 
-  c = runtime_callers (1, pcbuf, sizeof pcbuf / sizeof pcbuf[0]);
-  runtime_printtrace (pcbuf, c);
+  c = runtime_callers (1, locbuf, nelem (locbuf));
+  runtime_printtrace (locbuf, c, true);
 }
 
 void
-runtime_printtrace (uintptr *pcbuf, int32 c)
+runtime_printtrace (Location *locbuf, int32 c, bool current)
 {
   int32 i;
 
   for (i = 0; i < c; ++i)
     {
-      struct __go_string fn;
-      struct __go_string file;
-      int line;
-
-      if (__go_file_line (pcbuf[i], &fn, &file, &line)
-         && runtime_showframe (fn.__data))
+      if (runtime_showframe (locbuf[i].function, current))
        {
-         runtime_printf ("%S\n", fn);
-         runtime_printf ("\t%S:%d\n", file, line);
+         runtime_printf ("%S\n", locbuf[i].function);
+         runtime_printf ("\t%S:%D\n", locbuf[i].filename,
+                         (int64) locbuf[i].lineno);
        }
     }
 }