public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA] Remove unnecessary call to save_current_inferior
@ 2013-08-29 18:12 Doug Evans
  2013-09-02 19:05 ` Pedro Alves
  2013-09-03 20:33 ` Pedro Alves
  0 siblings, 2 replies; 5+ messages in thread
From: Doug Evans @ 2013-08-29 18:12 UTC (permalink / raw)
  To: gdb-patches

Hi.
AFAICT the call to save_current_inferior here is unnecessary.

Regression tested on amd64-linux.

Ok to check in?

2013-08-29  Doug Evans  <dje@google.com>

	* progspace.c (save_current_space_and_thread): Remove unnecessary
	call to save_current_inferior.

Index: progspace.c
===================================================================
RCS file: /cvs/src/src/gdb/progspace.c,v
retrieving revision 1.18
diff -u -p -r1.18 progspace.c
--- progspace.c	28 Aug 2013 17:52:03 -0000	1.18
+++ progspace.c	29 Aug 2013 17:58:15 -0000
@@ -471,7 +471,8 @@ save_current_space_and_thread (void)
   /* If restoring to null thread, we need to restore the pspace as
      well, hence, we need to save the current program space first.  */
   old_chain = save_current_program_space ();
-  save_current_inferior ();
+  /* There's no need to save the current inferior here.
+     That is handled by make_cleanup_restore_current_thread.  */
   make_cleanup_restore_current_thread ();
 
   return old_chain;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Remove unnecessary call to save_current_inferior
  2013-08-29 18:12 [RFA] Remove unnecessary call to save_current_inferior Doug Evans
@ 2013-09-02 19:05 ` Pedro Alves
  2013-09-03 20:17   ` Doug Evans
  2013-09-03 20:33 ` Pedro Alves
  1 sibling, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2013-09-02 19:05 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On 08/29/2013 07:11 PM, Doug Evans wrote:
> Hi.
> AFAICT the call to save_current_inferior here is unnecessary.

What if there are no threads in the current inferior?

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Remove unnecessary call to save_current_inferior
  2013-09-02 19:05 ` Pedro Alves
@ 2013-09-03 20:17   ` Doug Evans
  2013-09-03 20:32     ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Doug Evans @ 2013-09-03 20:17 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Mon, Sep 2, 2013 at 12:05 PM, Pedro Alves <palves@redhat.com> wrote:
> On 08/29/2013 07:11 PM, Doug Evans wrote:
>> Hi.
>> AFAICT the call to save_current_inferior here is unnecessary.
>
> What if there are no threads in the current inferior?

I considered that, at least I tried to ...
Does make_cleanup_restore_current_thread/do_restore_current_thread_cleanup
not handle it?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Remove unnecessary call to save_current_inferior
  2013-09-03 20:17   ` Doug Evans
@ 2013-09-03 20:32     ` Pedro Alves
  0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2013-09-03 20:32 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On 09/03/2013 09:17 PM, Doug Evans wrote:
> On Mon, Sep 2, 2013 at 12:05 PM, Pedro Alves <palves@redhat.com> wrote:
>> On 08/29/2013 07:11 PM, Doug Evans wrote:
>>> Hi.
>>> AFAICT the call to save_current_inferior here is unnecessary.
>>
>> What if there are no threads in the current inferior?
> 
> I considered that, at least I tried to ...
> Does make_cleanup_restore_current_thread/do_restore_current_thread_cleanup
> not handle it?

Sorry, I remembered incorrectly.  Indeed it does.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Remove unnecessary call to save_current_inferior
  2013-08-29 18:12 [RFA] Remove unnecessary call to save_current_inferior Doug Evans
  2013-09-02 19:05 ` Pedro Alves
@ 2013-09-03 20:33 ` Pedro Alves
  1 sibling, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2013-09-03 20:33 UTC (permalink / raw)
  To: Doug Evans; +Cc: gdb-patches

On 08/29/2013 07:11 PM, Doug Evans wrote:
> Hi.
> AFAICT the call to save_current_inferior here is unnecessary.
> 
> Regression tested on amd64-linux.
> 
> Ok to check in?

OK.

Thanks,
-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-03 20:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-29 18:12 [RFA] Remove unnecessary call to save_current_inferior Doug Evans
2013-09-02 19:05 ` Pedro Alves
2013-09-03 20:17   ` Doug Evans
2013-09-03 20:32     ` Pedro Alves
2013-09-03 20:33 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).