emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a680a9fc64: LLDB support: handle unsorted enum member lists


From: Gerd Moellmann
Subject: master a680a9fc64: LLDB support: handle unsorted enum member lists
Date: Mon, 22 Aug 2022 05:20:23 -0400 (EDT)

branch: master
commit a680a9fc6475c079d45283580329cff39ef5ba9c
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>

    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.
---
 etc/emacs_lldb.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/etc/emacs_lldb.py b/etc/emacs_lldb.py
index 880a835341..a2329e6ea4 100644
--- a/etc/emacs_lldb.py
+++ b/etc/emacs_lldb.py
@@ -33,7 +33,10 @@ import lldb
 # Return the name of enumerator ENUM as a string.
 def enumerator_name(enum):
     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
 # functions.
@@ -91,7 +94,6 @@ class Lisp_Object:
             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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]