You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2021/02/24 11:09:16 UTC

[mynewt-core] 03/05: hw/scripts: Allow GDB script for MTB to be used on crash dumps

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 27b289b548260a50b25d7e8785788387a1b85efb
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Fri Feb 5 13:22:16 2021 +0100

    hw/scripts: Allow GDB script for MTB to be used on crash dumps
    
    If 'mtb_state_at_crash' symbol is present in core dump MTB script
    can be used on crash dump files to see what lead to crash.
---
 hw/scripts/micro-trace-buffer.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/scripts/micro-trace-buffer.py b/hw/scripts/micro-trace-buffer.py
index 5abc402..8806e73 100644
--- a/hw/scripts/micro-trace-buffer.py
+++ b/hw/scripts/micro-trace-buffer.py
@@ -37,6 +37,12 @@ class MicroTraceBuffer(gdb.Command):
 
     def __init__(self):
         super(MicroTraceBuffer, self).__init__("mtb", gdb.COMMAND_STATUS, gdb.COMPLETE_NONE)
+        try:
+            mtb_state_at_crash = gdb.lookup_symbol("mtb_state_at_crash")[0]
+            if mtb_state_at_crash is not None and int(gdb.parse_and_eval('mtb_state_at_crash.mtb_base_reg')) != 0:
+                self._mtb_base_addr = int(gdb.parse_and_eval('mtb_state_at_crash').address)
+        except gdb.error:
+            pass
         if colorama:
             self._colors = {"A": colorama.Fore.BLUE,
                             "D": colorama.Fore.RESET,