This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH]: Fix stack offset correction for 68hc11
- To: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Subject: Re: [PATCH]: Fix stack offset correction for 68hc11
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 25 Sep 2000 15:34:33 -0400
- Cc: gdb-patches at sourceware dot cygnus dot com
- References: <39AC2889.F12F65B2@worldnet.fr>
Stephane Carrez wrote:
>
> Hi!
>
> For 68hc11, a stack offset correction of +1 must be applied on the stack
> register before using it to read/write the memory. No correction is required
> for 68hc12. The stack offset correction was already applied (inlined) at
> several places but it was only correct for 68hc11.
>
> I've committed the following patch to fix the problem.
FYI,
> + /* Stack pointer correction value. For 68hc11, the stack pointer points
> + to the next push location. An offset of 1 must be applied to obtain
> + the address where the last value is saved. For 68hc12, the stack
> + pointer points to the last value pushed. No offset is necessary. */
> + static int stack_correction = 1;
Can I encourage you to create ``struct gdbarch_tdep'' object and put
this value in there. Eventually gdb is going to have more than one
active GDB architecture and when that happens static variables just
won't work :-(
enjoy,
Andrew