Skip to content

debuginfo: Make GDB tests use line breakpoints like done in LLDB tests. #18422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
commands,
check_lines,
use_gdb_pretty_printer,
..
breakpoint_lines
} = parse_debugger_commands(testfile, "gdb");
let mut cmds = commands.connect("\n");

Expand Down Expand Up @@ -535,11 +535,22 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
}
}

// The following line actually doesn't have to do anything with
// pretty printing, it just tells GDB to print values on one line:
script_str.push_str("set print pretty off\n");

// Load the target executable
script_str.push_str(format!("file {}\n",
exe_file.as_str().unwrap().replace("\\", "\\\\"))
.as_slice());

// Add line breakpoints
for line in breakpoint_lines.iter() {
script_str.push_str(format!("break '{}':{}\n",
testfile.filename_display(),
*line)[]);
}

script_str.push_str(cmds.as_slice());
script_str.push_str("quit\n");

Expand Down
5 changes: 1 addition & 4 deletions src/test/debuginfo/basic-types-globals-metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-windows: FIXME #13256
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g
// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish
// gdb-command:whatis 'basic-types-globals-metadata::B'
// gdb-check:type = bool
// gdb-command:whatis 'basic-types-globals-metadata::I'
Expand Down Expand Up @@ -66,7 +63,7 @@ static F32: f32 = 2.5;
static F64: f64 = 3.5;

fn main() {
_zzz();
_zzz(); // #break

let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64);
}
Expand Down
5 changes: 1 addition & 4 deletions src/test/debuginfo/basic-types-globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@
// about UTF-32 character encoding and will print a rust char as only
// its numerical value.

// ignore-windows: FIXME #13256
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g
// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish
// gdb-command:print 'basic-types-globals::B'
// gdb-check:$1 = false
// gdb-command:print 'basic-types-globals::I'
Expand Down Expand Up @@ -70,7 +67,7 @@ static F32: f32 = 2.5;
static F64: f64 = 3.5;

fn main() {
_zzz();
_zzz(); // #break

let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64);
}
Expand Down
4 changes: 1 addition & 3 deletions src/test/debuginfo/basic-types-metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
// min-lldb-version: 310

// compile-flags:-g
// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish
// gdb-command:whatis unit
// gdb-check:type = ()
// gdb-command:whatis b
Expand Down Expand Up @@ -67,7 +65,7 @@ fn main() {
let u64: u64 = 64;
let f32: f32 = 2.5;
let f64: f64 = 3.5;
_zzz();
_zzz(); // #break
if 1i == 1 { _yyy(); }
}

Expand Down
11 changes: 3 additions & 8 deletions src/test/debuginfo/basic-types-mut-globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
// about UTF-32 character encoding and will print a rust char as only
// its numerical value.

// ignore-windows: FIXME #13256
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g
// gdb-command:rbreak zzz

// gdb-command:run
// gdb-command:finish

// Check initializers
// gdb-command:print 'basic-types-mut-globals::B'
Expand Down Expand Up @@ -84,9 +82,6 @@
// gdb-command:print 'basic-types-mut-globals'::F64
// gdb-check:$28 = 9.25

// gdb-command:detach
// gdb-command:quit

#![allow(unused_variables)]

static mut B: bool = false;
Expand All @@ -105,7 +100,7 @@ static mut F32: f32 = 2.5;
static mut F64: f64 = 3.5;

