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,ARM] Next pc of sigreturn/rt_sigreturn syscall


Generally looks OK.

On Tue, Aug 24, 2010 at 08:05:55PM -0700, Yao Qi wrote:
> Here is the updated patch, in which:
>   1.  Add arm_linux_syscall_next_pc, similar to
> mips_linux_syscall_next_pc.  Compute the return address of SWI in both
> ARM mode and Thumb mode.
>   2.  Extract some common code from arm_linux_copy_svc.

A valid return address won't be zero, but it's still confusing.
Please do this the way that e.g. mips_linux_get_longjmp_target does;
return 0 or 1, and have a CORE_ADDR * parameter.

> +static int
> +arm_linux_sigreturn_return_addr(struct frame_info *frame,
> +				unsigned long svc_number)

Space before "(".  Same problem in other places, too.

> +/* When FRAME is at a syscall instruction, return the PC of the next
> +   instruction to be executed.  */
> +
> +static CORE_ADDR
> +arm_linux_syscall_next_pc (struct frame_info *frame)
> +{
> +  CORE_ADDR pc = get_frame_pc (frame);
> +  CORE_ADDR return_addr = 0;
> +  return_addr = arm_linux_sigreturn_return_addr(frame,
> +						get_frame_register_unsigned (frame, 7));

Line too long; move the read of r7 to another temporary.

What about non-EABI?  We shouldn't wire this up for non-EABI binaries,
because the syscall number won't be in r7.

> @@ -2808,7 +2808,16 @@ thumb_get_next_pc_raw (struct frame_info *frame, CORE_ADDR pc, int insert_bkpt)
>    else if ((inst1 & 0xf000) == 0xd000)	/* conditional branch */
>      {
>        unsigned long cond = bits (inst1, 8, 11);
> -      if (cond != 0x0f && condition_true (cond, status))    /* 0x0f = SWI */
> +      if (cond == 0x0f)  /* 0x0f = SWI */

Why did you remove the condition_true check?

> +	{
> +	  struct gdbarch_tdep *tdep;
> +	  tdep = gdbarch_tdep (get_frame_arch (frame));

You can just use gdbarch_tdep (gdbarch).

-- 
Daniel Jacobowitz
CodeSourcery


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