From: Andre Simoes Dias Vieira Date: Fri, 26 Feb 2016 13:44:37 +0000 (+0000) Subject: Fix for GDB crashing with printf on ARM targets. X-Git-Tag: users/ARM/embedded-gdb-7.10-branch-2016q1~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=24ad6cefb1533cfd3af77eacbcb95b6825bcae46;p=thirdparty%2Fbinutils-gdb.git Fix for GDB crashing with printf on ARM targets. gdb/ChangeLog.arm: 2016-02-16 Andre Vieira Backport from mainline 2016-02-04 Yao Qi * remote.c (remote_wait_as): Set rs->waiting_for_stop_reply to 0 before handling 'F' and set it back afterwards. --- diff --git a/gdb/ChangeLog.arm b/gdb/ChangeLog.arm new file mode 100644 index 00000000000..da444fdfd46 --- /dev/null +++ b/gdb/ChangeLog.arm @@ -0,0 +1,6 @@ +2016-02-16 Andre Vieira + Backport from mainline + 2016-02-04 Yao Qi + + * remote.c (remote_wait_as): Set rs->waiting_for_stop_reply to + 0 before handling 'F' and set it back afterwards. diff --git a/gdb/remote.c b/gdb/remote.c index 610da1eb320..2ce29323267 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -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': {