[PATCH v5] [gdb/testsuite] New test: gdb.base/check-errno.exp

Pedro Alves pedro@palves.net
Mon May 13 14:34:32 GMT 2024


Whoops, I notice now that I sent it off list by mistake.  Replying again to add it to the list.
While at it, since I'm back on the PC, commenting in line too -- see further below.

On 2024-05-12 11:24, Pedro Alves wrote:
> Sent from phone sorry for top reply.
> 
> It's because you are missing a .* at the end of the patterns.  Same as you would need if you used gdb_test. 
> 
> Also .* at the beginning of the pattern is unnecessary, it's already implicit.
> 
> 
> A 11 de maio de 2024 22:57:41 WEST, Kevin Buettner <kevinb@redhat.com> escreveu:
> 
>     Hi Pedro,
> 
>     Thanks for your review!
> 
>     On Fri, 10 May 2024 14:08:24 +0100
>     Pedro Alves <pedro@palves.net> wrote:
> 
>         Actually, you can also use -wrap to simplify further:
> 
>         gdb_test_multiple "ptype errno" "" {
>         -re -wrap "type = int" {
>         pass $gdb_test_name
>         }
> 
> 
>     I've made all of your suggested fixes, except for the one above.
> 
>     While I can use -wrap for the above RE, if I also use it for the next
>     RE, I see failures when using check-read1 when testing on a machine
>     without glibc debuginfo. For the moment, I've decided against using
>     -wrap, but if I get time, I'll revisit it and try to understand why
>     it's failing.
> 
>     This isn't working for me:
> 
>     gdb_test_multiple "ptype errno" "check errno type availability" {
>     -re -wrap "type = int" {
>     pass $gdb_test_name
>     }
>     -re -wrap "type = .*no debug info" {

This should be:

      -re -wrap "type = .*no debug info.*" {

Note you had the .* in the original version too:

      -re "type = .*no debug info.*$::gdb_prompt $" {

It's the same transformation you would do if you used gdb_test instead.

The .* wasn't needed for the "type = int" case because you didn't have it
in the original version either:

      -re "type = int\r\n$::gdb_prompt $" {

This one:

      -re -wrap ".*Cannot find thread-local variables on this target" {

should be

      -re -wrap ".*Cannot find thread-local variables on this target.*" {

for the same reason -- the original had a .* :

      -re ".*Cannot find thread-local storage.*$::gdb_prompt $" {

and really, it should be:

     -re -wrap "Cannot find thread-local variables on this target.*" {

... as the leading ".*" doesn't add anything.  IMHO, it can misleads
newcomers into thinking that not adding a ".*" at the start gives you
a tighter match.

Pedro Alves



More information about the Gdb-patches mailing list