about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/primops.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 3d080dec3fc1..b9ba3da64880 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -296,18 +296,19 @@ static Expr prim_getEnv(EvalState & state, const ATermVector & args)
     return makeStr(getEnv(name));
 }
 
-/* for debugging purposes. print the first arg on stdout (perhaps stderr should be used?)
- * and return the second
+
+/* Evaluate the first expression, and print its abstract syntax tree
+   on standard error.  Then return the second expression.  Useful for
+   debugging.
  */
 static Expr prim_trace(EvalState & state, const ATermVector & args)
 {
-    //string str = evalStringNoCtx(state, args[0]);
-
-    Expr a = evalExpr(state, args[0]);
-    printf("traced value: %s\n", atPrint(a).c_str());
+    Expr e = evalExpr(state, args[0]);
+    printMsg(lvlError, format("trace: %1%") % e);
     return evalExpr(state, args[1]);
 }
 
+
 static Expr prim_relativise(EvalState & state, const ATermVector & args)
 {
     PathSet context; /* !!! what to do? */