aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sim/common/sim-utils.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index 259b14c..d4a624c 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -123,14 +123,17 @@ sim_cpu_lookup (SIM_DESC sd, const char *cpu_name)
const char *
sim_cpu_msg_prefix (sim_cpu *cpu)
{
-#if MAX_NR_PROCESSORS == 1
- return "";
-#else
static char *prefix;
+ if (MAX_NR_PROCESSORS == 1)
+ return "";
+
if (prefix == NULL)
{
+ SIM_DESC sd = CPU_STATE (cpu);
int maxlen = 0;
+ int i;
+
for (i = 0; i < MAX_NR_PROCESSORS; ++i)
{
int len = strlen (CPU_NAME (STATE_CPU (sd, i)));
@@ -140,8 +143,8 @@ sim_cpu_msg_prefix (sim_cpu *cpu)
prefix = (char *) xmalloc (maxlen + 5);
}
sprintf (prefix, "%s: ", CPU_NAME (cpu));
+
return prefix;
-#endif
}
/* Cover fn to sim_io_eprintf. */