Skip to content

Commit 91a0e18

Browse files
debuginfo: Add a rust-gdb shell script that will start GDB with Rust pretty printers enabled.
1 parent d2368c3 commit 91a0e18

File tree

101 files changed

+396
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+396
-71
lines changed

mk/clean.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ clean-generic-$(2)-$(1):
6464
-name '*.dll' -o \
6565
-name '*.def' -o \
6666
-name '*.py' -o \
67+
-name '*.pyc' -o \
6768
-name '*.bc' \
6869
\) \
6970
| xargs rm -f
@@ -79,7 +80,7 @@ define CLEAN_HOST_STAGE_N
7980

8081
clean$(1)_H_$(2): \
8182
$$(foreach crate,$$(CRATES),clean$(1)_H_$(2)-lib-$$(crate)) \
82-
$$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS),clean$(1)_H_$(2)-tool-$$(tool))
83+
$$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_H_$(2)-tool-$$(tool))
8384
$$(Q)rm -fr $(2)/rt/libbacktrace
8485

8586
clean$(1)_H_$(2)-tool-%:
@@ -99,7 +100,7 @@ define CLEAN_TARGET_STAGE_N
99100

100101
clean$(1)_T_$(2)_H_$(3): \
101102
$$(foreach crate,$$(CRATES),clean$(1)_T_$(2)_H_$(3)-lib-$$(crate)) \
102-
$$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool))
103+
$$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS_ALL),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool))
103104
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
104105
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a
105106
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix

mk/debuggers.mk

+88-13
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,77 @@
1212
# Copy debugger related scripts
1313
######################################################################
1414

15-
DEBUGGER_RUSTLIB_ETC_SCRIPTS=lldb_rust_formatters.py
16-
DEBUGGER_BIN_SCRIPTS=rust-lldb
1715

18-
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS=$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS), \
19-
$(CFG_SRC_DIR)src/etc/$(script))
20-
DEBUGGER_BIN_SCRIPTS_ABS=$(foreach script,$(DEBUGGER_BIN_SCRIPTS), \
21-
$(CFG_SRC_DIR)src/etc/$(script))
16+
## GDB ##
17+
DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB=gdb_load_rust_pretty_printers.py \
18+
gdb_rust_pretty_printing.py
19+
DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS=\
20+
$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB), \
21+
$(CFG_SRC_DIR)src/etc/$(script))
22+
23+
DEBUGGER_BIN_SCRIPTS_GDB=rust-gdb
24+
DEBUGGER_BIN_SCRIPTS_GDB_ABS=\
25+
$(foreach script,$(DEBUGGER_BIN_SCRIPTS_GDB), \
26+
$(CFG_SRC_DIR)src/etc/$(script))
27+
28+
29+
## LLDB ##
30+
DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB=lldb_rust_formatters.py
31+
DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS=\
32+
$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB), \
33+
$(CFG_SRC_DIR)src/etc/$(script))
34+
35+
DEBUGGER_BIN_SCRIPTS_LLDB=rust-lldb
36+
DEBUGGER_BIN_SCRIPTS_LLDB_ABS=\
37+
$(foreach script,$(DEBUGGER_BIN_SCRIPTS_LLDB), \
38+
$(CFG_SRC_DIR)src/etc/$(script))
39+
40+
41+
## ALL ##
42+
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL=$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB) \
43+
$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB)
44+
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS=$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
45+
$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS)
46+
DEBUGGER_BIN_SCRIPTS_ALL=$(DEBUGGER_BIN_SCRIPTS_GDB) \
47+
$(DEBUGGER_BIN_SCRIPTS_LLDB)
48+
DEBUGGER_BIN_SCRIPTS_ALL_ABS=$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) \
49+
$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
2250

23-
DEBUGGER_SCRIPTS_ALL=$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $(DEBUGGER_BIN_SCRIPTS_ABS)
2451

2552
# $(1) - the stage to copy to
2653
# $(2) - the host triple
2754
define DEF_INSTALL_DEBUGGER_SCRIPTS_HOST
2855

