aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2018-12-31 14:05:09 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-01-03 21:24:00 +0000
commit66644cd32ba63e7fda70e455766b438631ec0b61 (patch)
treef8a7255166793a24a5c33150f9adf3c4c6a03975 /gdb
parent592d8c0a5d193d3aad03437942a54a667477acea (diff)
downloadbinutils-66644cd32ba63e7fda70e455766b438631ec0b61.zip
binutils-66644cd32ba63e7fda70e455766b438631ec0b61.tar.gz
binutils-66644cd32ba63e7fda70e455766b438631ec0b61.tar.bz2
gdb/remote: Remove a cleanup in remote_check_symbols
Convert one of the variables that requires a cleanup from a 'char *' to a 'gdb::char_vector' in remote_target::remote_check_symbols. Tested on x86-64/Linux with target_board native-gdbserver and native-extended-gdbserver. gdb/ChangeLog: * remote.c (remote_target::remote_check_symbols): Convert `msg` to gdb::char_vector, remove cleanup, and update uses of `msg`.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/remote.c21
2 files changed, 16 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7d5fc45..4850082 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-03 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * remote.c (remote_target::remote_check_symbols): Convert `msg` to
+ gdb::char_vector, remove cleanup, and update uses of `msg`.
+
2019-01-03 Jim Wilson <jimw@sifive.com>
* riscv-tdep.c (riscv_freg_feature): Drop s0 name from f8.
diff --git a/gdb/remote.c b/gdb/remote.c
index efed998..324ed46 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4883,7 +4883,7 @@ init_all_packet_configs (void)
void
remote_target::remote_check_symbols ()
{
- char *msg, *reply, *tmp;
+ char *reply, *tmp;
int end;
long reply_size;
struct cleanup *old_chain;
@@ -4905,10 +4905,9 @@ remote_target::remote_check_symbols ()
/* Allocate a message buffer. We can't reuse the input buffer in RS,
because we need both at the same time. */
- msg = (char *) xmalloc (get_remote_packet_size ());
- old_chain = make_cleanup (xfree, msg);
+ gdb::char_vector msg (get_remote_packet_size ());
reply = (char *) xmalloc (get_remote_packet_size ());
- make_cleanup (free_current_contents, &reply);
+ old_chain = make_cleanup (free_current_contents, &reply);
reply_size = get_remote_packet_size ();
/* Invite target to request symbol lookups. */
@@ -4922,11 +4921,13 @@ remote_target::remote_check_symbols ()
struct bound_minimal_symbol sym;
tmp = &reply[8];
- end = hex2bin (tmp, (gdb_byte *) msg, strlen (tmp) / 2);
+ end = hex2bin (tmp, reinterpret_cast <gdb_byte *> (msg.data ()),
+ strlen (tmp) / 2);
msg[end] = '\0';
- sym = lookup_minimal_symbol (msg, NULL, NULL);
+ sym = lookup_minimal_symbol (msg.data (), NULL, NULL);
if (sym.minsym == NULL)
- xsnprintf (msg, get_remote_packet_size (), "qSymbol::%s", &reply[8]);
+ xsnprintf (msg.data (), get_remote_packet_size (), "qSymbol::%s",
+ &reply[8]);
else
{
int addr_size = gdbarch_addr_bit (target_gdbarch ()) / 8;
@@ -4938,11 +4939,11 @@ remote_target::remote_check_symbols ()
sym_addr,
current_top_target ());
- xsnprintf (msg, get_remote_packet_size (), "qSymbol:%s:%s",
+ xsnprintf (msg.data (), get_remote_packet_size (), "qSymbol:%s:%s",
phex_nz (sym_addr, addr_size), &reply[8]);
}
-
- putpkt (msg);
+
+ putpkt (msg.data ());
getpkt (&reply, &reply_size, 0);
}