aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2016-07-20 15:52:54 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-07-20 18:52:43 +1000
commit50ffe5e499d76ffd813154c0cfbe0d1b01866d49 (patch)
treec86d51b89ade0e9bfde7c61e1bceb6c859eb4968
parenta7e2b69fc66aecefa45c52e5486c55d3743f1418 (diff)
downloadskiboot-50ffe5e499d76ffd813154c0cfbe0d1b01866d49.zip
skiboot-50ffe5e499d76ffd813154c0cfbe0d1b01866d49.tar.gz
skiboot-50ffe5e499d76ffd813154c0cfbe0d1b01866d49.tar.bz2
mambo: Fix bt command and add little endian support
This fixes the bt (back trace) command which had bit rot. It also adds little endian support. Format looks like this: systemsim % bt pc: 0x000000003007F270 lr: 0x000000003007EFAC stack:0x0000000031C03B60 0x0000000031C03BF0 stack:0x0000000031C03C00 0x0000000030022F44 stack:0x0000000031C03C90 0x0000000030023000 stack:0x0000000031C03D20 0x0000000030039540 stack:0x0000000031C03E30 0x00000000300145BC stack:0x0000000031C03F00 0x000000003000259C Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--external/mambo/mambo_utils.tcl40
1 files changed, 32 insertions, 8 deletions
diff --git a/external/mambo/mambo_utils.tcl b/external/mambo/mambo_utils.tcl
index 65bf036..cf156df 100644
--- a/external/mambo/mambo_utils.tcl
+++ b/external/mambo/mambo_utils.tcl
@@ -219,27 +219,51 @@ proc egdb { {t 0} } {
gdb $t
}
+proc mem_display_64_le { addr } {
+ set data 0
+ for {set i 0} {$i < 8} {incr i} {
+ set data [ expr $data << 8 ]
+ set l [ mysim memory display [ expr $addr+7-$i ] 1 ]
+ set data [ expr $data | $l ]
+ }
+ return [format 0x%X $data]
+}
+
+proc mem_display_64 { addr le } {
+ if { $le } {
+ return [ mem_display_64_le $addr ]
+ }
+ # mysim memory display is big endian
+ return [ mysim memory display $addr 8 ]
+}
+
proc bt { {sp 0} } {
set t 0
if { $sp < 16 } {
set t $sp
set sp 0
}
+ set lr [mysim cpu 0:$t display spr pc]
+ puts "pc:\t\t\t\t$lr"
if { $sp == 0 } {
set sp [mysim cpu 0:$t display gpr 1]
}
set lr [mysim cpu 0:$t display spr lr]
- puts "backtrace thread $t, stack $sp"
- i $lr
- while { 1 == 1 } {
+ puts "lr:\t\t\t\t$lr"
+
+ set msr [mysim cpu 0:$t display spr msr]
+ set le [ expr $msr & 1 ]
+
+ # Limit to 200 in case of an infinite loop
+ for {set i 0} {$i < 200} {incr i} {
set pa [ mysim util dtranslate $sp ]
- set bc [ mysim memory display $pa 8 ]
- set cr [ mysim memory display [expr $pa+8] 8 ]
- set lr [ mysim memory display [expr $pa+16] 8 ]
- i $lr
- if { $bc == 0 } { return }
+ set bc [ mem_display_64 $pa $le ]
+ set lr [ mem_display_64 [ expr $pa + 16 ] $le ]
+ puts "stack:$pa \t$lr"
+ if { $bc == 0 } { break }
set sp $bc
}
+ puts ""
}
proc ton { } {mysim mode turbo }