changeset 3046:e3e858889ab6

scripts/os9.gdb: Add "smart" single step command Also add online documentation to all commands!
author Tormod Volden <debian.tormod@gmail.com>
date Sat, 24 Jan 2015 23:15:48 +0100
parents f4f1066c8096
children a951ab0b3003
files scripts/os9.gdb
diffstat 1 files changed, 53 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/os9.gdb	Sat Jan 24 01:16:13 2015 +0100
+++ b/scripts/os9.gdb	Sat Jan 24 23:15:48 2015 +0100
@@ -1,16 +1,17 @@
 # gdb scripts for NitrOS-9 (or OS-9)
 # Copyright 2014  Tormod Volden
 
-# os9_mdir prints out registered modules, like os9 mdir command
 
-# pretty-print of registers on every halt,
-# and update external source code window
 define hook-stop
 	printf "S=%04x X=%04x Y=%04x U=%04x A=%02x B=%02x CC=%02x PC=%04x ", $s, $x, $y, $u, $a, $b, $cc , $pc
 	os9_mwhere
 end
 
-# print name of module at given address
+document hook-stop
+ Pretty-print of registers on every halt,
+ and updates external source code window.
+end
+
 define os9_mname
 	set $mname = (char*)$arg0 + *((int*)$arg0 + 2)
 	while 1
@@ -24,7 +25,10 @@
 	end
 end
 
-# print details of module at given address
+document os9_mname
+ Print name of module at given address
+end
+
 define os9_mident
 	set $m = (int*)$arg0
 	set $msize = *($m + 1)
@@ -38,7 +42,10 @@
 	printf "\n"
 end
 
-# list all registered modules
+document os9_mident
+ Print details of module at given address.
+end
+
 define os9_mdir
 	printf "addr size ty name\n"
 	set $mt = 0x300
@@ -50,7 +57,10 @@
 	end
 end
 
-# finds module at given address, sets $mstart
+document os9_mdir
+ List all modules registered in module directory.
+end
+
 define os9_mwhich
 	set $pc_reg = $arg0
 	set $mt = 0x300
@@ -69,10 +79,10 @@
 	end
 end
 
+document os9_mwhich
+ (internal) Finds module at given address, sets $mstart quietly.
+end
 
-# Look up source code line for given address.
-# Requires assembly list files named by CRC in current directory
-# and "gvim" to display listing and highlight line.
 define os9_mwhere
 	if ($argc == 1)
 		set $pc_reg = $arg0
@@ -90,8 +100,40 @@
 	end
 end
 
-# Set breakpoint in current module, at given offset
+document os9_mwhere
+ Look up source code line for given address.
+ Requires assembly list files named by CRC in current directory
+ and "gvim" to display listing and highlight line.
+end
+
 define b9
 	os9_mwhich $pc
 	eval "hbreak *0x%x", (int)$mstart + $arg0
 end
+
+document b9
+ Set breakpoint in current module, at given offset.
+end
+
+define ss
+	set $steps = 0
+	if (*$pc == 0x103f)
+		set $steps = 3
+	end
+	if (*(char*)$pc == 0x8d)
+		set $steps = 2
+	end
+	if (*(char*)$pc == 0x17)
+		set $steps = 3
+	end
+	if ($steps != 0)
+		thbreak *($pc + $steps)
+		cont
+        else
+		stepi
+	end
+end
+
+document ss
+ Single step, but skips OS-9 SWI, bsr and lbsr.
+end