/usr/share/openmsx/scripts/showdebuggable.tcl is in openmsx-data 0.8.2-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | namespace eval showdebuggable {
#
# show_debuggable
#
set_help_text showdebuggable \
{Print content of debuggable nicely formatted
Usage:
showdebuggable <debuggable> <address> [<linecount>]
}
set_tabcompletion_proc showdebuggable [namespace code tab_showdebuggable]
proc tab_showdebuggable {args} {
if {[llength $args] == 2} {
return [debug list]
}
}
proc showdebuggable_line {debuggable address} {
set size [debug size $debuggable]
set num [expr {(($address + 16) <= $size) ? 16 : ($size - $address)}]
set mem "[debug read_block $debuggable $address $num]"
binary scan $mem c* values
set hex ""
foreach val $values {
append hex [format "%02x " [expr {$val & 0xff}]]
}
set pad [string repeat " " [expr {16 - $num}]]
set asc [regsub -all {[^ !-~]} $mem {.}]
return [format "%04x: %s%s %s\n" $address $hex $pad $asc]
}
proc showdebuggable {debuggable {address 0} {lines 8}} {
set result ""
for {set i 0} {$i < $lines} {incr i} {
if {$address >= [debug size $debuggable]} break
append result [showdebuggable_line $debuggable $address]
incr address 16
}
return $result
}
# Some stuff for backwards compatibility. Do we want to deprecate them?
# I prefer to keep this as a convenience function.
set_help_text showmem \
{Print the content of the CPU visible memory nicely formatted
This is a shortcut for 'showdebuggable memory <address>'.
Usage:
showmem <address> [<linecount>]
}
proc showmem {{address 0} {lines 8}} {
showdebuggable memory $address $lines
}
namespace export showdebuggable
namespace export showmem
} ;# namespace showdebuggable
namespace import showdebuggable::*
|