From cc67f780ecdb8a5c50eaae9e04b7fc11ce23ddba Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 18 Jan 2023 20:14:54 -0500 Subject: [PATCH] sim: info: convert verbose field to a bool 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. --- 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 +#include #include #ifdef __cplusplus @@ -197,9 +198,9 @@ int sim_store_register (SIM_DESC sd, int regno, const void *buf, int length); /* Print whatever statistics the simulator has collected. - VERBOSE is currently unused and must always be zero. */ + When VERBOSE is enabled, extra details will be shown. */ -void sim_info (SIM_DESC sd, int verbose); +void sim_info (SIM_DESC sd, bool verbose); /* 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. */ void -scache_print_profile (SIM_CPU *cpu, int verbose) +scache_print_profile (SIM_CPU *cpu, bool verbose) { SIM_DESC sd = CPU_STATE (cpu); unsigned long hits = 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. */ /* 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); #if WITH_PROFILE_SCACHE_P 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. */ void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { SIM_ASSERT (STATE_MAGIC (sd) == 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 */ void -sim_module_info (SIM_DESC sd, int verbose) +sim_module_info (SIM_DESC sd, bool verbose) { struct module_list *modules = 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); /* Lists of installed handlers. */ @@ -98,7 +98,7 @@ SIM_RC sim_module_suspend (SIM_DESC sd); SIM_RC sim_module_resume (SIM_DESC sd); /* Report general information on module */ -void sim_module_info (SIM_DESC sd, int verbose); +void sim_module_info (SIM_DESC sd, bool verbose); /* 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) } static void -profile_print_pc (sim_cpu *cpu, int verbose) +profile_print_pc (sim_cpu *cpu, bool verbose) { SIM_DESC sd = CPU_STATE (cpu); PROFILE_DATA *profile = CPU_PROFILE_DATA (cpu); @@ -758,7 +758,7 @@ profile_insn_init (SIM_DESC sd) } 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 = CPU_STATE (cpu); @@ -831,7 +831,7 @@ profile_print_insn (sim_cpu *cpu, int verbose) #if WITH_PROFILE_MEMORY_P 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 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 static void -profile_print_model (sim_cpu *cpu, int verbose) +profile_print_model (sim_cpu *cpu, bool verbose) { SIM_DESC sd = CPU_STATE (cpu); PROFILE_DATA *data = CPU_PROFILE_DATA (cpu); @@ -1110,7 +1110,7 @@ profile_print_addr_ranges (sim_cpu *cpu) section titles. */ static void -profile_info (SIM_DESC sd, int verbose) +profile_info (SIM_DESC sd, bool verbose) { int i,c; int print_title_p = 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_, 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 verbose); +typedef void (PROFILE_INFO_CPU_CALLBACK_FN) (struct _sim_cpu *cpu, bool verbose); /* 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, } 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, uint64_t length) } 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[] = }; static void -print_parallel (SIM_CPU *cpu, int verbose) +print_parallel (SIM_CPU *cpu, bool verbose) { SIM_DESC sd = CPU_STATE (cpu); PROFILE_DATA *p = CPU_PROFILE_DATA (cpu); @@ -2057,7 +2057,7 @@ print_parallel (SIM_CPU *cpu, int verbose) } 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 = 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) } void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { sim_cpu *cpu = STATE_CPU (sd, 0); const struct h8300_sim_state *state = 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) } 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 */ 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); /* Cover function of sim_state_free to free the cpu buffers as well. */ @@ -194,7 +194,7 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv, /* PROFILE_CPU_CALLBACK */ static void -print_m32r_misc_cpu (SIM_CPU *cpu, int verbose) +print_m32r_misc_cpu (SIM_CPU *cpu, bool verbose) { SIM_DESC sd = 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, } 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) } void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { SIM_CPU *cpu = STATE_CPU (sd, 0); struct mcore_sim_cpu *mcore_cpu = 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 *memory, int length) } void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { SIM_CPU *cpu = STATE_CPU (sd, 0); host_callback *callback = 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) } void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { TRACE(trace_gdb, ("sim_info(verbose=%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". */ void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { check_desc (sd); 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) } void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { check_desc (sd); 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) } void -sim_info (SIM_DESC sd, int verbose) +sim_info (SIM_DESC sd, bool verbose) { double timetaken = (double) saved_state.asregs.ticks / (double) now_persec (); -- 2.30.2