2018-03-09 16:46:37 +00:00
|
|
|
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
|
Subject: workaround stale frame_info * (PR 13866)
|
|
|
|
|
|
|
|
FileName: gdb-stale-frame_info.patch
|
|
|
|
|
|
|
|
;; Workaround crashes from stale frame_info pointer (BZ 804256).
|
|
|
|
;;=push+jan
|
|
|
|
|
2012-06-16 04:55:29 +00:00
|
|
|
http://sourceware.org/ml/gdb-patches/2012-04/msg00058.html
|
|
|
|
|
|
|
|
Hi,
|
|
|
|
|
|
|
|
I did not look at which commit caused this regression but apparently it was
|
|
|
|
introduced at least with multi-inferiors.
|
|
|
|
|
|
|
|
I understand this fix is not right fix of the crash; but in most GDB cases one
|
|
|
|
does not use multi-inferior so why to regress single-inferior by it.
|
|
|
|
Some more simple solutions still fix the single-inferior mode but they
|
|
|
|
regressed the multi-inferior mode
|
|
|
|
gdb.threads/no-unwaited-for-left.exp
|
|
|
|
gdb.multi/base.exp
|
|
|
|
so I had to put there that sorting magic.
|
|
|
|
|
|
|
|
With proper C++ sanity check of stale live frame_info references the testcase
|
|
|
|
would be simple without the "frame_garbage_collection" reproducer below.
|
|
|
|
It is also reproducible just with valgrind but regularly running the whole
|
|
|
|
testsuite under valgrind I did not find feasible.
|
|
|
|
|
|
|
|
No regressions on {x86_64,x86_64-m32,i686}-fedora17-linux-gnu.
|
|
|
|
|
|
|
|
Thanks,
|
|
|
|
Jan
|
|
|
|
|
|
|
|
gdb/
|
|
|
|
2012-04-04 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
Workaround PR backtrace/13866.
|
|
|
|
* progspace.c (switch_to_program_space_and_thread): Try not to call
|
|
|
|
switch_to_thread.
|
2018-03-09 16:46:37 +00:00
|
|
|
---
|
|
|
|
gdb/progspace-and-thread.c | 18 ++++++++++++++++--
|
|
|
|
1 file changed, 16 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/gdb/progspace-and-thread.c b/gdb/progspace-and-thread.c
|
|
|
|
index 27d626b05f..ee6342d96a 100644
|
|
|
|
--- a/gdb/progspace-and-thread.c
|
|
|
|
+++ b/gdb/progspace-and-thread.c
|
|
|
|
@@ -23,15 +23,29 @@
|
2012-06-16 04:55:29 +00:00
|
|
|
void
|
2018-03-09 16:46:37 +00:00
|
|
|
switch_to_program_space_and_thread (program_space *pspace)
|
2012-06-16 04:55:29 +00:00
|
|
|
{
|
2018-03-09 16:46:37 +00:00
|
|
|
- inferior *inf = find_inferior_for_program_space (pspace);
|
|
|
|
+ inferior *inf = current_inferior ();
|
|
|
|
+
|
2012-06-16 04:55:29 +00:00
|
|
|
+ if (inf->pspace != pspace)
|
|
|
|
+ inf = find_inferior_for_program_space (pspace);
|
2018-03-09 16:46:37 +00:00
|
|
|
|
- Use patchlist.pl to merge with gdb-7.9-10.fc22, a rebase to FSF GDB 7.9.
The GDB 7.8 features are:
* Python Scripting
- You can now access frame registers from Python scripts.
- New attribute 'producer' for gdb.Symtab objects.
* New Python-based convenience functions:
- $_caller_is(name [, number_of_frames])
- $_caller_matches(regexp [, number_of_frames])
- $_any_caller_is(name [, number_of_frames])
- $_any_caller_matches(regexp [, number_of_frames])
* New commands
- queue-signal signal-name-or-number
Queue a signal to be delivered to the thread when it is resumed.
* On resume, GDB now always passes the signal the program had stopped
for to the thread the signal was sent to, even if the user changed
threads before resuming. Previously GDB would often (but not
always) deliver the signal to the thread that happens to be current
at resume time.
* Conversely, the "signal" command now consistently delivers the
requested signal to the current thread. GDB now asks for
confirmation if the program had stopped for a signal and the user
switched threads meanwhile.
* "breakpoint always-inserted" modes "off" and "auto" merged.
Now, when 'breakpoint always-inserted mode' is set to "off", GDB
won't remove breakpoints from the target until all threads stop,
even in non-stop mode. The "auto" mode has been removed, and "off"
is now the default mode.
* MI changes
- The -list-thread-groups command outputs an exit-code field for
inferiors that have exited.
OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gdb?expand=0&rev=115
2015-02-25 13:45:10 +00:00
|
|
|
if (inf != NULL && inf->pid != 0)
|
2012-06-16 04:55:29 +00:00
|
|
|
{
|
2018-03-09 16:46:37 +00:00
|
|
|
thread_info *tp = any_live_thread_of_process (inf->pid);
|
|
|
|
+ thread_info *current_tp = NULL;
|
2012-06-16 04:55:29 +00:00
|
|
|
+
|
|
|
|
+ if (ptid_get_pid (inferior_ptid) == inf->pid)
|
|
|
|
+ current_tp = find_thread_ptid (inferior_ptid);
|
|
|
|
|
|
|
|
if (tp != NULL)
|
|
|
|
{
|
|
|
|
- switch_to_thread (tp->ptid);
|
|
|
|
+ /* Prefer primarily thread not THREAD_EXITED and secondarily thread
|
|
|
|
+ not EXECUTING. */
|
|
|
|
+ if (current_tp == NULL
|
|
|
|
+ || (tp->state != THREAD_EXITED
|
|
|
|
+ && current_tp->state == THREAD_EXITED)
|
|
|
|
+ || (!tp->executing && current_tp->executing))
|
|
|
|
+ switch_to_thread (tp->ptid);
|
|
|
|
+
|
|
|
|
/* Switching thread switches pspace implicitly. We're
|
|
|
|
done. */
|
|
|
|
return;
|
2018-03-09 16:46:37 +00:00
|
|
|
--
|
|
|
|
2.14.3
|
2012-06-16 04:55:29 +00:00
|
|
|
|