* [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp
@ 2026-09-16 9:52 Tom de Vries
2026-09-16 9:52 ` [PATCH 1/4] [gdb/testsuite] Use strict regexp " Tom de Vries
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Tom de Vries @ 2026-09-16 9:52 UTC (permalink / raw)
To: gdb-patches
This series consists of 4 patches improving test-case gdb.python/py-rbreak.exp.
The first makes matching more strict.
The second improves readability.
The third fixes an incorrect test name.
The fourth speeds up the test-case by not running to main.
Tom de Vries (4):
[gdb/testsuite] Use strict regexp in gdb.python/py-rbreak.exp
[gdb/testsuite] Make gdb.python/py-rbreak.exp more readable
[gdb/testsuite] Fix test name in gdb.python/py-rbreak.exp
[gdb/testsuite] Speed up gdb.python/py-rbreak.exp
gdb/testsuite/gdb.python/py-rbreak.exp | 33 +++++++++++++++-----------
1 file changed, 19 insertions(+), 14 deletions(-)
base-commit: cd2166234b9e6569b1cf8a4169e58f487996c447
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] [gdb/testsuite] Use strict regexp in gdb.python/py-rbreak.exp
2026-09-16 9:52 [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp Tom de Vries
@ 2026-09-16 9:52 ` Tom de Vries
2026-09-16 9:52 ` [PATCH 2/4] [gdb/testsuite] Make gdb.python/py-rbreak.exp more readable Tom de Vries
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tom de Vries @ 2026-09-16 9:52 UTC (permalink / raw)
To: gdb-patches
With a 16.3 based package and test-case gdb.python/py-rbreak.exp I ran into:
...
(gdb) py sl = gdb.rbreak("func.*",minsyms=False,throttle=10)
Breakpoint 17 at 0x4011ad: file py-rbreak-func2.c, line 21.
Breakpoint 18 at 0x4011b8: file py-rbreak-func2.c, line 27.
Breakpoint 19 at 0x4011c3: file py-rbreak-func2.c, line 33.
Breakpoint 20 at 0x40113a: file py-rbreak.c, line 21.
Breakpoint 21 at 0x401145: file py-rbreak.c, line 27.
Breakpoint 22 at 0x401150: file py-rbreak.c, line 33.
Breakpoint 23 at 0x40115b: file py-rbreak.c, line 39.
Breakpoint 24 at 0x401166: file py-rbreak.c, line 45.
Breakpoint 25 at 0x401171: file py-rbreak.c, line 51.
Breakpoint 26 at 0x40107e: file static-reloc.c, line 29.
(gdb) py print(len(sl))
10
(gdb) FAIL: $exp: check number of returned breakpoints is 9
...
The extra match is for _dl_relocate_static_pie_ifunc, which has a debug info
entry with address:
...
<1><295>: Abbrev Number: 2 (DW_TAG_subprogram)
<296> DW_AT_external : 1
<296> DW_AT_name : _dl_relocate_static_pie_ifunc
<29a> DW_AT_decl_file : 1
<29a> DW_AT_decl_line : 28
<29b> DW_AT_decl_column : 1
<29b> DW_AT_prototyped : 1
<29b> DW_AT_low_pc : 0x40107e
<2a3> DW_AT_high_pc : 0x7
<2ab> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<2ad> DW_AT_call_all_calls: 1
...
Previously, that was just a declaration:
...
<1><295>: Abbrev Number: 4 (DW_TAG_subprogram)
<296> DW_AT_external : 1
<296> DW_AT_name : _dl_relocate_static_pie_ifunc
<29a> DW_AT_decl_file : 1
<29b> DW_AT_decl_line : 28
<29c> DW_AT_decl_column : 1
<29d> DW_AT_prototyped : 1
...
I'm not sure what the exact cause for this difference is, but it breaks the
test-case.
Fix this by using a regexp that only matches the 9 functions defined in the
sources: func[1-6] and efunc[1-3].
I didn't consider it a good idea to update the test names using "func.*",
because the intention stays the same, and changing it would unnecessarily
disturb test summary comparisons.
Tested on x86-64-linux.
---
gdb/testsuite/gdb.python/py-rbreak.exp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-rbreak.exp b/gdb/testsuite/gdb.python/py-rbreak.exp
index ba02758ae79..731ac7bbdb3 100644
--- a/gdb/testsuite/gdb.python/py-rbreak.exp
+++ b/gdb/testsuite/gdb.python/py-rbreak.exp
@@ -45,11 +45,15 @@ gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"main\.\*\",minsyms=False)" \
"get main function breakpoint" 0
gdb_test "py print(len(sl))" "1" \
"check number of returned breakpoints is 1"
-gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func\.\*\",minsyms=False,throttle=10)" \
+
+# BRE matching func[1-6] and efunc[1-3].
+set re_func_efunc {r"^\(func[1-6]\|efunc[1-3]\)$"}
+
+gdb_py_test_silent_cmd "py sl = gdb.rbreak($re_func_efunc,minsyms=False,throttle=10)" \
"get functions matching func.*" 0
gdb_test "py print(len(sl))" "9" \
"check number of returned breakpoints is 9"
-gdb_test "py gdb.rbreak(\"func\.\*\",minsyms=False,throttle=5)" \
+gdb_test "py gdb.rbreak($re_func_efunc,minsyms=False,throttle=5)" \
"Number of breakpoints exceeds throttled maximum.*" \
"check throttle errors on too many breakpoints"
gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func1\",minsyms=True)" \
@@ -60,7 +64,7 @@ gdb_py_test_silent_cmd "python sym = gdb.lookup_symbol(\"efunc1\")" \
"find a symbol in objfile" 1
gdb_py_test_silent_cmd "python symtab = sym\[0\].symtab" \
"get backing symbol table" 1
-gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func\.\*\",minsyms=False,throttle=10,symtabs=\[symtab\])" \
+gdb_py_test_silent_cmd "py sl = gdb.rbreak($re_func_efunc,minsyms=False,throttle=10,symtabs=\[symtab\])" \
"get functions matching func.* in one symtab only" 0
gdb_test "py print(len(sl))" "3" \
"check number of returned breakpoints is 3"
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] [gdb/testsuite] Make gdb.python/py-rbreak.exp more readable
2026-09-16 9:52 [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp Tom de Vries
2026-09-16 9:52 ` [PATCH 1/4] [gdb/testsuite] Use strict regexp " Tom de Vries
@ 2026-09-16 9:52 ` Tom de Vries
2026-09-16 9:52 ` [PATCH 3/4] [gdb/testsuite] Fix test name in gdb.python/py-rbreak.exp Tom de Vries
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tom de Vries @ 2026-09-16 9:52 UTC (permalink / raw)
To: gdb-patches
Make gdb.python/py-rbreak.exp more readable by:
- adding empty lines between groups of tests, and
- reducing escaping using {} and subst_vars.
---
gdb/testsuite/gdb.python/py-rbreak.exp | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-rbreak.exp b/gdb/testsuite/gdb.python/py-rbreak.exp
index 731ac7bbdb3..2d5fb33f666 100644
--- a/gdb/testsuite/gdb.python/py-rbreak.exp
+++ b/gdb/testsuite/gdb.python/py-rbreak.exp
@@ -31,7 +31,8 @@ if {![runto_main]} {
}
gdb_test_no_output "nosharedlibrary"
-gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"\",minsyms=False)" \
+
+gdb_py_test_silent_cmd {py sl = gdb.rbreak("",minsyms=False)} \
"get all function breakpoints" 0
set min_breakpoints 11
gdb_test_multiple "py print(len(sl))" \
@@ -41,7 +42,8 @@ gdb_test_multiple "py print(len(sl))" \
gdb_assert { $n >= $min_breakpoints } $gdb_test_name
}
}
-gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"main\.\*\",minsyms=False)" \
+
+gdb_py_test_silent_cmd {py sl = gdb.rbreak("main.*",minsyms=False)} \
"get main function breakpoint" 0
gdb_test "py print(len(sl))" "1" \
"check number of returned breakpoints is 1"
@@ -53,18 +55,23 @@ gdb_py_test_silent_cmd "py sl = gdb.rbreak($re_func_efunc,minsyms=False,throttle
"get functions matching func.*" 0
gdb_test "py print(len(sl))" "9" \
"check number of returned breakpoints is 9"
+
gdb_test "py gdb.rbreak($re_func_efunc,minsyms=False,throttle=5)" \
"Number of breakpoints exceeds throttled maximum.*" \
"check throttle errors on too many breakpoints"
-gdb_py_test_silent_cmd "py sl = gdb.rbreak(\"func1\",minsyms=True)" \
+
+gdb_py_test_silent_cmd {py sl = gdb.rbreak("func1",minsyms=True)} \
"including minimal symbols, get functions matching func.*" 0
gdb_test "py print(len(sl))" "2" \
"check number of returned breakpoints is 2"
-gdb_py_test_silent_cmd "python sym = gdb.lookup_symbol(\"efunc1\")" \
+
+gdb_py_test_silent_cmd {python sym = gdb.lookup_symbol("efunc1")} \
"find a symbol in objfile" 1
-gdb_py_test_silent_cmd "python symtab = sym\[0\].symtab" \
+gdb_py_test_silent_cmd {python symtab = sym[0].symtab} \
"get backing symbol table" 1
-gdb_py_test_silent_cmd "py sl = gdb.rbreak($re_func_efunc,minsyms=False,throttle=10,symtabs=\[symtab\])" \
+gdb_py_test_silent_cmd \
+ [subst_vars \
+ {py sl = gdb.rbreak($re_func_efunc,minsyms=False,throttle=10,symtabs=[symtab])}] \
"get functions matching func.* in one symtab only" 0
gdb_test "py print(len(sl))" "3" \
"check number of returned breakpoints is 3"
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] [gdb/testsuite] Fix test name in gdb.python/py-rbreak.exp
2026-09-16 9:52 [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp Tom de Vries
2026-09-16 9:52 ` [PATCH 1/4] [gdb/testsuite] Use strict regexp " Tom de Vries
2026-09-16 9:52 ` [PATCH 2/4] [gdb/testsuite] Make gdb.python/py-rbreak.exp more readable Tom de Vries
@ 2026-09-16 9:52 ` Tom de Vries
2026-09-16 9:52 ` [PATCH 4/4] [gdb/testsuite] Speed up gdb.python/py-rbreak.exp Tom de Vries
2026-09-16 15:18 ` [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp Tom Tromey
4 siblings, 0 replies; 6+ messages in thread
From: Tom de Vries @ 2026-09-16 9:52 UTC (permalink / raw)
To: gdb-patches
I noticed here:
...
gdb_py_test_silent_cmd {py sl = gdb.rbreak("func1",minsyms=True)} \
"including minimal symbols, get functions matching func.*" 0
...
that the test name doesn't match the used regexp.
Fix this by using "matching func1.*".
---
gdb/testsuite/gdb.python/py-rbreak.exp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/testsuite/gdb.python/py-rbreak.exp b/gdb/testsuite/gdb.python/py-rbreak.exp
index 2d5fb33f666..395a603ef4e 100644
--- a/gdb/testsuite/gdb.python/py-rbreak.exp
+++ b/gdb/testsuite/gdb.python/py-rbreak.exp
@@ -61,7 +61,7 @@ gdb_test "py gdb.rbreak($re_func_efunc,minsyms=False,throttle=5)" \
"check throttle errors on too many breakpoints"
gdb_py_test_silent_cmd {py sl = gdb.rbreak("func1",minsyms=True)} \
- "including minimal symbols, get functions matching func.*" 0
+ "including minimal symbols, get functions matching func1.*" 0
gdb_test "py print(len(sl))" "2" \
"check number of returned breakpoints is 2"
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] [gdb/testsuite] Speed up gdb.python/py-rbreak.exp
2026-09-16 9:52 [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp Tom de Vries
` (2 preceding siblings ...)
2026-09-16 9:52 ` [PATCH 3/4] [gdb/testsuite] Fix test name in gdb.python/py-rbreak.exp Tom de Vries
@ 2026-09-16 9:52 ` Tom de Vries
2026-09-16 15:18 ` [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp Tom Tromey
4 siblings, 0 replies; 6+ messages in thread
From: Tom de Vries @ 2026-09-16 9:52 UTC (permalink / raw)
To: gdb-patches
I noticed that gdb.python/py-rbreak.exp does:
...
if {![runto_main]} {
return
}
gdb_test_no_output "nosharedlibrary"
...
Speed up the test-case by not running to main.
This breaks the gdb.lookup_symbol("efunc1") call, which requires a current
frame, so use lookup_global_symbol instead.
Also remove the nosharedlibrary command. No longer running to main means we
no longer load symbols for shared libraries, so the nosharedlibrary that drops
those symbols is no longer required.
---
gdb/testsuite/gdb.python/py-rbreak.exp | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-rbreak.exp b/gdb/testsuite/gdb.python/py-rbreak.exp
index 395a603ef4e..a1ca7d4283d 100644
--- a/gdb/testsuite/gdb.python/py-rbreak.exp
+++ b/gdb/testsuite/gdb.python/py-rbreak.exp
@@ -26,12 +26,6 @@ if {[prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile
return 1
}
-if {![runto_main]} {
- return
-}
-
-gdb_test_no_output "nosharedlibrary"
-
gdb_py_test_silent_cmd {py sl = gdb.rbreak("",minsyms=False)} \
"get all function breakpoints" 0
set min_breakpoints 11
@@ -65,9 +59,9 @@ gdb_py_test_silent_cmd {py sl = gdb.rbreak("func1",minsyms=True)} \
gdb_test "py print(len(sl))" "2" \
"check number of returned breakpoints is 2"
-gdb_py_test_silent_cmd {python sym = gdb.lookup_symbol("efunc1")} \
+gdb_py_test_silent_cmd {python sym = gdb.lookup_global_symbol("efunc1")} \
"find a symbol in objfile" 1
-gdb_py_test_silent_cmd {python symtab = sym[0].symtab} \
+gdb_py_test_silent_cmd {python symtab = sym.symtab} \
"get backing symbol table" 1
gdb_py_test_silent_cmd \
[subst_vars \
--
2.51.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp
2026-09-16 9:52 [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp Tom de Vries
` (3 preceding siblings ...)
2026-09-16 9:52 ` [PATCH 4/4] [gdb/testsuite] Speed up gdb.python/py-rbreak.exp Tom de Vries
@ 2026-09-16 15:18 ` Tom Tromey
4 siblings, 0 replies; 6+ messages in thread
From: Tom Tromey @ 2026-09-16 15:18 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> This series consists of 4 patches improving test-case gdb.python/py-rbreak.exp.
Tom> The first makes matching more strict.
Tom> The second improves readability.
Tom> The third fixes an incorrect test name.
Tom> The fourth speeds up the test-case by not running to main.
This all seems fine to me.
Approved-By: Tom Tromey <tom@tromey.com>
For patch #1, I don't really care if test names change.
In this particular case the choice of name to match was too generic, an
issue we have pretty frequently when system debuginfo is installed.
However your patch #4 removes this problem in a different way, so IMO
the series is fine as is.
thanks,
Tom
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-16 15:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 9:52 [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp Tom de Vries
2026-09-16 9:52 ` [PATCH 1/4] [gdb/testsuite] Use strict regexp " Tom de Vries
2026-09-16 9:52 ` [PATCH 2/4] [gdb/testsuite] Make gdb.python/py-rbreak.exp more readable Tom de Vries
2026-09-16 9:52 ` [PATCH 3/4] [gdb/testsuite] Fix test name in gdb.python/py-rbreak.exp Tom de Vries
2026-09-16 9:52 ` [PATCH 4/4] [gdb/testsuite] Speed up gdb.python/py-rbreak.exp Tom de Vries
2026-09-16 15:18 ` [PATCH 0/4] [gdb/testsuite] Fixes in gdb.python/py-rbreak.exp Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox