public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] [gdb/testsuite] Refactor regexp in gdb.base/annota1.exp
@ 2021-10-06 15:33 Tom de Vries
  2021-10-06 15:33 ` [PATCH 2/2] [gdb/testsuite] Fix FAIL " Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2021-10-06 15:33 UTC (permalink / raw)
  To: gdb-patches

Refactor regexp in gdb.base/annota1.exp to reduce indentation and repetition.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.base/annota1.exp | 56 +++++++++++++++++++-----------
 1 file changed, 35 insertions(+), 21 deletions(-)

diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index 13c9a48bba8..7a08137a1b0 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -127,29 +127,43 @@ gdb_test_multiple "info break" "breakpoint info" {
 #exp_internal 1
 set binexp [string_to_regexp $binfile]
 
-set run_re [join [list "\r\n\032\032post-prompt\r\nStarting program: $binexp " \
-		    "\(\(\r\nReading \[^\r\n\]+\)|\(\r\nwarning: File transfers from remote targets can be slow\[^\r\n\]+\)\)*" \
-		    "\(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+\r\nDo \"set use-deprecated-index-sections on\" before the file is read\r\nto use the section anyway\\.\)?" \
-		    "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
-		    "\032\032starting\(\(\r\nReading \[^\r\n\]+\)|\(\r\nwarning: File transfers from remote targets can be slow\[^\r\n\]+\)\)*" \
-		    "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
-		    "\032\032breakpoint 1\r\n\r\n" \
-		    "Breakpoint 1, \r\n" \
-		    "\032\032frame-begin 0 $hex\r\n\r\n" \
-		    "\032\032frame-function-name\r\n" \
-		    "main\r\n" \
-		    "\032\032frame-args\r\n \\(\\)\r\n" \
-		    "\032\032frame-source-begin\r\n at \r\n" \
-		    "\032\032frame-source-file\r\n.*annota1.c\r\n" \
-		    "\032\032frame-source-file-end\r\n:\r\n" \
-		    "\032\032frame-source-line\r\n$main_line\r\n" \
-		    "\032\032frame-source-end\r\n\r\n\r\n" \
-		    "\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \
-		    "\032\032frame-end\r\n\r\n" \
-		    "\032\032stopped.*$gdb_prompt$" ] "" ]
+set warning_slow_re \
+    "warning: File transfers from remote targets can be slow\[^\r\n\]+"
+set warning_gdb_index_re \
+    [multi_line \
+	 "warning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+" \
+	 "Do \"set use-deprecated-index-sections on\" before the file is read" \
+	 "to use the section anyway\\."]
+set reading_re \
+    "Reading \[^\r\n\]+"
+
+set run_re \
+    [list \
+	 "\r\n\032\032post-prompt\r\nStarting program: $binexp " \
+	 "\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \
+	 "\(\r\n$warning_gdb_index_re\)?" \
+	 "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
+	 "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \
+	 "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
+	 "\032\032breakpoint 1\r\n\r\n" \
+	 "Breakpoint 1, \r\n" \
+	 "\032\032frame-begin 0 $hex\r\n\r\n" \
+	 "\032\032frame-function-name\r\n" \
+	 "main\r\n" \
+	 "\032\032frame-args\r\n \\(\\)\r\n" \
+	 "\032\032frame-source-begin\r\n at \r\n" \
+	 "\032\032frame-source-file\r\n.*annota1.c\r\n" \
+	 "\032\032frame-source-file-end\r\n:\r\n" \
+	 "\032\032frame-source-line\r\n$main_line\r\n" \
+	 "\032\032frame-source-end\r\n\r\n\r\n" \
+	 "\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n" \
+	 "\032\032frame-end\r\n\r\n" \
+	 "\032\032stopped"]
+
+set run_re [join $run_re ""]
 
 gdb_test_multiple "run" "run until main breakpoint" {
-    -re $run_re {
+    -re $run_re.*$gdb_prompt$ {
 	pass $gdb_test_name
     }
 }

base-commit: cf2ad3e66286c9f3dc8cb6cf74a2af761cb7a49f
-- 
2.26.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] [gdb/testsuite] Fix FAIL in gdb.base/annota1.exp
  2021-10-06 15:33 [PATCH 1/2] [gdb/testsuite] Refactor regexp in gdb.base/annota1.exp Tom de Vries
@ 2021-10-06 15:33 ` Tom de Vries
  2021-10-06 20:51   ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Tom de Vries @ 2021-10-06 15:33 UTC (permalink / raw)
  To: gdb-patches

