This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Pass inferior to terminal_save_inferior


On 2018-10-22 16:54, Pedro Alves wrote:
On 10/16/2018 04:38 AM, Simon Marchi wrote:
Instead of relying on the current inferior, pass an inferior pointer to
the target implementing terminal_save_inferior.  There should be no
change in behavior.


Your original patch 3/3 ended up not using the inferior pointer.  :-)

I suppose that this doesn't hurt, like the equivalent target_detach
change.

Well, the original 3/3 patch doesn't change the implementation of terminal_save_inferior, it changes the inferior_exit observer, so it's not really related to this change.

I added documentation to terminal_save_inferior, as I understand it
(maybe I understood it wrong, so please take a look).

That looks good.  (please recall to update commit log.)

diff --git a/gdb/target.c b/gdb/target.c
index 2d98954b54ac..93d16b90f179 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -511,10 +511,7 @@ target_terminal_is_ours_kind (target_terminal_state desired_state)
   ALL_INFERIORS (inf)
     {
       if (inf->terminal_state == target_terminal_state::is_inferior)
-	{
-	  set_current_inferior (inf);
-	  current_top_target ()->terminal_save_inferior ();
-	}
+	current_top_target ()->terminal_save_inferior (inf);
     }
With multi-target, current_top_target() will depend on
the current inferior, so I'll need to put that
set_current_inferior call back.

Can't you access the inferior's target stack directly instead of changing the current inferior?

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]