1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-11 00:30:17 -08:00

LLDB support: handle unsorted enum member lists

* etc/emacs_lldb.py (enumerator_name): Handle the case that enum
member list is not sorted by value.
This commit is contained in:
Gerd Möllmann 2022-08-22 11:18:30 +02:00
parent a5e36575ae
commit a680a9fc64

View file

@ -33,7 +33,10 @@ import lldb
# Return the name of enumerator ENUM as a string. # Return the name of enumerator ENUM as a string.
def enumerator_name(enum): def enumerator_name(enum):
enumerators = enum.GetType().GetEnumMembers() enumerators = enum.GetType().GetEnumMembers()
return enumerators[enum.GetValueAsUnsigned()].GetName() for enum_member in enumerators:
if enum.GetValueAsUnsigned() == enum_member.GetValueAsUnsigned():
return enum_member.GetName()
return None
# A class wrapping an SBValue for a Lisp_Object, providing convenience # A class wrapping an SBValue for a Lisp_Object, providing convenience
# functions. # functions.
@ -91,7 +94,6 @@ class Lisp_Object:
self.unsigned = lisp_word.GetValueAsUnsigned() self.unsigned = lisp_word.GetValueAsUnsigned()
else: else:
self.unsigned = self.lisp_obj.GetValueAsUnsigned() self.unsigned = self.lisp_obj.GetValueAsUnsigned()
pass
# Initialize self.lisp_type to the C Lisp_Type enumerator of the # Initialize self.lisp_type to the C Lisp_Type enumerator of the
# Lisp_Object, as a string. Initialize self.pvec_type likewise to # Lisp_Object, as a string. Initialize self.pvec_type likewise to