29-
tmp/install-debugger-scripts$(1)_H_$(2).done: $$(DEBUGGER_SCRIPTS_ALL)
56+
tmp/install-debugger-scripts$(1)_H_$(2)-gdb.done: \
57+
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
58+
$$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
59+
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
60+
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
61+
$(Q)install $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(HBIN$(1)_H_$(2))
62+
$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
63+
$(Q)touch $$@
64+
65+
tmp/install-debugger-scripts$(1)_H_$(2)-lldb.done: \
66+
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
67+
$$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
68+
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
69+
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
70+
$(Q)install $$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(HBIN$(1)_H_$(2))
71+
$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
72+
$(Q)touch $$@
73+
74+
tmp/install-debugger-scripts$(1)_H_$(2)-all.done: \
75+
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
76+
$$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
3077
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
3178
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
32-
$(Q)install $(DEBUGGER_BIN_SCRIPTS_ABS) $$(HBIN$(1)_H_$(2))
33-
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
79+
$(Q)install $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(HBIN$(1)_H_$(2))
80+
$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
3481
$(Q)touch $$@
82+
83+
tmp/install-debugger-scripts$(1)_H_$(2)-none.done:
84+
$(Q)touch $$@
85+
3586
endef
3687

3788
# Expand host make-targets for all stages
@@ -44,12 +95,36 @@ $(foreach stage,$(STAGES), \
4495
# $(3) is the host triple
4596
define DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET
4697

47-
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3).done: $$(DEBUGGER_SCRIPTS_ALL)
98+
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-gdb.done: \
99+
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
100+
$$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
101+
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
102+
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
103+
$(Q)install $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
104+
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
105+
$(Q)touch $$@
106+
107+
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-lldb.done: \
108+
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
109+
$$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
48110
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
49111
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
50-
$(Q)install $(DEBUGGER_BIN_SCRIPTS_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
51-
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
112+
$(Q)install $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
113+
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
52114
$(Q)touch $$@
115+
116+
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-all.done: \
117+
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
118+
$$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
119+
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
120+
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
121+
$(Q)install $(DEBUGGER_BIN_SCRIPTS_ALL_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
122+
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
123+
$(Q)touch $$@
124+
125+
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-none.done:
126+
$(Q)touch $$@
127+
53128
endef
54129

55130
# Expand target make-targets for all stages

mk/main.mk

+8-2
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,12 @@ export CFG_DISABLE_INJECT_STD_VERSION
325325
# Per-stage targets and runner
326326
######################################################################
327327

328+
# Valid setting-strings are 'all', 'none', 'gdb', 'lldb'
329+
# This 'function' will determine which debugger scripts to copy based on a
330+
# target triple. See debuggers.mk for more information.
331+
TRIPLE_TO_DEBUGGER_SCRIPT_SETTING=\
332+
$(if $(findstring windows,$(1)),none,$(if $(findstring darwin,$(1)),lldb,gdb))
333+
328334
STAGES = 0 1 2 3
329335

330336
define SREQ
@@ -357,7 +363,7 @@ else
357363
HSREQ$(1)_H_$(3) = \
358364
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
359365
$$(MKFILE_DEPS) \
360-
tmp/install-debugger-scripts$(1)_H_$(3).done
366+
tmp/install-debugger-scripts$(1)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(3)).done
361367
endif
362368

363369
# Prerequisites for using the stageN compiler to build target artifacts
@@ -372,7 +378,7 @@ SREQ$(1)_T_$(2)_H_$(3) = \
372378
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
373379
$$(foreach dep,$$(TARGET_CRATES), \
374380
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
375-
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3).done
381+
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(2)).done
376382

377383
# Prerequisites for a working stageN compiler and complete set of target
378384
# libraries

mk/prepare.mk

+25-3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,27 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
144144
$$(call PREPARE_LIB,libcompiler-rt.a),),),)
145145
endef
146146

