[Skiboot] [PATCH 2/2] mambo: Integrate addr2line into backtrace command

Michael Neuling mikey at neuling.org
Wed Apr 17 11:43:47 AEST 2019


Gives nice output like this:

   systemsim % bt
   pc:                             0xC0000000002BF3D4      _savegpr0_28+0x0
   lr:                             0xC00000000004E0F4      opal_call+0x10
   stack:0x000000000041FAE0        0xC00000000004F054      opal_check_token+0x20
   stack:0x000000000041FB50        0xC0000000000500CC      __opal_flush_console+0x88
   stack:0x000000000041FBD0        0xC000000000050BF8      opal_flush_console+0x24
   stack:0x000000000041FC00        0xC0000000001F9510      udbg_opal_putc+0x88
   stack:0x000000000041FC40        0xC000000000020E78      udbg_write+0x7c
   stack:0x000000000041FC80        0xC0000000000B1C44      console_unlock+0x47c
   stack:0x000000000041FD80        0xC0000000000B2424      register_console+0x320
   stack:0x000000000041FE10        0xC0000000003A5328      register_early_udbg_console+0x98
   stack:0x000000000041FE80        0xC0000000003A4F14      setup_arch+0x68
   stack:0x000000000041FEF0        0xC0000000003A0880      start_kernel+0x74
   stack:0x000000000041FF90        0xC00000000000AC60      start_here_common+0x1c

Signed-off-by: Michael Neuling <mikey at neuling.org>
---
 external/mambo/mambo_utils.tcl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/external/mambo/mambo_utils.tcl b/external/mambo/mambo_utils.tcl
index 16a5574b77..818849db1a 100644
--- a/external/mambo/mambo_utils.tcl
+++ b/external/mambo/mambo_utils.tcl
@@ -402,12 +402,14 @@ proc bt { {sp 0} } {
     upvar #0 target_p p
 
     set lr [mysim cpu $p:$c:$t display spr pc]
-    puts "pc:\t\t\t\t$lr"
+    set sym [addr2func $lr]
+    puts "pc:\t\t\t\t$lr\t$sym"
     if { $sp == 0 } {
         set sp [mysim cpu $p:$c:$t display gpr 1]
     }
     set lr [mysim cpu $p:$c:$t display spr lr]
-    puts "lr:\t\t\t\t$lr"
+    set sym [addr2func $lr]
+    puts "lr:\t\t\t\t$lr\t$sym"
 
     set msr [mysim cpu $p:$c:$t display spr msr]
     set le [ expr $msr & 1 ]
@@ -417,7 +419,8 @@ proc bt { {sp 0} } {
         set pa [ mysim cpu $p:$c:$t util dtranslate $sp ]
         set bc [ mem_display_64 $pa $le ]
         set lr [ mem_display_64 [ expr $pa + 16 ] $le ]
-        puts "stack:$pa \t$lr"
+        set sym [addr2func $lr]
+        puts "stack:$pa \t$lr\t$sym"
         if { $bc == 0 } { break }
         set sp $bc
     }
-- 
2.20.1



More information about the Skiboot mailing list