Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Make gdb.base/annota1.exp more robust
Date: Fri, 8 Apr 2022 11:04:05 +0200	[thread overview]
Message-ID: <4a85ab96-c18f-9409-0b8b-68caca2e3e74@suse.de> (raw)
In-Reply-To: <d1c39b8f-5181-dba0-42b5-df7c96aacaf5@polymtl.ca>

[-- Attachment #1: Type: text/plain, Size: 3118 bytes --]

On 4/7/22 20:38, Simon Marchi wrote:
> On 2022-04-05 09:47, Tom de Vries via Gdb-patches wrote:
>> Hi,
>>
>> On openSUSE Tumbleweed I run into:
>> ...
>> FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
>> ...
>>
>> The problem is that the libthread_db message occurs at a location where it's
>> not expected:
>> ...
>> Starting program: outputs/gdb.base/annota1/annota1 ^M
>> ^M
>> ^Z^Zstarting^M
>> ^M
>> ^Z^Zframes-invalid^M
>> [Thread debugging using libthread_db enabled]^M
>> Using host libthread_db library "/lib64/libthread_db.so.1".^M
>> ^M
>> ^Z^Zbreakpoints-invalid^M
>> ^M
>> ...
>>
>> Fix this by making the matching more robust:
>> - rewrite the regexp such that each annotation is on a single line,
>>    starting with \r\n\032\032 and ending with \r\n
>> - add a regexp variable optional_re, that matches all possible optional
>>    output, and use it as a separator in the first part of the regexp
>>
>> Tested on x86_64-linux.
>>
>> Any comments?
>>
>> Thanks,
>> - Tom
> 
> Hi Tom,
> 
> This introduces a failure on Ubuntu 20.04 and on Arch Linux.
> 
>      PASS: gdb.base/annota1.exp: breakpoint info
>      run^M
>      ^M
>      ^Z^Zpost-prompt^M
>      Starting program: /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.base/annota1/annota1 ^M
>      ^M
>      ^Z^Zbreakpoints-invalid^M
>      ^M
>      ^Z^Zstarting^M
>      ^M
>      ^Z^Zframes-invalid^M
>      ^M
>      ^Z^Zbreakpoints-invalid^M
>      ^M
>      ^Z^Zbreakpoint 1^M
>      ^M
>      Breakpoint 1, ^M
>      ^Z^Zframe-begin 0 0x555555555183^M
>      ^M
>      ^Z^Zframe-function-name^M
>      main^M
>      ^Z^Zframe-args^M
>       ()^M
>      ^Z^Zframe-source-begin^M
>       at ^M
>      ^Z^Zframe-source-file^M
>      /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/annota1.c^M
>      ^Z^Zframe-source-file-end^M
>      :^M
>      ^Z^Zframe-source-line^M
>      15^M
>      ^Z^Zframe-source-end^M
>      ^M
>      ^M
>      ^Z^Zsource /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/annota1.c:15:103:beg:0x555555555183^M
>      ^M
>      ^Z^Zframe-end^M
>      ^M
>      ^Z^Zstopped^M
>      ^M
>      ^Z^Zpre-prompt^M
>      (gdb) ^M
>      ^Z^Zprompt^M
>      FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
> 
> The issue is the now hardcoded order of "breakpoints-invalid" and
> "frames-invalid" order in the test regexp, where the output happens in
> the other order.  Before your change, we had:
> 
> 	 "\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n" \
> 
> Meaning we didn't care about the order of those, and we didn't care if
> we saw them or not.  The change below moves those lines in optional_re,
> and fixes things on my side.
> 

Hi Simon,

thanks for reporting this.

I managed to reproduce on openSUSE Leap 15.3 with target board 
unix/-pie/-fPIE, and on ubuntu 20.04.

AFAICT, the issue is not a different order, but an additional 
annotation, and looking at the log you've posted above, I see the same.

I've wrote attached patch which fixes it, I've tested on both openSUSE 
and Ubuntu.

WDYT?

Thanks,
- Tom

[-- Attachment #2: 0001-gdb-testsuite-Fix-gdb.base-annota1.exp-with-pie.patch --]
[-- Type: text/x-patch, Size: 1229 bytes --]

[gdb/testsuite] Fix gdb.base/annota1.exp with pie

Since commit 359efc2d894 ("[gdb/testsuite] Make gdb.base/annota1.exp more
robust") we see this fail with target board unix/-fPIE/-pie:
...
FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout)
...

The problem is that the commit makes the number and order of matched
annotations fixed, while between target boards unix and unix/-fPIE/-pie there
is a difference:
...
 \032\032post-prompt
 Starting program: outputs/gdb.base/annota1/annota1

+\032\032breakpoints-invalid
+
 \032\032starting

 \032\032frames-invalid
...

Fix this by optionally matching the additional annotation.

Tested on x86_64-linux.

---
 gdb/testsuite/gdb.base/annota1.exp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index 40a13e7cf19..ac6ad6478f4 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -159,6 +159,8 @@ set run_re \
 	 "\r\n\032\032post-prompt\r\n" \
 	 "Starting program: $binexp \r\n" \
 	 $optional_re \
+	 "\(\r\n\032\032breakpoints-invalid\r\n\)?" \
+	 $optional_re \
 	 "\r\n\032\032starting\r\n" \
 	 $optional_re \
 	 "\r\n\032\032frames-invalid\r\n" \

  reply	other threads:[~2022-04-08  9:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-05 13:47 Tom de Vries via Gdb-patches
2022-04-07 14:10 ` Tom Tromey
2022-04-07 18:38 ` Simon Marchi via Gdb-patches
2022-04-08  9:04   ` Tom de Vries via Gdb-patches [this message]
2022-04-11  8:43     ` Tom de Vries via Gdb-patches
2022-04-11 15:21       ` Simon Marchi via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a85ab96-c18f-9409-0b8b-68caca2e3e74@suse.de \
    --to=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tdevries@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox