From 5dc5e669864153949899b7a7c37737be65b80ba1 Mon Sep 17 00:00:00 2001 From: obscuren Date: Sat, 4 Apr 2015 22:16:29 +0200 Subject: [PATCH] set backtrace during runtime --- cmd/geth/admin.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/geth/admin.go b/cmd/geth/admin.go index 639d5283ee..f2887c6db3 100644 --- a/cmd/geth/admin.go +++ b/cmd/geth/admin.go @@ -36,6 +36,18 @@ func (js *jsre) adminBindings() { admin.Set("export", js.exportChain) admin.Set("dumpBlock", js.dumpBlock) admin.Set("verbosity", js.verbosity) + admin.Set("backtrace", js.backtrace) +} + +func (js *jsre) backtrace(call otto.FunctionCall) otto.Value { + tracestr, err := call.Argument(0).ToString() + if err != nil { + fmt.Println(err) + return otto.UndefinedValue() + } + glog.GetTraceLocation().Set(tracestr) + + return otto.UndefinedValue() } func (js *jsre) verbosity(call otto.FunctionCall) otto.Value {