about summary refs log tree commit diff
path: root/src/libmain
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-12T11·51+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-12T11·51+0100
commit89e6781cc5885cbf6284a51c0403dded62ce8bc0 (patch)
tree8ce64784036d7db386aa929dc27c0445ff63c49f /src/libmain
parent2bcb384e95500ff197fd4888c659ccf0034cf214 (diff)
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.
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc9
1 files changed, 3 insertions, 6 deletions
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) {