This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/5 v5] Tracepoint for ppc64


Wei-cheng Wang <cole945@gmail.com> writes:

> +/* Return true if ADDR is a valid address for tracepoint.  Set *ISZIE
> +   to the number of bytes the target should copy elsewhere for the
> +   tracepoint.  */
> +
> +static int
> +ppc_fast_tracepoint_valid_at (struct gdbarch *gdbarch,
> +			      CORE_ADDR addr, int *isize, char **msg)
> +{
> +  CORE_ADDR base, pagesz;
> +  const int SCRATCH_BUFFER_NPAGES = 20;
> +  int isValid = 1;
> +
> +  if (isize)
> +    *isize = gdbarch_max_insn_length (gdbarch);
> +
> +  /* If we can figure out where is the jump-pad, check whether
> +     the address for tracepoint is too far away.  Otherwise,
> +     assume it is valid.  */
> +  if (target_auxv_search (&current_target, AT_PHDR, &base) > 0
> +      && target_auxv_search (&current_target, AT_PAGESZ, &pagesz) > 0)
> +    {
> +      /* The jump-pad is supposed to be mapped here.
> +	 See gdbserver/linux-ppc-ipa.c and gdbserver/tracepoint.c.  */
> +      long dist;
> +      CORE_ADDR jpad_base
> +	= (base & ~(pagesz - 1)) - SCRATCH_BUFFER_NPAGES * pagesz;
> +
> +      dist = jpad_base - addr;
> +      if (dist >= (1 << 25) || dist < -(1 << 25))
> +	isValid = 0;
> +    }

It is not right to me that GDB knows how/where jumppads are allocated in
GDBserver.  It is the internal implementation of GDBserver, and GDB
shouldn't know about it.  Other debugging stubs which support fast
tracepoint may allocate jumppads somewhere else.  Even for GDBserver, we
may change the policy of allocating jumppads, for example, allocate
multiple chunks of jumppads which are closed to main executable and
shared libraries.  In this way, fast tracepoint can work in shared library.

-- 
Yao (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]