Skip to content

Commit 54a5a2b

Browse files
debuginfo: Make GDB tests use line breakpoints like done in LLDB tests.
On some Windows versions of GDB this is more stable than setting breakpoints via function names.
1 parent 7e66231 commit 54a5a2b

File tree

91 files changed

+69
-448
lines changed

Some content is hidden

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

91 files changed

+69
-448
lines changed

src/compiletest/runtest.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
364364
commands,
365365
check_lines,
366366
use_gdb_pretty_printer,
367-
..
367+
breakpoint_lines
368368
} = parse_debugger_commands(testfile, "gdb");
369369
let mut cmds = commands.connect("\n");
370370

@@ -535,11 +535,22 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
535535
}
536536
}
537537

538+
// The following line actually doesn't have to do anything with
539+
// pretty printing, it just tells GDB to print values on one line:
540+
script_str.push_str("set print pretty off\n");
541+
538542
// Load the target executable
539543
script_str.push_str(format!("file {}\n",
540544
exe_file.as_str().unwrap().replace("\\", "\\\\"))
541545
.as_slice());
542546

547+
// Add line breakpoints
548+
for line in breakpoint_lines.iter() {
549+
script_str.push_str(format!("break '{}':{}\n",
550+
testfile.filename_display(),
551+
*line)[]);
552+
}
553+
543554
script_str.push_str(cmds.as_slice());
544555
script_str.push_str("quit\n");
545556

src/test/debuginfo/basic-types-globals-metadata.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
// min-lldb-version: 310
1414

1515
// compile-flags:-g
16-
// gdb-command:rbreak zzz
1716
// gdb-command:run
18-
// gdb-command:finish
1917
// gdb-command:whatis 'basic-types-globals-metadata::B'
2018
// gdb-check:type = bool
2119
// gdb-command:whatis 'basic-types-globals-metadata::I'
@@ -66,7 +64,7 @@ static F32: f32 = 2.5;
6664
static F64: f64 = 3.5;
6765

6866
fn main() {
69-
_zzz();
67+
_zzz(); // #break
7068

7169
let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64);
7270
}

src/test/debuginfo/basic-types-globals.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
// min-lldb-version: 310
2020

2121
// compile-flags:-g
22-
// gdb-command:rbreak zzz
2322
// gdb-command:run
24-
// gdb-command:finish
2523
// gdb-command:print 'basic-types-globals::B'
2624
// gdb-check:$1 = false
2725
// gdb-command:print 'basic-types-globals::I'
@@ -70,7 +68,7 @@ static F32: f32 = 2.5;
7068
static F64: f64 = 3.5;
7169

7270
fn main() {
73-
_zzz();
71+
_zzz(); // #break
7472

7573
let a = (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64);
7674
}

src/test/debuginfo/basic-types-metadata.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
// min-lldb-version: 310
1313

1414
// compile-flags:-g
15-
// gdb-command:rbreak zzz
1615
// gdb-command:run
17-
// gdb-command:finish
1816
// gdb-command:whatis unit
1917
// gdb-check:type = ()
2018
// gdb-command:whatis b
@@ -67,7 +65,7 @@ fn main() {
6765
let u64: u64 = 64;
6866
let f32: f32 = 2.5;
6967
let f64: f64 = 3.5;
70-
_zzz();
68+
_zzz(); // #break
7169
if 1i == 1 { _yyy(); }
7270
}
7371

src/test/debuginfo/basic-types-mut-globals.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
// min-lldb-version: 310
2020

2121
// compile-flags:-g
22-
// gdb-command:rbreak zzz
22+
2323
// gdb-command:run
24-
// gdb-command:finish
2524

2625
// Check initializers
2726
// gdb-command:print 'basic-types-mut-globals::B'
@@ -84,9 +83,6 @@
8483
// gdb-command:print 'basic-types-mut-globals'::F64
8584
// gdb-check:$28 = 9.25
8685

87-
// gdb-command:detach
88-
// gdb-command:quit
89-
9086
#![allow(unused_variables)]
9187

9288
static mut B: bool = false;
@@ -105,7 +101,7 @@ static mut F32: f32 = 2.5;
105101
static mut F64: f64 = 3.5;
106102

