runtime: Don't use filename without '/' for backtrace library.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Nov 2013 22:31:29 +0000 (22:31 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 14 Nov 2013 22:31:29 +0000 (22:31 +0000)
Fixes http://golang.org/issue/6715.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204828 138bc75d-0d04-0410-961f-82ee72b054a4

libgo/runtime/go-caller.c

index 8ca3c7e..c49704d 100644 (file)
@@ -101,6 +101,13 @@ __go_get_backtrace_state ()
       const char *filename;
 
       filename = (const char *) runtime_progname ();
+
+      /* If there is no '/' in FILENAME, it was found on PATH, and
+        might not be the same as the file with the same name in the
+        current directory.  */
+      if (__builtin_strchr (filename, '/') == NULL)
+       filename = NULL;
+
       back_state = backtrace_create_state (filename, 1, error_callback, NULL);
     }
   runtime_unlock (&back_state_lock);