]> git.lizzy.rs Git - rust.git/commitdiff
debuginfo: Add a rust-gdb shell script that will start GDB with Rust pretty printers...
authorMichael Woerister <michaelwoerister@posteo>
Wed, 3 Dec 2014 22:48:18 +0000 (14:48 -0800)
committerMichael Woerister <michaelwoerister@posteo>
Tue, 30 Dec 2014 16:26:13 +0000 (17:26 +0100)
101 files changed:
mk/clean.mk
mk/debuggers.mk
mk/main.mk
mk/prepare.mk
src/compiletest/runtest.rs
src/etc/gdb_load_rust_pretty_printers.py [new file with mode: 0644]
src/etc/rust-gdb [new file with mode: 0755]
src/librustc/lint/builtin.rs
src/librustc_llvm/lib.rs
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/debuginfo.rs
src/rustllvm/RustWrapper.cpp
src/test/debuginfo/basic-types-globals-metadata.rs
src/test/debuginfo/basic-types-globals.rs
src/test/debuginfo/basic-types-metadata.rs
src/test/debuginfo/basic-types-mut-globals.rs
src/test/debuginfo/basic-types.rs
src/test/debuginfo/borrowed-basic.rs
src/test/debuginfo/borrowed-c-style-enum.rs
src/test/debuginfo/borrowed-enum.rs
src/test/debuginfo/borrowed-struct.rs
src/test/debuginfo/borrowed-tuple.rs
src/test/debuginfo/borrowed-unique-basic.rs
src/test/debuginfo/box.rs
src/test/debuginfo/boxed-struct.rs
src/test/debuginfo/by-value-non-immediate-argument.rs
src/test/debuginfo/by-value-self-argument-in-trait-impl.rs
src/test/debuginfo/c-style-enum-in-composite.rs
src/test/debuginfo/c-style-enum.rs
src/test/debuginfo/closure-in-generic-function.rs
src/test/debuginfo/destructured-fn-argument.rs
src/test/debuginfo/destructured-for-loop-variable.rs
src/test/debuginfo/destructured-local.rs
src/test/debuginfo/evec-in-struct.rs
src/test/debuginfo/function-arg-initialization.rs
src/test/debuginfo/function-arguments.rs
src/test/debuginfo/function-prologue-stepping-no-stack-check.rs
src/test/debuginfo/function-prologue-stepping-regular.rs
src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs
src/test/debuginfo/gdb-pretty-struct-and-enums.rs
src/test/debuginfo/generic-function.rs
src/test/debuginfo/generic-functions-nested.rs
src/test/debuginfo/generic-method-on-generic-struct.rs
src/test/debuginfo/generic-static-method-on-struct-and-enum.rs
src/test/debuginfo/generic-struct-style-enum.rs
src/test/debuginfo/generic-struct.rs
src/test/debuginfo/generic-trait-generic-static-default-method.rs
src/test/debuginfo/generic-tuple-style-enum.rs
src/test/debuginfo/include_string.rs
src/test/debuginfo/issue12886.rs
src/test/debuginfo/lexical-scope-in-for-loop.rs
src/test/debuginfo/lexical-scope-in-if.rs
src/test/debuginfo/lexical-scope-in-match.rs
src/test/debuginfo/lexical-scope-in-stack-closure.rs
src/test/debuginfo/lexical-scope-in-unconditional-loop.rs
src/test/debuginfo/lexical-scope-in-unique-closure.rs
src/test/debuginfo/lexical-scope-in-while.rs
src/test/debuginfo/lexical-scope-with-macro.rs
src/test/debuginfo/lexical-scopes-in-block-expression.rs
src/test/debuginfo/limited-debuginfo.rs
src/test/debuginfo/method-on-enum.rs
src/test/debuginfo/method-on-generic-struct.rs
src/test/debuginfo/method-on-struct.rs
src/test/debuginfo/method-on-trait.rs
src/test/debuginfo/method-on-tuple-struct.rs
src/test/debuginfo/multiple-functions-equal-var-names.rs
src/test/debuginfo/multiple-functions.rs
src/test/debuginfo/name-shadowing-and-scope-nesting.rs
src/test/debuginfo/nil-enum.rs
src/test/debuginfo/no-debug-attribute.rs
src/test/debuginfo/option-like-enum.rs
src/test/debuginfo/packed-struct-with-destructor.rs
src/test/debuginfo/packed-struct.rs
src/test/debuginfo/recursive-enum.rs
src/test/debuginfo/recursive-struct.rs
src/test/debuginfo/self-in-default-method.rs
src/test/debuginfo/self-in-generic-default-method.rs
src/test/debuginfo/shadowed-argument.rs
src/test/debuginfo/shadowed-variable.rs
src/test/debuginfo/simd.rs
src/test/debuginfo/simple-lexical-scope.rs
src/test/debuginfo/simple-struct.rs
src/test/debuginfo/simple-tuple.rs
src/test/debuginfo/static-method-on-struct-and-enum.rs
src/test/debuginfo/struct-in-enum.rs
src/test/debuginfo/struct-in-struct.rs
src/test/debuginfo/struct-style-enum.rs
src/test/debuginfo/struct-with-destructor.rs
src/test/debuginfo/trait-generic-static-default-method.rs
src/test/debuginfo/trait-pointers.rs
src/test/debuginfo/tuple-in-struct.rs
src/test/debuginfo/tuple-in-tuple.rs
src/test/debuginfo/tuple-struct.rs
src/test/debuginfo/tuple-style-enum.rs
src/test/debuginfo/type-names.rs
src/test/debuginfo/unique-enum.rs
src/test/debuginfo/var-captured-in-nested-closure.rs
src/test/debuginfo/var-captured-in-sendable-closure.rs
src/test/debuginfo/var-captured-in-stack-closure.rs
src/test/debuginfo/vec-slices.rs
src/test/debuginfo/vec.rs