107103
fn main() {
108-
_zzz();
104+
_zzz(); // #break
109105

110106
unsafe {
111107
B = true;
@@ -124,7 +120,7 @@ fn main() {
124120
F64 = 9.25;
125121
}
126122

127-
_zzz();
123+
_zzz(); // #break
128124
}
129125

130126
fn _zzz() {()}

src/test/debuginfo/basic-types.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121

2222
// === GDB TESTS ===================================================================================
2323

24-
// gdb-command:rbreak zzz
2524
// gdb-command:run
26-
// gdb-command:finish
2725
// gdb-command:print b
2826
// gdb-check:$1 = false
2927
// gdb-command:print i

src/test/debuginfo/borrowed-basic.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818

1919
// === GDB TESTS ===================================================================================
2020

21-
// gdb-command:rbreak zzz
2221
// gdb-command:run
23-
// gdb-command:finish
2422
// gdb-command:print *bool_ref
2523
// gdb-check:$1 = true
2624

src/test/debuginfo/borrowed-c-style-enum.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
// === GDB TESTS ===================================================================================
1717

18-
// gdb-command:rbreak zzz
1918
// gdb-command:run
20-
// gdb-command:finish
2119

2220
// gdb-command:print *the_a_ref
2321
// gdb-check:$1 = TheA

src/test/debuginfo/borrowed-enum.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
// === GDB TESTS ===================================================================================
1818

19-
// gdb-command:rbreak zzz
2019
// gdb-command:run
21-
// gdb-command:finish
2220

2321
// gdb-command:print *the_a_ref
2422
// gdb-check:$1 = {{RUST$ENUM$DISR = TheA, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = TheA, 0, 2088533116, 2088533116}}

src/test/debuginfo/borrowed-struct.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515
// === GDB TESTS ===================================================================================
1616

17-
// gdb-command:rbreak zzz
1817
// gdb-command:run
19-
// gdb-command:finish
2018

2119
// gdb-command:print *stack_val_ref
2220
// gdb-check:$1 = {x = 10, y = 23.5}

src/test/debuginfo/borrowed-tuple.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
// === GDB TESTS ===================================================================================
1717

18-
// gdb-command:rbreak zzz
1918
// gdb-command:run
20-
// gdb-command:finish
2119

2220
// gdb-command:print *stack_val_ref
2321
// gdb-check:$1 = {-14, -19}

src/test/debuginfo/borrowed-unique-basic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818

1919
// === GDB TESTS ===================================================================================
2020

21-
// gdb-command:rbreak zzz
2221
// gdb-command:run
23-
// gdb-command:finish
22+
2423
// gdb-command:print *bool_ref
2524
// gdb-check:$1 = true
2625

src/test/debuginfo/box.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515

1616
// === GDB TESTS ===================================================================================
1717

18-
// gdb-command:set print pretty off
19-
// gdb-command:rbreak zzz
2018
// gdb-command:run
21-
// gdb-command:finish
19+
2220
// gdb-command:print *a
2321
// gdb-check:$1 = 1
2422
// gdb-command:print *b

src/test/debuginfo/boxed-struct.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
// === GDB TESTS ===================================================================================
1717

18-
// gdb-command:rbreak zzz
1918
// gdb-command:run
20-
// gdb-command:finish
2119

2220
// gdb-command:print *unique
2321
// gdb-check:$1 = {x = 99, y = 999, z = 9999, w = 99999}

src/test/debuginfo/by-value-non-immediate-argument.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@
1616

1717
// === GDB TESTS ===================================================================================
1818

19-
// gdb-command:rbreak zzz
2019
// gdb-command:run
2120

22-
// gdb-command:finish
2321
// gdb-command:print s
2422
// gdb-check:$1 = {a = 1, b = 2.5}
2523
// gdb-command:continue
2624

27-
// gdb-command:finish
2825
// gdb-command:print x
2926
// gdb-check:$2 = {a = 3, b = 4.5}
3027
// gdb-command:print y
@@ -33,17 +30,14 @@
3330
// gdb-check:$4 = 6.5
3431
// gdb-command:continue
3532

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

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

46-
// gdb-command:finish
4741
// gdb-command:print x
4842
// gdb-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, 0, 2088533116, 2088533116}}
4943
// gdb-command:continue

src/test/debuginfo/by-value-self-argument-in-trait-impl.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,16 @@
1515

1616
// === GDB TESTS ===================================================================================
1717

18-
// gdb-command:rbreak zzz
1918
// gdb-command:run
2019

21-
// gdb-command:finish
2220
// gdb-command:print self
2321
// gdb-check:$1 = 1111
2422
// gdb-command:continue
2523

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

31-
// gdb-command:finish
3228
// gdb-command:print self
3329
// gdb-check:$3 = {4444.5, 5555, 6666, 7777.5}
3430
// gdb-command:continue

src/test/debuginfo/c-style-enum-in-composite.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
// === GDB TESTS ===================================================================================
1818

19-
// gdb-command:rbreak zzz
2019
// gdb-command:run
21-
// gdb-command:finish
2220

2321
// gdb-command:print tuple_interior_padding
2422
// gdb-check:$1 = {0, OneHundred}

src/test/debuginfo/c-style-enum.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
// === GDB TESTS ===================================================================================
1818

19-
// gdb-command:rbreak zzz
20-
2119
// gdb-command:print 'c-style-enum::SINGLE_VARIANT'
2220
// gdb-check:$1 = TheOnlyVariant
2321

@@ -40,7 +38,6 @@
4038
// gdb-check:$7 = OneHundred
4139

4240
// gdb-command:run
43-
// gdb-command:finish
4441

4542
// gdb-command:print auto_one
4643
// gdb-check:$8 = One

src/test/debuginfo/closure-in-generic-function.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,14 @@
1515

1616
// === GDB TESTS ===================================================================================
1717

18-
// gdb-command:rbreak zzz
1918
// gdb-command:run
2019

21-
// gdb-command:finish
2220
// gdb-command:print x
2321
// gdb-check:$1 = 0.5
2422
// gdb-command:print y
2523
// gdb-check:$2 = 10
2624
// gdb-command:continue
2725

28-
// gdb-command:finish
2926
// gdb-command:print *x
3027
// gdb-check:$3 = 29
3128
// gdb-command:print *y

0 commit comments

Comments
 (0)