summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-04-16 16:59:01 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-04-16 16:59:01 -0700
commitb5a859dd2188e51abdbbbcb68af1a299605f92dd (patch)
tree85deb615a36b96ccc1173cd126afd0e8fd8a3e30
parent0e3992bb2c96fea651067698572f855949ebe6f5 (diff)
downloadtxr-b5a859dd2188e51abdbbbcb68af1a299605f92dd.tar.gz
txr-b5a859dd2188e51abdbbbcb68af1a299605f92dd.tar.bz2
txr-b5a859dd2188e51abdbbbcb68af1a299605f92dd.zip
debugging: disassemble vm code out of debugger.
* lib.c (dis): New function that we can call from gdb to disassemble a VM function, if we know its address. I've done this manually way too many times. * lib.h (dis): Declared.
-rw-r--r--lib.c13
-rw-r--r--lib.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index dcf9e870..58b05f0a 100644
--- a/lib.c
+++ b/lib.c
@@ -13098,3 +13098,16 @@ void d(val obj)
void breakpt(void)
{
}
+
+/*
+ * Function for dissembling VM functions
+ * when debugging in gdb.
+ */
+
+void dis(val obj)
+{
+ val sym = intern(lit("disassemble"), user_package);
+ val fun = cdr(if2(sym, lookup_fun(nil, sym)));
+ if (fun)
+ funcall1(fun, obj);
+}
diff --git a/lib.h b/lib.h
index cd357004..e4040bc5 100644
--- a/lib.h
+++ b/lib.h
@@ -1217,6 +1217,7 @@ int compat_fixup(int compat_ver);
void dump(val obj, val stream);
void d(val obj);
void breakpt(void);
+void dis(val obj);
#define nil convert(obj_t *, 0)