aboutsummaryrefslogtreecommitdiff
path: root/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-06-15 10:34:04 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-06-15 10:34:04 -0400
commit60025a37045835c8bbf914eccdbeba6d6e2c275f (patch)
tree38282635e1f5aa5be22cf96e6b8cddbb72e971f4 /std/debug.zig
parentacf16b5fb34e3ce985df16cba1be1455492e4564 (diff)
parent7c5ceb0c4cdf5fafadd92b13048bc9878554abc4 (diff)
downloadzig-60025a37045835c8bbf914eccdbeba6d6e2c275f.tar.gz
zig-60025a37045835c8bbf914eccdbeba6d6e2c275f.zip
Merge remote-tracking branch 'origin/master' into copy-elision-3
Diffstat (limited to 'std/debug.zig')
-rw-r--r--std/debug.zig11
1 files changed, 7 insertions, 4 deletions
diff --git a/std/debug.zig b/std/debug.zig
index 253f250713..ae9a5227c9 100644
--- a/std/debug.zig
+++ b/std/debug.zig
@@ -85,8 +85,8 @@ fn wantTtyColor() bool {
/// TODO multithreaded awareness
pub fn dumpCurrentStackTrace(start_addr: ?usize) void {
const stderr = getStderrStream() catch return;
- if (os.wasi.is_the_target) {
- stderr.print("Unable to dump stack trace: unimplemented on WASI\n") catch return;
+ if (builtin.strip_debug_info) {
+ stderr.print("Unable to dump stack trace: debug info stripped\n") catch return;
return;
}
const debug_info = getSelfDebugInfo() catch |err| {
@@ -151,8 +151,8 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace
/// TODO multithreaded awareness
pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void {
const stderr = getStderrStream() catch return;
- if (os.wasi.is_the_target) {
- stderr.print("Unable to dump stack trace: unimplemented on WASI\n") catch return;
+ if (builtin.strip_debug_info) {
+ stderr.print("Unable to dump stack trace: debug info stripped\n") catch return;
return;
}
const debug_info = getSelfDebugInfo() catch |err| {
@@ -223,6 +223,7 @@ pub fn writeStackTrace(
debug_info: *DebugInfo,
tty_color: bool,
) !void {
+ if (builtin.strip_debug_info) return error.MissingDebugInfo;
var frame_index: usize = 0;
var frames_left: usize = std.math.min(stack_trace.index, stack_trace.instruction_addresses.len);
@@ -783,6 +784,8 @@ pub const OpenSelfDebugInfoError = error{
};
pub fn openSelfDebugInfo(allocator: *mem.Allocator) !DebugInfo {
+ if (builtin.strip_debug_info)
+ return error.MissingDebugInfo;
if (windows.is_the_target) {
return openSelfDebugInfoWindows(allocator);
}