about summary refs log tree commit diff
path: root/src/rt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-03-16 14:27:44 -0700
committerbors <bors@rust-lang.org>2013-03-16 14:27:44 -0700
commitb53da4b9dd977fdffba3f10e570d7c025238dec3 (patch)
treeffba2f796ce9bb6e36c1d083553db7bc9638f0be /src/rt
parentebba8b4e3591c95508a4c1121784e768272a574a (diff)
parent63d18658c1d19bdcc4cad91ce808a9590b53f3d2 (diff)
downloadrust-b53da4b9dd977fdffba3f10e570d7c025238dec3.tar.gz
rust-b53da4b9dd977fdffba3f10e570d7c025238dec3.zip
auto merge of #5342 : brson/rust/debug-mem, r=brson
Fixes #5341
Diffstat (limited to 'src/rt')
-rw-r--r--src/rt/rust_builtin.cpp5
-rw-r--r--src/rt/rust_env.cpp2
-rw-r--r--src/rt/rust_env.h8
-rw-r--r--src/rt/rustrt.def.in1
4 files changed, 14 insertions, 2 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index ccb2c0c5c1c..a2053c115bb 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -876,6 +876,11 @@ rust_dbg_extern_identity_u8(char u) {
     return u;
 }
 
+extern "C" rust_env*
+rust_get_rt_env() {
+    rust_task *task = rust_get_current_task();
+    return task->kernel->env;
+}
 
 //
 // Local Variables:
diff --git a/src/rt/rust_env.cpp b/src/rt/rust_env.cpp
index b2df5f03b23..cade5f1ed2c 100644
--- a/src/rt/rust_env.cpp
+++ b/src/rt/rust_env.cpp
@@ -23,6 +23,7 @@
 #define DETAILED_LEAKS "DETAILED_LEAKS"
 #define RUST_SEED "RUST_SEED"
 #define RUST_POISON_ON_FREE "RUST_POISON_ON_FREE"
+#define RUST_DEBUG_MEM "RUST_DEBUG_MEM"
 
 #if defined(__WIN32__)
 static int
@@ -128,6 +129,7 @@ load_env(int argc, char **argv) {
     env->poison_on_free = getenv(RUST_POISON_ON_FREE) != NULL;
     env->argc = argc;
     env->argv = argv;
+    env->debug_mem = getenv(RUST_DEBUG_MEM) != NULL;
     return env;
 }
 
diff --git a/src/rt/rust_env.h b/src/rt/rust_env.h
index c2aba575c44..df27f7674f2 100644
--- a/src/rt/rust_env.h
+++ b/src/rt/rust_env.h
@@ -14,16 +14,20 @@
 
 #include "rust_globals.h"
 
+// Avoiding 'bool' type here since I'm not sure it has a standard size
+typedef uint8_t rust_bool;
+
 struct rust_env {
     size_t num_sched_threads;
     size_t min_stack_size;
     size_t max_stack_size;
     char* logspec;
-    bool detailed_leaks;
+    rust_bool detailed_leaks;
     char* rust_seed;
-    bool poison_on_free;
+    rust_bool poison_on_free;
     int argc;
     char **argv;
+    rust_bool debug_mem;
 };
 
 rust_env* load_env(int argc, char **argv);
diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in
index 7fb6334ca75..5a8868f33f9 100644
--- a/src/rt/rustrt.def.in
+++ b/src/rt/rustrt.def.in
@@ -201,3 +201,4 @@ rust_dbg_extern_identity_u64
 rust_dbg_extern_identity_TwoU64s
 rust_dbg_extern_identity_double
 rust_dbg_extern_identity_u8
+rust_get_rt_env