aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-12-31 10:35:39 -0800
committerGraydon Hoare <[email protected]>2010-12-31 10:35:39 -0800
commitc0d4e88428296b8da6f2616f47c760b32abf66ed (patch)
tree1a374f814eec606eef3163b20dd27d08a83ecff9 /src
parentTeach ty.unify about ty_obj. (diff)
downloadrust-c0d4e88428296b8da6f2616f47c760b32abf66ed.tar.xz
rust-c0d4e88428296b8da6f2616f47c760b32abf66ed.zip
Add std.dbg.trap(str msg) for help debugging.
Diffstat (limited to 'src')
-rw-r--r--src/lib/dbg.rs5
-rw-r--r--src/rt/rust_builtin.cpp8
2 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/dbg.rs b/src/lib/dbg.rs
index 51a31e07..774052dc 100644
--- a/src/lib/dbg.rs
+++ b/src/lib/dbg.rs
@@ -18,6 +18,7 @@ native "rust" mod rustrt {
fn debug_obj[T](&T x, uint nmethods, uint nbytes);
fn debug_fn[T](&T x);
fn debug_ptrcast[T, U](@T x) -> @U;
+ fn debug_trap(str msg);
}
fn debug_vec[T](vec[T] v) {
@@ -61,6 +62,10 @@ fn ptr_cast[T, U](@T x) -> @U {
ret rustrt.debug_ptrcast[T, U](x);
}
+fn trap(str s) {
+ rustrt.debug_trap(s);
+}
+
// Local Variables:
// mode: rust;
// fill-column: 78;
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index cb16fbf0..84111d82 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -363,6 +363,14 @@ debug_ptrcast(rust_task *task,
return ptr;
}
+extern "C" CDECL void
+debug_trap(rust_task *task, rust_str *s)
+{
+ task->log(rust_log::STDLIB, "trapping: %s", s->data);
+ // FIXME: x86-ism.
+ __asm__("int3");
+}
+
//
// Local Variables: