[RFC PATCH] gdb/testsuite: fix gdb.base/info-types*.exp when no libc debug info

Tom de Vries tdevries@suse.de
Wed Jun 23 21:51:32 GMT 2021


On 6/23/21 5:36 PM, Simon Marchi wrote:
>> -# Match output of COMMAND line-by-line, using PATTERNS.
>> +# Match output of COMMAND using re.  Read output line-by-line.
> 
> re -> RE
> 
>>  # Report pass/fail with MESSAGE.
>> -
>> -proc gdb_test_lines { command message patterns } {
>> +# For a command foo with output
>> +#   (gdb) foo^M
>> +#   <line1>^M
>> +#   <line2>^M
>> +#   (gdb)
>> +# the portion matched using re is:
>> +#   <line1>^M
>> +#   <line2>^M
> 
> To summarize, the intent is that it works pretty much like gdb_test, but
> it consumes the output as it is produced to avoid timing out?
> 

Indeed, the only difference is in scope of match compared to gdb_test:
- matching starts at the line after the prompt, so it skips the command
- there's no implicit .* before the gdb prompt, so we can use anchor '$'
  in a meaningful way.

Committed.

Thanks,
- Tom.

>> +    if { [regexp $re $lines] } {
>> +	pass $message
>> +    } else {
>> +	fail $message
>> +    }
> 
> That could probably use gdb_assert:
> 
>   gdb_assert { [regexp $re $lines] } $message
> 
> But otherwise, LGTM.
> 
> Simon
> 


More information about the Gdb-patches mailing list