Remove isize output argument from fast_tracepoint_valid_at

This patch removes the isize output argument from the
fast_tracepoint_valid_at gdbarch hook.  It was used to return the size
of the instruction that needs to be replaced when installing a fast
tracepoint.  Instead of getting this value from the
fast_tracepoint_valid_at hook, we can call the gdb_insn_length function.

If we do not do this, then architectures which do not have a restriction
on where to install the fast tracepoint will send uninitialized memory
off to GDBserver.  See remote_download_tracepoint:

~~~
int isize;

if (gdbarch_fast_tracepoint_valid_at (target_gdbarch (),
				      tpaddr, &isize, NULL))
  xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x",
	     isize);
~~~

The default implementation of fast_tracepoint_valid_at will not set
isize resulting in uninitialized memory being sent.  Later on, GDBserver
could use this information to compute a jump offset.

gdb/ChangeLog:

	* arch-utils.c (default_fast_tracepoint_valid_at): Remove unused
	isize argument.
	* arch-utils.h (default_fast_tracepoint_valid_at): Likewise.
	* breakpoint.c (check_fast_tracepoint_sals): Adjust call to
	gdbarch_fast_tracepoint_valid_at.
	* gdbarch.sh (fast_tracepoint_valid_at): Remove isize argument.
	* gdbarch.h: Regenerate.
	* gdbarch.c: Regenerate.
	* i386-tdep.c (i386_fast_tracepoint_valid_at): Remove isize
	argument.  Do not set it.
	* remote.c (remote_download_tracepoint): Adjust call to
	gdbarch_fast_tracepoint_valid_at.  Call gdb_insn_length to get
	the instruction length.
This commit is contained in:
Pierre Langlois
2015-07-30 18:05:00 +01:00
parent e8b416815b
commit 6b940e6a06
9 changed files with 31 additions and 20 deletions

View File

@@ -44,6 +44,7 @@
#include "gdb_bfd.h"
#include "filestuff.h"
#include "rsp-low.h"
#include "disasm.h"
#include <sys/time.h>
@@ -11106,12 +11107,10 @@ remote_download_tracepoint (struct target_ops *self, struct bp_location *loc)
target capabilities at definition time. */
if (remote_supports_fast_tracepoints ())
{
int isize;
if (gdbarch_fast_tracepoint_valid_at (target_gdbarch (),
tpaddr, &isize, NULL))
if (gdbarch_fast_tracepoint_valid_at (loc->gdbarch, tpaddr,
NULL))
xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x",
isize);
gdb_insn_length (loc->gdbarch, tpaddr));
else
/* If it passed validation at definition but fails now,
something is very wrong. */