This is the mail archive of the gdb-patches@sources.redhat.com 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: [ppc64-linux]: skip linkage functions


On Jun 5,  6:54pm, Jim Blandy wrote:

> 2003-06-05  Jim Blandy  <jimb@redhat.com>
> 
> 	Recognize and skip 64-bit PowerPC Linux linkage functions.
> 	* ppc-linux-tdep.c (insn_d, insn_ds, insn_xfx, read_insn, struct
> 	insn_pattern, insns_match_pattern, d_field, ds_field): New
> 	functions, macros, and types for working with PPC instructions.
> 	(ppc64_standard_linkage, PPC64_STANDARD_LINKAGE_LEN,
> 	ppc64_in_solib_call_trampoline, ppc64_standard_linkage_target,
> 	ppc64_skip_trampoline_code): New functions, variables, and macros
> 	for recognizing and skipping linkage functions.
> 	(ppc_linux_init_abi): Use ppc64_in_solib_call_trampoline and
> 	ppc64_skip_trampoline_code for the 64-bit PowerPC Linux ABI.

Okay...

...except that I can't figure out where "set INSN[i] to -1" (from the
comment) happens in insns_match_pattern().  Once you fix this (or
explain it to me), feel free to commit this patch.

> + /* Return non-zero if the instructions at PC match the series
> +    described in PATTERN, or zero otherwise.  PATTERN is an array of
> +    'struct insn_pattern' objects, terminated by an entry whose mask is
> +    zero.
> + 
> +    When the match is successful, fill INSN[i] with what PATTERN[i]
> +    matched.  If PATTERN[i] is optional, and the instruction wasn't
> +    present, set INSN[i] to -1.  INSN should have as many elements as
> +    PATTERN.  Note that, if PATTERN contains optional instructions
> +    which aren't present in memory, then INSN will have holes, so
> +    INSN[i] isn't necessarily the i'th instruction in memory.  */
> + static int
> + insns_match_pattern (CORE_ADDR pc,
> +                      struct insn_pattern *pattern,
> +                      unsigned int *insn)
> + {
> +   int i;
> + 
> +   for (i = 0; pattern[i].mask; i++)
> +     {
> +       insn[i] = read_insn (pc);
> +       if ((insn[i] & pattern[i].mask) == pattern[i].data)
> +         pc += 4;
> +       else if (pattern[i].optional)
> +         insn[i] = 0;
> +       else
> +         return 0;
> +     }
> + 
> +   return 1;
> + }


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