Skip to content

Commit 4acbfa8

Browse files
committed
[gdb] Don't throw an exception for types that have no fields
The JsDbg frontend will call GetAllFields even for types such as 'char'. For such types, accessing .fields() will throw an exception, which makes the Objdiff extension fail. Instead, just return [].
1 parent 8bd22f2 commit 4acbfa8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

server/JsDbg.Gdb/JsDbg.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,15 @@ def GetAllFields(module, type, includeBaseTypes):
154154
if t is None:
155155
return None
156156

157-
fields = t.fields()
158157
resultFields = []
158+
159+
try:
160+
fields = t.fields()
161+
except:
162+
# If this is a type that has no fields, return instead of throwing
163+
# an exception (e.g. 'char').
164+
return resultFields
165+
159166
for field in fields:
160167
if field.is_base_class:
161168
if not includeBaseTypes:

0 commit comments

Comments
 (0)