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, nios2] Nios II R2 support for GDB


Sandra Loosemore <sandra@codesourcery.com> writes:

Hi Sandra,
The patch looks good to me.  Some comments below...

> +  if (mach == bfd_mach_nios2r2)
> +    {
> +      /* R2 trap encoding:
> +	   ((0x2d << 26) | (0x1f << 21) | (0x1d << 16) | (0x20 << 0))
> +	   0xb7fd0020
> +	 CDX trap.n encoding:
> +	   ((0xd << 12) | (0x1f << 6) | (0x9 << 0))
> +	   0xd7c9   

Please remove these trailing spaces above.

> @@ -156,13 +156,30 @@ nios2_linux_rt_sigreturn_init (const struct tramp_frame *self,
>    trad_frame_set_id (this_cache, frame_id_build (base, func));
>  }
>  
> -static struct tramp_frame nios2_linux_rt_sigreturn_tramp_frame =
> +/* Trampoline for sigreturn.  This has the form
> +     movi r2, __NR_rt_sigreturn
> +     trap 0
> +   appropriately encoded for R1 or R2.  */
> +   
   ^^^^
Remove spaces above too.

>  
>  static CORE_ADDR
> -nios2_linux_syscall_next_pc (struct frame_info *frame)
> +nios2_linux_syscall_next_pc (struct frame_info *frame,
> +			     const struct nios2_opcode *op)
>  {
>    CORE_ADDR pc = get_frame_pc (frame);
>    ULONGEST syscall_nr = get_frame_register_unsigned (frame, NIOS2_R2_REGNUM);
> @@ -182,7 +200,7 @@ nios2_linux_syscall_next_pc (struct frame_info *frame)
>    if (syscall_nr == 139 /* rt_sigreturn */)
>      return frame_unwind_caller_pc (frame);
>  
> -  return pc + NIOS2_OPCODE_SIZE;
> +  return pc + op->size;

Nit: Can we get the size of opcode without OP here?  We can get the
gdbarch of FRAME by frame_unwind_arch, we can tell it is R1 or R2, and
get to know the size of the instruction?

-- 
Yao (éå)


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