fn main() {
_zzz();
_zzz(); // #break

unsafe {
B = true;
Expand All @@ -124,7 +119,7 @@ fn main() {
F64 = 9.25;
}

_zzz();
_zzz(); // #break
}

fn _zzz() {()}
2 changes: 0 additions & 2 deletions src/test/debuginfo/basic-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish
// gdb-command:print b
// gdb-check:$1 = false
// gdb-command:print i
Expand Down
2 changes: 0 additions & 2 deletions src/test/debuginfo/borrowed-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish
// gdb-command:print *bool_ref
// gdb-check:$1 = true

Expand Down
2 changes: 0 additions & 2 deletions src/test/debuginfo/borrowed-c-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish

// gdb-command:print *the_a_ref
// gdb-check:$1 = TheA
Expand Down
2 changes: 0 additions & 2 deletions src/test/debuginfo/borrowed-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish

// gdb-command:print *the_a_ref
// gdb-check:$1 = {{RUST$ENUM$DISR = TheA, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = TheA, 0, 2088533116, 2088533116}}
Expand Down
2 changes: 0 additions & 2 deletions src/test/debuginfo/borrowed-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish

// gdb-command:print *stack_val_ref
// gdb-check:$1 = {x = 10, y = 23.5}
Expand Down
2 changes: 0 additions & 2 deletions src/test/debuginfo/borrowed-tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish

// gdb-command:print *stack_val_ref
// gdb-check:$1 = {-14, -19}
Expand Down
3 changes: 1 addition & 2 deletions src/test/debuginfo/borrowed-unique-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish

// gdb-command:print *bool_ref
// gdb-check:$1 = true

Expand Down
4 changes: 1 addition & 3 deletions src/test/debuginfo/box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@

// === GDB TESTS ===================================================================================

// gdb-command:set print pretty off
// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish

// gdb-command:print *a
// gdb-check:$1 = 1
// gdb-command:print *b
Expand Down
2 changes: 0 additions & 2 deletions src/test/debuginfo/boxed-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish

// gdb-command:print *unique
// gdb-check:$1 = {x = 99, y = 999, z = 9999, w = 99999}
Expand Down
6 changes: 0 additions & 6 deletions src/test/debuginfo/by-value-non-immediate-argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run

// gdb-command:finish
// gdb-command:print s
// gdb-check:$1 = {a = 1, b = 2.5}
// gdb-command:continue

// gdb-command:finish
// gdb-command:print x
// gdb-check:$2 = {a = 3, b = 4.5}
// gdb-command:print y
Expand All @@ -33,17 +30,14 @@
// gdb-check:$4 = 6.5
// gdb-command:continue

// gdb-command:finish
// gdb-command:print a
// gdb-check:$5 = {7, 8, 9.5, 10.5}
// gdb-command:continue

// gdb-command:finish
// gdb-command:print a
// gdb-check:$6 = {11.5, 12.5, 13, 14}
// gdb-command:continue

// gdb-command:finish
// gdb-command:print x
// gdb-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, 0, 2088533116, 2088533116}}
// gdb-command:continue
Expand Down
4 changes: 0 additions & 4 deletions src/test/debuginfo/by-value-self-argument-in-trait-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run

// gdb-command:finish
// gdb-command:print self
// gdb-check:$1 = 1111
// gdb-command:continue

// gdb-command:finish
// gdb-command:print self
// gdb-check:$2 = {x = 2222, y = 3333}
// gdb-command:continue

// gdb-command:finish
// gdb-command:print self
// gdb-check:$3 = {4444.5, 5555, 6666, 7777.5}
// gdb-command:continue
Expand Down
2 changes: 0 additions & 2 deletions src/test/debuginfo/c-style-enum-in-composite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run
// gdb-command:finish

// gdb-command:print tuple_interior_padding
// gdb-check:$1 = {0, OneHundred}
Expand Down
4 changes: 0 additions & 4 deletions src/test/debuginfo/c-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-windows: FIXME #13256
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz

// gdb-command:print 'c-style-enum::SINGLE_VARIANT'
// gdb-check:$1 = TheOnlyVariant

Expand All @@ -40,7 +37,6 @@
// gdb-check:$7 = OneHundred

// gdb-command:run
// gdb-command:finish

// gdb-command:print auto_one
// gdb-check:$8 = One
Expand Down
3 changes: 0 additions & 3 deletions src/test/debuginfo/closure-in-generic-function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@

// === GDB TESTS ===================================================================================

// gdb-command:rbreak zzz
// gdb-command:run

// gdb-command:finish
// gdb-command:print x
// gdb-check:$1 = 0.5
// gdb-command:print y
// gdb-check:$2 = 10
// gdb-command:continue

// gdb-command:finish
// gdb-command:print *x
// gdb-check:$3 = 29
// gdb-command:print *y
Expand Down
Loading