Commit 686750d2 by Ian Lance Taylor

runtime: Use argv[0] to get executable name for backtrace.

From-SVN: r192123
parent 4f60bf18
...@@ -98,7 +98,12 @@ __go_get_backtrace_state () ...@@ -98,7 +98,12 @@ __go_get_backtrace_state ()
{ {
runtime_lock (&back_state_lock); runtime_lock (&back_state_lock);
if (back_state == NULL) if (back_state == NULL)
back_state = backtrace_create_state (NULL, 1, error_callback, NULL); {
const char *filename;
filename = (const char *) runtime_progname ();
back_state = backtrace_create_state (filename, 1, error_callback, NULL);
}
runtime_unlock (&back_state_lock); runtime_unlock (&back_state_lock);
return back_state; return back_state;
} }
......
...@@ -117,6 +117,12 @@ runtime_args(int32 c, byte **v) ...@@ -117,6 +117,12 @@ runtime_args(int32 c, byte **v)
runtime_sysargs(c, v); runtime_sysargs(c, v);
} }
byte*
runtime_progname()
{
return argc == 0 ? nil : argv[0];
}
void void
runtime_goargs(void) runtime_goargs(void)
{ {
......
...@@ -520,5 +520,6 @@ extern uintptr runtime_stacks_sys; ...@@ -520,5 +520,6 @@ extern uintptr runtime_stacks_sys;
struct backtrace_state; struct backtrace_state;
extern struct backtrace_state *__go_get_backtrace_state(void); extern struct backtrace_state *__go_get_backtrace_state(void);
extern _Bool __go_file_line(uintptr, String*, String*, int *); extern _Bool __go_file_line(uintptr, String*, String*, int *);
extern byte* runtime_progname();
int32 getproccount(void); int32 getproccount(void);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment