From 4e317a765bbe1c47fb9d461b7effa40f34220c85 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 22 Jun 2021 14:16:01 -0400 Subject: gdb/python: print name of unwinder that claimed frame in debug message If we have multiple registered unwinders, this will helps identify which unwinder was chosen and make it easier to track down potential problems. Unwinders have a mandatory name argument, which we can use in the message. First, make gdb._execute_unwinders return a tuple containing the name, in addition to the UnwindInfo. Then, make pyuw_sniffer include the name in the debug message. I moved the debug message earlier. I think it's good to print it as early as possible, so that we see it in case an assert is hit in the loop below, for example. gdb/ChangeLog: * python/lib/gdb/__init__.py (_execute_unwinders): Return tuple with name of chosen unwinder. * python/py-unwind.c (pyuw_sniffer): Print name of chosen unwinder in debug message. Change-Id: Id603545b44a97df2a39dd1872fe1f38ad5059f03 --- gdb/python/lib/gdb/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'gdb/python/lib') diff --git a/gdb/python/lib/gdb/__init__.py b/gdb/python/lib/gdb/__init__.py index d748b3a..f2f38b3 100644 --- a/gdb/python/lib/gdb/__init__.py +++ b/gdb/python/lib/gdb/__init__.py @@ -90,27 +90,33 @@ def _execute_unwinders(pending_frame): Arguments: pending_frame: gdb.PendingFrame instance. + Returns: - gdb.UnwindInfo instance or None. + Tuple with: + + [0] gdb.UnwindInfo instance + [1] Name of unwinder that claimed the frame (type `str`) + + or None, if no unwinder has claimed the frame. """ for objfile in objfiles(): for unwinder in objfile.frame_unwinders: if unwinder.enabled: unwind_info = unwinder(pending_frame) if unwind_info is not None: - return unwind_info + return (unwind_info, unwinder.name) for unwinder in current_progspace().frame_unwinders: if unwinder.enabled: unwind_info = unwinder(pending_frame) if unwind_info is not None: - return unwind_info + return (unwind_info, unwinder.name) for unwinder in frame_unwinders: if unwinder.enabled: unwind_info = unwinder(pending_frame) if unwind_info is not None: - return unwind_info + return (unwind_info, unwinder.name) return None -- cgit v1.1