* H8300 simulator on MinGW fails to compile.
@ 2006-09-13 12:33 Chris Johns
2006-09-13 16:55 ` Eli Zaretskii
0 siblings, 1 reply; 9+ messages in thread
From: Chris Johns @ 2006-09-13 12:33 UTC (permalink / raw)
To: gdb-patches
Hi,
Building the target h8300-rtems4.7 on a MinGW host configured with:
$ head config.status
#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host lapdog:
#
# ../gdb-6.5/configure --target=h8300-rtems4.7 --verbose --disable-nls
--without-included-gettext --disable-win32-registry --disable-werror --enable-sim
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.
fails to compile as signal numbers are not present. The patch is against 6.5 sources.
Ok ?
Regards
Chris
2006-09-13 Chris Johns <chrisj@rtems.org>
* sim-signal.c: Add __MINGW32__ to define the SIGTRAP, SIGBUS,
and SIGQUIT.
--- gdb-6.5/sim/common/sim-signal.c Wed Sep 13 19:04:12 2006
+++ gdb-6.5/sim/common/sim-signal.c~ Tue Nov 29 13:43:06 2005
@@ -27,7 +27,7 @@
to not think the process has died (so it can be debugged at the point of
failure). */
-#if defined (_MSC_VER) || __MINGW32__
+#ifdef _MSC_VER
#ifndef SIGTRAP
#define SIGTRAP 5
#endif
2006-09-13 Chris Johns <chrisj@rtems.org>
* compile.c: Define SIGBUS if not provided.
--- gdb-6.5/sim/h8300/compile.c Wed Sep 13 19:00:37 2006
+++ gdb-6.5/sim/h8300/compile.c~ Tue Jun 29 05:26:37 2004
@@ -37,9 +37,6 @@
#ifndef SIGTRAP
# define SIGTRAP 5
#endif
-#ifndef SIGBUS
-# define SIGBUS 7
-#endif
int debug;
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: H8300 simulator on MinGW fails to compile.
2006-09-13 12:33 H8300 simulator on MinGW fails to compile Chris Johns
@ 2006-09-13 16:55 ` Eli Zaretskii
2006-09-13 20:10 ` Chris Johns
0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2006-09-13 16:55 UTC (permalink / raw)
To: Chris Johns; +Cc: gdb-patches
> Date: Wed, 13 Sep 2006 22:32:58 +1000
> From: Chris Johns <chrisj@rtems.org>
>
> Building the target h8300-rtems4.7 on a MinGW host configured with:
>
> $ head config.status
> #! /bin/sh
> # Generated automatically by configure.
> # Run this file to recreate the current configuration.
> # This directory was configured as follows,
> # on host lapdog:
> #
> # ../gdb-6.5/configure --target=h8300-rtems4.7 --verbose --disable-nls
> --without-included-gettext --disable-win32-registry --disable-werror --enable-sim
> #
> # Compiler output produced by configure, useful for debugging
> # configure, is in ./config.log if it exists.
>
> fails to compile as signal numbers are not present.
Please show the error messages. From the info you posted, I cannot
figure out the problem and how your patches solve it.
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: H8300 simulator on MinGW fails to compile.
2006-09-13 16:55 ` Eli Zaretskii
@ 2006-09-13 20:10 ` Chris Johns
2006-09-13 20:30 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: Chris Johns @ 2006-09-13 20:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
Eli Zaretskii wrote:
>> Date: Wed, 13 Sep 2006 22:32:58 +1000
>> From: Chris Johns <chrisj@rtems.org>
>>
>> Building the target h8300-rtems4.7 on a MinGW host configured with:
>>
>> $ head config.status
>> #! /bin/sh
>> # Generated automatically by configure.
>> # Run this file to recreate the current configuration.
>> # This directory was configured as follows,
>> # on host lapdog:
>> #
>> # ../gdb-6.5/configure --target=h8300-rtems4.7 --verbose --disable-nls
>> --without-included-gettext --disable-win32-registry --disable-werror --enable-sim
>> #
>> # Compiler output produced by configure, useful for debugging
>> # configure, is in ./config.log if it exists.
>>
>> fails to compile as signal numbers are not present.
>
> Please show the error messages. From the info you posted, I cannot
> figure out the problem and how your patches solve it.
>
Sure. I should have had this in the original post.
make[3]: Entering directory `/opt/gdb/6.5/h8300/sim/h8300'
gcc -c -DHAVE_CONFIG_H -DPROFILE=1 -DWITH_PROFILE=-1 -DDEFAULT_INLINE=0
-D__USE_MINGW_FSEEK -I. -I../../../gdb-6.5/sim/h8300 -I../common
-I../../../gdb-6.5/sim/h8300/../common -I../../include
-I../../../gdb-6.5/sim/h8300/../../include -I../../bfd
-I../../../gdb-6.5/sim/h8300/../../bfd -I../../opcodes
-I../../../gdb-6.5/sim/h8300/../../opcodes -I../../intl
-I../../../gdb-6.5/sim/h8300/../../intl -g -O2 ../../../gdb-6.5/sim/h8300/compile.c
../../../gdb-6.5/sim/h8300/compile.c: In function `sim_resume':
../../../gdb-6.5/sim/h8300/compile.c:1942: error: `SIGBUS' undeclared (first use in this
function)
../../../gdb-6.5/sim/h8300/compile.c:1942: error: (Each undeclared identifier is reported
only once
../../../gdb-6.5/sim/h8300/compile.c:1942: error: for each function it appears in.)
make[3]: *** [compile.o] Error 1
Then after patching compile.c:
make[3]: Entering directory `/opt/gdb/6.5/h8300/sim/h8300'
gcc -c ../../../gdb-6.5/sim/h8300/../common/sim-signal.c -DHAVE_CONFIG_H -DPROFILE=1
-DWITH_PROFILE=-1 -DDEFAULT_INLINE=0 -D__USE_MINGW_FSEEK -I.
-I../../../gdb-6.5/sim/h8300 -I../common -I../../../gdb-6.5/sim/h8300/../common
-I../../include -I../../../gdb-6.5/sim/h8300/../../include -I../../bfd
-I../../../gdb-6.5/sim/h8300/../../bfd -I../../opcodes
-I../../../gdb-6.5/sim/h8300/../../opcodes -I../../intl
-I../../../gdb-6.5/sim/h8300/../../intl -g -O2
../../../gdb-6.5/sim/h8300/../common/sim-signal.c: In function `sim_signal_to_host':
../../../gdb-6.5/sim/h8300/../common/sim-signal.c:61: error: `SIGTRAP' undeclared (first
use in this function)
../../../gdb-6.5/sim/h8300/../common/sim-signal.c:61: error: (Each undeclared identifier
is reported only once
../../../gdb-6.5/sim/h8300/../common/sim-signal.c:61: error: for each function it appears in.)
make[3]: *** [sim-signal.o] Error 1
Regards
Chris
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: H8300 simulator on MinGW fails to compile.
2006-09-13 20:10 ` Chris Johns
@ 2006-09-13 20:30 ` Daniel Jacobowitz
2006-09-14 1:22 ` Chris Johns
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2006-09-13 20:30 UTC (permalink / raw)
To: Chris Johns; +Cc: Eli Zaretskii, gdb-patches
First, a minor point: your patch was reversed, deleting instead
of adding. New file second on the diff command line.
On Thu, Sep 14, 2006 at 06:10:08AM +1000, Chris Johns wrote:
> ../../../gdb-6.5/sim/h8300/compile.c: In function `sim_resume':
> ../../../gdb-6.5/sim/h8300/compile.c:1942: error: `SIGBUS' undeclared
> (first use in this function)
> ../../../gdb-6.5/sim/h8300/compile.c:1942: error: (Each undeclared
> identifier is reported only once
> ../../../gdb-6.5/sim/h8300/compile.c:1942: error: for each function it
> appears in.)
> make[3]: *** [compile.o] Error 1
Some work has been done to reduce the use of host signal numbers in the
simulator. Rather than adding more bandaids, we need to do more to
switch to either the SIM_* or TARGET_SIGNAL_* constants. The host's
numbers just aren't relevant.
Unfortunately all the code is somewhat tangled in multiple sims.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: H8300 simulator on MinGW fails to compile.
2006-09-13 20:30 ` Daniel Jacobowitz
@ 2006-09-14 1:22 ` Chris Johns
2006-09-14 3:05 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: Chris Johns @ 2006-09-14 1:22 UTC (permalink / raw)
To: gdb-patches; +Cc: Eli Zaretskii
Daniel Jacobowitz wrote:
> First, a minor point: your patch was reversed, deleting instead
> of adding. New file second on the diff command line.
Oops. I will not post again until your second point is resolved.
>
> On Thu, Sep 14, 2006 at 06:10:08AM +1000, Chris Johns wrote:
>> ../../../gdb-6.5/sim/h8300/compile.c: In function `sim_resume':
>> ../../../gdb-6.5/sim/h8300/compile.c:1942: error: `SIGBUS' undeclared
>> (first use in this function)
>> ../../../gdb-6.5/sim/h8300/compile.c:1942: error: (Each undeclared
>> identifier is reported only once
>> ../../../gdb-6.5/sim/h8300/compile.c:1942: error: for each function it
>> appears in.)
>> make[3]: *** [compile.o] Error 1
>
> Some work has been done to reduce the use of host signal numbers in the
> simulator. Rather than adding more bandaids, we need to do more to
> switch to either the SIM_* or TARGET_SIGNAL_* constants. The host's
> numbers just aren't relevant.
Did wonder why simulator signals needed to equated to the host signals. I am still not
clear why the code is like this.
>
> Unfortunately all the code is somewhat tangled in multiple sims.
>
I see what you mean.
The TARGET_SIGNAL_* shows up in the ppc, d10v, and arm sims. The host type SIG* such as
SIGBUS appear to be in most of the sims.
Is the solution to change sim-signal.c to use TARGET_SIGNAL_* and then change the effected
sim files to SIM_SIG* ?
Regards
Chris
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: H8300 simulator on MinGW fails to compile.
2006-09-14 1:22 ` Chris Johns
@ 2006-09-14 3:05 ` Daniel Jacobowitz
2006-09-14 23:43 ` Chris Johns
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2006-09-14 3:05 UTC (permalink / raw)
To: Chris Johns; +Cc: gdb-patches, Eli Zaretskii
On Thu, Sep 14, 2006 at 11:22:15AM +1000, Chris Johns wrote:
> Did wonder why simulator signals needed to equated to the host signals. I
> am still not clear why the code is like this.
No good reason. It's historical ugliness.
> I see what you mean.
>
> The TARGET_SIGNAL_* shows up in the ppc, d10v, and arm sims. The host type
> SIG* such as SIGBUS appear to be in most of the sims.
>
> Is the solution to change sim-signal.c to use TARGET_SIGNAL_* and then
> change the effected sim files to SIM_SIG* ?
I'm not entirely sure any more; it's been ages since I looked at these.
I think the SIM_SIG* constants may be older than the TARGET_SIGNAL_*
constants; I don't think we need both... but I really don't know. The
problem is that a given int variable could hold any of the three right
now.
It's a righteous mess.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: H8300 simulator on MinGW fails to compile.
2006-09-14 3:05 ` Daniel Jacobowitz
@ 2006-09-14 23:43 ` Chris Johns
2006-09-16 3:53 ` Daniel Jacobowitz
0 siblings, 1 reply; 9+ messages in thread
From: Chris Johns @ 2006-09-14 23:43 UTC (permalink / raw)
To: gdb-patches; +Cc: Eli Zaretskii
Daniel Jacobowitz wrote:
>
> I'm not entirely sure any more; it's been ages since I looked at these.
> I think the SIM_SIG* constants may be older than the TARGET_SIGNAL_*
> constants; I don't think we need both... but I really don't know. The
> problem is that a given int variable could hold any of the three right
> now.
>
I am confused about the source of the host signals. The nrun.c file has
code to handle the host signals. Are they coming from the gdb UI or
something similar ?
> It's a righteous mess.
It does not look great but then again I do not know the code to make a
clear judgement.
What is simplest way to run 'make check' on the simulator ?
Regards
Chris
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: H8300 simulator on MinGW fails to compile.
2006-09-14 23:43 ` Chris Johns
@ 2006-09-16 3:53 ` Daniel Jacobowitz
2006-09-19 1:20 ` Chris Johns
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2006-09-16 3:53 UTC (permalink / raw)
To: Chris Johns; +Cc: gdb-patches, Eli Zaretskii
On Fri, Sep 15, 2006 at 09:42:57AM +1000, Chris Johns wrote:
> Daniel Jacobowitz wrote:
> >
> >I'm not entirely sure any more; it's been ages since I looked at these.
> >I think the SIM_SIG* constants may be older than the TARGET_SIGNAL_*
> >constants; I don't think we need both... but I really don't know. The
> >problem is that a given int variable could hold any of the three right
> >now.
> >
>
> I am confused about the source of the host signals. The nrun.c file has
> code to handle the host signals. Are they coming from the gdb UI or
> something similar ?
There's at least two different things at issue here. nrun.c, I
believe, does not get linked in when the simulator is used from GDB.
Instead, it's only used for the 'foo-elf-run' binaries. As such, it
receives actual host signals (specifically SIGINT). So that's
undoubtedly a host signal number. But then that queues up SIM_SIGINT
inside the simulator.
What's interesting is to trace a particular use of a host signal number
through the various files, and figure out where it's set and used. I
can generally do them one at a time. For instance, the h8300 use of
SIGBUS:
sim_engine_set_run_state (sd, sim_stopped, SIGBUS);
One call site for sim_engine_set_run_state passes SIM_SIGTRAP, another
passes pending_sigrc, but both are inside #if 0. Another passes 0.
Everything else uses a host signal number, and comes from the h8300
sim. The signal number gets stored in engine->sigrc.
There's two ways to get it out again: sim_stop_reason leaves it as is
if sim_exited and treats it as a SIM_* signal if sim_stopped or
sim_signalled, and sim_engine_get_run_state just returns it.
The other way to set ->sigrc is sim_engine_halt. And pretty much all
call sites use SIM_* constants for that, as far as I checked.
So what all that boils down to is, I think the h8300 sim is simply
wrong. The use of SIGINT for signal() is fine, but all the others
should probably be changed. Then you won't need the definitions any
more. Want to give it a try?
> What is simplest way to run 'make check' on the simulator ?
Some simulators have a testsuite, others don't; h8300 appears not to.
You can always stress it by using it to run other things, like the GCC
testsuite.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: H8300 simulator on MinGW fails to compile.
2006-09-16 3:53 ` Daniel Jacobowitz
@ 2006-09-19 1:20 ` Chris Johns
0 siblings, 0 replies; 9+ messages in thread
From: Chris Johns @ 2006-09-19 1:20 UTC (permalink / raw)
To: gdb-patches; +Cc: Eli Zaretskii
Daniel Jacobowitz wrote:
>
> There's at least two different things at issue here. nrun.c, I
> believe, does not get linked in when the simulator is used from GDB.
> Instead, it's only used for the 'foo-elf-run' binaries. As such, it
> receives actual host signals (specifically SIGINT). So that's
> undoubtedly a host signal number. But then that queues up SIM_SIGINT
> inside the simulator.
>
I now understand the source of signals when run as a stand alone program.
> What's interesting is to trace a particular use of a host signal number
> through the various files, and figure out where it's set and used. I
> can generally do them one at a time. For instance, the h8300 use of
> SIGBUS:
>
> sim_engine_set_run_state (sd, sim_stopped, SIGBUS);
>
> One call site for sim_engine_set_run_state passes SIM_SIGTRAP, another
> passes pending_sigrc, but both are inside #if 0. Another passes 0.
> Everything else uses a host signal number, and comes from the h8300
> sim. The signal number gets stored in engine->sigrc.
>
> There's two ways to get it out again: sim_stop_reason leaves it as is
> if sim_exited and treats it as a SIM_* signal if sim_stopped or
> sim_signalled, and sim_engine_get_run_state just returns it.
>
> The other way to set ->sigrc is sim_engine_halt. And pretty much all
> call sites use SIM_* constants for that, as far as I checked.
>
This is how I see the flow. I think it is simplest to try and get to
just SIM_* and TARGET_SIGNAL_* and no host signal numbers in the simulators.
> So what all that boils down to is, I think the h8300 sim is simply
> wrong. The use of SIGINT for signal() is fine, but all the others
> should probably be changed. Then you won't need the definitions any
> more. Want to give it a try?
Yeap will do.
>
>> What is simplest way to run 'make check' on the simulator ?
>
> Some simulators have a testsuite, others don't; h8300 appears not to.
> You can always stress it by using it to run other things, like the GCC
> testsuite.
>
I am not sure I understand what you mean by running the gcc testsuite.
I will also chat to Joel Sherrill as he has put the H8300 into RTEMS and
see what RTEMS tests we can run.
Thanks.
Regards
Chris
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-09-19 1:20 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-13 12:33 H8300 simulator on MinGW fails to compile Chris Johns
2006-09-13 16:55 ` Eli Zaretskii
2006-09-13 20:10 ` Chris Johns
2006-09-13 20:30 ` Daniel Jacobowitz
2006-09-14 1:22 ` Chris Johns
2006-09-14 3:05 ` Daniel Jacobowitz
2006-09-14 23:43 ` Chris Johns
2006-09-16 3:53 ` Daniel Jacobowitz
2006-09-19 1:20 ` Chris Johns
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox