]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix for GDB crashing with printf on ARM targets.
authorAndre Simoes Dias Vieira <andsim01@arm.com>
Fri, 26 Feb 2016 13:44:37 +0000 (13:44 +0000)
committerAndre Simoes Dias Vieira <andsim01@arm.com>
Tue, 1 Mar 2016 17:08:55 +0000 (17:08 +0000)
gdb/ChangeLog.arm:
2016-02-16  Andre Vieira  <andre.simoesdiasvieira@arm.com>
    Backport from mainline
    2016-02-04  Yao Qi  <yao.qi@linaro.org>

* remote.c (remote_wait_as): Set rs->waiting_for_stop_reply to
0 before handling 'F' and set it back afterwards.

gdb/ChangeLog.arm [new file with mode: 0644]
gdb/remote.c

diff --git a/gdb/ChangeLog.arm b/gdb/ChangeLog.arm
new file mode 100644 (file)
index 0000000..da444fd
--- /dev/null
@@ -0,0 +1,6 @@
+2016-02-16  Andre Vieira  <andre.simoesdiasvieira@arm.com>
+    Backport from mainline
+    2016-02-04  Yao Qi  <yao.qi@linaro.org>
+
+    * remote.c (remote_wait_as): Set rs->waiting_for_stop_reply to
+    0 before handling 'F' and set it back afterwards.
index 610da1eb320b4b1c071604da67de245f0363c948..2ce29323267f7db09c2ca4a9e65f1a6f1aaad996 100644 (file)
@@ -6359,8 +6359,16 @@ remote_wait_as (ptid_t ptid, struct target_waitstatus *status, int options)
       status->value.sig = GDB_SIGNAL_0;
       break;
     case 'F':          /* File-I/O request.  */
+      /* GDB may access the inferior memory while handling the File-I/O
+        request, but we don't want GDB accessing memory while waiting
+        for a stop reply.  See the comments in putpkt_binary.  Set
+        waiting_for_stop_reply to 0 temporarily.  */
+      rs->waiting_for_stop_reply = 0;
       remote_fileio_request (buf, rs->ctrlc_pending_p);
       rs->ctrlc_pending_p = 0;
+      /* GDB handled the File-I/O request, and the target is running
+        again.  Keep waiting for events.  */
+      rs->waiting_for_stop_reply = 1;
       break;
     case 'T': case 'S': case 'X': case 'W':
       {