Re: [PATCH v5 07/12] gdb: amd64 linux coredump support with shadow stack.

Luis
2025-08-06T20:53:00Z

On 8/5/25 05:29, Thiago Jung Bauermann wrote:
> Hello,
>
> "Schimpe, Christina" <christina.schimpe@intel.com> writes:
>
>>>>>> +
>>>>>> + # At this point we have a couple of core files, the gcore one
>>>>>> + generated by
>>>>>> + # GDB and the one generated by the operating system. Make
>>>>>> + sure GDB can
>>>>>> + # read both correctly.
>>>>>> +
>>>>>> + if {$gcore_generated} {
>>>>>> + clean_restart $binfile
>>>>>> +
>>>>>> + with_test_prefix "gcore corefile" {
>>>>>> + check_core_file $gcore_filename $ssp_in_gcore
>>>>>> + }
>>>>>> + } else {
>>>>>> + fail "gcore corefile not generated"
>>>>>
>>>>> It's better, where possible, to avoid having pass/fail results that
>>>>> only show up down some code paths.
>>>>>
>>>>> In this case it's easy to avoid having a stray 'fail' by
>>>>> restructuring the code too:
>>>>>
>>>>> gdb_assert { $gcore_generated } "gcore corefile created"
>>>>> if { $gcore_generated } {
>>>>> ... etc ...
>>>>> }
>>>>>
>>>>> Now you'll always have either a pass or fail based on the gcore
>>>>> being generated.
>>>>
>>>> Good idea. I did that for aarch64-gcs-core.exp.
>>
>> If no OS corefile is found we will see a FAIL here.
>> The usual coredump testing doesn't fail in case the coredump file is not found.
>> So all gdb.base/corefile*.exp tests have sth. like:
>>
>> set corefile [core_find $binfile {}]
>> if {$corefile == ""} {
>> return
>> }
>>
>> This can happen in case corefiles are managed, for instance, by apport on ubuntu.
>> Do we want a different behaviour ?
>
> Interesting point. Perhaps a FAIL Isn't the best result to report in
> this case, but IMHO it would be worth reporting an UNTESTED or perhaps
> UNSUPPORTED result rather than silently returning.
>
> I don't have a strong opinion on this matter though.
>

When testing core files, I usually change the core_pattern in
/proc/sys/kernel/core_pattern so the files are properly generated and
saved. Personally I find it useful to have a FAIL output when the core
file generation didn't work.