[PATCH 2/2] Include count of unexpected core files in gdb.sum summary

John Baldwin jhb@FreeBSD.org
Thu Jun 23 22:09:07 GMT 2022


On 6/23/22 12:12 PM, Pedro Alves wrote:
> On 2022-06-23 19:30, Pedro Alves wrote:
> 
>> +# Add our line to the summary line.
>> +sed "/=== gdb Summary ===/{
>> +n
>> +a\
>> +# of unexpected core files	$cores
>> +}" -i gdb.sum
> 
> I knew this -i wasn't portable as is, but then forgot to fix it before posting.  I now tried
> the script on a FreeBSD machine on the gcc compile farm, and tweaked this so it works with BSD
> seds too.  That sed invocation now looks like:
> 
>   # Add our line to the summary line.
>   sed -i'' -e "/=== gdb Summary ===/{
>   n
>   a\\
>   # of unexpected core files     $cores
>   }" gdb.sum
> 
> If -i doesn't work elsewhere, we can just do:
> 
>   sed .... < gdb.sum > gdb.sum.tmp
>   mv gdb.sum.tmp gdb.sum
> 
> Here's the updated patch.

Thanks for testing on FreeBSD. :)

I like the idea.  The only thing I see is that you might want to use a
pattern of '*core*' to look for cores instead of 'core*.'.  On BSD's at
least core files by default are named <program>.core (e.g. gdb.core) and
don't match the 'core*' glob.  If '*core*' has too many false positives
perhaps you can use 'core* *.core' as the patterns to look for?

-- 
John Baldwin


More information about the Gdb-patches mailing list