[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
pkg 1d02e7a48b 02/76: Add xprint command
From: |
Gerd Moellmann |
Subject: |
pkg 1d02e7a48b 02/76: Add xprint command |
Date: |
Fri, 21 Oct 2022 00:16:07 -0400 (EDT) |
branch: pkg
commit 1d02e7a48ba1705c4102ea15c42425fe607cb203
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>
Add xprint command
---
etc/emacs_lldb.py | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/etc/emacs_lldb.py b/etc/emacs_lldb.py
index 15efcec057..a8a0f1c08b 100644
--- a/etc/emacs_lldb.py
+++ b/etc/emacs_lldb.py
@@ -137,7 +137,8 @@ class Lisp_Object:
self.value = self.eval(f"((EMACS_INT) {self.unsigned}) "
f">> (GCTYPEBITS - 1)")
else:
- assert False, "Unknown Lisp type"
+ msg = f"Unknown Lisp type {self.lisp_type}"
+ assert False, msg
# Create an SBValue for EXPR with name NAME.
def create_value(self, name, expr):
@@ -168,10 +169,32 @@ class Lisp_Object:
return Lisp_Object(name).get_string_data()
return None
+ def is_nil(self):
+ return self.lisp_type == None
+
+ # Get the package of a symbol or None if not a symbol.
+ def get_symbol_package(self):
+ if self.lisp_type == "Lisp_Symbol":
+ value = self.value.GetValueForExpressionPath("->u.s.package")
+ package = Lisp_Object(value)
+ if package.pvec_type:
+ name =
Lisp_Object(package.value.GetValueForExpressionPath("->name"))
+ return name.get_string_data()
+ return None
+
# Return a summary string for this object.
def summary(self):
return str(self.value)
+ def dump(self, result):
+ if self.lisp_type == "Lisp_Symbol":
+ result.AppendMessage(f"package: {self.get_symbol_package()}")
+ result.AppendMessage(f"name: {self.get_symbol_name()}")
+ elif self.lisp_type == "Lisp_String":
+ result.AppendMessage(str(self.get_string_data()))
+ else:
+ result.AppendMessage(self.summary())
+
########################################################################
# LLDB Commands
@@ -199,6 +222,12 @@ def xdebug_print(debugger, command, result, internal_dict):
"""Print Lisp_Objects using safe_debug_print()"""
debugger.HandleCommand(f"expr safe_debug_print({command})")
+def xprint(debugger, command, ctx, result, internal_dict):
+ frame = ctx.GetFrame()
+ lisp_obj = Lisp_Object(frame.EvaluateExpression(command))
+ lisp_obj.dump(result)
+
+
########################################################################
# Formatters
@@ -248,6 +277,7 @@ def enable_type_category(debugger, category):
def __lldb_init_module(debugger, internal_dict):
define_command(debugger, xbacktrace)
define_command(debugger, xdebug_print)
+ define_command(debugger, xprint)
define_type_summary(debugger, "Lisp_Object", type_summary_Lisp_Object)
enable_type_category(debugger, "Emacs")
print('Emacs debugging support has been installed.')
- pkg bb6b5db2b7 24/76: Dpn't assume symbol-name of keywords starts with colon, (continued)
- pkg bb6b5db2b7 24/76: Dpn't assume symbol-name of keywords starts with colon, Gerd Moellmann, 2022/10/21
- pkg c025885c33 41/76: symbol-name returning ':' for keywords, Gerd Moellmann, 2022/10/21
- pkg 8561667124 33/76: Handle packages in completion, Gerd Moellmann, 2022/10/21
- pkg df9417ac57 66/76: Remove Lisp_Symbol::external, Gerd Moellmann, 2022/10/21
- pkg 85bd8cfcdb 18/76: Mapping over symbols in a package, mapatoms, Gerd Moellmann, 2022/10/21
- pkg 62c7059adc 19/76: Initialize package system earlier, Gerd Moellmann, 2022/10/21
- pkg a19917468c 04/76: Don't fix symbols here, Gerd Moellmann, 2022/10/21
- pkg 072e89afa1 23/76: Use make-package instead of make-vector, Gerd Moellmann, 2022/10/21
- pkg f6b80ef5a5 25/76: Blabla, Gerd Moellmann, 2022/10/21
- pkg 2ed1ac6639 09/76: Fixing stuff, Gerd Moellmann, 2022/10/21
- pkg 1d02e7a48b 02/76: Add xprint command,
Gerd Moellmann <=
- pkg a3f99fde48 22/76: Remove Lisp_Symbol::next pointer, Gerd Moellmann, 2022/10/21
- pkg 2518bc249c 39/76: Fix printing symbols, Gerd Moellmann, 2022/10/21
- pkg bbb2609103 40/76: Recognize vectors as obarrays, Gerd Moellmann, 2022/10/21
- pkg 76d59f8a03 60/76: Fix missing ')', Gerd Moellmann, 2022/10/21
- pkg 73b617eaa9 64/76: Change package symbol table layout, Gerd Moellmann, 2022/10/21
- pkg 0976c09890 37/76: Fix printing of confusing symbol names, Gerd Moellmann, 2022/10/21
- pkg aaf12c12b6 32/76: Some scribbling, Gerd Moellmann, 2022/10/21
- pkg 963de7cafe 35/76: More scribbling, Gerd Moellmann, 2022/10/21
- pkg 90c070fec6 59/76: Restore obarray.el to return vectors, Gerd Moellmann, 2022/10/21
- pkg 74da61ff09 74/76: Remove a call to pkg_break, Gerd Moellmann, 2022/10/21