Skip to content

Commit

Permalink
Distribute both rust-lldb and rust-gdb everywhere
Browse files Browse the repository at this point in the history
Both debuggers are viable in some capacity on all tier-1 platforms,
and people often ask for rust-lldb on Linux or rust-gdb on OS X.
  • Loading branch information
brson committed Apr 8, 2016
1 parent 8694b4f commit 246cc5f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 98 deletions.
80 changes: 8 additions & 72 deletions mk/debuggers.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,68 +13,24 @@
######################################################################


## GDB ##
DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB=gdb_load_rust_pretty_printers.py \
## ALL ##
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL=lldb_rust_formatters.py \
gdb_load_rust_pretty_printers.py \
gdb_rust_pretty_printing.py \
debugger_pretty_printers_common.py
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_pretty_printers_common.py
DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS=\
$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB), \
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS=\
$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL), \
$(CFG_SRC_DIR)src/etc/$(script))

DEBUGGER_BIN_SCRIPTS_LLDB=rust-lldb
DEBUGGER_BIN_SCRIPTS_LLDB_ABS=\
$(foreach script,$(DEBUGGER_BIN_SCRIPTS_LLDB), \
DEBUGGER_BIN_SCRIPTS_ALL=rust-gdb rust-lldb
DEBUGGER_BIN_SCRIPTS_ALL_ABS=\
$(foreach script,$(DEBUGGER_BIN_SCRIPTS_ALL), \
$(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)


# $(1) - the stage to copy to
# $(2) - the host triple
define DEF_INSTALL_DEBUGGER_SCRIPTS_HOST

tmp/install-debugger-scripts$(1)_H_$(2)-gdb.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
$(Q)touch $$@.start_time
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
$(Q)install $$(DEBUGGER_BIN_SCRIPTS_GDB_ABS) $$(HBIN$(1)_H_$(2))
$(Q)install $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time

tmp/install-debugger-scripts$(1)_H_$(2)-lldb.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
$(Q)touch $$@.start_time
$(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 -r $$@.start_time $$@ && rm $$@.start_time

tmp/install-debugger-scripts$(1)_H_$(2)-all.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
Expand All @@ -100,26 +56,6 @@ $(foreach stage,$(STAGES), \
# $(3) is the host triple
define DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET

tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-gdb.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_GDB_ABS)
$(Q)touch $$@.start_time
$(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_GDB_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
$(Q)touch -r $$@.start_time $$@ && rm $$@.start_time

tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-lldb.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_LLDB_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_LLDB_ABS)
$(Q)touch $$@.start_time
$(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 -r $$@.start_time $$@ && rm $$@.start_time

tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-all.done: \
$$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS) \
$$(DEBUGGER_BIN_SCRIPTS_ALL_ABS)
Expand Down
10 changes: 2 additions & 8 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,6 @@ endif
# 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

define SREQ
Expand Down Expand Up @@ -435,7 +429,7 @@ else
HSREQ$(1)_H_$(3) = \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
$$(MKFILE_DEPS) \
tmp/install-debugger-scripts$(1)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(3)).done
tmp/install-debugger-scripts$(1)_H_$(3)-all.done
endif

# Prerequisites for using the stageN compiler to build target artifacts
Expand All @@ -450,7 +444,7 @@ SREQ$(1)_T_$(2)_H_$(3) = \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(foreach dep,$$(TARGET_CRATES_$(2)), \
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-$$(call TRIPLE_TO_DEBUGGER_SCRIPT_SETTING,$(2)).done
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3)-all.done

# Prerequisites for a working stageN compiler and complete set of target
# libraries
Expand Down
33 changes: 15 additions & 18 deletions src/bootstrap/build/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,24 +198,21 @@ pub fn rustc(build: &Build, stage: u32, host: &str) {
t!(fs::create_dir_all(&dst));
install(&build.src.join("src/etc/").join(file), &dst, 0o644);
};
if host.contains("windows") {
// no debugger scripts
} else if host.contains("darwin") {
// lldb debugger scripts
install(&build.src.join("src/etc/rust-lldb"), &image.join("bin"),
0o755);

cp_debugger_script("lldb_rust_formatters.py");
cp_debugger_script("debugger_pretty_printers_common.py");
} else {
// gdb debugger scripts
install(&build.src.join("src/etc/rust-gdb"), &image.join("bin"),
0o755);

cp_debugger_script("gdb_load_rust_pretty_printers.py");
cp_debugger_script("gdb_rust_pretty_printing.py");
cp_debugger_script("debugger_pretty_printers_common.py");
}

// lldb debugger scripts
install(&build.src.join("src/etc/rust-lldb"), &image.join("bin"),
0o755);

cp_debugger_script("lldb_rust_formatters.py");

// gdb debugger scripts
install(&build.src.join("src/etc/rust-gdb"), &image.join("bin"),
0o755);

cp_debugger_script("gdb_load_rust_pretty_printers.py");
cp_debugger_script("gdb_rust_pretty_printing.py");

cp_debugger_script("debugger_pretty_printers_common.py");

// Misc license info
let cp = |file: &str| {
Expand Down

0 comments on commit 246cc5f

Please sign in to comment.