aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-01-31 16:41:15 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-01-31 16:41:15 +0000
commit422e2fc06270497c479de0da7408158cc5e31c9a (patch)
tree5a17bc9cc94cb084798cb1aea61bfb04796e85d5 /libgo
parentb5fbde9215da5efaa03cfd17fbce0ca3346583e5 (diff)
downloadgcc-422e2fc06270497c479de0da7408158cc5e31c9a.zip
gcc-422e2fc06270497c479de0da7408158cc5e31c9a.tar.gz
gcc-422e2fc06270497c479de0da7408158cc5e31c9a.tar.bz2
runtime: Don't allocate when doing a backtrace.
From-SVN: r195615
Diffstat (limited to 'libgo')
-rw-r--r--libgo/runtime/go-callers.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libgo/runtime/go-callers.c b/libgo/runtime/go-callers.c
index ea6b5db..2154a8a 100644
--- a/libgo/runtime/go-callers.c
+++ b/libgo/runtime/go-callers.c
@@ -43,8 +43,14 @@ callback (void *data, uintptr_t pc, const char *filename, int lineno,
loc = &arg->locbuf[arg->index];
loc->pc = pc;
- loc->filename = runtime_gostring ((const byte *) filename);
- loc->function = runtime_gostring ((const byte *) function);
+
+ /* The libbacktrace library says that these strings might disappear,
+ but with the current implementation they won't. We can't easily
+ allocate memory here, so for now assume that we can save a
+ pointer to the strings. */
+ loc->filename = runtime_gostringnocopy ((const byte *) filename);
+ loc->function = runtime_gostringnocopy ((const byte *) function);
+
loc->lineno = lineno;
++arg->index;
return arg->index >= arg->max;