Fix ravenscar-thread.c for multi-target

Message ID 20200123205909.30663-1-tromey@adacore.com
State New, archived
Headers

Commit Message

Tom Tromey Jan. 23, 2020, 8:59 p.m. UTC
  ravenscar-thread.c needed a change to adapt to multi-target:
ravenscar_thread_target::mourn_inferior called the mourn_inferior
method on the target beneat -- but when the target beneath was the
remote target, this resulted in the ravenscar target being deleted.

Switching the order of the calls to unpush_target and the beneath's
mourn_inferior fixes this problem.

gdb/ChangeLog
2020-01-23  Tom Tromey  <tromey@adacore.com>

	* ravenscar-thread.c (ravenscar_thread_target::mourn_inferior):
	Call beneath target's mourn_inferior after unpushing.

Change-Id: Ia80380515c403adc40505a6b3420c9cb35754370
---
 gdb/ChangeLog          | 5 +++++
 gdb/ravenscar-thread.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)
  

Comments

Tom Tromey Jan. 31, 2020, 10:38 a.m. UTC | #1
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:

Tom> ravenscar-thread.c needed a change to adapt to multi-target:
Tom> ravenscar_thread_target::mourn_inferior called the mourn_inferior
Tom> method on the target beneat -- but when the target beneath was the
Tom> remote target, this resulted in the ravenscar target being deleted.

Tom> Switching the order of the calls to unpush_target and the beneath's
Tom> mourn_inferior fixes this problem.

Tom> gdb/ChangeLog
Tom> 2020-01-23  Tom Tromey  <tromey@adacore.com>

Tom> 	* ravenscar-thread.c (ravenscar_thread_target::mourn_inferior):
Tom> 	Call beneath target's mourn_inferior after unpushing.

I'm checking this in now.

Tom
  

Patch

diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 5d24c59e996..fd3beb03ec3 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -515,8 +515,9 @@  void
 ravenscar_thread_target::mourn_inferior ()
 {
   m_base_ptid = null_ptid;
-  beneath ()->mourn_inferior ();
+  target_ops *beneath = this->beneath ();
   unpush_target (this);
+  beneath->mourn_inferior ();
 }
 
 /* Implement the to_core_of_thread target_ops "method".  */