This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch, nios2] Nios II R2 support for GDB
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Sandra Loosemore <sandra at codesourcery dot com>
- Cc: <gdb-patches at sourceware dot org>, Yao Qi <qiyaoltc at gmail dot com>
- Date: Mon, 03 Aug 2015 15:00:11 +0100
- Subject: Re: [patch, nios2] Nios II R2 support for GDB
- Authentication-results: sourceware.org; auth=none
- References: <55B91CAD dot 8030306 at codesourcery dot com>
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 (éå)