Skip to content

Commit 4ba3725

Browse files
committed
[gdb] Better handle typedefs to anonymous unions
When compiled with clang, for a typedef to an anonymous union, gdb will not be able to find a name and so 'name' is None. When that happens, we should just not call strip_typedefs to keep a name to refer to the type. Because this only happens with clang, I have not written a testcase for this bug. I did file a clang bug (see link in comment). This shows up with base::internal::LockImpl::NativeHandle.
1 parent 4acbfa8 commit 4ba3725

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

server/JsDbg.Gdb/JsDbg.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,17 @@ def IsFunctionPointer(t):
113113

114114

115115
def FormatType(symbol_type):
116-
t = symbol_type.strip_typedefs()
116+
# The type may be a typedef to an anonymous union (e.g.
117+
# base::internal::LockImpl::NativeHandle). In that case, keep the
118+
# typedef name so we have *some* name to refer to this type.
119+
# (This is only an issue with clang,
120+
# https://bugs.llvm.org/show_bug.cgi?id=43054)
121+
stripped = symbol_type.strip_typedefs()
122+
if stripped.name:
123+
t = stripped
124+
else:
125+
t = symbol_type
126+
117127
if IsFunctionPointer(t):
118128
# No good way to interop a function pointer back to python; lie and say it's a void*
119129
return "void *"

0 commit comments

Comments
 (0)