aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorMarcin Koƛcielnicki <koriakin@0x04.net>2016-03-12 14:03:26 +0100
committerMarcin Koƛcielnicki <koriakin@0x04.net>2016-03-30 01:51:06 +0200
commit28170b88cc8b40fdea2b065dafe6e1872a47ee4e (patch)
treecb05b89e30b424c98961d3e3eb13e63f29055484 /gdb/remote.c
parenta08b52b5c45195c0b095215f19422d2ab67a3a8d (diff)
downloadgdb-28170b88cc8b40fdea2b065dafe6e1872a47ee4e.zip
gdb-28170b88cc8b40fdea2b065dafe6e1872a47ee4e.tar.gz
gdb-28170b88cc8b40fdea2b065dafe6e1872a47ee4e.tar.bz2
gdbserver: Handle 'v' packet while processing qSymbol.
On powerpc64, qSymbol query may require gdb to read a function descriptor, sending a vFile packet to gdbserver. Thus, we need to handle 'v' packet in look_up_one_symbol. vFile replies may be quite long, and require reallocating own_buf. Since handle_v_requests assumes the buffer is the static global own_buf from server.c and reallocates it, we need to make own_buf global and use it from look_up_one_symbol instead of using our own auto variable. I've also done the same change in relocate_instruction, just in case. On gdb side, in remote_check_symbols, rs->buf may be clobbered by vFile handling, yet we need its contents for the reply (the symbol name is stored there). Allocate a new buffer instead. This broke fast tracepoints on powerpc64, due to errors in reading IPA symbols. gdb/ChangeLog: * remote.c (remote_check_symbols): Allocate own buffer for reply. gdbserver/ChangeLog: * remote-utils.c (look_up_one_symbol): Remove own_buf, handle 'v' packets. (relocate_instruction): Remove own_buf. * server.c (own_buf): Make global. (handle_v_requests): Make global. * server.h (own_buf): New declaration. (handle_v_requests): New prototype.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index af0a08a..5c407b6 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4335,6 +4335,7 @@ remote_check_symbols (void)
struct remote_state *rs = get_remote_state ();
char *msg, *reply, *tmp;
int end;
+ long reply_size;
struct cleanup *old_chain;
/* The remote side has no concept of inferiors that aren't running
@@ -4356,13 +4357,15 @@ remote_check_symbols (void)
because we need both at the same time. */
msg = (char *) xmalloc (get_remote_packet_size ());
old_chain = make_cleanup (xfree, msg);
+ reply = (char *) xmalloc (get_remote_packet_size ());
+ make_cleanup (free_current_contents, &reply);
+ reply_size = get_remote_packet_size ();
/* Invite target to request symbol lookups. */
putpkt ("qSymbol::");
- getpkt (&rs->buf, &rs->buf_size, 0);
- packet_ok (rs->buf, &remote_protocol_packets[PACKET_qSymbol]);
- reply = rs->buf;
+ getpkt (&reply, &reply_size, 0);
+ packet_ok (reply, &remote_protocol_packets[PACKET_qSymbol]);
while (startswith (reply, "qSymbol:"))
{
@@ -4390,8 +4393,7 @@ remote_check_symbols (void)
}
putpkt (msg);
- getpkt (&rs->buf, &rs->buf_size, 0);
- reply = rs->buf;
+ getpkt (&reply, &reply_size, 0);
}
do_cleanups (old_chain);