debuginfo: Add a rust-gdb shell script that will start GDB with Rust pretty printers enabled.

This commit is contained in:
Michael Woerister 2014-12-03 14:48:18 -08:00
parent d2368c3c11
commit 91a0e18866
101 changed files with 396 additions and 71 deletions

View File

@ -64,6 +64,7 @@ clean-generic-$(2)-$(1):
-name '*.dll' -o \ -name '*.dll' -o \
-name '*.def' -o \ -name '*.def' -o \
-name '*.py' -o \ -name '*.py' -o \
-name '*.pyc' -o \
-name '*.bc' \ -name '*.bc' \
\) \ \) \
| xargs rm -f | xargs rm -f
@ -79,7 +80,7 @@ define CLEAN_HOST_STAGE_N
clean$(1)_H_$(2): \ clean$(1)_H_$(2): \
$$(foreach crate,$$(CRATES),clean$(1)_H_$(2)-lib-$$(crate)) \ $$(foreach crate,$$(CRATES),clean$(1)_H_$(2)-lib-$$(crate)) \
$$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS),clean$(1)_H_$(2)-tool-$$(tool)) $$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_H_$(2)-tool-$$(tool))
$$(Q)rm -fr $(2)/rt/libbacktrace $$(Q)rm -fr $(2)/rt/libbacktrace
clean$(1)_H_$(2)-tool-%: clean$(1)_H_$(2)-tool-%:
@ -99,7 +100,7 @@ define CLEAN_TARGET_STAGE_N
clean$(1)_T_$(2)_H_$(3): \ clean$(1)_T_$(2)_H_$(3): \
$$(foreach crate,$$(CRATES),clean$(1)_T_$(2)_H_$(3)-lib-$$(crate)) \ $$(foreach crate,$$(CRATES),clean$(1)_T_$(2)_H_$(3)-lib-$$(crate)) \
$$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool)) $$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool))
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a $$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a $$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix

View File

