diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-10-05 13:44:40 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-10-05 13:44:40 +0000 |
commit | 686750d25df6b870f11f7744b2a3f631d998952a (patch) | |
tree | 042cdf673fe73fbd7eee478b145e55873f39db18 /libgo | |
parent | 4f60bf181ef50a8c3b6fd9a15682782922c49633 (diff) | |
download | gcc-686750d25df6b870f11f7744b2a3f631d998952a.zip gcc-686750d25df6b870f11f7744b2a3f631d998952a.tar.gz gcc-686750d25df6b870f11f7744b2a3f631d998952a.tar.bz2 |
runtime: Use argv[0] to get executable name for backtrace.
From-SVN: r192123
Diffstat (limited to 'libgo')
-rw-r--r-- | libgo/runtime/go-caller.c | 7 | ||||
-rw-r--r-- | libgo/runtime/runtime.c | 6 | ||||
-rw-r--r-- | libgo/runtime/runtime.h | 1 |
3 files changed, 13 insertions, 1 deletions
diff --git a/libgo/runtime/go-caller.c b/libgo/runtime/go-caller.c index 8d8fe4c..843adf6 100644 --- a/libgo/runtime/go-caller.c +++ b/libgo/runtime/go-caller.c @@ -98,7 +98,12 @@ __go_get_backtrace_state () { runtime_lock (&back_state_lock); 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); return back_state; } diff --git a/libgo/runtime/runtime.c b/libgo/runtime/runtime.c index e0a7925..8611596 100644 --- a/libgo/runtime/runtime.c +++ b/libgo/runtime/runtime.c @@ -117,6 +117,12 @@ runtime_args(int32 c, byte **v) runtime_sysargs(c, v); } +byte* +runtime_progname() +{ + return argc == 0 ? nil : argv[0]; +} + void runtime_goargs(void) { diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index f96d740..74050da 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -520,5 +520,6 @@ extern uintptr runtime_stacks_sys; struct backtrace_state; extern struct backtrace_state *__go_get_backtrace_state(void); extern _Bool __go_file_line(uintptr, String*, String*, int *); +extern byte* runtime_progname(); int32 getproccount(void); |