[06/10] remote: Small cleanup in compare_section_command

Message ID 20180516141830.16859-7-palves@redhat.com
State New
Headers show
Series
  • remote: More multi-target preparation
Related show

Commit Message

Pedro Alves May 16, 2018, 2:18 p.m.
The set_general_process call in compare_sections_command isn't
actually needed.  remote_target::verify_memory and
remote_target::xfer_partial already handle making sure the remote is
pointing at the right process or thread.

Getting this out of the way helps a bit with further elimination of
the remote_state global, because we have to handle the case of a user
invoking the command even if not connect to a remote target.

gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

	* remote.c (compare_section_command): Remove set_general_process
	call.
---
 gdb/remote.c | 3 ---
 1 file changed, 3 deletions(-)

-- 
2.14.3

Comments

Simon Marchi May 18, 2018, 9:16 p.m. | #1
On 2018-05-16 10:18 AM, Pedro Alves wrote:
> The set_general_process call in compare_sections_command isn't

> actually needed.  remote_target::verify_memory and

> remote_target::xfer_partial already handle making sure the remote is

> pointing at the right process or thread.

> 

> Getting this out of the way helps a bit with further elimination of

> the remote_state global, because we have to handle the case of a user

> invoking the command even if not connect to a remote target.

> 

> gdb/ChangeLog:

> yyyy-mm-dd  Pedro Alves  <palves@redhat.com>

> 

> 	* remote.c (compare_section_command): Remove set_general_process

> 	call.

> ---

>  gdb/remote.c | 3 ---

>  1 file changed, 3 deletions(-)

> 

> diff --git a/gdb/remote.c b/gdb/remote.c

> index 8e1baf0856..ef15eafe2a 100644

> --- a/gdb/remote.c

> +++ b/gdb/remote.c

> @@ -10511,9 +10511,6 @@ compare_sections_command (const char *args, int from_tty)

>    if (!exec_bfd)

>      error (_("command cannot be used without an exec file"));

>  

> -  /* Make sure the remote is pointing at the right process.  */

> -  set_general_process ();

> -

>    if (args != NULL && strcmp (args, "-r") == 0)

>      {

>        read_only = 1;

> 



LGTM.

Simon

Patch

diff --git a/gdb/remote.c b/gdb/remote.c
index 8e1baf0856..ef15eafe2a 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10511,9 +10511,6 @@  compare_sections_command (const char *args, int from_tty)
   if (!exec_bfd)
     error (_("command cannot be used without an exec file"));
 
-  /* Make sure the remote is pointing at the right process.  */
-  set_general_process ();
-
   if (args != NULL && strcmp (args, "-r") == 0)
     {
       read_only = 1;