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.
This commit is contained in:
Mike Frysinger 2023-01-18 20:14:54 -05:00
parent 7fd14d6f58
commit cc67f780ec
21 changed files with 31 additions and 30 deletions

View File

@ -20,6 +20,7 @@
#ifndef SIM_SIM_H
#define SIM_SIM_H 1
#include <stdbool.h>
#include <stdint.h>
#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.

View File

@ -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);

View File

@ -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

View File

@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
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));

View File

@ -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;

View File

@ -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 */

View File

@ -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;

View File

@ -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.

View File

@ -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];

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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");
}

View File

@ -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];

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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 ();