[Patch,ARM] Next pc of sigreturn/rt_sigreturn syscall

Yao Qi yao@codesourcery.com
Thu Aug 26 08:51:00 GMT 2010


Daniel Jacobowitz wrote:
> 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.
> 
OK, done as you suggested.

>> +static int
>> +arm_linux_sigreturn_return_addr(struct frame_info *frame,
>> +				unsigned long svc_number)
> 
> Space before "(".  Same problem in other places, too.
> 

Done.

>> +/* 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.
> 

Done.

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

I've added code for non-EABI to decode SWI instruction for syscall
number.  See details in my patch.

> 
>> @@ -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?

Because I noticed that condition_true always returns true if cond is 0xf
(INST_NV).

>> +	{
>> +	  struct gdbarch_tdep *tdep;
>> +	  tdep = gdbarch_tdep (get_frame_arch (frame));
> 
> You can just use gdbarch_tdep (gdbarch).

OK, done in my patch.

-- 
Yao Qi
CodeSourcery
yao@codesourcery.com
(650) 331-3385 x739
-------------- next part --------------
A non-text attachment was scrubbed...
Name: return_addr_sigreturn.patch
Type: text/x-patch
Size: 7073 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20100826/a6f4fe3a/attachment.bin>


More information about the Gdb-patches mailing list