diff options
author | Tom Tromey <tom@tromey.com> | 2018-05-03 00:04:11 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-05-04 09:11:55 -0600 |
commit | 69b6ecb049143078f43a9372b68ac90a4601dc8c (patch) | |
tree | dcbf6a3773d79b43387e58b3959c283e486fa492 /gdb | |
parent | 11859c310cd6b6fd892337a5ee1d36921e6d08d8 (diff) | |
download | gdb-69b6ecb049143078f43a9372b68ac90a4601dc8c.zip gdb-69b6ecb049143078f43a9372b68ac90a4601dc8c.tar.gz gdb-69b6ecb049143078f43a9372b68ac90a4601dc8c.tar.bz2 |
Remove a cleanup from remote.c
This removes a cleanup from remote.c by using std::string to construct
the qSupported packet.
Tested by the buildbot.
ChangeLog
2018-05-04 Tom Tromey <tom@tromey.com>
* remote.c (remote_query_supported_append): Change type.
(remote_check_symbols): Update.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/remote.c | 42 |
2 files changed, 24 insertions, 23 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c20f2a9..b7e372f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-05-04 Tom Tromey <tom@tromey.com> + + * remote.c (remote_query_supported_append): Change type. + (remote_check_symbols): Update. + 2018-05-04 Paul Pluzhnikov <ppluzhnikov@google.com> PR gdb/11420 diff --git a/gdb/remote.c b/gdb/remote.c index 89cba54..66099cf 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -4957,13 +4957,12 @@ register_remote_support_xml (const char *xml) #endif } -static char * -remote_query_supported_append (char *msg, const char *append) +static void +remote_query_supported_append (std::string *msg, const char *append) { - if (msg) - return reconcat (msg, msg, ";", append, (char *) NULL); - else - return xstrdup (append); + if (!msg->empty ()) + msg->append (";"); + msg->append (append); } static void @@ -4984,48 +4983,45 @@ remote_query_supported (void) rs->buf[0] = 0; if (packet_support (PACKET_qSupported) != PACKET_DISABLE) { - char *q = NULL; - struct cleanup *old_chain = make_cleanup (free_current_contents, &q); + std::string q; if (packet_set_cmd_state (PACKET_multiprocess_feature) != AUTO_BOOLEAN_FALSE) - q = remote_query_supported_append (q, "multiprocess+"); + remote_query_supported_append (&q, "multiprocess+"); if (packet_set_cmd_state (PACKET_swbreak_feature) != AUTO_BOOLEAN_FALSE) - q = remote_query_supported_append (q, "swbreak+"); + remote_query_supported_append (&q, "swbreak+"); if (packet_set_cmd_state (PACKET_hwbreak_feature) != AUTO_BOOLEAN_FALSE) - q = remote_query_supported_append (q, "hwbreak+"); + remote_query_supported_append (&q, "hwbreak+"); - q = remote_query_supported_append (q, "qRelocInsn+"); + remote_query_supported_append (&q, "qRelocInsn+"); if (packet_set_cmd_state (PACKET_fork_event_feature) != AUTO_BOOLEAN_FALSE) - q = remote_query_supported_append (q, "fork-events+"); + remote_query_supported_append (&q, "fork-events+"); if (packet_set_cmd_state (PACKET_vfork_event_feature) != AUTO_BOOLEAN_FALSE) - q = remote_query_supported_append (q, "vfork-events+"); + remote_query_supported_append (&q, "vfork-events+"); if (packet_set_cmd_state (PACKET_exec_event_feature) != AUTO_BOOLEAN_FALSE) - q = remote_query_supported_append (q, "exec-events+"); + remote_query_supported_append (&q, "exec-events+"); if (packet_set_cmd_state (PACKET_vContSupported) != AUTO_BOOLEAN_FALSE) - q = remote_query_supported_append (q, "vContSupported+"); + remote_query_supported_append (&q, "vContSupported+"); if (packet_set_cmd_state (PACKET_QThreadEvents) != AUTO_BOOLEAN_FALSE) - q = remote_query_supported_append (q, "QThreadEvents+"); + remote_query_supported_append (&q, "QThreadEvents+"); if (packet_set_cmd_state (PACKET_no_resumed) != AUTO_BOOLEAN_FALSE) - q = remote_query_supported_append (q, "no-resumed+"); + remote_query_supported_append (&q, "no-resumed+"); /* Keep this one last to work around a gdbserver <= 7.10 bug in the qSupported:xmlRegisters=i386 handling. */ if (remote_support_xml != NULL && packet_support (PACKET_qXfer_features) != PACKET_DISABLE) - q = remote_query_supported_append (q, remote_support_xml); - - q = reconcat (q, "qSupported:", q, (char *) NULL); - putpkt (q); + remote_query_supported_append (&q, remote_support_xml); - do_cleanups (old_chain); + q = "qSupported:" + q; + putpkt (q.c_str ()); getpkt (&rs->buf, &rs->buf_size, 0); |