This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH 3/3] arc: Add support for Newlib
Hi Yao,
> -----Original Message-----
> From: Yao Qi [mailto:qiyaoltc@gmail.com]
> Sent: Tuesday, October 11, 2016 5:14 PM
> To: Anton Kolesov <Anton.Kolesov@synopsys.com>
> Cc: gdb-patches@sourceware.org; Francois Bedard <Francois.Bedard@synopsys.com>
> Subject: Re: [PATCH 3/3] arc: Add support for Newlib
>
> Anton Kolesov <Anton.Kolesov@synopsys.com> writes:
>
> Hi Anton,
>
> > +/* Implement the 'init_osabi' method of struct gdb_osabi_handler. */
> > +
> > +static void
> > +arc_newlib_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
> > +{
> > + if (arc_debug)
> > + debug_printf ("arc-newlib: Initialization.\n");
> > +
> > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> > +
> > + /* Offset of original PC in longjmp jump buffer (in registers). Value of
> PC
> > + offset can be found in newlib/libc/machine/arc/setjmp.S. */
> > + tdep->jb_pc = 18;
>
> What is jb_pc on arc-linux? Is it 18 or a different one? If it is 18
> too, we can use arc_get_longjmp_target for both newlib and linux. Patch
> #1 is not needed.
Unfortunately, it is different in our uClibc port [1] - jb_pc is 15 there.
uClibc saves r13-r25, fp (r27), sp (r28), blink (r31); newlib on the other
hand saves all registers from r13 through r31. Back in time ARC port of GDB
had an "if" inside the get_longjump_target which was selecting offset based
on OS/ABI, instead of using tdep->jb_pc. But using jb_pc, like in arm-tdep.c,
looks like a better solution architecturally.
[1] http://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/tree/libc/sysdeps/linux/arc/bits/setjmp.h
Anton
>
> --
> Yao (齐尧)