On openSUSE tumbleweed I run into:
...
FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
...
due to a message related to libthread_db:
...
^Z^Zstarting^M
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib64/libthread_db.so.1".^M
^M
^Z^Zframes-invalid^M
...
which is not matched by the regexp.

Fix this by updating the regexp.

Tested on x86_64-linux.
---
 gdb/testsuite/gdb.base/annota1.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index 7a08137a1b0..13e82c176e2 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -136,6 +136,10 @@ set warning_gdb_index_re \
 	 "to use the section anyway\\."]
 set reading_re \
     "Reading \[^\r\n\]+"
+set libthread_db_re \
+    [multi_line \
+	 "\\\[Thread debugging using libthread_db enabled\\\]" \
+	 "Using host libthread_db library \[^\r\n\]+"]
 
 set run_re \
     [list \
@@ -143,7 +147,7 @@ set run_re \
 	 "\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \
 	 "\(\r\n$warning_gdb_index_re\)?" \
 	 "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
-	 "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)\)*" \
+	 "\032\032starting\(\(\r\n$reading_re\)|\(\r\n$warning_slow_re\)|\r\n$libthread_db_re\)*" \
 	 "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
 	 "\032\032breakpoint 1\r\n\r\n" \
 	 "Breakpoint 1, \r\n" \
-- 
2.26.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] [gdb/testsuite] Fix FAIL in gdb.base/annota1.exp
  2021-10-06 15:33 ` [PATCH 2/2] [gdb/testsuite] Fix FAIL " Tom de Vries
@ 2021-10-06 20:51   ` Simon Marchi
  2021-10-07  3:43     ` Tom de Vries
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Marchi @ 2021-10-06 20:51 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

On 2021-10-06 11:33 a.m., Tom de Vries via Gdb-patches wrote:
> On openSUSE tumbleweed I run into:
> ...
> FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
> ...
> due to a message related to libthread_db:
> ...
> ^Z^Zstarting^M
> [Thread debugging using libthread_db enabled]^M
> Using host libthread_db library "/lib64/libthread_db.so.1".^M
> ^M
> ^Z^Zframes-invalid^M
> ...
> which is not matched by the regexp.
>
> Fix this by updating the regexp.
>
> Tested on x86_64-linux.

The patches LGTM.  Do you know why you see this message for a single
threaded program?  Is it related to gcc/glibc now always linking against
libpthread (or libpthread being merged into libc, I don't remember)?

Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] [gdb/testsuite] Fix FAIL in gdb.base/annota1.exp
  2021-10-06 20:51   ` Simon Marchi
@ 2021-10-07  3:43     ` Tom de Vries
  0 siblings, 0 replies; 4+ messages in thread
From: Tom de Vries @ 2021-10-07  3:43 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 10/6/21 10:51 PM, Simon Marchi wrote:
> On 2021-10-06 11:33 a.m., Tom de Vries via Gdb-patches wrote:
>> On openSUSE tumbleweed I run into:
>> ...
>> FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
>> ...
>> due to a message related to libthread_db:
>> ...
>> ^Z^Zstarting^M
>> [Thread debugging using libthread_db enabled]^M
>> Using host libthread_db library "/lib64/libthread_db.so.1".^M
>> ^M
>> ^Z^Zframes-invalid^M
>> ...
>> which is not matched by the regexp.
>>
>> Fix this by updating the regexp.
>>
>> Tested on x86_64-linux.
> 
> The patches LGTM.  Do you know why you see this message for a single
> threaded program?  Is it related to gcc/glibc now always linking against
> libpthread (or libpthread being merged into libc, I don't remember)?
> 

The latter, indeed.

Thanks for the review.

- Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-07  3:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 15:33 [PATCH 1/2] [gdb/testsuite] Refactor regexp in gdb.base/annota1.exp Tom de Vries
2021-10-06 15:33 ` [PATCH 2/2] [gdb/testsuite] Fix FAIL " Tom de Vries
2021-10-06 20:51   ` Simon Marchi
2021-10-07  3:43     ` Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).