147+
define INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS
148+
$(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $(PREPARE_DEST_BIN_DIR)
149+
$(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc
150+
endef
151+
152+
define INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS
153+
$(Q)$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_BIN_DIR)
154+
$(Q)$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) $(PREPARE_DEST_LIB_DIR)/rustlib/etc
155+
endef
156+
157+
define INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS
158+
$(Q)echo "No debugger scripts will be installed for host $(PREPARE_HOST)"
159+
endef
160+
161+
# $(1) is PREPARE_HOST
162+
INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\
163+
$(INSTALL_NO_DEBUGGER_SCRIPTS_COMMANDS),\
164+
$(if $(findstring darwin,$(1)),\
165+
$(INSTALL_LLDB_DEBUGGER_SCRIPTS_COMMANDS),\
166+
$(INSTALL_GDB_DEBUGGER_SCRIPTS_COMMANDS)))
167+
147168
define DEF_PREPARE
148169

149170
prepare-base-$(1): PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE)
@@ -170,9 +191,10 @@ prepare-host-dirs-$(1): prepare-maybe-clean-$(1)
170191
$$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR)/rustlib/etc)
171192
$$(call PREPARE_DIR,$$(PREPARE_DEST_MAN_DIR))
172193

173-
prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) $(DEBUGGER_SCRIPTS_ALL)
174-
$$(Q)$$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_ABS) $$(PREPARE_DEST_BIN_DIR)
175-
$$(Q)$$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(PREPARE_DEST_LIB_DIR)/rustlib/etc
194+
prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) \
195+
$$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) \
196+
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS)
197+
$$(call INSTALL_DEBUGGER_SCRIPT_COMMANDS,$$(PREPARE_HOST))
176198

177199
$$(foreach tool,$$(PREPARE_TOOLS), \
178200
$$(foreach host,$$(CFG_HOST), \

src/compiletest/runtest.rs

+4-33
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
367367
let DebuggerCommands {
368368
commands,
369369
check_lines,
370-
use_gdb_pretty_printer,
371370
breakpoint_lines
372371
} = parse_debugger_commands(testfile, "gdb");
373372
let mut cmds = commands.connect("\n");
@@ -521,16 +520,11 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
521520
if header::gdb_version_to_int(version.as_slice()) >
522521
header::gdb_version_to_int("7.4") {
523522
// Add the directory containing the pretty printers to
524-
// GDB's script auto loading safe path ...
523+
// GDB's script auto loading safe path
525524
script_str.push_str(
526525
format!("add-auto-load-safe-path {}\n",
527526
rust_pp_module_abs_path.replace("\\", "\\\\").as_slice())
528527
.as_slice());
529-
// ... and also the test directory
530-
script_str.push_str(
531-
format!("add-auto-load-safe-path {}\n",
532-
config.build_base.as_str().unwrap().replace("\\", "\\\\"))
533-
.as_slice());
534528
}
535529
}
536530
_ => {
@@ -543,6 +537,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
543537
// pretty printing, it just tells GDB to print values on one line:
544538
script_str.push_str("set print pretty off\n");
545539

540+
// Add the pretty printer directory to GDB's source-file search path
541+
script_str.push_str(format!("directory {}\n", rust_pp_module_abs_path)[]);
542+
546543
// Load the target executable
547544
script_str.push_str(format!("file {}\n",
548545
exe_file.as_str().unwrap().replace("\\", "\\\\"))
@@ -564,12 +561,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
564561
script_str.as_slice(),
565562
"debugger.script");
566563

567-
if use_gdb_pretty_printer {
568-
// Only emit the gdb auto-loading script if pretty printers
569-
// should actually be loaded
570-
dump_gdb_autoload_script(config, testfile);
571-
}
572-
573564
// run debugger script with gdb
574565
#[cfg(windows)]
575566
fn debugger() -> String {
@@ -611,19 +602,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
611602
}
612603

613604
check_debugger_output(&debugger_run_result, check_lines.as_slice());
614-
615-
fn dump_gdb_autoload_script(config: &Config, testfile: &Path) {
616-
let mut script_path = output_base_name(config, testfile);
617-
let mut script_file_name = script_path.filename().unwrap().to_vec();
618-
script_file_name.push_all("-gdb.py".as_bytes());
619-
script_path.set_filename(script_file_name.as_slice());
620-
621-
let script_content = "import gdb_rust_pretty_printing\n\
622-
gdb_rust_pretty_printing.register_printers(gdb.current_objfile())\n"
623-
.as_bytes();
624-
625-
File::create(&script_path).write(script_content).unwrap();
626-
}
627605
}
628606

629607
fn find_rust_src_root(config: &Config) -> Option<Path> {
@@ -781,7 +759,6 @@ struct DebuggerCommands {
781759
commands: Vec<String>,
782760
check_lines: Vec<String>,
783761
breakpoint_lines: Vec<uint>,
784-
use_gdb_pretty_printer: bool
785762
}
786763

787764
fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
@@ -794,7 +771,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
794771
let mut breakpoint_lines = vec!();
795772
let mut commands = vec!();
796773
let mut check_lines = vec!();
797-
let mut use_gdb_pretty_printer = false;
798774
let mut counter = 1;
799775
let mut reader = BufferedReader::new(File::open(file_path).unwrap());
800776
for line in reader.lines() {
@@ -804,10 +780,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
804780
breakpoint_lines.push(counter);
805781
}
806782

807-
if line.as_slice().contains("gdb-use-pretty-printer") {
808-
use_gdb_pretty_printer = true;
809-
}
810-
811783
header::parse_name_value_directive(
812784
line.as_slice(),
813785
command_directive.as_slice()).map(|cmd| {
@@ -832,7 +804,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
832804
commands: commands,
833805
check_lines: check_lines,
834806
breakpoint_lines: breakpoint_lines,
835-
use_gdb_pretty_printer: use_gdb_pretty_printer,
836807
}
837808
}
838809

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
# file at the top-level directory of this distribution and at
3+
# http://rust-lang.org/COPYRIGHT.
4+
#
5+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
# option. This file may not be copied, modified, or distributed
9+
# except according to those terms.
10+
11+
import gdb_rust_pretty_printing
12+
gdb_rust_pretty_printing.register_printers(gdb.current_objfile())

src/etc/rust-gdb

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
# Exit if anything fails
13+
set -e
14+
15+
# Find out where the pretty printer Python module is
16+
RUSTC_SYSROOT=`rustc --print=sysroot`
17+
GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
18+
19+
# Run GDB with the additional arguments that load the pretty printers
20+
PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" gdb \
21+
-d "$GDB_PYTHON_MODULE_DIRECTORY" \
22+
-iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \
23+
"$@"

src/librustc/lint/builtin.rs

+1
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ impl LintPass for UnusedAttributes {
654654
"static_assert",
655655
"thread_local",
656656
"no_debug",
657+
"omit_gdb_pretty_printer_section",
657658
"unsafe_no_drop_flag",
658659

659660
// used in resolve

src/librustc_llvm/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,8 @@ extern {
17431743
isOptimized: bool,
17441744
Flags: *const c_char,
17451745
RuntimeVer: c_uint,
1746-
SplitName: *const c_char);
1746+
SplitName: *const c_char)
1747+
-> DIDescriptor;
17471748

17481749
pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
17491750
Filename: *const c_char,

src/librustc_trans/trans/base.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2673,6 +2673,8 @@ pub fn create_entry_wrapper(ccx: &CrateContext,
26732673
unsafe {
26742674
llvm::LLVMPositionBuilderAtEnd(bld, llbb);
26752675

2676+
debuginfo::insert_reference_to_gdb_debug_scripts_section_global(ccx);
2677+
26762678
let (start_fn, args) = if use_start_lang_item {
26772679
let start_def_id = match ccx.tcx().lang_items.require(StartFnLangItem) {
26782680
Ok(id) => id,

0 commit comments

Comments
 (0)