@@ -329,6 +329,40 @@ proc doff { opt } {
simdebug set $opt 0
}
+# skisym and linsym return the address of a symbol, looked up from
+# the relevant System.map or skiboot.map file.
+proc linsym { name } {
+ global linux_symbol_map
+
+ # create a regexp that matches the symbol name
+ set base {([[:xdigit:]]*) (.)}
+ set exp [concat $base " $name"]
+ set ret ""
+
+ foreach {line addr type} [regexp -line -inline $exp $linux_symbol_map] {
+ set ret "0x$addr"
+ }
+
+ return $ret
+}
+
+# skisym factors in skiboot's load address
+proc skisym { name } {
+ global skiboot_symbol_map
+ global mconf
+
+ set base {([[:xdigit:]]*) (.)}
+ set exp [concat $base " $name"]
+ set ret ""
+
+ foreach {line addr type} [regexp -line -inline $exp $skiboot_symbol_map] {
+ set actual_addr [expr "0x$addr" + $mconf(boot_load)]
+ set ret [format "0x%.16x" $actual_addr]
+ }
+
+ return $ret
+}
+
proc start_qtrace { { qtfile qtrace.qt } } {
global env
@@ -105,6 +105,22 @@ if {![info exists of::encode_compat]} {
# allows running mambo in another directory to the one skiboot.tcl is in.
if { [file exists mambo_utils.tcl] } then {
source mambo_utils.tcl
+
+ if { [info exists env(VMLINUX_MAP)] } {
+ global linux_symbol_map
+
+ set fp [open $env(VMLINUX_MAP) r]
+ set linux_symbol_map [read $fp]
+ close $fp
+ }
+
+ if { [info exists env(SKIBOOT_MAP)] } {
+ global skiboot_symbol_map
+
+ set fp [open $env(SKIBOOT_MAP) r]
+ set skiboot_symbol_map [read $fp]
+ close $fp
+ }
}
#
Adds the skisym and linsym commands which can be used to find the address of a Linux or Skiboot symbol. To function this requires the user to provide the SKIBOOT_MAP and VMLINUX_MAP environmental variables which indicate which skiboot.map and System.map files should be used. Examples: Look up a symbol address: systemsim % skisym .load_and_boot_kernel 0x0000000030013a08 Set a breakpoint there: systemsim % b [skisym .load_and_boot_kernel] breakpoint set at [0:0]: 0x0000000030013a08 (0x0000000030013A08) Enc:0x7D800026 : mfcr r12 Signed-off-by: Oliver O'Halloran <oohall@gmail.com> --- external/mambo/mambo_utils.tcl | 34 ++++++++++++++++++++++++++++++++++ external/mambo/skiboot.tcl | 16 ++++++++++++++++ 2 files changed, 50 insertions(+)