This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: PATCH multi-arch GET_LONGJMP_TARGET
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Pierre Muller <muller at cerbere dot u-strasbg dot fr>
- Cc: gdb-patches at sources dot redhat dot com, Richard dot Earnshaw at arm dot com
- Date: Tue, 19 Feb 2002 10:41:38 +0000
- Subject: Re: PATCH multi-arch GET_LONGJMP_TARGET
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> >
> > This patch makes that
> > GET_LONGJMP_TARGET is always defined for all mutiarched target
> > (even partial !).
> >
> > Thus it breaks compilation of Cygwin native GDB,
> > because JB_PC and JB_ELEMENT_SIZE are not defined for these targets.
> > (and several other i386 targets)
> >
> > The correct fix would be to add these values to gdbarch ...
> >
> > The following was committed as an obvious fix.
>
> Ah, sorry about that.
>
> Perhaps it would also be sensible to check GET_LONGJMP_TARGET_P() in that
> code and always return 0 if it is false.
>
> I'll go around the other tdep files and clean those up as well.
>
> R.
>
Thinking about it, the cleanest way to handle this for now is to change
the test for a definition of JB_PC, since unless that is defined the code
won't compile, and even if it did it would give the wrong answer.
As far as I can tell, apart from i386, only two further ports define
GET_LONGJMP_TARGET: arc and sparc. Arc seems never to use the code
(there's only one .h file for that port and it doesn't define
GET_LONGJMP_TARGET or JB_PC); Sparc seems to define it for pretty much all
configurations I can think of.
Anyone object to the following patch? I'll leave the x86 code as is for
now, since you've already fixed that.
R.
<date> Richard Earnshaw <rearnsha@arm.com>
* arc-tdep.c (get_longjmp_target): Only compile this function if
JB_PC is defined.
* sparc-tdep.c (get_longjmp_target): Likewise.
Index: arc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arc-tdep.c,v
retrieving revision 1.8
diff -p -r1.8 arc-tdep.c
*** arc-tdep.c 2002/02/05 04:37:21 1.8
--- arc-tdep.c 2002/02/19 10:35:26
*************** arc_software_single_step (enum target_si
*** 571,577 ****
}
}
! #ifdef GET_LONGJMP_TARGET
/* Figure out where the longjmp will land. Slurp the args out of the stack.
We expect the first arg to be a pointer to the jmp_buf structure from which
we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
--- 571,579 ----
}
}
! /* Because of Multi-arch, GET_LONGJMP_TARGET is always defined. So test
! for a definition of JB_PC. */
! #ifdef JB_PC
/* Figure out where the longjmp will land. Slurp the args out of the stack.
We expect the first arg to be a pointer to the jmp_buf structure from which
we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.22
diff -p -r1.22 sparc-tdep.c
*** sparc-tdep.c 2002/01/20 19:26:48 1.22
--- sparc-tdep.c 2002/02/19 10:35:26
*************** fill_fpregset (gdb_fpregset_t *fpregsetp
*** 1686,1693 ****
#endif /* USE_PROC_FS */
!
! #ifdef GET_LONGJMP_TARGET
/* Figure out where the longjmp will land. We expect that we have just entered
longjmp and haven't yet setup the stack frame, so the args are still in the
--- 1686,1694 ----
#endif /* USE_PROC_FS */
! /* Because of Multi-arch, GET_LONGJMP_TARGET is always defined. So test
! for a definition of JB_PC. */
! #ifdef JB_PC
/* Figure out where the longjmp will land. We expect that we have just entered
longjmp and haven't yet setup the stack frame, so the args are still in the