about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-09-23 12:26:41 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-09-23 12:26:41 -0700
commit03f0932a6db65859292fb26280dbcb32db392a92 (patch)
tree616f3b8bf5cbbfbd81c586a6e88010abc8844c30
parent9226ac9ec56f1b3ba5320f34b57ebb78aec0bc46 (diff)
downloadrust-03f0932a6db65859292fb26280dbcb32db392a92.tar.gz
rust-03f0932a6db65859292fb26280dbcb32db392a92.zip
rt: ifdef out backtrace() on Windows
-rw-r--r--src/rt/rust_debug.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/rt/rust_debug.cpp b/src/rt/rust_debug.cpp
index 697f9f13bbc..e4aa3b2533c 100644
--- a/src/rt/rust_debug.cpp
+++ b/src/rt/rust_debug.cpp
@@ -23,20 +23,32 @@ debug::flag track_origins("RUST_TRACK_ORIGINS");
 
 namespace debug {
 
+#ifdef HAVE_BACKTRACE
 std::string
 backtrace() {
-    void *call_stack[256];
-    int n_frames = ::backtrace(call_stack, 256);
+    void *call_stack[128];
+    int n_frames = ::backtrace(call_stack, 128);
     char **syms = backtrace_symbols(call_stack, n_frames);
 
+    std::cerr << "n_frames: " << n_frames << std::endl;
+
     std::stringstream ss;
-    for (int i = 0; i < n_frames; i++)
+    for (int i = 0; i < n_frames; i++) {
+        std::cerr << syms[i] << std::endl;
         ss << syms[i] << std::endl;
+    }
 
     free(syms);
 
     return ss.str();
 }
+#else
+std::string
+backtrace() {
+    std::string s;
+    return s;
+}
+#endif
 
 void
 maybe_track_origin(rust_task *task, void *ptr) {