index aadc55ba6c4977dda86d5e5567c1ea6a8681b108..5b90d41ceeceb85c5e1ed457f054032149d39bc1 100644 (file)
@@ -64,6 +64,7 @@ clean-generic-$(2)-$(1):
          -name '*.dll' -o \
          -name '*.def' -o \
          -name '*.py' -o \
+         -name '*.pyc' -o \
          -name '*.bc' \
          \) \
          | xargs rm -f
@@ -79,7 +80,7 @@ define CLEAN_HOST_STAGE_N
 
 clean$(1)_H_$(2): \
            $$(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
 
 clean$(1)_H_$(2)-tool-%:
@@ -99,7 +100,7 @@ define CLEAN_TARGET_STAGE_N
 
 clean$(1)_T_$(2)_H_$(3): \
            $$(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))/libcompiler-rt.a
        $(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix
index 54955f06295fc168eb069bb170601d02ed96a54b..899cc42d066e4a2032a37a5646925fecb7e913d2 100644 (file)
 # 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), \
-                                     $(CFG_SRC_DIR)src/etc/$(script))
-DEBUGGER_BIN_SCRIPTS_ABS=$(foreach script,$(DEBUGGER_BIN_SCRIPTS), \
-                             $(CFG_SRC_DIR)src/etc/$(script))
+## GDB ##
+DEBUGGER_RUSTLIB_ETC_SCRIPTS_GDB=gdb_load_rust_pretty_printers.py \
+                                 gdb_rust_pretty_printing.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_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
 # $(2) - the host triple
 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 $$(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 $$@
+
+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_ABS) $$(HBIN$(1)_H_$(2))
-       $(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(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
 
 # Expand host make-targets for all stages
@@ -44,12 +95,36 @@ $(foreach stage,$(STAGES), \
 # $(3) is the host triple
 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 $$(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 $$@
+
+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_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_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
 
 # Expand target make-targets for all stages
index 4aed1cea9ca0987dd637ffbdd1a5fdac70e2307c..7d0617b988a4bfb852a19f282ff73f7a786394be 100644 (file)
@@ -325,6 +325,12 @@ export CFG_DISABLE_INJECT_STD_VERSION
 # 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
@@ -357,7 +363,7 @@ else
 HSREQ$(1)_H_$(3) = \
        $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
        $$(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
 
 # 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)) \
        $$(foreach dep,$$(TARGET_CRATES), \
            $$(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
 # libraries
index d404d3d2950e04a931740f3e926975ad4f97efd2..52fbbef81bd78e4098fd9ecafd1b3981f1ea70c6 100644 (file)
@@ -144,6 +144,27 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
           $$(call PREPARE_LIB,libcompiler-rt.a),),),)
 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
 
 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_MAN_DIR))
 
-prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) $(DEBUGGER_SCRIPTS_ALL)
-       $$(Q)$$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_ABS) $$(PREPARE_DEST_BIN_DIR)
-       $$(Q)$$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(PREPARE_DEST_LIB_DIR)/rustlib/etc
+prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) \
+                               $$(DEBUGGER_BIN_SCRIPTS_ALL_ABS) \
+                               $$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ALL_ABS)
+       $$(call INSTALL_DEBUGGER_SCRIPT_COMMANDS,$$(PREPARE_HOST))
 
 $$(foreach tool,$$(PREPARE_TOOLS), \
   $$(foreach host,$$(CFG_HOST), \
index 1abcd8bd214075ecd264622abeea789b207264ab..6bc34f1eb2c60da030ecc0e51bb8b64afd280dfe 100644 (file)
@@ -367,7 +367,6 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
     let DebuggerCommands {
         commands,
         check_lines,
-        use_gdb_pretty_printer,
         breakpoint_lines
     } = parse_debugger_commands(testfile, "gdb");
     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()) >
                         header::gdb_version_to_int("7.4") {
                         // 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(
                             format!("add-auto-load-safe-path {}\n",
                                     rust_pp_module_abs_path.replace("\\", "\\\\").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:
             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
             script_str.push_str(format!("file {}\n",
                                         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(),
                              "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
             #[cfg(windows)]
             fn debugger() -> String {
@@ -611,19 +602,6 @@ fn debugger() -> String {
     }
 
     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> {
@@ -781,7 +759,6 @@ struct DebuggerCommands {
     commands: Vec<String>,
     check_lines: Vec<String>,
     breakpoint_lines: Vec<uint>,
-    use_gdb_pretty_printer: bool
 }
 
 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 commands = vec!();
     let mut check_lines = vec!();
-    let mut use_gdb_pretty_printer = false;
     let mut counter = 1;
     let mut reader = BufferedReader::new(File::open(file_path).unwrap());
     for line in reader.lines() {
@@ -804,10 +780,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
                     breakpoint_lines.push(counter);
                 }
 
-                if line.as_slice().contains("gdb-use-pretty-printer") {
-                    use_gdb_pretty_printer = true;
-                }
-
                 header::parse_name_value_directive(
                         line.as_slice(),
                         command_directive.as_slice()).map(|cmd| {
@@ -832,7 +804,6 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str)
         commands: commands,
         check_lines: check_lines,
         breakpoint_lines: breakpoint_lines,
-        use_gdb_pretty_printer: use_gdb_pretty_printer,
     }
 }
 
diff --git a/src/etc/gdb_load_rust_pretty_printers.py b/src/etc/gdb_load_rust_pretty_printers.py
new file mode 100644 (file)
index 0000000..755cac1
--- /dev/null
@@ -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())
diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb
new file mode 100755 (executable)
index 0000000..520a108
--- /dev/null
@@ -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" \
+  "$@"
index 35c29f646e4a01b1917cff23aa3c3214b298b6b6..7c496623d62d2da9236db4117d33f32155f9241d 100644 (file)
@@ -654,6 +654,7 @@ fn check_attribute(&mut self, cx: &Context, attr: &ast::Attribute) {
             "static_assert",
             "thread_local",
             "no_debug",
+            "omit_gdb_pretty_printer_section",
             "unsafe_no_drop_flag",
 
             // used in resolve
index 3528b510ea1bbf6ae4b8c89bc8958baae2fe9b66..296ebcf9cfd8f7b946bef5d6e0bf2700654f2d57 100644 (file)
@@ -1743,7 +1743,8 @@ pub fn LLVMDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
                                           isOptimized: bool,
                                           Flags: *const c_char,
                                           RuntimeVer: c_uint,
-                                          SplitName: *const c_char);
+                                          SplitName: *const c_char)
+                                          -> DIDescriptor;
 
     pub fn LLVMDIBuilderCreateFile(Builder: DIBuilderRef,
                                    Filename: *const c_char,
index f0d738d839d7a01e281de85cfc35ae38926af7cc..c0837a54cdbef0ad6c47dd3e15b52d332c9f4754 100644 (file)
@@ -2673,6 +2673,8 @@ fn create_entry_fn(ccx: &CrateContext,
         unsafe {
             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_def_id = match ccx.tcx().lang_items.require(StartFnLangItem) {
                     Ok(id) => id,
index 56c42c7afdeb8bfd956c2c50f0cc44398cb72d08..23221d88157e9a173b876a9d23eced2cd90da870 100644 (file)
 use std::rc::{Rc, Weak};
 use syntax::util::interner::Interner;
 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::parse::token::{mod, special_idents};
 
@@ -740,7 +740,16 @@ pub fn finalize(cx: &CrateContext) {
     }
 
     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 {
         llvm::LLVMDIBuilderFinalize(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 compile_unit_name = match cx.sess().local_crate_source_file {
         None => fallback_path(cx),
@@ -1614,7 +1623,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
                            (option_env!("CFG_VERSION")).expect("CFG_VERSION"));
 
     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| {
             "".with_c_str(|flags| {
                 "".with_c_str(|split_name| {
@@ -1628,7 +1637,7 @@ fn compile_unit_metadata(cx: &CrateContext) {
                             cx.sess().opts.optimize != config::No,
                             flags,
                             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
+}
+
index 9fda05431db49639cf742bda554bf2c3d63d5f47..bce73a27699363db24e5f4339c7b6bbff6216396 100644 (file)
@@ -257,7 +257,7 @@ extern "C" void LLVMDIBuilderFinalize(DIBuilderRef Builder) {
     Builder->finalize();
 }
 
-extern "C" void LLVMDIBuilderCreateCompileUnit(
+extern "C" LLVMValueRef LLVMDIBuilderCreateCompileUnit(
     DIBuilderRef Builder,
     unsigned Lang,
     const char* File,
@@ -267,8 +267,14 @@ extern "C" void LLVMDIBuilderCreateCompileUnit(
     const char* Flags,
     unsigned RuntimeVer,
     const char* SplitName) {
-    Builder->createCompileUnit(Lang, File, Dir, Producer, isOptimized,
-        Flags, RuntimeVer, SplitName);
+    return wrap(Builder->createCompileUnit(Lang,
+                                           File,
+                                           Dir,
+                                           Producer,
+                                           isOptimized,
+                                           Flags,
+                                           RuntimeVer,
+                                           SplitName));
 }
 
 extern "C" LLVMValueRef LLVMDIBuilderCreateFile(
index 54d34d1840ca033aa6e9cbd989d007a34f11585b..4251f22b291470cef15d41a0ecf391a4f5dfad59 100644 (file)
@@ -45,6 +45,7 @@
 
 #![allow(unused_variables)]
 #![allow(dead_code)]
+#![omit_gdb_pretty_printer_section]
 
 
 static B: bool = false;
index bbb8c2423c375ed5da4f896aa3830dfff2e1c101..a4d4ddfea531db9303ff0ab0a8748e73e07c3845 100644 (file)
@@ -50,6 +50,7 @@
 // gdb-command:continue
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 static B: bool = false;
 static I: int = -1;
index b998f096a07389b0de8581184b08126e0b3b4c79..6aa228ec51bfce93cae3939bffa7ed31c6bfbb8f 100644 (file)
@@ -48,6 +48,7 @@
 // gdb-command:continue
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn main() {
     let unit: () = ();
index 435bfd98989b3cb9fa875309f30f0415f48234ae..bc8cdaf8eacc9eb41e6a9c14e9aff8f426ab48c1 100644 (file)
@@ -83,6 +83,7 @@
 // gdb-check:$28 = 9.25
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 static mut B: bool = false;
 static mut I: int = -1;
index 8be91e3ee76b3bd1a510c85292b1e8eb30d52544..f61f49228cdebf508223b82aaaba685f8dc6f9b2 100644 (file)
@@ -88,6 +88,7 @@
 // lldb-check:[...]$12 = 3.5
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn main() {
     let b: bool = false;
index 00bee44d264cff20c7640a71558326b1ad01ca69..f4c31278cf63be5c83722eee42a9e8ecc004eeee 100644 (file)
 // lldb-check:[...]$12 = 3.5
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn main() {
     let bool_val: bool = true;
index bbda6c93ebaf9344ad319899f054654190f6fb2c..c2da58f1583c0b38c239865ce51b30a43d9607f5 100644 (file)
@@ -41,6 +41,7 @@
 // lldb-check:[...]$2 = TheC
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 enum ABC { TheA, TheB, TheC }
 
index 9cda56a774380e2295f8a342db0d56d6850f2abc..d54869888f182d590c235949d73ac9b4a4ea3f6d 100644 (file)
@@ -40,6 +40,7 @@
 // lldb-check:[...]$2 = TheOnlyCase(4820353753753434)
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 // 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
index 7e6cf41162c38f9b767007653db9ee63c8a8e525..e3cf438be439c81dd56aa33163679e41c7d0b8fb 100644 (file)
@@ -64,6 +64,7 @@
 // lldb-check:[...]$6 = 26.5
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 struct SomeStruct {
     x: int,
index 57c14450467497d71f54274546cb7000b7155f26..ce0930f2fbf38f71de67f153a28c1b6836ec987c 100644 (file)
@@ -42,6 +42,7 @@
 
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn main() {
     let stack_val: (i16, f32) = (-14, -19f32);
index 30787716c72a803fd83b3dc77ec81a248254230b..d152775a8ed6a9514626589208f25474dfe9e4db 100644 (file)
 // lldb-check:[...]$12 = 3.5
 
 #![allow(unused_variables)]
-
+#![omit_gdb_pretty_printer_section]
 
 fn main() {
     let bool_box: Box<bool> = box true;
index 59f0c8f2d657ca60d17a1adee5e6b6881d7d6d96..5a70eb190412832f3a0266993297a8241e5d8ab9 100644 (file)
@@ -32,6 +32,7 @@
 // lldb-check:[...]$1 = (2, 3.5)
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn main() {
     let a = box 1i;
index 8f77de7e6d3ced64a317bfa8f1824228bcb5baf5..f9d762bf99d28a1b43c16fe5742c5f891d726b76 100644 (file)
@@ -35,6 +35,7 @@
 // lldb-check:[...]$1 = StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 }
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 struct StructWithSomePadding {
     x: i16,
index 258c49afcc42c84f4422f7b170cc808b6f5066fc..b0c5b2f21b95cf675b96e96ef95c3ded614cb853 100644 (file)
@@ -71,6 +71,8 @@
 // lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 #[deriving(Clone)]
 struct Struct {
     a: int,
index 57a3e503d0aa9a14c8997158e94db34add854fc8..6907313370e1a5edf57f26e6ec3bc158dc9bea1d 100644 (file)
@@ -46,6 +46,8 @@
 // lldb-check:[...]$2 = (4444.5, 5555, 6666, 7777.5)
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 trait Trait {
     fn method(self) -> Self;
 }
index 17e4110c2f1d3868aaea9dba48e0e1e225a0d110..f2dfc63d52253edfe7f0211741c0927e4807765c 100644 (file)
@@ -65,6 +65,7 @@
 // lldb-check:[...]$6 = (StructWithDrop { a: OneHundred, b: Vienna }, 9)
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 use self::AnEnum::{OneHundred, OneThousand, OneMillion};
 use self::AnotherEnum::{MountainView, Toronto, Vienna};
index b0a0142f6dd556eb2de16434a6e3d02501e20c79..b62a8167eaf07f30e40a54f083888b6a29018b27 100644 (file)
@@ -99,6 +99,7 @@
 
 #![allow(unused_variables)]
 #![allow(dead_code)]
+#![omit_gdb_pretty_printer_section]
 
 use self::AutoDiscriminant::{One, Two, Three};
 use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion};
index 673b4676a9552aaa2ce6fd20d9fe2feca6bb4d18..84366ae71146501ee1e25e61d44c4d67fc009f78 100644 (file)
@@ -46,6 +46,8 @@
 // lldb-check:[...]$3 = 110
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) {
 
     let closure = |x, y| {
index 17e1651f9f6eda68487e1d3d0ba09e2885207f6e..b4688e4928a6bfa65644a532068c821cdd9b58e8 100644 (file)
 // lldb-command:continue
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 use self::Univariant::Unit;
 
index 9935bb60364862da137b08ffd5618a2d42d71f62..364720d0e4fb34d0316d8630bd29142438967371 100644 (file)
 // lldb-check:[...]$23 = (34903493, 232323)
 // lldb-command:continue
 
+#![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
+
 struct Struct {
     x: i16,
     y: f32,
index 58db37888e6d7aa7b0a66552c4d6c281d010a631..d5a6b36f1fcf90329f69cf7d16726be3f1db3f34 100644 (file)
 
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 use self::Univariant::Unit;
 
index 786868f6b89ddab084dbce06cb0117fd821d42f9..f623a321922b8d7695cd4f7665cab48414a17059 100644 (file)
@@ -51,6 +51,7 @@
 // lldb-check:[...]$4 = StructPaddedAtEnd { x: [22, 23], y: [24, 25] }
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 struct NoPadding1 {
     x: [u32; 3],
index 53b3044b0f7f7c9c2fb5a4fe397b94c49f8707fa..55c5c50406416aa807d43b576cc593f075587ef6 100644 (file)
 // lldb-command:continue
 
 
-
 #![allow(unused_variables)]
-
-
+#![omit_gdb_pretty_printer_section]
 
 fn immediate_args(a: int, b: bool, c: f64) {
     ::std::io::print("") // #break
index 304745e39453d2a1691486f4a52da2fd945b901c..01136c11014a343f8764c5ae340f10bcd7f0d1d1 100644 (file)
@@ -45,6 +45,9 @@
 // lldb-check:[...]$3 = 3000
 // lldb-command:continue
 
+
+#![omit_gdb_pretty_printer_section]
+
 fn main() {
 
     fun(111102, true);
index 3288fa4c0cbd1746c63fe2a9bb378f2764d5bda5..e437e35db3a991117d4c61332a295422ba3040e9 100644 (file)
 // lldb-command:continue
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 #[no_stack_check]
 fn immediate_args(a: int, b: bool, c: f64) {
index dbeb87fd44afe1662b80e4f646161e12b3789e02..05ea357389bc61004678a88beb9835f47ea61329 100644 (file)
 // lldb-command:continue
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn immediate_args(a: int, b: bool, c: f64) {
     ()
index 8abb2cd5c26f984b91f68bc4128cc7b20bc40bb9..092cd9edc70658e21d3a008c9048270a9aaaf6f9 100644 (file)
@@ -17,7 +17,6 @@
 // ignore-lldb
 // ignore-android: FIXME(#10381)
 // compile-flags:-g
-// gdb-use-pretty-printer
 
 // gdb-command: run
 
index 76cf3c1149dd552e8665965cabeb1d2b0e3f921b..64c120e1ab3a9a6566f59f9830afadbf708a9969 100644 (file)
@@ -13,7 +13,6 @@
 // ignore-lldb
 // ignore-android: FIXME(#10381)
 // compile-flags:-g
-// gdb-use-pretty-printer
 
 // 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
index abfe95db51ba2d9ff5e00b99a49878d0ee18ff5b..cefe67970e959494f291d56b4f487e64db26c4c4 100644 (file)
@@ -70,6 +70,7 @@
 // lldb-check:[...]$8 = ((5, Struct { a: 6, b: 7.5 }), (Struct { a: 6, b: 7.5 }, 5))
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
 
 #[deriving(Clone)]
 struct Struct {
index 069906b14fd08dd3ec7fed41f36f588271e0686c..0f3fd556f189a6c64f67d52cfb8f994575261537 100644 (file)
@@ -70,6 +70,9 @@
 // lldb-check:[...]$7 = 2.5
 // lldb-command:continue
 
+
+#![omit_gdb_pretty_printer_section]
+
 fn outer<TA: Clone>(a: TA) {
     inner(a.clone(), 1i);
     inner(a.clone(), 2.5f64);
index 4c0c82efea35d33873f78142ac1c2aaccc2e2e37..0e358499a3d025d0ae0e5ac4816250f241cc041c 100644 (file)
 // lldb-check:[...]$14 = -10.5
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
 
 struct Struct<T> {
     x: T
index d69d432fcb30f64815e13ec6be10c1aaeb7b78de..bf755d379a6237ffd7cc26e4c341dd65d1e97389 100644 (file)
@@ -31,6 +31,9 @@
 // gdb-check:$5 = 5
 // gdb-command:continue
 
+
+#![omit_gdb_pretty_printer_section]
+
 struct Struct {
     x: int
 }
index 5e967266421722ed7bae849775a2e17851d05801..992e74179137bad54a4c4b7ef50fcc2f78eb6462 100644 (file)
@@ -29,6 +29,9 @@
 // gdb-command:print univariant
 // gdb-check:$4 = {{a = -1}}
 
+
+#![omit_gdb_pretty_printer_section]
+
 use self::Regular::{Case1, Case2, Case3};
 use self::Univariant::TheOnlyCase;
 
index 7d485a6f5d5a025fe70166a88f1515a5447c715f..908968fd6b32acbd97265b9c2bd24c37195e1d0c 100644 (file)
@@ -41,6 +41,9 @@
 // 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 } }
 
+
+#![omit_gdb_pretty_printer_section]
+
 struct AGenericStruct<TKey, TValue> {
     key: TKey,
     value: TValue
index 0984f8c9fa2cfde6f74e50972081cbddb95925dd..4382861fd20991af0d3e2f248fc4978e5528449c 100644 (file)
@@ -25,6 +25,7 @@
 // gdb-check:$4 = {3.5, {4, 5, 6}}
 // gdb-command:continue
 
+#![omit_gdb_pretty_printer_section]
 
 struct Struct {
     x: int
index 74d5dd2adc800365eab7331877edc4a8bff230b7..f9dc9d1f055c82c205a3ae57ab29d2fdde507601 100644 (file)
@@ -48,6 +48,8 @@
 // lldb-command:print univariant
 // lldb-check:[...]$3 = TheOnlyCase(-1)
 
+#![omit_gdb_pretty_printer_section]
+
 use self::Regular::{Case1, Case2, Case3};
 use self::Univariant::TheOnlyCase;
 
index f196938437a3975c8210e51c071cece57a6efadb..25719a802863d78898283b61a2e2dfa3a0fde9dc 100644 (file)
@@ -36,6 +36,7 @@
 // lldb-command:continue
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 // This test case makes sure that debug info does not ICE when include_str is
 // used multiple times (see issue #11322).
index e2dae2dc3f05992c86367c0cb37d8b81babec6b8..c6acc9a31fe3c68a0c70d13ac41f48144241b818 100644 (file)
 
 // gdb-command:run
 // gdb-command:next
-// gdb-check:[...]32[...]s
+// gdb-check:[...]34[...]s
 // gdb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 // 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
index 7636ffdb07dcd6a02a54e656d3db53d5a5a9bd75..3309ae13c9dcbc2430c9368f89517ca4cc3f0311 100644 (file)
@@ -86,6 +86,8 @@
 // lldb-check:[...]$6 = 1000000
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 fn main() {
 
     let range = [1i, 2, 3];
index 5bfe8371209c4ea7903e1c978215da249c6c2a5f..bc3a69452432550aaecd01eefabade4acc1dca05 100644 (file)
 // lldb-check:[...]$15 = -1
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
 
 fn main() {
 
index 6a956e06f245bf06110f6ccc38ab81ce5205fb13..37976ab3996ae22e18a9156dadd155f7937c4f99 100644 (file)
 // lldb-check:[...]$17 = 232
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
 
 struct Struct {
     x: int,
index 6666ddfbc829c26086ea42925db3b7456b875c36..d6e3a43eea0a6383f478ebf0a23243515bfcff8c 100644 (file)
@@ -70,6 +70,8 @@
 // lldb-check:[...]$5 = false
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 fn main() {
 
     let x = false;
index 51ddc83a8d863c9dcde38ae6c5bab3c7ea122291..b295c6f37a7a16d3d5567a9c32881c1f7451894b 100644 (file)
 // lldb-check:[...]$12 = 2
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 fn main() {
 
     let mut x = 0i;
index fa7822495d5f15ede8117880cc1b546583fbd752..be4085b63abe51dcacd0261647af347d9aa1632b 100644 (file)
@@ -70,6 +70,9 @@
 // lldb-check:[...]$5 = false
 // lldb-command:continue
 
+
+#![omit_gdb_pretty_printer_section]
+
 fn main() {
 
     let x = false;
index bafff552cd394cc140997712afdaecc7889dfc72..c7a36ef9b82bd07f0e69ba72d32380c11899d519 100644 (file)
 // lldb-check:[...]$12 = 2
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
 
 fn main() {
 
index 2c76f2ca7dfa87385843104ab479f02dc5660cbb..be52ffff1b45e9aaba2df6274ea5240cfe740b80 100644 (file)
 
 
 #![feature(macro_rules)]
+#![omit_gdb_pretty_printer_section]
 
 macro_rules! trivial {
     ($e1:expr) => ($e1)
index 41dee642feacd9c4886d83e8e073a4523ac49e6a..2f8b11ac283b63b884cf719c856d5075100f0441 100644 (file)
 
 #![allow(unused_variables)]
 #![allow(unused_assignments)]
+#![omit_gdb_pretty_printer_section]
 
 static mut MUT_INT: int = 0;
 
index 3a633fc5eeccf42f5ddcdbf041dbba5257177ba1..35889ff81335c04b9789447e487988d583d27a66 100644 (file)
@@ -30,6 +30,7 @@
 
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 struct Struct {
     a: i64,
index 8cb8fae75cf062bbd9819228ee838ece8bf95c1e..b1ebb124d4e76a53a4e877590f0e33864dc9fb46 100644 (file)
 // lldb-check:[...]$14 = -10
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 enum Enum {
     Variant1 { x: u16, y: u16 },
     Variant2 (u32)
index d4244ee27d4c20b696d5d09c4d22be690ef2bbcd..68a6ac8c1f31e9c00f8f635942981ad2f0c89bf0 100644 (file)
 // lldb-command:continue
 
 
+#![omit_gdb_pretty_printer_section]
+
 struct Struct<T> {
     x: T
 }
index ca00587ba445d81ca4e797b2532f06f79eca204c..84e74d4364cfaa2cea68cdf833acda89c87a82cb 100644 (file)
 // lldb-check:[...]$14 = -10
 // lldb-command:continue
 
+
+#![omit_gdb_pretty_printer_section]
+
 struct Struct {
     x: int
 }
index e70f86a53679ea555b34b6110a0204fe7102eee4..f53bb11eac442555e4f9786df0b8b6a626248011 100644 (file)
 // lldb-check:[...]$14 = -10
 // lldb-command:continue
 
+
+#![omit_gdb_pretty_printer_section]
+
 struct Struct {
     x: int
 }
index 31bdd20e409db8eb2d8e6027142b9bb32d922934..6994c38818c1b906733db0945d942ab33ed29779 100644 (file)
 // lldb-check:[...]$14 = -10
 // lldb-command:continue
 
+
+#![omit_gdb_pretty_printer_section]
+
 struct TupleStruct(int, f64);
 
 impl TupleStruct {
index d5d085bfe50a63e5998f9754ad3f6b6d0f71407b..cb21c13426a7b63cd3977f7d86cbb8cd1cef3be4 100644 (file)
@@ -45,6 +45,7 @@
 // lldb-check:[...]$2 = 30303
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn function_one() {
     let abc = 10101i;
index a94785b892dc02912664b23fd07c834f2ff7a134..ef7c4ce2045c7fe02d9e6e593dadc3292ad6089a 100644 (file)
@@ -45,6 +45,7 @@
 // lldb-check:[...]$2 = 30303
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn function_one() {
     let a = 10101i;
index 5d6dfb90794fdab905ffe998970823364b0ceea7..d248c7e98198c71b9c1264fb149ad8b5414e3da7 100644 (file)
@@ -94,6 +94,8 @@
 // lldb-check:[...]$11 = 20
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 fn main() {
     let x = false;
     let y = true;
index 306dfed9895e8cb63a621f5ea4916caaff3f88d1..f0eaf6acb6138f86ea4f7fec1fb906a0fba6bc9d 100644 (file)
@@ -23,6 +23,7 @@
 // gdb-check:$2 = {<No data fields>}
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 enum ANilEnum {}
 enum AnotherNilEnum {}
index 826ac381c82098b977ba0650385cadfced366cc6..dcc1928ae50c91e7ddcf86d312be5c26e816da55 100644 (file)
@@ -24,6 +24,7 @@
 // gdb-command:continue
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn function_with_debuginfo() {
     let abc = 10u;
index 333a430e3511130c47567d22939ec712869f2aa4..333ad602cf1301a55c21082689f79007a42f15b3 100644 (file)
@@ -68,6 +68,8 @@
 // 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
 // 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
index 1140c2cdb44d1a34a9d8f5057f5fd6d5b4ffe3fa..84c0b8da02c0610bdfc7d008c48399d48ce87237 100644 (file)
@@ -74,6 +74,7 @@
 
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 #[repr(packed)]
 struct Packed {
index 93941823fbc3a845a114ed2f631755ff77109545..97e6ee79952e8078c0480e6673833f3f3762c594 100644 (file)
@@ -60,6 +60,7 @@
 // lldb-check:[...]$5 = 40
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 #[repr(packed)]
 struct Packed {
index f43caed0810144ccd524a2a59d8c949c171724bc..93348e7b53e559b9732726850bae5c61fb1898ed 100644 (file)
@@ -18,6 +18,7 @@
 // is taken from issue #11083.
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 pub struct Window<'a> {
     callbacks: WindowCallbacks<'a>
index 8cc0fdabfc2e7b73cb7465dcaaf0b73597edd198..90c32ad8da11ffad27354715c5f94d53063cea2b 100644 (file)
@@ -69,6 +69,7 @@
 // gdb-command:continue
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 use self::Opt::{Empty, Val};
 
index 87fdb2c42c8f86956905346f0946c1b1af4170a7..f8ef5b3d2fcf9411cfe493eaccd8c5172cf40c19 100644 (file)
 // lldb-check:[...]$14 = -10
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
 
 struct Struct {
     x: int
index 6f488230521eb066d4e423b0c0a9ff7ac33f81e4..c2594df7d351c1da129e3e56bccad819dbbd2819 100644 (file)
 // lldb-check:[...]$14 = -10.5
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
 
 struct Struct {
     x: int
index ead960c36df99361c2a715461efb744e6c2d3309..c5c3664b07a7c307f355236ef695369129345ac2 100644 (file)
@@ -58,6 +58,9 @@
 // lldb-check:[...]$5 = 20
 // lldb-command:continue
 
+
+#![omit_gdb_pretty_printer_section]
+
 fn a_function(x: bool, y: bool) {
     zzz(); // #break
     sentinel();
index fa56c1d1fb756d24f316d249c75771f2d0d645bd..f384b756da67813c9941a6562c534b157b5d2f3c 100644 (file)
@@ -58,6 +58,8 @@
 // lldb-check:[...]$5 = 20
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 fn main() {
     let x = false;
     let y = true;
index 2c2eedf416775299a0d6ec12e5765209b008a75f..288e7461dd5a0c226d5a507000dfac7fc52b97ae 100644 (file)
@@ -43,6 +43,7 @@
 
 #![allow(experimental)]
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 use std::simd::{i8x16, i16x8,i32x4,i64x2,u8x16,u16x8,u32x4,u64x2,f32x4,f64x2};
 
index 4330a27325837c07b3a9f4f8e2c96ba7b687121a..5981c18494d40c8b4ffe6079f0fc3437934f9917 100644 (file)
@@ -78,6 +78,9 @@
 // lldb-check:[...]$6 = false
 // lldb-command:continue
 
+
+#![omit_gdb_pretty_printer_section]
+
 fn main() {
     let x = false;
 
index 51241be921ca2acca866cbedbb316b8e4bf16dfa..3015b16a0aa99ea4ccdda9103f64f83c5aafc3b7 100644 (file)
@@ -95,8 +95,9 @@
 // lldb-command:print padding_at_end
 // lldb-check:[...]$5 = PaddingAtEnd { x: -10014, y: 10015 }
 
-#![allow(unused_variables)];
-#![allow(dead_code)];
+#![allow(unused_variables)]
+#![allow(dead_code)]
+#![omit_gdb_pretty_printer_section]
 
 struct NoPadding16 {
     x: u16,
index bbc9941e013c10e9ff1a05d2b14b14311cd3b06c..78184fab7d3904971a6c4e620f75f2e81885b03a 100644 (file)
@@ -92,6 +92,7 @@
 
 #![allow(unused_variables)]
 #![allow(dead_code)]
+#![omit_gdb_pretty_printer_section]
 
 static mut NO_PADDING_8: (i8, u8) = (-50, 50);
 static mut NO_PADDING_16: (i16, i16, u16) = (-1, 2, 3);
index f808e7f8a90ff578710da5008c23ca1bbab381fd..59ee300b3e3b52644a2fa1dc36ebf0c796ba6d84 100644 (file)
@@ -54,6 +54,8 @@
 // lldb-check:[...]$4 = 5
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 struct Struct {
     x: int
 }
index 68281cb2230281bd8e5104eb3cd98147f1a3fe84..6f801a7d587d378a9b4b2b5c11d121217c34cbfa 100644 (file)
@@ -42,6 +42,7 @@
 // lldb-check:[...]$2 = TheOnlyCase(Struct { x: 123, y: 456, z: 789 })
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 use self::Regular::{Case1, Case2};
 use self::Univariant::TheOnlyCase;
index 4a7588b0bec592b207c1e2e164e2822d0a62856b..3f819c92e1017de50d762f9295522dec5e654e72 100644 (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 } } } }
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 struct Simple {
     x: i32
index 48c6c2d79fb43afb30103c8f571721a5d7d475d4..f6d4627082f0e2d37b8b6b009d19be2e936e2e12 100644 (file)
@@ -49,6 +49,7 @@
 // lldb-check:[...]$3 = TheOnlyCase { a: -1 }
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 use self::Regular::{Case1, Case2, Case3};
 use self::Univariant::TheOnlyCase;
index 854ba2171eb4285071d2e9cf73838607841f9124..743f5ac5ff452c82023504d02ec1e7114ffd0ac3 100644 (file)
@@ -45,6 +45,7 @@
 // lldb-check:[...]$3 = NestedOuter { a: NestedInner { a: WithDestructor { x: 7890, y: 9870 } } }
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 struct NoDestructor {
     x: i32,
index 8d565a323acd3e652cdf92ea37661f761f5e69ce..2ecafb02ae52d4e8ac4f1d1355e98d962f1162de 100644 (file)
@@ -45,6 +45,8 @@
 // lldb-check:[...]$3 = (1, 2, 3)
 // lldb-command:continue
 
+#![omit_gdb_pretty_printer_section]
+
 struct Struct {
     x: int
 }
index d73c3cf0f7789bebfbc16519942f84d6e1dffcf2..9f8c0aa06e67692f2fd118498707a31b4772f2fa 100644 (file)
@@ -16,6 +16,7 @@
 // lldb-command:run
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 trait Trait {
     fn method(&self) -> int { 0 }
index 02492bf1aa2cf58239792786c37b38587e4f9c59..3d28490c0cfd76f3f38eb38b0148d11ff44de2a7 100644 (file)
@@ -41,6 +41,7 @@
 // gdb-check:$10 = {x = {{40, 41, 42}, {43, 44}}, y = {45, 46, 47, 48}}
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 struct NoPadding1 {
     x: (i32, i32),
index 30fdd8c5530ade2b832f736ff8dce68fa25f03fe..b1228f7a8846ada1726d3a1b6156e2e3e9c10334 100644 (file)
@@ -57,6 +57,7 @@
 // lldb-check:[...]$6 = ((21, 22), 23)
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 fn main() {
     let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3);
index 62c150878cfb99b722470a08cc4059a484c94ef8..0960ab5834dd6693b08d8aeec56e3f202c9723e0 100644 (file)
@@ -62,6 +62,9 @@
 // to all fields having the name "<unnamed_field>"). Otherwise they are handled the same a normal
 // structs.
 
+
+#![omit_gdb_pretty_printer_section]
+
 struct NoPadding16(u16, i16);
 struct NoPadding32(i32, f32, u32);
 struct NoPadding64(f64, i64, u64);
index 07a0f1696061134dba93e6008942ed0c4aae8d49..f205f484f25fb5ba1cd617560af0f293bc702799 100644 (file)
@@ -49,6 +49,7 @@
 // lldb-check:[...]$3 = TheOnlyCase(-1)
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 use self::Regular::{Case1, Case2, Case3};
 use self::Univariant::TheOnlyCase;
index 286c44667c5b46cdbfcf2ac4a246ceb4d2dcfaa9..ddcbfdcceee01c2c8bbb36d54055a53990cd3d62 100644 (file)
 // gdb-command:whatis stack_closure2
 // gdb-check:type = struct (&mut|i8, f32| -> f32, uint)
 
+#![omit_gdb_pretty_printer_section]
+
 use self::Enum1::{Variant1_1, Variant1_2};
 use std::ptr;
 
index 3c0a4a21b4fceb92125e897c1c60e9d72a084c6b..3d028eb1077bc70f431ae9f686f19ae7cec478fb 100644 (file)
@@ -42,6 +42,7 @@
 // lldb-check:[...]$2 = TheOnlyCase(123234)
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 // 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
index f3ee711e8fdc7530afde199b448c1c817a8480e6..99d67c60516b5a6fe1e8652c6efcf6e6952b7c4a 100644 (file)
@@ -79,6 +79,7 @@
 // lldb-command:continue
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 struct Struct {
     a: int,
index fca47ed47bd7a1adeeee3503369fc362301a006e..b34749260f30c16816b0d04dc798998f783a47d0 100644 (file)
@@ -42,6 +42,7 @@
 
 #![allow(unused_variables)]
 #![feature(unboxed_closures)]
+#![omit_gdb_pretty_printer_section]
 
 struct Struct {
     a: int,
index 761d0f0be8f583309d5a682b6ddfdbb264693438..f474e8d1317993feb8647e2d2626a4fb32ab9b9f 100644 (file)
@@ -72,6 +72,7 @@
 
 #![feature(unboxed_closures)]
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 struct Struct {
     a: int,
index dfe16452d85890ddb5d178f945000b0005143cfa..70211d74d885d9534bd600a8bc80b70fb7324774 100644 (file)
@@ -78,6 +78,7 @@
 
 #![allow(unused_variables)]
 #![feature(slicing_syntax)]
+#![omit_gdb_pretty_printer_section]
 
 struct AStruct {
     x: i16,
index 00c93653cf411892b4c4e7e7526ae36d4f5dbbc5..92a490206b6243afc7855c6484b6a20d15cf9cbe 100644 (file)
@@ -29,6 +29,7 @@
 // lldb-check:[...]$0 = [1, 2, 3]
 
 #![allow(unused_variables)]
+#![omit_gdb_pretty_printer_section]
 
 static mut VECT: [i32; 3] = [1, 2, 3];