Extend support for debugging Emacs with LLDB
* etc/emacs_lldb.py: Handle case of Lisp_Object being a struct (--enable-lisp-type-checking). Enable Emacs type category by default. Expand children in type summary for Lisp_Object.
This commit is contained in:
parent
3892ec6bb2
commit
ffe4a5dac0
1 changed files with 19 additions and 5 deletions
|
@ -75,15 +75,24 @@ class Lisp_Object:
|
|||
|
||||
# Object construction/initialization.
|
||||
def __init__(self, lisp_obj):
|
||||
self.frame = lisp_obj.GetFrame()
|
||||
self.lisp_obj = lisp_obj
|
||||
self.unsigned = lisp_obj.GetValueAsUnsigned()
|
||||
self.frame = lisp_obj.GetFrame()
|
||||
self.lisp_type = None
|
||||
self.pvec_type = None
|
||||
self.value = None
|
||||
self.init_unsigned()
|
||||
self.init_lisp_types()
|
||||
self.init_values()
|
||||
|
||||
def init_unsigned(self):
|
||||
if self.lisp_obj.GetNumChildren() != 0:
|
||||
# Lisp_Object is actually a struct.
|
||||
lisp_word = self.lisp_obj.GetValueForExpressionPath(".i")
|
||||
self.unsigned = lisp_word.GetValueAsUnsigned()
|
||||
else:
|
||||
self.unsigned = self.lisp_obj.GetValueAsUnsigned()
|
||||
pass
|
||||
|
||||
# Initialize self.lisp_type to the C Lisp_Type enumerator of the
|
||||
# Lisp_Object, as a string. Initialize self.pvec_type likewise to
|
||||
# the pvec_type enumerator if the object is a vector-like, as a
|
||||
|
@ -222,17 +231,22 @@ def define(overwrite):
|
|||
# and deleted in a similar way.
|
||||
def define_type_summary(debugger, regex, function):
|
||||
python_function = __name__ + "." + function.__name__
|
||||
debugger.HandleCommand(f"type summary add "
|
||||
debugger.HandleCommand(f"type summary add --expand "
|
||||
f"--cascade true "
|
||||
f"--category Emacs "
|
||||
f'--regex "{regex}" '
|
||||
f"--python-function {python_function}")
|
||||
f"--python-function {python_function} "
|
||||
+ regex)
|
||||
|
||||
# Enable a given category of type summary providers.
|
||||
def enable_type_category(debugger, category):
|
||||
debugger.HandleCommand(f"type category enable {category}")
|
||||
|
||||
# This function is called by LLDB to initialize the module.
|
||||
def __lldb_init_module(debugger, internal_dict):
|
||||
define_command(debugger, xbacktrace)
|
||||
define_command(debugger, xdebug_print)
|
||||
define_type_summary(debugger, "Lisp_Object", type_summary_Lisp_Object)
|
||||
enable_type_category(debugger, "Emacs")
|
||||
print('Emacs debugging support has been installed.')
|
||||
|
||||
# end.
|
||||
|
|
Loading…
Add table
Reference in a new issue