This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: nrun-1.patch
- To: Doug Evans <dje at transmeta dot com>
- Subject: Re: nrun-1.patch
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Thu, 26 Oct 2000 01:44:07 +1100
- Cc: gdb-patches at sourceware dot cygnus dot com, Stephane dot Carrez at worldnet dot fr
- References: <200010040735.AAA17322@casey.transmeta.com>
Doug Evans wrote:
>
> I haven't seen any follow up to my last message on the subject
> (which I believe was convincing), therefore I'm submitting this patch.
>
> Appended is my last message to refresh your memory. :-)
>
> 2000-10-04 Doug Evans <dje@casey.transmeta.com>
>
> * common/nrun.c (main): Back out change of Jul 27. Always call sim_info.
> * m68hc11/interp.c (sim_info): Only print something if
> STATE_VERBOSE_P.
I went diging (also had a holiday but that is another story) and yes,
sim_info() is ment to always be called. Its the responsibility of the
simulator target to decide what if anything should be printed.
One addition to your patch though. I think src/include/remote-sim.h
should also be updated to more clearly explain the behavour so that we
(stephane and I) don't make the same mistake again. GDB owns
remote-sim.h so we don't need GCC approval to change it.
Andrew
> Index: common/nrun.c
> ===================================================================
> RCS file: /cvs/src/src/sim/common/nrun.c,v
> retrieving revision 1.2
> diff -c -p -r1.2 nrun.c
> *** nrun.c 2000/07/27 11:49:07 1.2
> --- nrun.c 2000/10/04 07:28:44
> *************** main (int argc, char **argv)
> *** 164,172 ****
> (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT));
>
> }
> /* Print any stats the simulator collected. */
> ! if (STATE_VERBOSE_P (sd))
> ! sim_info (sd, 0);
>
> /* Shutdown the simulator. */
> sim_close (sd, 0);
> --- 164,172 ----
> (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT));
>
> }
> +
> /* Print any stats the simulator collected. */
> ! sim_info (sd, 0);
>
> /* Shutdown the simulator. */
> sim_close (sd, 0);
> Index: m68hc11/interp.c
> ===================================================================
> RCS file: /cvs/src/src/sim/m68hc11/interp.c,v
> retrieving revision 1.3
> diff -c -p -r1.3 interp.c
> *** interp.c 2000/09/10 14:05:29 1.3
> --- interp.c 2000/10/04 07:28:44
> *************** sim_trace (SIM_DESC sd)
> *** 302,311 ****
> void
> sim_info (SIM_DESC sd, int verbose)
> {
> ! sim_io_eprintf (sd, "Simulator info:\n");
> ! sim_io_eprintf (sd, " CPU Motorola 68HC11\n");
> ! sim_get_info (sd, 0);
> ! sim_module_info (sd, verbose || STATE_VERBOSE_P (sd));
> }
>
> SIM_RC
> --- 302,314 ----
> void
> sim_info (SIM_DESC sd, int verbose)
> {
> ! if (STATE_VERBOSE_P (sd))
> ! {
> ! sim_io_eprintf (sd, "Simulator info:\n");
> ! sim_io_eprintf (sd, " CPU Motorola 68HC11\n");
> ! sim_get_info (sd, 0);
> ! sim_module_info (sd, 1);
> ! }
> }
>
> SIM_RC
>
> From: Doug Evans <dje@casey.transmeta.com>
> Date: Sun, 10 Sep 2000 17:01:59 -0700 (PDT)
> To: Stephane Carrez <Stephane.Carrez@worldnet.fr>
> Cc: cagney@redhat.com,
> gdb-patches@sourceware.cygnus.com
> Subject: Re: nrun.c patch
> In-Reply-To: <39BBFE2C.28B6D825@worldnet.fr>
> References: <200009100427.VAA27516@casey.transmeta.com>
> <39BBADC1.94352650@worldnet.fr>
> <14779.49324.843786.880750@casey.transmeta.com>
> <39BBFE2C.28B6D825@worldnet.fr>
>
> Stephane Carrez writes:
> > - several simulator (h8300, h8500, mcore, d10v, sh, w65) are printing statistics
> > about insn or cpu cycles executed (and I'm doing the same for 68hc11).
> > None of them are checking flags as you suggest.
> >
> > May be the way things were intended to work are not correct and we can fix that.
> > Now, I just want/need a common way to enable/disable the simulator statistics.
>
> Look at it this way.
>
> The minute a simulator has more than one thing the user may choose
> to ask the simulator to print out, sim_info has to test which one the
> user asked for (which can be none, any combination of, or all).
> It's simpler and cleaner to just always call sim_info,
> and let sim_info test for what to print / not print.