Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 04/16] push remote_desc into struct remote_state
Date: Thu, 27 Jun 2013 20:29:00 -0000	[thread overview]
Message-ID: <87bo6rmhin.fsf@fleche.redhat.com> (raw)
In-Reply-To: <51C880C5.6050307@redhat.com> (Pedro Alves's message of "Mon, 24	Jun 2013 18:24:21 +0100")

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> @@ -10194,8 +10202,9 @@ remote_file_get (const char *remote_file, const char *local_file, int from_tty)
>> FILE *file;
>> gdb_byte *buffer;
>> ULONGEST offset;
>> +  struct remote_state *rs = get_remote_state ();
>> 
>> -  if (!remote_desc)
>> +  if (!rs->remote_desc)
>> error (_("command can only be used with remote target"));

Pedro> This looks conceptually fishy.

Pedro> A rs == NULL check would be less surprising.  After all, if
Pedro> we were multi-target already, and not using the remote target,
Pedro> get_remote_state would most naturally return NULL.

Pedro> But if not using the remote target, we probably shouldn't
Pedro> be getting here anyway.

Pedro> remote_file_get could nowadays be using the target_fileio_XXX methods
Pedro> instead of remote_hostio_XXX, and therefore the command could be
Pedro> generalized to work with all targets.

Pedro> Something to keep in mind, and file under fix-it-later...  Not sure
Pedro> we have tests for these commands that try them when not connected to
Pedro> a remote target.

Thanks Pedro.

You saw the future quite accurately here.  I did see crashes in this
code after the multi-target conversion, precisely because I changed
get_remote_state to return NULL when not connected; and this path is
exercised by the test suite.

So, a later patch will introduce the == NULL check as well.

In this series, though, get_remote_state cannot return NULL.  This may
seem odd, but it is consistent with the state of the code before the
series -- and I wanted to try to make this series obviously not
behavior-changing.

Tom


  reply	other threads:[~2013-06-27 20:21 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21 17:25 [PATCH 00/16] clean up remote.c state Tom Tromey
2013-06-21 17:25 ` [PATCH 01/16] use the libiberty crc code Tom Tromey
2013-06-24 17:24   ` Pedro Alves
2013-06-27 20:12     ` Tom Tromey
2013-06-21 17:25 ` [PATCH 09/16] push last_sent_signal into struct remote_state Tom Tromey
2013-06-21 17:25 ` [PATCH 04/16] push remote_desc " Tom Tromey
2013-06-24 17:25   ` Pedro Alves
2013-06-27 20:29     ` Tom Tromey [this message]
2013-06-28 16:43       ` [PATCH] Make file transfer commands work with all (native) targets. (was: Re: [PATCH 04/16] push remote_desc into struct remote_state) Pedro Alves
2013-06-28 17:40         ` [PATCH] Make file transfer commands work with all (native) targets Tom Tromey
2013-06-28 17:46         ` [PATCH] Make file transfer commands work with all (native) targets. (was: Re: [PATCH 04/16] push remote_desc into struct remote_state) Eli Zaretskii
2013-06-28 19:05           ` [PATCH] Make file transfer commands work with all (native) targets Pedro Alves
2013-06-28 19:35             ` Eli Zaretskii
2013-07-01 14:28               ` Tom Tromey
2013-07-01 16:34                 ` Pedro Alves
2013-07-01 16:41                 ` Eli Zaretskii
2013-07-01 16:44                   ` Pedro Alves
2013-06-21 17:25 ` [PATCH 07/16] push last_pass_packet into struct remote_state Tom Tromey
2013-06-21 17:25 ` [PATCH 08/16] push last_program_signals_packet " Tom Tromey
2013-06-24 17:36   ` Pedro Alves
2013-06-27 20:13     ` Tom Tromey
2013-06-21 17:25 ` [PATCH 06/16] push remote_traceframe_number " Tom Tromey
2013-06-21 17:25 ` [PATCH 16/16] move some static thread state into remote_state Tom Tromey
2013-06-24 17:33   ` Pedro Alves
2013-06-27 20:21     ` Tom Tromey
2013-06-21 17:25 ` [PATCH 10/16] push last_sent_step into struct remote_state Tom Tromey
2013-06-21 17:25 ` [PATCH 14/16] move async_client_callback and async_client_context into remote_state Tom Tromey
2013-06-24 17:32   ` Pedro Alves
2013-06-24 18:44     ` Tom Tromey
2013-06-24 19:03       ` Pedro Alves
2013-06-21 17:25 ` [PATCH 11/16] move some statics from remote_read_qxfer into struct remote_state Tom Tromey
2013-06-24 17:25   ` Pedro Alves
2013-06-21 17:25 ` [PATCH 05/16] push general_thread and continue_thread " Tom Tromey
2013-06-21 17:25 ` [PATCH 03/16] Add new_remote_state Tom Tromey
2013-06-21 17:25 ` [PATCH 15/16] move remote_stopped_by_watchpoint_p and remote_watch_data_address into remote_state Tom Tromey
2013-06-21 17:25 ` [PATCH 13/16] move sizeof_pkt into remote_trace_find Tom Tromey
2013-06-24  1:45   ` Yao Qi
2013-06-24 14:54     ` Tom Tromey
2013-06-24 17:32   ` Pedro Alves
2013-06-21 17:25 ` [PATCH 12/16] move use_threadinfo_query and use_threadextra_query into struct remote_state Tom Tromey
2013-06-21 17:30 ` [PATCH 02/16] make remote_protocol_features "const" Tom Tromey
2013-06-24 18:35 ` [PATCH 00/16] clean up remote.c state Pedro Alves
2013-07-05  3:07 ` Yao Qi
2013-07-05 14:27   ` Pedro Alves
2013-08-14 17:53 ` Tom Tromey
2013-06-28 17:40 [PATCH v2 00/16] Tom Tromey
2013-06-28 17:40 ` [PATCH 04/16] push remote_desc into struct remote_state Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bo6rmhin.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox