gdb/testsuite: fix an issue that prevents selftest

Message ID OS3P286MB2152D128C759609D7AF24BDCF0199@OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM
State New
Headers
Series gdb/testsuite: fix an issue that prevents selftest |

Commit Message

Enze Li Dec. 4, 2022, 2:18 p.m. UTC
  When running gdb.gdb/selftest.exp, I see the following warning,
...
(gdb) break captured_main
Breakpoint 1 at 0x4fdab2
(gdb) run -nw -nx -iex "set height 0" -iex "set width 0"
Starting program: /home/lee/dev/binutils-gdb/gdb/testsuite/outputs/gdb.gdb/selftest/xgdb -nw -nx -iex "set height 0" -iex "set width 0"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, 0x0000555555a51ab2 in captured_main(void*) ()
(gdb) FAIL: gdb.gdb/selftest.exp: run until breakpoint at captured_main
WARNING: Couldn't test self
testcase /home/lee/dev/binutils-gdb/gdb/testsuite/gdb.gdb/selftest.exp completed in 1 seconds
...

Work around this by adding a dot and an asterisk in pattern instead of a
space.

Tested on x86_64-linux.
---
 gdb/testsuite/lib/selftest-support.exp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: 13556f4057d37f510f77143a1632febcc5618d1f
  

Comments

Simon Marchi Dec. 5, 2022, 7:50 p.m. UTC | #1
On 12/4/22 09:18, Enze Li via Gdb-patches wrote:
> When running gdb.gdb/selftest.exp, I see the following warning,
> ...
> (gdb) break captured_main
> Breakpoint 1 at 0x4fdab2
> (gdb) run -nw -nx -iex "set height 0" -iex "set width 0"
> Starting program: /home/lee/dev/binutils-gdb/gdb/testsuite/outputs/gdb.gdb/selftest/xgdb -nw -nx -iex "set height 0" -iex "set width 0"
> [Thread debugging using libthread_db enabled]
> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
> 
> Breakpoint 1, 0x0000555555a51ab2 in captured_main(void*) ()
> (gdb) FAIL: gdb.gdb/selftest.exp: run until breakpoint at captured_main

Doesn't this look like a bug to you?  What is the extra `()` at the end
of the line?

Simon
  
Enze Li Dec. 7, 2022, 1:37 p.m. UTC | #2
On Mon, Dec 05 2022 at 02:50:24 PM -0500, Simon Marchi wrote:

> On 12/4/22 09:18, Enze Li via Gdb-patches wrote:
>> When running gdb.gdb/selftest.exp, I see the following warning,
>> ...
>> (gdb) break captured_main
>> Breakpoint 1 at 0x4fdab2
>> (gdb) run -nw -nx -iex "set height 0" -iex "set width 0"
>> Starting program:
>> /home/lee/dev/binutils-gdb/gdb/testsuite/outputs/gdb.gdb/selftest/xgdb
>> -nw -nx -iex "set height 0" -iex "set width 0"
>> [Thread debugging using libthread_db enabled]
>> Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
>> 
>> Breakpoint 1, 0x0000555555a51ab2 in captured_main(void*) ()
>> (gdb) FAIL: gdb.gdb/selftest.exp: run until breakpoint at captured_main

Hi Simon,

Thanks for your review.

>
> Doesn't this look like a bug to you?  What is the extra `()` at the end
> of the line?

Hmmm...After digging into it further, I realized that this patch doesn't
fix the root cause; please drop this patch.

Before running the testcase, I used CXXFLAGS="-std=gnu++11" to compile
GDB, which overrides the default "-O2 -g", and directly causes the
compiled GDB to have no debug information.  I think this may have caused
the problem.  Is that what it is?

The extra `()` is supposed to show the arguments, but since it does not
have debugging information, it is empty here.

I sent a new patch to the list to fix the root cause, you might want to
have a look. :)

Best Regards,
Enze
  

Patch

diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
index 3c270d88527d..7e5f5a2567d0 100644
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -73,10 +73,10 @@  proc selftest_setup { executable function } {
 
     set description "run until breakpoint at $function"
     gdb_test_multiple "run $INTERNAL_GDBFLAGS" "$description" {
-        -re "Starting program.*Breakpoint \[0-9\]+,.*$function \\(.*\\).* at .*main.c:.*$gdb_prompt $" {
+        -re "Starting program.*Breakpoint \[0-9\]+,.*$function.*\\(.*\\).* at .*main.c:.*$gdb_prompt $" {
             pass "$description"
         }
-        -re "Starting program.*Breakpoint \[0-9\]+,.*$function \\(.*\\).*$gdb_prompt $" {
+        -re "Starting program.*Breakpoint \[0-9\]+,.*$function.*\\(.*\\).*$gdb_prompt $" {
             xfail "$description (line numbers scrambled?)"
         }
         -re "vfork: No more processes.*$gdb_prompt $" {