Skip to content

Commit dc08b19

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

File tree

97 files changed

+324
-62
lines changed

Some content is hidden

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

97 files changed

+324
-62
lines changed

mk/clean.mk

Lines changed: 3 additions & 2 deletions
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

Lines changed: 88 additions & 13 deletions
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

Lines changed: 8 additions & 2 deletions
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

Lines changed: 25 additions & 3 deletions
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

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
365365
let DebuggerCommands {
366366
commands,
367367
check_lines,
368-
use_gdb_pretty_printer,
369368
breakpoint_lines
370369
} = parse_debugger_commands(testfile, "gdb");
371370
let mut cmds = commands.connect("\n");
@@ -519,16 +518,11 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
519518
if header::gdb_version_to_int(version.as_slice()) >
520519
header::gdb_version_to_int("7.4") {
521520
// Add the directory containing the pretty printers to
522-
// GDB's script auto loading safe path ...
521+
// GDB's script auto loading safe path
523522
script_str.push_str(
524523
format!("add-auto-load-safe-path {}\n",
525524
rust_pp_module_abs_path.replace("\\", "\\\\").as_slice())
526525
.as_slice());
527-
// ... and also the test directory
528-
script_str.push_str(
529-
format!("add-auto-load-safe-path {}\n",
530-
config.build_base.as_str().unwrap().replace("\\", "\\\\"))
531-
.as_slice());
532526
}
533527
}
534528
_ => {
@@ -541,6 +535,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
541535
// pretty printing, it just tells GDB to print values on one line:
542536
script_str.push_str("set print pretty off\n");
543537

538+
// Add the pretty printer directory to GDB's source-file search path
539+
script_str.push_str(format!("directory {}\n", rust_pp_module_abs_path)[]);
540+
544541
// Load the target executable
545542
script_str.push_str(format!("file {}\n",
546543
exe_file.as_str().unwrap().replace("\\", "\\\\"))
@@ -562,12 +559,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
562559
script_str.as_slice(),
563560
"debugger.script");
564561

565-
if use_gdb_pretty_printer {
566-
// Only emit the gdb auto-loading script if pretty printers
567-
// should actually be loaded
568-
dump_gdb_autoload_script(config, testfile);
569-
}
570-
571562
// run debugger script with gdb
572563
#[cfg(windows)]
573564
fn debugger() -> String {
@@ -609,19 +600,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
609600
}
610601

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

627605
fn find_rust_src_root(config: &Config) -> Option<Path> {
@@ -779,7 +757,6 @@ struct DebuggerCommands {
779757
commands: Vec<String>,
780758
check_lines: Vec<String>,
781759
breakpoint_lines: Vec<uint>,
782-
use_gdb_pretty_printer: bool
783760
}
784761

785762
fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
@@ -792,7 +769,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
792769
let mut breakpoint_lines = vec!();
793770
let mut commands = vec!();
794771
let mut check_lines = vec!();
795-
let mut use_gdb_pretty_printer = false;
796772
let mut counter = 1;
797773
let mut reader = BufferedReader::new(File::open(file_path).unwrap());
798774
for line in reader.lines() {
@@ -802,10 +778,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
802778
breakpoint_lines.push(counter);
803779
}
804780

805-
if line.as_slice().contains("gdb-use-pretty-printer") {
806-
use_gdb_pretty_printer = true;
807-
}
808-
809781
header::parse_name_value_directive(
810782
line.as_slice(),
811783
command_directive.as_slice()).map(|cmd| {
@@ -830,7 +802,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
830802
commands: commands,
831803
check_lines: check_lines,
832804
breakpoint_lines: breakpoint_lines,
833-
use_gdb_pretty_printer: use_gdb_pretty_printer,
834805
}
835806
}
836807

Lines changed: 12 additions & 0 deletions
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

Lines changed: 23 additions & 0 deletions
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 -Zprint-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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ impl LintPass for UnusedAttributes {
628628
"static_assert",
629629
"thread_local",
630630
"no_debug",
631+
"omit_gdb_pretty_printer_section",
631632
"unsafe_no_drop_flag",
632633

633634
// used in resolve

0 commit comments

Comments
 (0)