diff options
| author | bors <bors@rust-lang.org> | 2013-08-02 01:13:51 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-02 01:13:51 -0700 |
| commit | dbde42e59e6854979085f3b8a949f307b4da8ffa (patch) | |
| tree | 46c2cf29dcfe88caaf3460593156be4cf0cd6bff /src | |
| parent | bbcce8d95c582d3f918fe4e978d6a715efd991e9 (diff) | |
| parent | 05eff5f731fbdf0597bb6a4b94a7603571ff66b6 (diff) | |
| download | rust-dbde42e59e6854979085f3b8a949f307b4da8ffa.tar.gz rust-dbde42e59e6854979085f3b8a949f307b4da8ffa.zip | |
auto merge of #8175 : brson/rust/nodbg, r=graydon
This stuff is ancient, unused, and tied to oldsched
Diffstat (limited to 'src')
| -rw-r--r-- | src/libextra/dbg.rs | 80 | ||||
| -rw-r--r-- | src/libextra/extra.rs | 1 | ||||
| -rw-r--r-- | src/libstd/unstable/lang.rs | 2 | ||||
| -rw-r--r-- | src/rt/rust_builtin.cpp | 92 | ||||
| -rw-r--r-- | src/rt/rust_debug.h | 13 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 7 |
6 files changed, 0 insertions, 195 deletions
diff --git a/src/libextra/dbg.rs b/src/libextra/dbg.rs deleted file mode 100644 index 2c25ee9da78..00000000000 --- a/src/libextra/dbg.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Unsafe debugging functions for inspecting values. - -#[allow(missing_doc)]; - -use std::cast::transmute; -use std::unstable::intrinsics::{get_tydesc}; - -pub mod rustrt { - use std::unstable::intrinsics::{TyDesc}; - - #[abi = "cdecl"] - extern { - pub unsafe fn debug_tydesc(td: *TyDesc); - pub unsafe fn debug_opaque(td: *TyDesc, x: *()); - pub unsafe fn debug_box(td: *TyDesc, x: *()); - pub unsafe fn debug_tag(td: *TyDesc, x: *()); - pub unsafe fn debug_fn(td: *TyDesc, x: *()); - pub unsafe fn debug_ptrcast(td: *TyDesc, x: *()) -> *(); - pub unsafe fn rust_dbg_breakpoint(); - } -} - -pub fn debug_tydesc<T>() { - unsafe { - rustrt::debug_tydesc(get_tydesc::<T>()); - } -} - -pub fn debug_opaque<T>(x: T) { - unsafe { - rustrt::debug_opaque(get_tydesc::<T>(), transmute(&x)); - } -} - -pub fn debug_box<T>(x: @T) { - unsafe { - rustrt::debug_box(get_tydesc::<T>(), transmute(&x)); - } -} - -pub fn debug_tag<T>(x: T) { - unsafe { - rustrt::debug_tag(get_tydesc::<T>(), transmute(&x)); - } -} - -pub fn debug_fn<T>(x: T) { - unsafe { - rustrt::debug_fn(get_tydesc::<T>(), transmute(&x)); - } -} - -pub unsafe fn ptr_cast<T, U>(x: @T) -> @U { - transmute( - rustrt::debug_ptrcast(get_tydesc::<T>(), transmute(x))) -} - -/// Triggers a debugger breakpoint -pub fn breakpoint() { - unsafe { - rustrt::rust_dbg_breakpoint(); - } -} - -#[test] -fn test_breakpoint_should_not_abort_process_when_not_under_gdb() { - // Triggering a breakpoint involves raising SIGTRAP, which terminates - // the process under normal circumstances - breakpoint(); -} diff --git a/src/libextra/extra.rs b/src/libextra/extra.rs index f4fb7bcd76c..80dee18f89b 100644 --- a/src/libextra/extra.rs +++ b/src/libextra/extra.rs @@ -78,7 +78,6 @@ pub mod sha2; pub mod url; pub mod ebml; -pub mod dbg; pub mod getopts; pub mod json; pub mod md4; diff --git a/src/libstd/unstable/lang.rs b/src/libstd/unstable/lang.rs index 74604b4ea17..9bbc578d194 100644 --- a/src/libstd/unstable/lang.rs +++ b/src/libstd/unstable/lang.rs @@ -41,8 +41,6 @@ pub mod rustrt { #[rust_stack] pub fn rust_try_get_task() -> *rust_task; - - pub fn rust_dbg_breakpoint(); } } diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index e6517b3639a..d77a9f58a38 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -150,93 +150,6 @@ debug_static_mut_check_four() { assert(debug_static_mut == 4); } -/* Debug builtins for std::dbg. */ - -static void -debug_tydesc_helper(type_desc *t) -{ - rust_task *task = rust_get_current_task(); - LOG(task, stdlib, " size %" PRIdPTR ", align %" PRIdPTR, - t->size, t->align); -} - -extern "C" CDECL void -debug_tydesc(type_desc *t) { - rust_task *task = rust_get_current_task(); - LOG(task, stdlib, "debug_tydesc"); - debug_tydesc_helper(t); -} - -extern "C" CDECL void -debug_opaque(type_desc *t, uint8_t *front) { - rust_task *task = rust_get_current_task(); - LOG(task, stdlib, "debug_opaque"); - debug_tydesc_helper(t); - // Account for alignment. `front` may not indeed be the - // front byte of the passed-in argument - if (((uintptr_t)front % t->align) != 0) { - front = (uint8_t *)align_to((uintptr_t)front, (size_t)t->align); - } - for (uintptr_t i = 0; i < t->size; ++front, ++i) { - LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, *front); - } -} - -extern "C" CDECL void -debug_box(type_desc *t, rust_opaque_box *box) { - rust_task *task = rust_get_current_task(); - LOG(task, stdlib, "debug_box(0x%" PRIxPTR ")", box); - debug_tydesc_helper(t); - LOG(task, stdlib, " refcount %" PRIdPTR, - box->ref_count - 1); // -1 because we ref'ed for this call - uint8_t *data = (uint8_t *)box_body(box); - for (uintptr_t i = 0; i < t->size; ++i) { - LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, data[i]); - } -} - -struct rust_tag { - uintptr_t discriminant; - uint8_t variant[]; -}; - -extern "C" CDECL void -debug_tag(type_desc *t, rust_tag *tag) { - rust_task *task = rust_get_current_task(); - - LOG(task, stdlib, "debug_tag"); - debug_tydesc_helper(t); - LOG(task, stdlib, " discriminant %" PRIdPTR, tag->discriminant); - - for (uintptr_t i = 0; i < t->size - sizeof(tag->discriminant); ++i) - LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, - tag->variant[i]); -} - -extern "C" CDECL void -debug_fn(type_desc *t, fn_env_pair *fn) { - rust_task *task = rust_get_current_task(); - LOG(task, stdlib, "debug_fn"); - debug_tydesc_helper(t); - LOG(task, stdlib, " fn at 0x%" PRIxPTR, fn->f); - LOG(task, stdlib, " env at 0x%" PRIxPTR, fn->env); - if (fn->env) { - LOG(task, stdlib, " refcount %" PRIdPTR, fn->env->ref_count); - } -} - -extern "C" CDECL void * -debug_ptrcast(type_desc *from_ty, - type_desc *to_ty, - void *ptr) { - rust_task *task = rust_get_current_task(); - LOG(task, stdlib, "debug_ptrcast from"); - debug_tydesc_helper(from_ty); - LOG(task, stdlib, "to"); - debug_tydesc_helper(to_ty); - return ptr; -} - extern "C" CDECL void * debug_get_stk_seg() { rust_task *task = rust_get_current_task(); @@ -583,11 +496,6 @@ rust_should_log_console() { return (uintptr_t)should_log_console(); } -extern "C" CDECL void -rust_dbg_breakpoint() { - BREAKPOINT_AWESOME; -} - extern "C" CDECL rust_sched_id rust_osmain_sched_id() { rust_task *task = rust_get_current_task(); diff --git a/src/rt/rust_debug.h b/src/rt/rust_debug.h index 7f025bb908e..951d2c36cb8 100644 --- a/src/rt/rust_debug.h +++ b/src/rt/rust_debug.h @@ -17,19 +17,6 @@ #include <string> #include <cstdlib> -#ifndef _WIN32 - -#include <signal.h> -#define BREAKPOINT_AWESOME \ - do { \ - signal(SIGTRAP, SIG_IGN); \ - raise(SIGTRAP); \ - } while (0) - -#else -#define BREAKPOINT_AWESOME -#endif - struct rust_task; namespace debug { diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index 7b438849751..75e02d0a103 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -1,9 +1,3 @@ -debug_box -debug_fn -debug_opaque -debug_ptrcast -debug_tag -debug_tydesc debug_get_stk_seg debug_abi_1 debug_abi_2 @@ -178,7 +172,6 @@ rust_dbg_lock_wait rust_dbg_lock_signal rust_dbg_call rust_dbg_do_nothing -rust_dbg_breakpoint rust_osmain_sched_id rust_task_inhibit_kill rust_task_allow_kill |
