From 89e6781cc5885cbf6284a51c0403dded62ce8bc0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 12 Nov 2013 12:51:59 +0100 Subject: Make function calls show up in stack traces again Note that adding --show-trace prevents functions calls from being tail-recursive, so an expression that evaluates without --show-trace may fail with a stack overflow if --show-trace is given. --- src/libmain/shared.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/libmain') diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index b71bca682baa..b0b69f7f617d 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -89,9 +89,6 @@ static void setLogType(string lt) } -static bool showTrace = false; - - string getArg(const string & opt, Strings::iterator & i, const Strings::iterator & end) { @@ -214,7 +211,7 @@ static void initAndRun(int argc, char * * argv) else if (arg == "--no-build-hook") settings.useBuildHook = false; else if (arg == "--show-trace") - showTrace = true; + settings.showTrace = true; else if (arg == "--option") { ++i; if (i == args.end()) throw UsageError("`--option' requires two arguments"); string name = *i; @@ -299,8 +296,8 @@ int main(int argc, char * * argv) % e.what() % programId); return 1; } catch (BaseError & e) { - printMsg(lvlError, format("error: %1%%2%") % (showTrace ? e.prefix() : "") % e.msg()); - if (e.prefix() != "" && !showTrace) + printMsg(lvlError, format("error: %1%%2%") % (settings.showTrace ? e.prefix() : "") % e.msg()); + if (e.prefix() != "" && !settings.showTrace) printMsg(lvlError, "(use `--show-trace' to show detailed location information)"); return e.status; } catch (std::bad_alloc & e) { -- cgit 1.4.1