From 3a2eb806f820458749111b3a78807d349d73696d Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 8 May 2020 16:39:34 +0200 Subject: Misc: Made gdb crash reporting script more automation friendly * Don't block on successful exit * Generate timestamped filenames to avoid overwriting old logs (cherry picked from commit 58d3f17430bb0ab64c9da157bdbc842098d96370) --- contrib/debugger/crashreport.gdb | 41 +++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'contrib') diff --git a/contrib/debugger/crashreport.gdb b/contrib/debugger/crashreport.gdb index 7ad2e84a483..894cafa5015 100644 --- a/contrib/debugger/crashreport.gdb +++ b/contrib/debugger/crashreport.gdb @@ -1,5 +1,5 @@ set logging overwrite on -set logging file backtrace.log +set logging file backtrace.log.temp set style enabled off set height unlimited set width unlimited @@ -9,19 +9,30 @@ set pagination 0 set logging on echo \n--- DEBUG: --- START\n\n run -echo \n--- DEBUG: BACKTRACE FULL\n -if TrinityAssertionFailedMessage != 0 - printf "%s\n", TrinityAssertionFailedMessage +# check if exited normally +if $_isvoid($_exitcode) + echo \n--- DEBUG: BACKTRACE FULL\n + # print assertion message if this is ASSERT crash + if TrinityAssertionFailedMessage != 0 + printf "%s\n", TrinityAssertionFailedMessage + end + echo \n + backtrace full + echo \n--- DEBUG: INFO REGISTERS\n\n + info registers + echo \n--- DEBUG: CALLS (x/16i $pc)\n\n + x/16i $pc + echo \n--- DEBUG: THREAD APPLY ALL BACKTRACE\n + thread apply all backtrace + echo \n--- DEBUG: --- STOP\n\n + echo Generated by crashreport.gdb script version 1.4\n + set logging off + + # rename log file to avoid it getting overwritten by restart scripts + shell mv backtrace.log.temp backtrace_$(date +%Y-%m-%d-%T).log +else + # normal exit, cleanup temp file + set logging off + shell rm backtrace.log.temp end -echo \n -backtrace full -echo \n--- DEBUG: INFO REGISTERS\n\n -info registers -echo \n--- DEBUG: CALLS (x/16i $pc)\n\n -x/16i $pc -echo \n--- DEBUG: THREAD APPLY ALL BACKTRACE\n -thread apply all backtrace -echo \n--- DEBUG: --- STOP\n\n -echo Generated by crashreport.gdb script version 1.3\n -set logging off quit -- cgit v1.2.3