This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [committed][gdb/testsuite] Fix gdb.base/define.exp with check-read1


Sorry about this and thanks for fixing. I'll be adding check-read1 to my
test case checklist.

Rich

On 7/29/19 10:38 AM, Tom de Vries wrote:
> [ was: Re: [PATCH v2] Restore original GDB prompt in define.exp ]
> On 09-07-19 09:17, Richard Bunt wrote:
>> Restore original GDB prompt in define.exp
>>
>> define.exp will fail on a GDB which has set a custom prompt to identify
>> itself.  This is because the test resets the prompt to a hard coded
>> "(gdb)" but then verifies the success of this against the value in
>> $gdb_prompt, which is set to the custom prompt.
>>
>> The original approach to fix this involved resetting the prompt to
>> $gdb_prompt rather than a hard coded "(gdb)". However it was noted during
>> review that $gdb_prompt is a regular expression rather than a string.
>> This is problematic because in general the prompt would be reset to a
>> regular expression rather than an instance of a string accepted by said
>> regular expression.
>>
>> The fix used in commit avoids the above issue by capturing the literal
>> prompt from running "show prompt" and uses this literal to restore the
>> previous prompt.
>>
>> Regression tested with GCC 7.3.0 on x86_64, ppc64le, aarch64.
>>
>> gdb/testsuite/ChangeLog:
>>
>> 2019-07-04  Richard Bunt  <richard.bunt@arm.com>
>> 	Stephen Roberts  <stephen.roberts@arm.com>
>>
>> 	* gdb.base/define.exp: Restore original prompt.
>>
>> ---
>>  gdb/testsuite/gdb.base/define.exp | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp
>> index 0590da9..e8508b8 100644
>> --- a/gdb/testsuite/gdb.base/define.exp
>> +++ b/gdb/testsuite/gdb.base/define.exp
>> @@ -283,6 +283,15 @@ gdb_test_multiple "define target hookpost-testsuite" "" {
>>
>>  gdb_test "target testsuite" "one\r\nhello\r\ntwo" "target testsuite with hooks"
>>
>> +# Save the GDB prompt so it can be restored to the original value later.
>> +set prior_prompt ""
>> +gdb_test_multiple "show prompt" "save gdb_prompt" {
>> +    -re "Gdb's prompt is \"($gdb_prompt) \"\.\[\r\n\]*$gdb_prompt $" {
>> +	set prior_prompt $expect_out(1,string)
>> +	pass "save gdb_prompt"
>> +    }
>> +}
>> +
>>  # This is a quasi-define command: Verify that the user can redefine
>>  # GDB's gdb_prompt.
>>  #
>> @@ -292,7 +301,7 @@ gdb_test_multiple "set prompt \\(blah\\) " "set gdb_prompt" {
>>      }
>>  }
>>
>> -gdb_test_multiple "set prompt \\(gdb\\) " "reset gdb_prompt" {
>> +gdb_test_multiple "set prompt $prior_prompt " "reset gdb_prompt" {
>>      -re "$gdb_prompt $" {
>>  	pass "reset gdb_prompt"
>>      }
>>
> 
> This seems to have caused a check-read1 regression.
> 
> Fixed by patch below, committed to trunk.
> 
> Thanks,
> - Tom
> 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]