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.
This commit is contained in:
Marcin Kościelnicki 2016-03-12 14:03:26 +01:00
parent a08b52b5c4
commit 28170b88cc
6 changed files with 56 additions and 23 deletions

View file

@ -82,6 +82,8 @@ extern int disable_packet_Tthread;
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;
@ -113,6 +115,8 @@ typedef int gdb_fildes_t;
#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);