Skip to content

Commit 9352913

Browse files
committed
Explain: Handle alternate spelling of "uncaughtExceptions".
The symbol for this counter appears to have a couple of spellings that come up in practice in different programs. The field is still in the same place in the structure returned by `__cxa_get_globals()` so in future we might want to just look at it by offset, rather than name. For now this will do.
1 parent 81174a8 commit 9352913

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

explain/explain.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,11 @@ def cpp_get_uncaught_exceptions():
227227
"""
228228
Return the current number of uncaught exceptions on the current thread.
229229
"""
230-
return int(gdb.parse_and_eval("__cxa_get_globals()->uncaught_exceptions"))
230+
try:
231+
return int(gdb.parse_and_eval("__cxa_get_globals()->uncaught_exceptions"))
232+
except gdb.error:
233+
# Fall back to alternate spelling which has also been observed.
234+
return int(gdb.parse_and_eval("__cxa_get_globals()->uncaughtExceptions"))
231235

232236

233237
def cpp_exception_state_present():

0 commit comments

Comments
 (0)