From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id D7C193858032; Thu, 19 Jan 2023 01:48:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7C193858032 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674092885; bh=gRzaGLJbuTnc7cCft/hzUq1qafae2uFuNVDOPD2FN7c=; h=From:To:Subject:Date:From; b=MtSzFNqTAzfCifGhDWUQbFBgrW8zYg8VvvvWVCKwqHAZEHAEq+3EJ7RP0S04wJtfg O1CxzvxjxC430h3oauyCMK2cECjjKbiaCBvcKHtmqlU9We0yp/A/Z1Zyg3Y8ZFZHDJ SPYt7BjP6jhal8QmbLLs3zMO5s9m259AQzp5mheA= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] sim: info: convert verbose field to a bool X-Act-Checkin: binutils-gdb X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: 7fd14d6f580eeed46ef4d6f04f6b5f2f1318c0f9 X-Git-Newrev: cc67f780ecdb8a5c50eaae9e04b7fc11ce23ddba Message-Id: <20230119014805.D7C193858032@sourceware.org> Date: Thu, 19 Jan 2023 01:48:05 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dcc67f780ecdb= 8a5c50eaae9e04b7fc11ce23ddba commit cc67f780ecdb8a5c50eaae9e04b7fc11ce23ddba Author: Mike Frysinger Date: Wed Jan 18 20:14:54 2023 -0500 sim: info: convert verbose field to a bool =20 The verbose argument has always been an int treated as a bool, so convert it to an explicit bool. Further, update the API docs to match the reality that the verbose value is actually used by some of the internal modules. Diff: --- include/sim/sim.h | 5 +++-- sim/common/cgen-scache.c | 2 +- sim/common/cgen-scache.h | 2 +- sim/common/sim-info.c | 2 +- sim/common/sim-module.c | 2 +- sim/common/sim-module.h | 4 ++-- sim/common/sim-profile.c | 12 ++++++------ sim/common/sim-profile.h | 2 +- sim/d10v/interp.c | 2 +- sim/erc32/interf.c | 2 +- sim/frv/profile.c | 4 ++-- sim/h8300/compile.c | 2 +- sim/m32c/gdb-if.c | 2 +- sim/m32r/sim-if.c | 4 ++-- sim/m68hc11/interp.c | 2 +- sim/mcore/interp.c | 2 +- sim/microblaze/interp.c | 2 +- sim/ppc/sim_calls.c | 2 +- sim/rl78/gdb-if.c | 2 +- sim/rx/gdb-if.c | 2 +- sim/sh/interp.c | 2 +- 21 files changed, 31 insertions(+), 30 deletions(-) diff --git a/include/sim/sim.h b/include/sim/sim.h index 8f33b094297..4575269fe7d 100644 --- a/include/sim/sim.h +++ b/include/sim/sim.h @@ -20,6 +20,7 @@ #ifndef SIM_SIM_H #define SIM_SIM_H 1 =20 +#include #include =20 #ifdef __cplusplus @@ -197,9 +198,9 @@ int sim_store_register (SIM_DESC sd, int regno, const v= oid *buf, int length); =20 /* Print whatever statistics the simulator has collected. =20 - VERBOSE is currently unused and must always be zero. */ + When VERBOSE is enabled, extra details will be shown. */ =20 -void sim_info (SIM_DESC sd, int verbose); +void sim_info (SIM_DESC sd, bool verbose); =20 =20 /* Return a memory map in XML format. diff --git a/sim/common/cgen-scache.c b/sim/common/cgen-scache.c index f087dc72a3e..c6de30e1657 100644 --- a/sim/common/cgen-scache.c +++ b/sim/common/cgen-scache.c @@ -420,7 +420,7 @@ scache_lookup_or_alloc (SIM_CPU *cpu, IADDR pc, int n, = SCACHE **bufp) /* Print cache access statics for CPU. */ =20 void -scache_print_profile (SIM_CPU *cpu, int verbose) +scache_print_profile (SIM_CPU *cpu, bool verbose) { SIM_DESC sd =3D CPU_STATE (cpu); unsigned long hits =3D CPU_SCACHE_HITS (cpu); diff --git a/sim/common/cgen-scache.h b/sim/common/cgen-scache.h index f3674cc3a0b..2b79cb1d859 100644 --- a/sim/common/cgen-scache.h +++ b/sim/common/cgen-scache.h @@ -117,7 +117,7 @@ extern void scache_flush_cpu (SIM_CPU *); /* Scache profiling support. */ =20 /* Print summary scache usage information. */ -extern void scache_print_profile (SIM_CPU *cpu, int verbose); +extern void scache_print_profile (SIM_CPU *cpu, bool verbose); =20 #if WITH_PROFILE_SCACHE_P =20 diff --git a/sim/common/sim-info.c b/sim/common/sim-info.c index 0e3554da0d9..db8cc85b358 100644 --- a/sim/common/sim-info.c +++ b/sim/common/sim-info.c @@ -27,7 +27,7 @@ along with this program. If not, see . */ sim-module. */ =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { SIM_ASSERT (STATE_MAGIC (sd) =3D=3D SIM_MAGIC_NUMBER); sim_module_info (sd, verbose || STATE_VERBOSE_P (sd)); diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c index 0d5f6c16263..f03e4b774b7 100644 --- a/sim/common/sim-module.c +++ b/sim/common/sim-module.c @@ -272,7 +272,7 @@ sim_module_uninstall (SIM_DESC sd) /* Called when ever simulator info is needed */ =20 void -sim_module_info (SIM_DESC sd, int verbose) +sim_module_info (SIM_DESC sd, bool verbose) { struct module_list *modules =3D STATE_MODULES (sd); MODULE_INFO_LIST *modp; diff --git a/sim/common/sim-module.h b/sim/common/sim-module.h index d50e5df477d..cfa06cb37ab 100644 --- a/sim/common/sim-module.h +++ b/sim/common/sim-module.h @@ -39,7 +39,7 @@ typedef SIM_RC (MODULE_INIT_FN) (SIM_DESC); typedef SIM_RC (MODULE_RESUME_FN) (SIM_DESC); typedef SIM_RC (MODULE_SUSPEND_FN) (SIM_DESC); typedef void (MODULE_UNINSTALL_FN) (SIM_DESC); -typedef void (MODULE_INFO_FN) (SIM_DESC, int); +typedef void (MODULE_INFO_FN) (SIM_DESC, bool); =20 =20 /* Lists of installed handlers. */ @@ -98,7 +98,7 @@ SIM_RC sim_module_suspend (SIM_DESC sd); SIM_RC sim_module_resume (SIM_DESC sd); =20 /* Report general information on module */ -void sim_module_info (SIM_DESC sd, int verbose); +void sim_module_info (SIM_DESC sd, bool verbose); =20 =20 /* Module private data */ diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c index 77b2bd3024e..6b3853e9e18 100644 --- a/sim/common/sim-profile.c +++ b/sim/common/sim-profile.c @@ -611,7 +611,7 @@ profile_pc_init (SIM_DESC sd) } =20 static void -profile_print_pc (sim_cpu *cpu, int verbose) +profile_print_pc (sim_cpu *cpu, bool verbose) { SIM_DESC sd =3D CPU_STATE (cpu); PROFILE_DATA *profile =3D CPU_PROFILE_DATA (cpu); @@ -758,7 +758,7 @@ profile_insn_init (SIM_DESC sd) } =20 static void -profile_print_insn (sim_cpu *cpu, int verbose) +profile_print_insn (sim_cpu *cpu, bool verbose) { unsigned int i, n, total, max_val, max_name_len; SIM_DESC sd =3D CPU_STATE (cpu); @@ -831,7 +831,7 @@ profile_print_insn (sim_cpu *cpu, int verbose) #if WITH_PROFILE_MEMORY_P =20 static void -profile_print_memory (sim_cpu *cpu, int verbose) +profile_print_memory (sim_cpu *cpu, bool verbose) { unsigned int i, n; unsigned int total_read, total_write; @@ -905,7 +905,7 @@ profile_print_memory (sim_cpu *cpu, int verbose) #if WITH_PROFILE_CORE_P =20 static void -profile_print_core (sim_cpu *cpu, int verbose) +profile_print_core (sim_cpu *cpu, bool verbose) { unsigned int total; unsigned int max_val; @@ -962,7 +962,7 @@ profile_print_core (sim_cpu *cpu, int verbose) #if WITH_PROFILE_MODEL_P =20 static void -profile_print_model (sim_cpu *cpu, int verbose) +profile_print_model (sim_cpu *cpu, bool verbose) { SIM_DESC sd =3D CPU_STATE (cpu); PROFILE_DATA *data =3D CPU_PROFILE_DATA (cpu); @@ -1110,7 +1110,7 @@ profile_print_addr_ranges (sim_cpu *cpu) section titles. */ =20 static void -profile_info (SIM_DESC sd, int verbose) +profile_info (SIM_DESC sd, bool verbose) { int i,c; int print_title_p =3D 0; diff --git a/sim/common/sim-profile.h b/sim/common/sim-profile.h index 23b21ea09d7..9b062f3301b 100644 --- a/sim/common/sim-profile.h +++ b/sim/common/sim-profile.h @@ -120,7 +120,7 @@ SIM_RC sim_profile_set_option (SIM_DESC sd_, const char= *name_, int idx_, =20 typedef void (PROFILE_INFO_CALLBACK_FN) (SIM_DESC, int); struct _sim_cpu; /* forward reference */ -typedef void (PROFILE_INFO_CPU_CALLBACK_FN) (struct _sim_cpu *cpu, int ver= bose); +typedef void (PROFILE_INFO_CPU_CALLBACK_FN) (struct _sim_cpu *cpu, bool ve= rbose); =20 =0C /* Struct containing most profiling data. diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c index aebd98ab6ac..46d7bf274cc 100644 --- a/sim/d10v/interp.c +++ b/sim/d10v/interp.c @@ -1043,7 +1043,7 @@ sim_engine_run (SIM_DESC sd, } =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { char buf1[40]; char buf2[40]; diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c index 8af3434f2e7..b487c7ca230 100644 --- a/sim/erc32/interf.c +++ b/sim/erc32/interf.c @@ -354,7 +354,7 @@ sim_read (SIM_DESC sd, uint64_t mem, void *buffer, uint= 64_t length) } =20 void -sim_info(SIM_DESC sd, int verbose) +sim_info(SIM_DESC sd, bool verbose) { show_stat(&sregs); } diff --git a/sim/frv/profile.c b/sim/frv/profile.c index fab941a3e42..238816b836e 100644 --- a/sim/frv/profile.c +++ b/sim/frv/profile.c @@ -1991,7 +1991,7 @@ slot_names[] =3D }; =20 static void -print_parallel (SIM_CPU *cpu, int verbose) +print_parallel (SIM_CPU *cpu, bool verbose) { SIM_DESC sd =3D CPU_STATE (cpu); PROFILE_DATA *p =3D CPU_PROFILE_DATA (cpu); @@ -2057,7 +2057,7 @@ print_parallel (SIM_CPU *cpu, int verbose) } =20 void -frv_profile_info (SIM_CPU *cpu, int verbose) +frv_profile_info (SIM_CPU *cpu, bool verbose) { /* FIXME: Need to add smp support. */ PROFILE_DATA *p =3D CPU_PROFILE_DATA (cpu); diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 1e303a92eca..a4b39ae3380 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -4489,7 +4489,7 @@ h8300_reg_fetch (SIM_CPU *cpu, int rn, void *buf, int= length) } =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { sim_cpu *cpu =3D STATE_CPU (sd, 0); const struct h8300_sim_state *state =3D H8300_SIM_STATE (sd); diff --git a/sim/m32c/gdb-if.c b/sim/m32c/gdb-if.c index 5d4d86f2404..410d47cffa8 100644 --- a/sim/m32c/gdb-if.c +++ b/sim/m32c/gdb-if.c @@ -705,7 +705,7 @@ sim_memory_map (SIM_DESC sd) } =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { printf ("The m32c minisim doesn't collect any statistics.\n"); } diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c index de8d870e85c..d621e3f6dc5 100644 --- a/sim/m32r/sim-if.c +++ b/sim/m32r/sim-if.c @@ -36,7 +36,7 @@ #define M32R_DEFAULT_MEM_SIZE 0x2000000 /* 32M */ =20 static void free_state (SIM_DESC); -static void print_m32r_misc_cpu (SIM_CPU *cpu, int verbose); +static void print_m32r_misc_cpu (SIM_CPU *cpu, bool verbose); =0C /* Cover function of sim_state_free to free the cpu buffers as well. */ =20 @@ -194,7 +194,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, cha= r * const *argv, /* PROFILE_CPU_CALLBACK */ =20 static void -print_m32r_misc_cpu (SIM_CPU *cpu, int verbose) +print_m32r_misc_cpu (SIM_CPU *cpu, bool verbose) { SIM_DESC sd =3D CPU_STATE (cpu); char buf[20]; diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c index 323ae21448f..df6bd7bea56 100644 --- a/sim/m68hc11/interp.c +++ b/sim/m68hc11/interp.c @@ -515,7 +515,7 @@ sim_engine_run (SIM_DESC sd, } =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { const char *cpu_type; const struct bfd_arch_info *arch; diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c index f2707fb9374..53cfdad050b 100644 --- a/sim/mcore/interp.c +++ b/sim/mcore/interp.c @@ -1294,7 +1294,7 @@ mcore_reg_fetch (SIM_CPU *cpu, int rn, void *memory, = int length) } =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { SIM_CPU *cpu =3D STATE_CPU (sd, 0); struct mcore_sim_cpu *mcore_cpu =3D MCORE_SIM_CPU (cpu); diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c index f53c1d7d65b..5e701e56d40 100644 --- a/sim/microblaze/interp.c +++ b/sim/microblaze/interp.c @@ -368,7 +368,7 @@ microblaze_reg_fetch (SIM_CPU *cpu, int rn, void *memor= y, int length) } =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { SIM_CPU *cpu =3D STATE_CPU (sd, 0); host_callback *callback =3D STATE_CALLBACK (sd); diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c index 88544457c6e..13e39a6e07b 100644 --- a/sim/ppc/sim_calls.c +++ b/sim/ppc/sim_calls.c @@ -149,7 +149,7 @@ sim_write (SIM_DESC sd, uint64_t mem, const void *buf, = uint64_t length) } =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { TRACE(trace_gdb, ("sim_info(verbose=3D%d) called\n", verbose)); psim_print_info (simulator, verbose); diff --git a/sim/rl78/gdb-if.c b/sim/rl78/gdb-if.c index be93f578a89..d780bc0fed0 100644 --- a/sim/rl78/gdb-if.c +++ b/sim/rl78/gdb-if.c @@ -391,7 +391,7 @@ sim_store_register (SIM_DESC sd, int regno, const void = *buf, int length) /* Print out message associated with "info target". */ =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { check_desc (sd); =20 diff --git a/sim/rx/gdb-if.c b/sim/rx/gdb-if.c index 5e2ad2f02af..a2b9218d89b 100644 --- a/sim/rx/gdb-if.c +++ b/sim/rx/gdb-if.c @@ -644,7 +644,7 @@ sim_store_register (SIM_DESC sd, int regno, const void = *buf, int length) } =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { check_desc (sd); =20 diff --git a/sim/sh/interp.c b/sim/sh/interp.c index c067f0f2bea..2e2e13641e4 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -2272,7 +2272,7 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, = int *sigrc) } =20 void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { double timetaken =3D=20 (double) saved_state.asregs.ticks / (double) now_persec ();