]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: move remote_target::start_remote variable to narrower scope
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 18 Jan 2021 05:46:13 +0000 (00:46 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 18 Jan 2021 05:46:13 +0000 (00:46 -0500)
The wait_status variable is only used when the target is in in all-stop
mode.  We can therefore move it in the !target_is_non_stop scope.  That
lets us remove the assert in the else, that checks that the wait status
is not set.  If the variable doesn't exist in that scope, it pretty much
guarantees that it is not set.

gdb/ChangeLog:

* remote.c (remote_target::start_remote): Move wait_status to
narrower scope.

Change-Id: I30979135e3f4f36d04178baa67575c4e58d3b648

gdb/ChangeLog
gdb/remote.c

index 657e707b30fff6ee6e484b5bfed1a405095a31bb..a7c8b77938336c7f31d4d8a8dc59891d493501cc 100644 (file)
@@ -1,3 +1,8 @@
+2021-01-18  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * remote.c (remote_target::start_remote): Move wait_status to
+       narrower scope.
+
 2021-01-18  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * remote.c (class remote_target):
index 49181d3871673c3d4b85a0212c458ca2a5e551ec..17b0cab35c6115f05ac0d22c1440d38ee486484c 100644 (file)
@@ -4636,7 +4636,6 @@ remote_target::start_remote (int from_tty, int extended_p)
 {
   struct remote_state *rs = get_remote_state ();
   struct packet_config *noack_config;
-  char *wait_status = NULL;
 
   /* Signal other parts that we're going through the initial setup,
      and so things may not be stable yet.  E.g., we don't try to
@@ -4776,6 +4775,8 @@ remote_target::start_remote (int from_tty, int extended_p)
 
   if (!target_is_non_stop_p ())
     {
+      char *wait_status = NULL;
+
       if (rs->buf[0] == 'W' || rs->buf[0] == 'X')
        {
          if (!extended_p)
@@ -4903,10 +4904,6 @@ remote_target::start_remote (int from_tty, int extended_p)
          return;
        }
 
-      /* In non-stop mode, any cached wait status will be stored in
-        the stop reply queue.  */
-      gdb_assert (wait_status == NULL);
-
       /* Report all signals during attach/startup.  */
       pass_signals ({});