diff options
author | Guinevere Larsen <guinevere@redhat.com> | 2024-03-14 16:14:28 +0100 |
---|---|---|
committer | Guinevere Larsen <guinevere@redhat.com> | 2025-01-17 11:49:16 -0300 |
commit | b49f56d0aa0bcd8d73e87e6e17ff4fb0efa4c090 (patch) | |
tree | 4ecf6348118b8ceab34622f8e50c6091502489ef /gdb/frame-unwind.h | |
parent | 1239e7cf37336d69931a656290c25a5d5455b9cc (diff) | |
download | binutils-b49f56d0aa0bcd8d73e87e6e17ff4fb0efa4c090.zip binutils-b49f56d0aa0bcd8d73e87e6e17ff4fb0efa4c090.tar.gz binutils-b49f56d0aa0bcd8d73e87e6e17ff4fb0efa4c090.tar.bz2 |
gdb: introduce ability to disable frame unwinders
Sometimes, in the GDB testsuite, we want to test the ability of specific
unwinders to handle some piece of code. Usually this is done by trying
to outsmart GDB, or by coercing the compiler to remove information that
GDB would rely on. Both approaches have problems as GDB gets smarter
with time, and that compilers might differ in version and behavior, or
simply introduce new useful information. This was requested back in 2003
in PR backtrace/8434.
To improve our ability to thoroughly test GDB, this patch introduces a
new maintenance command that allows a user to disable some unwinders,
based on either the name of the unwinder or on its class. With this
change, it will now be possible for GDB to not find any frame unwinders
for a given frame, which would previously cause GDB to assert. GDB will
now check if any frame unwinder has been disabled, and if some has, it
will just error out instead of asserting.
Unwinders can be disabled or re-enabled in 3 different ways:
* Disabling/enabling all at once (using '-all').
* By specifying an unwinder class to be disabled (option '-class').
* By specifying the name of an unwinder (option '-name').
If you give no options to the command, GDB assumes the input is an
unwinder class. '-class' would make no difference if used, is just here
for completeness.
This command is meant to be used once the inferior is already at the
desired location for the test. An example session would be:
(gdb) start
Temporary breakpoint 1, main () at omp.c:17
17 func();
(gdb) maint frame-unwinder disable ARCH
(gdb) bt
\#0 main () at omp.c:17
(gdb) maint frame-unwinder enable ARCH
(gdb) cont
Continuing.
This commit is a more generic version of commit 3c3bb0580be0,
and so, based on the final paragraph of the commit message:
gdb: Add switch to disable DWARF stack unwinders
<...>
If in the future we find ourselves adding more switches to disable
different unwinders, then we should probably move to a more generic
solution, and remove this patch.
this patch also reverts 3c3bb0580be0
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=8434
Co-Authored-By: Andrew Burgess <aburgess@redhat.com>
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Approved-By: Andrew Burgess <aburgess@redhat.com>
temp adding completion
Diffstat (limited to 'gdb/frame-unwind.h')
-rw-r--r-- | gdb/frame-unwind.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gdb/frame-unwind.h b/gdb/frame-unwind.h index 3164aa0..baf09ed 100644 --- a/gdb/frame-unwind.h +++ b/gdb/frame-unwind.h @@ -192,6 +192,12 @@ public: const frame_data *unwind_data () const { return m_unwind_data; } + bool enabled () const + { return m_enabled; } + + void set_enabled (bool state) const + { m_enabled = state; } + /* Default stop_reason implementation. It reports NO_REASON, unless the frame is the outermost. */ @@ -247,6 +253,9 @@ private: /* Additional data used by the trampoline and python frame unwinders. */ const frame_data *m_unwind_data; + + /* Whether this unwinder can be used when sniffing. */ + mutable bool m_enabled = true; }; /* This is a legacy version of the frame unwinder. The original struct |