@ -12,26 +12,77 @@
# Copy debugger related scripts # Copy debugger related scripts
###################################################################### ######################################################################
DEBUGGER_RUSTLIB_ETC_SCRIPTS=lldb_rust_formatters.py
DEBUGGER_BIN_SCRIPTS=rust-lldb
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS=$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS), \ ## GDB ##
$(CFG_SRC_DIR)src/etc/$(script)) DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB=gdb_load_rust_pretty_printers.py \
DEBUGGER_BIN_SCRIPTS_ABS=$(foreach script,$(DEBUGGER_BIN_SCRIPTS), \ gdb_rust_pretty_printing.py
$(CFG_SRC_DIR)src/etc/$(script)) DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS=\
$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB), \
$(CFG_SRC_DIR)src/etc/$(script))
DEBUGGER_BIN_SCRIPTS_GDB=rust-gdb
DEBUGGER_BIN_SCRIPTS_GDB_ABS=\
$(foreach script,$(DEBUGGER_BIN_SCRIPTS_GDB), \
$(CFG_SRC_DIR)src/etc/$(script))
## LLDB ##
DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB=lldb_rust_formatters.py
DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS=\
$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB), \
$(CFG_SRC_DIR)src/etc/$(script))
DEBUGGER_BIN_SCRIPTS_LLDB=rust-lldb
DEBUGGER_BIN_SCRIPTS_LLDB_ABS=\
$(foreach script,$(DEBUGGER_BIN_SCRIPTS_LLDB), \
$(CFG_SRC_DIR)src/etc/$(script))
## ALL ##
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL=$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB) \
$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB)
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS=$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS)
DEBUGGER_BIN_SCRIPTS_ALL=$(DEBUGGER_BIN_SCRIPTS_GDB) \
$(DEBUGGER_BIN_SCRIPTS_LLDB)
DEBUGGER_BIN_SCRIPTS_ALL_ABS=$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) \
$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
DEBUGGER_SCRIPTS_ALL=$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $(DEBUGGER_BIN_SCRIPTS_ABS)
# $(1) - the stage to copy to # $(1) - the stage to copy to
# $(2) - the host triple # $(2) - the host triple
define DEF_INSTALL_DEBUGGER_SCRIPTS_HOST define DEF_INSTALL_DEBUGGER_SCRIPTS_HOST
tmp/install-debugger-scripts$(1)_H_$(2).done: $$(DEBUGGER_SCRIPTS_ALL) tmp/install-debugger-scripts$(1)_H_$(2)-gdb.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
$(Q)mkdir -p $$(HBIN$(1)_H_$(2)) $(Q)mkdir -p $$(HBIN$(1)_H_$(2))
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc $(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
$(Q)install $(DEBUGGER_BIN_SCRIPTS_ABS) $$(HBIN$(1)_H_$(2)) $(Q)install $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(HBIN$(1)_H_$(2))
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc $(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
$(Q)touch $$@ $(Q)touch $$@
tmp/install-debugger-scripts$(1)_H_$(2)-lldb.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
$(Q)install $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(HBIN$(1)_H_$(2))
$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
$(Q)touch $$@
tmp/install-debugger-scripts$(1)_H_$(2)-all.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
$(Q)install $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(HBIN$(1)_H_$(2))
$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
$(Q)touch $$@
tmp/install-debugger-scripts$(1)_H_$(2)-none.done:
$(Q)touch $$@
endef endef
# Expand host make-targets for all stages # Expand host make-targets for all stages
@ -44,12 +95,36 @@ $(foreach stage,$(STAGES), \
# $(3) is the host triple # $(3) is the host triple
define DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET define DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3).done: $$(DEBUGGER_SCRIPTS_ALL) tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-gdb.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3)) $(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc $(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
$(Q)install $(DEBUGGER_BIN_SCRIPTS_ABS) $$(TBIN$(1)_T_$(2)_H_$(3)) $(Q)install $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc $(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
$(Q)touch $$@ $(Q)touch $$@
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-lldb.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
$(Q)install $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
$(Q)touch $$@
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-all.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
$(Q)install $(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
$(Q)touch $$@
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-none.done:
$(Q)touch $$@
endef endef
# Expand target make-targets for all stages # Expand target make-targets for all stages

View File

@ -325,6 +325,12 @@ export CFG_DISABLE_INJECT_STD_VERSION
# Per-stage targets and runner # Per-stage targets and runner
###################################################################### ######################################################################
# Valid setting-strings are 'all', 'none', 'gdb', 'lldb'
# This 'function' will determine which debugger scripts to copy based on a
# target triple. See debuggers.mk for more information.
TRIPLE_TO_DEBUGGER_SCRIPT_SETTING=\
$(if $(findstring windows,$(1)),none,$(if $(findstring darwin,$(1)),lldb,gdb))
STAGES = 0 1 2 3 STAGES = 0 1 2 3
define SREQ define SREQ
@ -357,7 +363,7 @@ else
HSREQ$(1)_H_$(3) = \ HSREQ$(1)_H_$(3) = \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
$$(MKFILE_DEPS) \ $$(MKFILE_DEPS) \
tmp/install-debugger-scripts$(1)_H_$(3).done tmp/install-debugger-scripts$(1)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(3)).done
endif endif
# Prerequisites for using the stageN compiler to build target artifacts # Prerequisites for using the stageN compiler to build target artifacts
@ -372,7 +378,7 @@ SREQ$(1)_T_$(2)_H_$(3) = \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \ $$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(foreach dep,$$(TARGET_CRATES), \ $$(foreach dep,$$(TARGET_CRATES), \
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3).done tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(2)).done
# Prerequisites for a working stageN compiler and complete set of target # Prerequisites for a working stageN compiler and complete set of target
# libraries # libraries

View File

@ -144,6 +144,27 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
$$(call PREPARE_LIB,libcompiler-rt.a),),),) $$(call PREPARE_LIB,libcompiler-rt.a),),),)
endef endef
define INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS
$(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $(PREPARE_DEST_BIN_DIR)
$(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc
endef
define INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS
$(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_BIN_DIR)
$(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc
endef
define INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS
$(Q)echo "No debugger scripts will be installed for host $(PREPARE_HOST)"
endef
# $(1) is PREPARE_HOST
INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\
$(INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS),\
$(if $(findstring darwin,$(1)),\
$(INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS),\
$(INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS)))
define DEF_PREPARE define DEF_PREPARE
prepare-base-$(1): PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE) prepare-base-$(1): PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE)
@ -170,9 +191,10 @@ prepare-host-dirs-$(1): prepare-maybe-clean-$(1)
$$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR)/rustlib/etc) $$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR)/rustlib/etc)
$$(call PREPARE_DIR,$$(PREPARE_DEST_MAN_DIR)) $$(call PREPARE_DIR,$$(PREPARE_DEST_MAN_DIR))
prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) $(DEBUGGER_SCRIPTS_ALL) prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) \
$$(Q)$$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_ABS) $$(PREPARE_DEST_BIN_DIR) $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) \
$$(Q)$$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(PREPARE_DEST_LIB_DIR)/rustlib/etc $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS)
$$(call INSTALL_DEBUGGER_SCRIPT_COMMANDS,$$(PREPARE_HOST))
$$(foreach tool,$$(PREPARE_TOOLS), \ $$(foreach tool,$$(PREPARE_TOOLS), \
$$(foreach host,$$(CFG_HOST), \ $$(foreach host,$$(CFG_HOST), \

View File

@ -367,7 +367,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
let DebuggerCommands { let DebuggerCommands {
commands, commands,
check_lines, check_lines,
use_gdb_pretty_printer,
breakpoint_lines breakpoint_lines
} = parse_debugger_commands(testfile, "gdb"); } = parse_debugger_commands(testfile, "gdb");
let mut cmds = commands.connect("\n"); let mut cmds = commands.connect("\n");
@ -521,16 +520,11 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
if header::gdb_version_to_int(version.as_slice()) > if header::gdb_version_to_int(version.as_slice()) >
header::gdb_version_to_int("7.4") { header::gdb_version_to_int("7.4") {
// Add the directory containing the pretty printers to // Add the directory containing the pretty printers to
// GDB's script auto loading safe path ... // GDB's script auto loading safe path
script_str.push_str( script_str.push_str(
format!("add-auto-load-safe-path {}\n", format!("add-auto-load-safe-path {}\n",
rust_pp_module_abs_path.replace("\\", "\\\\").as_slice()) rust_pp_module_abs_path.replace("\\", "\\\\").as_slice())
.as_slice()); .as_slice());
// ... and also the test directory
script_str.push_str(
format!("add-auto-load-safe-path {}\n",
config.build_base.as_str().unwrap().replace("\\", "\\\\"))
.as_slice());
} }
} }
_ => { _ => {
@ -543,6 +537,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
// pretty printing, it just tells GDB to print values on one line: // pretty printing, it just tells GDB to print values on one line:
script_str.push_str("set print pretty off\n"); script_str.push_str("set print pretty off\n");
// Add the pretty printer directory to GDB's source-file search path
script_str.push_str(format!("directory {}\n", rust_pp_module_abs_path)[]);
// Load the target executable // Load the target executable
script_str.push_str(format!("file {}\n", script_str.push_str(format!("file {}\n",
exe_file.as_str().unwrap().replace("\\", "\\\\")) exe_file.as_str().unwrap().replace("\\", "\\\\"))
@ -564,12 +561,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
script_str.as_slice(), script_str.as_slice(),
"debugger.script"); "debugger.script");
if use_gdb_pretty_printer {
// Only emit the gdb auto-loading script if pretty printers
// should actually be loaded
dump_gdb_autoload_script(config, testfile);
}
// run debugger script with gdb // run debugger script with gdb
#[cfg(windows)] #[cfg(windows)]
fn debugger() -> String { fn debugger() -> String {
@ -611,19 +602,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
} }
check_debugger_output(&debugger_run_result, check_lines.as_slice()); check_debugger_output(&debugger_run_result, check_lines.as_slice());
fn dump_gdb_autoload_script(config: &Config, testfile: &Path) {
let mut script_path = output_base_name(config, testfile);
let mut script_file_name = script_path.filename().unwrap().to_vec();
script_file_name.push_all("-gdb.py".as_bytes());
script_path.set_filename(script_file_name.as_slice());
let script_content = "import gdb_rust_pretty_printing\n\
gdb_rust_pretty_printing.register_printers(gdb.current_objfile())\n"
.as_bytes();
File::create(&script_path).write(script_content).unwrap();
}
} }
fn find_rust_src_root(config: &Config) -> Option<Path> { fn find_rust_src_root(config: &Config) -> Option<Path> {
@ -781,7 +759,6 @@ struct DebuggerCommands {
commands: Vec<String>, commands: Vec<String>,
check_lines: Vec<String>, check_lines: Vec<String>,
breakpoint_lines: Vec<uint>, breakpoint_lines: Vec<uint>,
use_gdb_pretty_printer: bool
} }
fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
@ -794,7 +771,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
let mut breakpoint_lines = vec!(); let mut breakpoint_lines = vec!();
let mut commands = vec!(); let mut commands = vec!();
let mut check_lines = vec!(); let mut check_lines = vec!();
let mut use_gdb_pretty_printer = false;
let mut counter = 1; let mut counter = 1;
let mut reader = BufferedReader::new(File::open(file_path).unwrap()); let mut reader = BufferedReader::new(File::open(file_path).unwrap());
for line in reader.lines() { for line in reader.lines() {
@ -804,10 +780,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
breakpoint_lines.push(counter); breakpoint_lines.push(counter);
} }
if line.as_slice().contains("gdb-use-pretty-printer") {
use_gdb_pretty_printer = true;
}
header::parse_name_value_directive( header::parse_name_value_directive(
line.as_slice(), line.as_slice(),
command_directive.as_slice()).map(|cmd| { command_directive.as_slice()).map(|cmd| {
@ -832,7 +804,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
commands: commands, commands: commands,
check_lines: check_lines, check_lines: check_lines,
breakpoint_lines: breakpoint_lines, breakpoint_lines: breakpoint_lines,
use_gdb_pretty_printer: use_gdb_pretty_printer,
} }
} }

View File

@ -0,0 +1,12 @@
# Copyright 2014 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.
import gdb_rust_pretty_printing
gdb_rust_pretty_printing.register_printers(gdb.current_objfile())

23
src/etc/rust-gdb Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# Copyright 2014 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.
# Exit if anything fails
set -e
# Find out where the pretty printer Python module is
RUSTC_SYSROOT=`rustc --print=sysroot`
GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
# Run GDB with the additional arguments that load the pretty printers
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" gdb \
-d "$GDB_PYTHON_MODULE_DIRECTORY" \
-iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
"$@"

View File

@ -654,6 +654,7 @@ impl LintPass for UnusedAttributes {
"static_assert", "static_assert",
"thread_local", "thread_local",
"no_debug", "no_debug",
"omit_gdb_pretty_printer_section",
"unsafe_no_drop_flag", "unsafe_no_drop_flag",
// used in resolve // used in resolve

View File

@ -1743,7 +1743,8 @@ extern {
isOptimized: bool, isOptimized: bool,
Flags: *const c_char, Flags: *const c_char,
RuntimeVer: c_uint, RuntimeVer: c_uint,
SplitName: *const c_char); SplitName: *const c_char)
-> DIDescriptor;
pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef, pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
Filename: *const c_char, Filename: *const c_char,

View File

@ -2673,6 +2673,8 @@ pub fn create_entry_wrapper(ccx: &CrateContext,
unsafe { unsafe {
llvm::LLVMPositionBuilderAtEnd(bld, llbb); llvm::LLVMPositionBuilderAtEnd(bld, llbb);
debuginfo::insert_reference_to_gdb_debug_scripts_section_global(ccx);
let (start_fn, args) = if use_start_lang_item { let (start_fn, args) = if use_start_lang_item {
let start_def_id = match ccx.tcx().lang_items.require(StartFnLangItem) { let start_def_id = match ccx.tcx().lang_items.require(StartFnLangItem) {
Ok(id) => id, Ok(id) => id,

View File

@ -212,7 +212,7 @@ use std::ptr;
use std::rc::{Rc, Weak}; use std::rc::{Rc, Weak};
use syntax::util::interner::Interner; use syntax::util::interner::Interner;
use syntax::codemap::{Span, Pos}; use syntax::codemap::{Span, Pos};
use syntax::{ast, codemap, ast_util, ast_map}; use syntax::{ast, codemap, ast_util, ast_map, attr};
use syntax::ast_util::PostExpansionMethod; use syntax::ast_util::PostExpansionMethod;
use syntax::parse::token::{mod, special_idents}; use syntax::parse::token::{mod, special_idents};
@ -740,7 +740,16 @@ pub fn finalize(cx: &CrateContext) {
} }
debug!("finalize"); debug!("finalize");
compile_unit_metadata(cx); let _ = compile_unit_metadata(cx);
if needs_gdb_debug_scripts_section(cx) {
// Add a .debug_gdb_scripts section to this compile-unit. This will
// cause GDB to try and load the gdb_load_rust_pretty_printers.py file,
// which activates the Rust pretty printers for binary this section is
// contained in.
get_or_insert_gdb_debug_scripts_section_global(cx);
}
unsafe { unsafe {
llvm::LLVMDIBuilderFinalize(DIB(cx)); llvm::LLVMDIBuilderFinalize(DIB(cx));
llvm::LLVMDIBuilderDispose(DIB(cx)); llvm::LLVMDIBuilderDispose(DIB(cx));
@ -1579,7 +1588,7 @@ fn create_DIArray(builder: DIBuilderRef, arr: &[DIDescriptor]) -> DIArray {
}; };
} }
fn compile_unit_metadata(cx: &CrateContext) { fn compile_unit_metadata(cx: &CrateContext) -> DIDescriptor {
let work_dir = &cx.sess().working_dir; let work_dir = &cx.sess().working_dir;
let compile_unit_name = match cx.sess().local_crate_source_file { let compile_unit_name = match cx.sess().local_crate_source_file {
None => fallback_path(cx), None => fallback_path(cx),
@ -1614,7 +1623,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
(option_env!("CFG_VERSION")).expect("CFG_VERSION")); (option_env!("CFG_VERSION")).expect("CFG_VERSION"));
let compile_unit_name = compile_unit_name.as_ptr(); let compile_unit_name = compile_unit_name.as_ptr();
work_dir.as_vec().with_c_str(|work_dir| { return work_dir.as_vec().with_c_str(|work_dir| {
producer.with_c_str(|producer| { producer.with_c_str(|producer| {
"".with_c_str(|flags| { "".with_c_str(|flags| {
"".with_c_str(|split_name| { "".with_c_str(|split_name| {
@ -1628,7 +1637,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
cx.sess().opts.optimize != config::No, cx.sess().opts.optimize != config::No,
flags, flags,
0, 0,
split_name); split_name)
} }
}) })
}) })
@ -4103,3 +4112,76 @@ fn namespace_for_item(cx: &CrateContext, def_id: ast::DefId) -> Rc<NamespaceTree
} }
}) })
} }
//=-----------------------------------------------------------------------------
// .debug_gdb_scripts binary section
//=-----------------------------------------------------------------------------
/// Inserts a side-effect free instruction sequence that makes sure that the
/// .debug_gdb_scripts global is referenced, so it isn't removed by the linker.
pub fn insert_reference_to_gdb_debug_scripts_section_global(ccx: &CrateContext) {
if needs_gdb_debug_scripts_section(ccx) {
let empty = b"".to_c_str();
let gdb_debug_scripts_section_global =
get_or_insert_gdb_debug_scripts_section_global(ccx);
unsafe {
let volative_load_instruction =
llvm::LLVMBuildLoad(ccx.raw_builder(),
gdb_debug_scripts_section_global,
empty.as_ptr());
llvm::LLVMSetVolatile(volative_load_instruction, llvm::True);
}
}
}
/// Allocates the global variable responsible for the .debug_gdb_scripts binary
/// section.
fn get_or_insert_gdb_debug_scripts_section_global(ccx: &CrateContext)
-> llvm::ValueRef {
let section_var_name = b"__rustc_debug_gdb_scripts_section__".to_c_str();
let section_var = unsafe {
llvm::LLVMGetNamedGlobal(ccx.llmod(), section_var_name.as_ptr())
};
if section_var == ptr::null_mut() {
let section_name = b".debug_gdb_scripts".to_c_str();
let section_contents = b"\x01gdb_load_rust_pretty_printers.py\0";
unsafe {
let llvm_type = Type::array(&Type::i8(ccx),
section_contents.len() as u64);
let section_var = llvm::LLVMAddGlobal(ccx.llmod(),
llvm_type.to_ref(),
section_var_name.as_ptr());
llvm::LLVMSetSection(section_var, section_name.as_ptr());
llvm::LLVMSetInitializer(section_var, C_bytes(ccx, section_contents));
llvm::LLVMSetGlobalConstant(section_var, llvm::True);
llvm::LLVMSetUnnamedAddr(section_var, llvm::True);
llvm::SetLinkage(section_var, llvm::Linkage::LinkOnceODRLinkage);
// This should make sure that the whole section is not larger than
// the string it contains. Otherwise we get a warning from GDB.
llvm::LLVMSetAlignment(section_var, 1);
section_var
}
} else {
section_var
}
}
fn needs_gdb_debug_scripts_section(ccx: &CrateContext) -> bool {
let omit_gdb_pretty_printer_section =
attr::contains_name(ccx.tcx()
.map
.krate()
.attrs
.as_slice(),
"omit_gdb_pretty_printer_section");
!omit_gdb_pretty_printer_section &&
!ccx.sess().target.target.options.is_like_osx &&
!ccx.sess().target.target.options.is_like_windows &&
ccx.sess().opts.debuginfo != NoDebugInfo
}

View File

@ -257,7 +257,7 @@ extern "C" void LLVMDIBuilderFinalize(DIBuilderRef Builder) {
Builder->finalize(); Builder->finalize();
} }
extern "C" void LLVMDIBuilderCreateCompileUnit( extern "C" LLVMValueRef LLVMDIBuilderCreateCompileUnit(
DIBuilderRef Builder, DIBuilderRef Builder,
unsigned Lang, unsigned Lang,
const char* File, const char* File,
@ -267,8 +267,14 @@ extern "C" void LLVMDIBuilderCreateCompileUnit(
const char* Flags, const char* Flags,
unsigned RuntimeVer, unsigned RuntimeVer,
const char* SplitName) { const char* SplitName) {
Builder->createCompileUnit(Lang, File, Dir, Producer, isOptimized, return wrap(Builder->createCompileUnit(Lang,
Flags, RuntimeVer, SplitName); File,
Dir,
Producer,
isOptimized,
Flags,
RuntimeVer,
SplitName));
} }
extern "C" LLVMValueRef LLVMDIBuilderCreateFile( extern "C" LLVMValueRef LLVMDIBuilderCreateFile(

View File

@ -45,6 +45,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(dead_code)] #![allow(dead_code)]
#![omit_gdb_pretty_printer_section]
static B: bool = false; static B: bool = false;

View File

@ -50,6 +50,7 @@
// gdb-command:continue // gdb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
static B: bool = false; static B: bool = false;
static I: int = -1; static I: int = -1;

View File

@ -48,6 +48,7 @@
// gdb-command:continue // gdb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let unit: () = (); let unit: () = ();

View File

@ -83,6 +83,7 @@
// gdb-check:$28 = 9.25 // gdb-check:$28 = 9.25
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
static mut B: bool = false; static mut B: bool = false;
static mut I: int = -1; static mut I: int = -1;

View File

@ -88,6 +88,7 @@
// lldb-check:[...]$12 = 3.5 // lldb-check:[...]$12 = 3.5
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let b: bool = false; let b: bool = false;

View File

@ -109,6 +109,7 @@
// lldb-check:[...]$12 = 3.5 // lldb-check:[...]$12 = 3.5
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let bool_val: bool = true; let bool_val: bool = true;

View File

@ -41,6 +41,7 @@
// lldb-check:[...]$2 = TheC // lldb-check:[...]$2 = TheC
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
enum ABC { TheA, TheB, TheC } enum ABC { TheA, TheB, TheC }

View File

@ -40,6 +40,7 @@
// lldb-check:[...]$2 = TheOnlyCase(4820353753753434) // lldb-check:[...]$2 = TheOnlyCase(4820353753753434)
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
// The first element is to ensure proper alignment, irrespective of the machines word size. Since // The first element is to ensure proper alignment, irrespective of the machines word size. Since
// the size of the discriminant value is machine dependent, this has be taken into account when // the size of the discriminant value is machine dependent, this has be taken into account when

View File

@ -64,6 +64,7 @@
// lldb-check:[...]$6 = 26.5 // lldb-check:[...]$6 = 26.5
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct SomeStruct { struct SomeStruct {
x: int, x: int,

View File

@ -42,6 +42,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let stack_val: (i16, f32) = (-14, -19f32); let stack_val: (i16, f32) = (-14, -19f32);

View File

@ -112,7 +112,7 @@
// lldb-check:[...]$12 = 3.5 // lldb-check:[...]$12 = 3.5
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let bool_box: Box<bool> = box true; let bool_box: Box<bool> = box true;

View File

@ -32,6 +32,7 @@
// lldb-check:[...]$1 = (2, 3.5) // lldb-check:[...]$1 = (2, 3.5)
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let a = box 1i; let a = box 1i;

View File

@ -35,6 +35,7 @@
// lldb-check:[...]$1 = StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 } // lldb-check:[...]$1 = StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 }
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct StructWithSomePadding { struct StructWithSomePadding {
x: i16, x: i16,

View File

@ -71,6 +71,8 @@
// lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 } // lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
#[deriving(Clone)] #[deriving(Clone)]
struct Struct { struct Struct {
a: int, a: int,

View File

@ -46,6 +46,8 @@
// lldb-check:[...]$2 = (4444.5, 5555, 6666, 7777.5) // lldb-check:[...]$2 = (4444.5, 5555, 6666, 7777.5)
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
trait Trait { trait Trait {
fn method(self) -> Self; fn method(self) -> Self;
} }

View File

@ -65,6 +65,7 @@
// lldb-check:[...]$6 = (StructWithDrop { a: OneHundred, b: Vienna }, 9) // lldb-check:[...]$6 = (StructWithDrop { a: OneHundred, b: Vienna }, 9)
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
use self::AnEnum::{OneHundred, OneThousand, OneMillion}; use self::AnEnum::{OneHundred, OneThousand, OneMillion};
use self::AnotherEnum::{MountainView, Toronto, Vienna}; use self::AnotherEnum::{MountainView, Toronto, Vienna};

View File

@ -99,6 +99,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(dead_code)] #![allow(dead_code)]
#![omit_gdb_pretty_printer_section]
use self::AutoDiscriminant::{One, Two, Three}; use self::AutoDiscriminant::{One, Two, Three};
use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion}; use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion};

View File

@ -46,6 +46,8 @@
// lldb-check:[...]$3 = 110 // lldb-check:[...]$3 = 110
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) { fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) {
let closure = |x, y| { let closure = |x, y| {

View File

@ -311,6 +311,7 @@
// lldb-command:continue // lldb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
use self::Univariant::Unit; use self::Univariant::Unit;

View File

@ -152,6 +152,9 @@
// lldb-check:[...]$23 = (34903493, 232323) // lldb-check:[...]$23 = (34903493, 232323)
// lldb-command:continue // lldb-command:continue
#![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: i16, x: i16,
y: f32, y: f32,

View File

@ -244,6 +244,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
use self::Univariant::Unit; use self::Univariant::Unit;

View File

@ -51,6 +51,7 @@
// lldb-check:[...]$4 = StructPaddedAtEnd { x: [22, 23], y: [24, 25] } // lldb-check:[...]$4 = StructPaddedAtEnd { x: [22, 23], y: [24, 25] }
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct NoPadding1 { struct NoPadding1 {
x: [u32; 3], x: [u32; 3],

View File

@ -222,10 +222,8 @@
// lldb-command:continue // lldb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn immediate_args(a: int, b: bool, c: f64) { fn immediate_args(a: int, b: bool, c: f64) {
::std::io::print("") // #break ::std::io::print("") // #break

View File

@ -45,6 +45,9 @@
// lldb-check:[...]$3 = 3000 // lldb-check:[...]$3 = 3000
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
fun(111102, true); fun(111102, true);

View File

@ -245,6 +245,7 @@
// lldb-command:continue // lldb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
#[no_stack_check] #[no_stack_check]
fn immediate_args(a: int, b: bool, c: f64) { fn immediate_args(a: int, b: bool, c: f64) {

View File

@ -126,6 +126,7 @@
// lldb-command:continue // lldb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn immediate_args(a: int, b: bool, c: f64) { fn immediate_args(a: int, b: bool, c: f64) {
() ()

View File

@ -17,7 +17,6 @@
// ignore-lldb // ignore-lldb
// ignore-android: FIXME(#10381) // ignore-android: FIXME(#10381)
// compile-flags:-g // compile-flags:-g
// gdb-use-pretty-printer
// gdb-command: run // gdb-command: run

View File

@ -13,7 +13,6 @@
// ignore-lldb // ignore-lldb
// ignore-android: FIXME(#10381) // ignore-android: FIXME(#10381)
// compile-flags:-g // compile-flags:-g
// gdb-use-pretty-printer
// This test uses some GDB Python API features (e.g. accessing anonymous fields) // This test uses some GDB Python API features (e.g. accessing anonymous fields)
// which are only available in newer GDB version. The following directive will // which are only available in newer GDB version. The following directive will

View File

@ -70,6 +70,7 @@
// lldb-check:[...]$8 = ((5, Struct { a: 6, b: 7.5 }), (Struct { a: 6, b: 7.5 }, 5)) // lldb-check:[...]$8 = ((5, Struct { a: 6, b: 7.5 }), (Struct { a: 6, b: 7.5 }, 5))
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
#[deriving(Clone)] #[deriving(Clone)]
struct Struct { struct Struct {

View File

@ -70,6 +70,9 @@
// lldb-check:[...]$7 = 2.5 // lldb-check:[...]$7 = 2.5
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn outer<TA: Clone>(a: TA) { fn outer<TA: Clone>(a: TA) {
inner(a.clone(), 1i); inner(a.clone(), 1i);
inner(a.clone(), 2.5f64); inner(a.clone(), 2.5f64);

View File

@ -112,6 +112,7 @@
// lldb-check:[...]$14 = -10.5 // lldb-check:[...]$14 = -10.5
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct<T> { struct Struct<T> {
x: T x: T

View File

@ -31,6 +31,9 @@
// gdb-check:$5 = 5 // gdb-check:$5 = 5
// gdb-command:continue // gdb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: int x: int
} }

View File

@ -29,6 +29,9 @@
// gdb-command:print univariant // gdb-command:print univariant
// gdb-check:$4 = {{a = -1}} // gdb-check:$4 = {{a = -1}}
#![omit_gdb_pretty_printer_section]
use self::Regular::{Case1, Case2, Case3}; use self::Regular::{Case1, Case2, Case3};
use self::Univariant::TheOnlyCase; use self::Univariant::TheOnlyCase;

View File

@ -41,6 +41,9 @@
// lldb-command:print float_int_float // lldb-command:print float_int_float
// lldb-check:[...]$3 = AGenericStruct<f64, generic-struct::AGenericStruct<int, f64>> { key: 6.5, value: AGenericStruct<int, f64> { key: 7, value: 8.5 } } // lldb-check:[...]$3 = AGenericStruct<f64, generic-struct::AGenericStruct<int, f64>> { key: 6.5, value: AGenericStruct<int, f64> { key: 7, value: 8.5 } }
#![omit_gdb_pretty_printer_section]
struct AGenericStruct<TKey, TValue> { struct AGenericStruct<TKey, TValue> {
key: TKey, key: TKey,
value: TValue value: TValue

View File

@ -25,6 +25,7 @@
// gdb-check:$4 = {3.5, {4, 5, 6}} // gdb-check:$4 = {3.5, {4, 5, 6}}
// gdb-command:continue // gdb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: int x: int

View File

@ -48,6 +48,8 @@
// lldb-command:print univariant // lldb-command:print univariant
// lldb-check:[...]$3 = TheOnlyCase(-1) // lldb-check:[...]$3 = TheOnlyCase(-1)
#![omit_gdb_pretty_printer_section]
use self::Regular::{Case1, Case2, Case3}; use self::Regular::{Case1, Case2, Case3};
use self::Univariant::TheOnlyCase; use self::Univariant::TheOnlyCase;

View File

@ -36,6 +36,7 @@
// lldb-command:continue // lldb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
// This test case makes sure that debug info does not ICE when include_str is // This test case makes sure that debug info does not ICE when include_str is
// used multiple times (see issue #11322). // used multiple times (see issue #11322).

View File

@ -16,9 +16,11 @@
// gdb-command:run // gdb-command:run
// gdb-command:next // gdb-command:next
// gdb-check:[...]32[...]s // gdb-check:[...]34[...]s
// gdb-command:continue // gdb-command:continue
#![omit_gdb_pretty_printer_section]
// IF YOU MODIFY THIS FILE, BE CAREFUL TO ADAPT THE LINE NUMBERS IN THE DEBUGGER COMMANDS // IF YOU MODIFY THIS FILE, BE CAREFUL TO ADAPT THE LINE NUMBERS IN THE DEBUGGER COMMANDS
// This test makes sure that gdb does not set unwanted breakpoints in inlined functions. If a // This test makes sure that gdb does not set unwanted breakpoints in inlined functions. If a

View File

@ -86,6 +86,8 @@
// lldb-check:[...]$6 = 1000000 // lldb-check:[...]$6 = 1000000
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let range = [1i, 2, 3]; let range = [1i, 2, 3];

View File

@ -134,6 +134,7 @@
// lldb-check:[...]$15 = -1 // lldb-check:[...]$15 = -1
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {

View File

@ -126,6 +126,7 @@
// lldb-check:[...]$17 = 232 // lldb-check:[...]$17 = 232
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: int, x: int,

View File

@ -70,6 +70,8 @@
// lldb-check:[...]$5 = false // lldb-check:[...]$5 = false
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let x = false; let x = false;

View File

@ -132,6 +132,8 @@
// lldb-check:[...]$12 = 2 // lldb-check:[...]$12 = 2
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let mut x = 0i; let mut x = 0i;

View File

@ -70,6 +70,9 @@
// lldb-check:[...]$5 = false // lldb-check:[...]$5 = false
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let x = false; let x = false;

View File

@ -132,6 +132,7 @@
// lldb-check:[...]$12 = 2 // lldb-check:[...]$12 = 2
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {

View File

@ -112,6 +112,7 @@
#![feature(macro_rules)] #![feature(macro_rules)]
#![omit_gdb_pretty_printer_section]
macro_rules! trivial { macro_rules! trivial {
($e1:expr) => ($e1) ($e1:expr) => ($e1)

View File

@ -349,6 +349,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(unused_assignments)] #![allow(unused_assignments)]
#![omit_gdb_pretty_printer_section]
static mut MUT_INT: int = 0; static mut MUT_INT: int = 0;

View File

@ -30,6 +30,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
a: i64, a: i64,

View File

@ -113,6 +113,8 @@
// lldb-check:[...]$14 = -10 // lldb-check:[...]$14 = -10
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
enum Enum { enum Enum {
Variant1 { x: u16, y: u16 }, Variant1 { x: u16, y: u16 },
Variant2 (u32) Variant2 (u32)

View File

@ -113,6 +113,8 @@
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct<T> { struct Struct<T> {
x: T x: T
} }

View File

@ -112,6 +112,9 @@
// lldb-check:[...]$14 = -10 // lldb-check:[...]$14 = -10
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: int x: int
} }

View File

@ -112,6 +112,9 @@
// lldb-check:[...]$14 = -10 // lldb-check:[...]$14 = -10
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: int x: int
} }

View File

@ -112,6 +112,9 @@
// lldb-check:[...]$14 = -10 // lldb-check:[...]$14 = -10
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct TupleStruct(int, f64); struct TupleStruct(int, f64);
impl TupleStruct { impl TupleStruct {

View File

@ -45,6 +45,7 @@
// lldb-check:[...]$2 = 30303 // lldb-check:[...]$2 = 30303
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn function_one() { fn function_one() {
let abc = 10101i; let abc = 10101i;

View File

@ -45,6 +45,7 @@
// lldb-check:[...]$2 = 30303 // lldb-check:[...]$2 = 30303
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn function_one() { fn function_one() {
let a = 10101i; let a = 10101i;

View File

@ -94,6 +94,8 @@
// lldb-check:[...]$11 = 20 // lldb-check:[...]$11 = 20
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let x = false; let x = false;
let y = true; let y = true;

View File

@ -23,6 +23,7 @@
// gdb-check:$2 = {<No data fields>} // gdb-check:$2 = {<No data fields>}
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
enum ANilEnum {} enum ANilEnum {}
enum AnotherNilEnum {} enum AnotherNilEnum {}

View File

@ -24,6 +24,7 @@
// gdb-command:continue // gdb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn function_with_debuginfo() { fn function_with_debuginfo() {
let abc = 10u; let abc = 10u;

View File

@ -68,6 +68,8 @@
// lldb-check:[...]$7 = None // lldb-check:[...]$7 = None
#![omit_gdb_pretty_printer_section]
// If a struct has exactly two variants, one of them is empty, and the other one // If a struct has exactly two variants, one of them is empty, and the other one
// contains a non-nullable pointer, then this value is used as the discriminator. // contains a non-nullable pointer, then this value is used as the discriminator.
// The test cases in this file make sure that something readable is generated for // The test cases in this file make sure that something readable is generated for

View File

@ -74,6 +74,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
#[repr(packed)] #[repr(packed)]
struct Packed { struct Packed {

View File

@ -60,6 +60,7 @@
// lldb-check:[...]$5 = 40 // lldb-check:[...]$5 = 40
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
#[repr(packed)] #[repr(packed)]
struct Packed { struct Packed {

View File

@ -18,6 +18,7 @@
// is taken from issue #11083. // is taken from issue #11083.
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
pub struct Window<'a> { pub struct Window<'a> {
callbacks: WindowCallbacks<'a> callbacks: WindowCallbacks<'a>

View File

@ -69,6 +69,7 @@
// gdb-command:continue // gdb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
use self::Opt::{Empty, Val}; use self::Opt::{Empty, Val};

View File

@ -112,6 +112,7 @@
// lldb-check:[...]$14 = -10 // lldb-check:[...]$14 = -10
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: int x: int

View File

@ -112,6 +112,7 @@
// lldb-check:[...]$14 = -10.5 // lldb-check:[...]$14 = -10.5
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: int x: int

View File

@ -58,6 +58,9 @@
// lldb-check:[...]$5 = 20 // lldb-check:[...]$5 = 20
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn a_function(x: bool, y: bool) { fn a_function(x: bool, y: bool) {
zzz(); // #break zzz(); // #break
sentinel(); sentinel();

View File

@ -58,6 +58,8 @@
// lldb-check:[...]$5 = 20 // lldb-check:[...]$5 = 20
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let x = false; let x = false;
let y = true; let y = true;

View File

@ -43,6 +43,7 @@
#![allow(experimental)] #![allow(experimental)]
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
use std::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2}; use std::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2};

View File

@ -78,6 +78,9 @@
// lldb-check:[...]$6 = false // lldb-check:[...]$6 = false
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let x = false; let x = false;

View File

@ -95,8 +95,9 @@
// lldb-command:print padding_at_end // lldb-command:print padding_at_end
// lldb-check:[...]$5 = PaddingAtEnd { x: -10014, y: 10015 } // lldb-check:[...]$5 = PaddingAtEnd { x: -10014, y: 10015 }
#![allow(unused_variables)]; #![allow(unused_variables)]
#![allow(dead_code)]; #![allow(dead_code)]
#![omit_gdb_pretty_printer_section]
struct NoPadding16 { struct NoPadding16 {
x: u16, x: u16,

View File

@ -92,6 +92,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(dead_code)] #![allow(dead_code)]
#![omit_gdb_pretty_printer_section]
static mut NO_PADDING_8: (i8, u8) = (-50, 50); static mut NO_PADDING_8: (i8, u8) = (-50, 50);
static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3); static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3);

View File

@ -54,6 +54,8 @@
// lldb-check:[...]$4 = 5 // lldb-check:[...]$4 = 5
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: int x: int
} }

View File

@ -42,6 +42,7 @@
// lldb-check:[...]$2 = TheOnlyCase(Struct { x: 123, y: 456, z: 789 }) // lldb-check:[...]$2 = TheOnlyCase(Struct { x: 123, y: 456, z: 789 })
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
use self::Regular::{Case1, Case2}; use self::Regular::{Case1, Case2};
use self::Univariant::TheOnlyCase; use self::Univariant::TheOnlyCase;

View File

@ -57,6 +57,7 @@
// lldb-check:[...]$7 = Tree { x: Simple { x: 25 }, y: InternalPaddingParent { x: InternalPadding { x: 26, y: 27 }, y: InternalPadding { x: 28, y: 29 }, z: InternalPadding { x: 30, y: 31 } }, z: BagInBag { x: Bag { x: Simple { x: 32 } } } } // lldb-check:[...]$7 = Tree { x: Simple { x: 25 }, y: InternalPaddingParent { x: InternalPadding { x: 26, y: 27 }, y: InternalPadding { x: 28, y: 29 }, z: InternalPadding { x: 30, y: 31 } }, z: BagInBag { x: Bag { x: Simple { x: 32 } } } }
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct Simple { struct Simple {
x: i32 x: i32

View File

@ -49,6 +49,7 @@
// lldb-check:[...]$3 = TheOnlyCase { a: -1 } // lldb-check:[...]$3 = TheOnlyCase { a: -1 }
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
use self::Regular::{Case1, Case2, Case3}; use self::Regular::{Case1, Case2, Case3};
use self::Univariant::TheOnlyCase; use self::Univariant::TheOnlyCase;

View File

@ -45,6 +45,7 @@
// lldb-check:[...]$3 = NestedOuter { a: NestedInner { a: WithDestructor { x: 7890, y: 9870 } } } // lldb-check:[...]$3 = NestedOuter { a: NestedInner { a: WithDestructor { x: 7890, y: 9870 } } }
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct NoDestructor { struct NoDestructor {
x: i32, x: i32,

View File

@ -45,6 +45,8 @@
// lldb-check:[...]$3 = (1, 2, 3) // lldb-check:[...]$3 = (1, 2, 3)
// lldb-command:continue // lldb-command:continue
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
x: int x: int
} }

View File

@ -16,6 +16,7 @@
// lldb-command:run // lldb-command:run
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
trait Trait { trait Trait {
fn method(&self) -> int { 0 } fn method(&self) -> int { 0 }

View File

@ -41,6 +41,7 @@
// gdb-check:$10 = {x = {{40, 41, 42}, {43, 44}}, y = {45, 46, 47, 48}} // gdb-check:$10 = {x = {{40, 41, 42}, {43, 44}}, y = {45, 46, 47, 48}}
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct NoPadding1 { struct NoPadding1 {
x: (i32, i32), x: (i32, i32),

View File

@ -57,6 +57,7 @@
// lldb-check:[...]$6 = ((21, 22), 23) // lldb-check:[...]$6 = ((21, 22), 23)
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
fn main() { fn main() {
let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3); let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3);

View File

@ -62,6 +62,9 @@
// to all fields having the name "<unnamed_field>"). Otherwise they are handled the same a normal // to all fields having the name "<unnamed_field>"). Otherwise they are handled the same a normal
// structs. // structs.
#![omit_gdb_pretty_printer_section]
struct NoPadding16(u16, i16); struct NoPadding16(u16, i16);
struct NoPadding32(i32, f32, u32); struct NoPadding32(i32, f32, u32);
struct NoPadding64(f64, i64, u64); struct NoPadding64(f64, i64, u64);

View File

@ -49,6 +49,7 @@
// lldb-check:[...]$3 = TheOnlyCase(-1) // lldb-check:[...]$3 = TheOnlyCase(-1)
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
use self::Regular::{Case1, Case2, Case3}; use self::Regular::{Case1, Case2, Case3};
use self::Univariant::TheOnlyCase; use self::Univariant::TheOnlyCase;

View File

@ -173,6 +173,8 @@
// gdb-command:whatis stack_closure2 // gdb-command:whatis stack_closure2
// gdb-check:type = struct (&mut|i8, f32| -> f32, uint) // gdb-check:type = struct (&mut|i8, f32| -> f32, uint)
#![omit_gdb_pretty_printer_section]
use self::Enum1::{Variant1_1, Variant1_2}; use self::Enum1::{Variant1_1, Variant1_2};
use std::ptr; use std::ptr;

View File

@ -42,6 +42,7 @@
// lldb-check:[...]$2 = TheOnlyCase(123234) // lldb-check:[...]$2 = TheOnlyCase(123234)
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
// The first element is to ensure proper alignment, irrespective of the machines word size. Since // The first element is to ensure proper alignment, irrespective of the machines word size. Since
// the size of the discriminant value is machine dependent, this has be taken into account when // the size of the discriminant value is machine dependent, this has be taken into account when

View File

@ -79,6 +79,7 @@
// lldb-command:continue // lldb-command:continue
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
a: int, a: int,

View File

@ -42,6 +42,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![feature(unboxed_closures)] #![feature(unboxed_closures)]
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
a: int, a: int,

View File

@ -72,6 +72,7 @@
#![feature(unboxed_closures)] #![feature(unboxed_closures)]
#![allow(unused_variables)] #![allow(unused_variables)]
#![omit_gdb_pretty_printer_section]
struct Struct { struct Struct {
a: int, a: int,

View File

@ -78,6 +78,7 @@
#![allow(unused_variables)] #![allow(unused_variables)]
#![feature(slicing_syntax)] #![feature(slicing_syntax)]
#![omit_gdb_pretty_printer_section]
struct AStruct { struct AStruct {
x: i16, x: i16,

Some files were not shown because too many files have changed in this diff Show More