+2016-03-30 Marcin Kościelnicki <koriakin@0x04.net>
+
+ * remote.c (remote_check_symbols): Allocate own buffer for reply.
+
2016-03-29 Max Filippov <jcmvbkbc@gmail.com>
* xtensa-tdep.c (xtensa_frame_cache): Change op1 type to LONGEST.
+2016-03-30 Marcin Kościelnicki <koriakin@0x04.net>
+
+ * 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.
+
2016-03-29 Marcin Kościelnicki <koriakin@0x04.net>
PR 18377
int
look_up_one_symbol (const char *name, CORE_ADDR *addrp, int may_ask_gdb)
{
- char own_buf[266], *p, *q;
+ char *p, *q;
int len;
struct sym_cache *sym;
struct process_info *proc;
/* We ought to handle pretty much any packet at this point while we
wait for the qSymbol "response". That requires re-entering the
main loop. For now, this is an adequate approximation; allow
- GDB to read from memory while it figures out the address of the
- symbol. */
- while (own_buf[0] == 'm')
+ GDB to read from memory and handle 'v' packets (for vFile transfers)
+ while it figures out the address of the symbol. */
+ while (1)
{
- CORE_ADDR mem_addr;
- unsigned char *mem_buf;
- unsigned int mem_len;
+ if (own_buf[0] == 'm')
+ {
+ CORE_ADDR mem_addr;
+ unsigned char *mem_buf;
+ unsigned int mem_len;
- decode_m_packet (&own_buf[1], &mem_addr, &mem_len);
- mem_buf = (unsigned char *) xmalloc (mem_len);
- if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
- bin2hex (mem_buf, own_buf, mem_len);
+ decode_m_packet (&own_buf[1], &mem_addr, &mem_len);
+ mem_buf = (unsigned char *) xmalloc (mem_len);
+ if (read_inferior_memory (mem_addr, mem_buf, mem_len) == 0)
+ bin2hex (mem_buf, own_buf, mem_len);
+ else
+ write_enn (own_buf);
+ free (mem_buf);
+ if (putpkt (own_buf) < 0)
+ return -1;
+ }
+ else if (own_buf[0] == 'v')
+ {
+ int new_len = -1;
+ handle_v_requests (own_buf, len, &new_len);
+ if (new_len != -1)
+ putpkt_binary (own_buf, new_len);
+ else
+ putpkt (own_buf);
+ }
else
- write_enn (own_buf);
- free (mem_buf);
- if (putpkt (own_buf) < 0)
- return -1;
+ break;
len = getpkt (own_buf);
if (len < 0)
return -1;
int
relocate_instruction (CORE_ADDR *to, CORE_ADDR oldloc)
{
- char own_buf[266];
int len;
ULONGEST written = 0;
static struct target_waitstatus last_status;
static ptid_t last_ptid;
-static char *own_buf;
+char *own_buf;
static unsigned char *mem_buf;
/* A sub-class of 'struct notif_event' for stop, holding information
}
/* Handle all of the extended 'v' packets. */
-static void
+void
handle_v_requests (char *own_buf, int packet_len, int *new_packet_len)
{
if (!disable_packet_vCont)
extern int disable_packet_qC;
extern int disable_packet_qfThreadInfo;
+extern char *own_buf;
+
extern int run_once;
extern int multi_process;
extern int report_fork_events;
#include "event-loop.h"
/* Functions from server.c. */
+extern void handle_v_requests (char *own_buf, int packet_len,
+ int *new_packet_len);
extern int handle_serial_event (int err, gdb_client_data client_data);
extern int handle_target_event (int err, gdb_client_data client_data);
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
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:"))
{
}
putpkt (msg);
- getpkt (&rs->buf, &rs->buf_size, 0);
- reply = rs->buf;
+ getpkt (&reply, &reply_size, 0);
}
do_cleanups (old_chain);