Tools to classify / uniquify core dumps or stack traces?

Aurelian Melinte
Thu Aug 1 23:05:00 GMT 2013

On 01/08/2013 3:35 PM, Jan Kratochvil wrote:
> On Thu, 01 Aug 2013 21:26:21 +0200, Paul Smith wrote:
>> Hi all.  I've got an environment where I'm getting lots of core dumps
>> from various places and it's very tedious to go through them and
>> determine which ones are for unique problems, and which are essentially
>> duplicates (same bug causing the core dump).
>> I was thinking of throwing together some kind of Perl or Python script
>> that could compare and categorize stack traces, but I thought surely
>> someone must have done something like this before.
>> Anyone have any pointers or thoughts about something like this?

I use a home-brewed script - pasted below - to turn a collection of core 
dumps into a report for each core. Then I sift manually through but 
still much faster than analyzing core by core.



# A script to extract core-file informations

if  [  $#  -ne  1  ]
   echo  "Usage:`basename $0`  <for-binary-image>"
   exit  -1

# Today and yesterdays cores
cores=`find  .-name  '*.core'  -mtime  -1`

#cores=`find . -name '*.core'`

for  corein  $cores
   rm  $gdblogfile

   bininfo=`ls  -l  $binimg`
   coreinfo=`ls  -l  $core`

   gdb  -batch  \
       -ex  "set logging file$gdblogfile"  \
       -ex  "set logging on"  \
       -ex  "set pagination off"  \
       -ex  "printf\"**\n** Process info for$binimg  -$core  \n** Generated`date`\n\""  \
       -ex  "printf\"**\n**$bininfo  \n**$coreinfo\n**\n\""  \
       -ex  "file$binimg"  \
       -ex  "core-file$core"  \
       -ex  "bt"  \
       -ex  "info proc"  \
       -ex  "printf\"*\n* Libraries\n*\n\""  \
       -ex  "info sharedlib"  \
       -ex  "printf\"*\n* Memory map\n*\n\""  \
       -ex  "info target"  \
       -ex  "printf\"*\n* Registers\n*\n\""  \
       -ex  "info registers"  \
       -ex  "printf\"*\n* Current instructions\n*\n\""  -ex  "x/16i\$pc"  \
       -ex  "printf\"*\n* Threads (full)\n*\n\""  \
       -ex  "info threads"  \
       -ex  "bt"  \
       -ex  "thread apply all bt full"  \
       -ex  "printf\"*\n* Threads (basic)\n*\n\""  \
       -ex  "info threads"  \
       -ex  "thread apply all bt"  \
       -ex  "printf\"*\n* Done\n*\n\""  \
       -ex  "quit"

More information about the Gdb mailing list