aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-10-31 22:57:42 -0400
committerMike Frysinger <vapier@gentoo.org>2021-10-31 23:05:45 -0400
commitc704d6e7ee44736aabec017f6ea1790fac668407 (patch)
tree685c9480e54121422070bbe29324670cbad8544a /sim/common
parentf0982318065617e92c28e23ee382981c2a898ca2 (diff)
downloadgdb-c704d6e7ee44736aabec017f6ea1790fac668407.zip
gdb-c704d6e7ee44736aabec017f6ea1790fac668407.tar.gz
gdb-c704d6e7ee44736aabec017f6ea1790fac668407.tar.bz2
sim: events: clean up trace casts
Don't blindly cast every possible type to (long). Change to the right printf format specifier whether it be a 64-bit type or a pointer.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/sim-events.c155
1 files changed, 83 insertions, 72 deletions
diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c
index 5a5798d..ee031c9 100644
--- a/sim/common/sim-events.c
+++ b/sim/common/sim-events.c
@@ -409,14 +409,17 @@ update_time_from_event (SIM_DESC sd)
event = event->next, i++)
{
ETRACE ((_ETRACE,
- "event time-from-event - time %ld, delta %ld - event %d, tag 0x%lx, time %ld, handler 0x%lx, data 0x%lx%s%s\n",
- (long)current_time,
- (long)events->time_from_event,
+ "event time-from-event - "
+ "time %" PRIi64 ", delta %" PRIi64 " - "
+ "event %i, tag %p, time %" PRIi64 ", handler %p, data "
+ "%p%s%s\n",
+ current_time,
+ events->time_from_event,
i,
- (long)event,
- (long)event->time_of_event,
- (long)event->handler,
- (long)event->data,
+ event,
+ event->time_of_event,
+ event->handler,
+ event->data,
(event->trace != NULL) ? ", " : "",
(event->trace != NULL) ? event->trace : ""));
}
@@ -513,12 +516,13 @@ sim_events_schedule_vtracef (SIM_DESC sd,
new_event->trace = NULL;
insert_sim_event (sd, new_event, delta_time);
ETRACE ((_ETRACE,
- "event scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx%s%s\n",
- (long)sim_events_time (sd),
- (long)new_event,
- (long)new_event->time_of_event,
- (long)new_event->handler,
- (long)new_event->data,
+ "event scheduled at %" PRIi64 " - "
+ "tag %p - time %" PRIi64 ", handler %p, data %p%s%s\n",
+ sim_events_time (sd),
+ new_event,
+ new_event->time_of_event,
+ new_event->handler,
+ new_event->data,
(new_event->trace != NULL) ? ", " : "",
(new_event->trace != NULL) ? new_event->trace : ""));
return new_event;
@@ -565,12 +569,13 @@ sim_events_schedule_after_signal (SIM_DESC sd,
#endif
ETRACE ((_ETRACE,
- "signal scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx\n",
- (long)sim_events_time (sd),
- (long)new_event,
- (long)new_event->time_of_event,
- (long)new_event->handler,
- (long)new_event->data));
+ "signal scheduled at %" PRIi64 " - "
+ "tag %p - time %" PRIi64 ", handler %p, data %p\n",
+ sim_events_time (sd),
+ new_event,
+ new_event->time_of_event,
+ new_event->handler,
+ new_event->data));
}
#endif
@@ -601,12 +606,13 @@ sim_events_watch_clock (SIM_DESC sd,
events->watchpoints = new_event;
events->work_pending = 1;
ETRACE ((_ETRACE,
- "event watching clock at %ld - tag 0x%lx - wallclock %ld, handler 0x%lx, data 0x%lx\n",
- (long)sim_events_time (sd),
- (long)new_event,
- (long)new_event->wallclock,
- (long)new_event->handler,
- (long)new_event->data));
+ "event watching clock at %" PRIi64 " - "
+ "tag %p - wallclock %u, handler %p, data %p\n",
+ sim_events_time (sd),
+ new_event,
+ new_event->wallclock,
+ new_event->handler,
+ new_event->data));
return new_event;
}
#endif
@@ -615,11 +621,11 @@ sim_events_watch_clock (SIM_DESC sd,
#if EXTERN_SIM_EVENTS_P
sim_event *
sim_events_watch_pc (SIM_DESC sd,
- int is_within,
- unsigned64 lb,
- unsigned64 ub,
- sim_event_handler *handler,
- void *data)
+ int is_within,
+ unsigned64 lb,
+ unsigned64 ub,
+ sim_event_handler *handler,
+ void *data)
{
sim_events *events = STATE_EVENTS (sd);
sim_event *new_event = sim_events_zalloc (sd);
@@ -639,13 +645,14 @@ sim_events_watch_pc (SIM_DESC sd,
events->watchpoints = new_event;
events->work_pending = 1;
ETRACE ((_ETRACE,
- "event watching pc at %ld - tag 0x%lx - pc 0x%lx..0x%lx, handler 0x%lx, data 0x%lx\n",
- (long)sim_events_time (sd),
- (long)new_event,
- (long)new_event->lb,
- (long)new_event->ub,
- (long)new_event->handler,
- (long)new_event->data));
+ "event watching pc at %" PRIi64 " - "
+ "tag %p - pc 0x%x..0x%x, handler %p, data %p\n",
+ sim_events_time (sd),
+ new_event,
+ new_event->lb,
+ new_event->ub,
+ new_event->handler,
+ new_event->data));
return new_event;
}
#endif
@@ -716,14 +723,15 @@ sim_events_watch_sim (SIM_DESC sd,
events->watchpoints = new_event;
events->work_pending = 1;
ETRACE ((_ETRACE,
- "event watching host at %ld - tag 0x%lx - host-addr 0x%lx, 0x%lx..0x%lx, handler 0x%lx, data 0x%lx\n",
- (long)sim_events_time (sd),
- (long)new_event,
- (long)new_event->host_addr,
- (long)new_event->lb,
- (long)new_event->ub,
- (long)new_event->handler,
- (long)new_event->data));
+ "event watching host at %" PRIi64 " - "
+ "tag %p - host-addr %p, 0x%x..0x%x, handler %p, data %p\n",
+ sim_events_time (sd),
+ new_event,
+ new_event->host_addr,
+ new_event->lb,
+ new_event->ub,
+ new_event->handler,
+ new_event->data));
return new_event;
}
#endif
@@ -796,14 +804,15 @@ sim_events_watch_core (SIM_DESC sd,
events->watchpoints = new_event;
events->work_pending = 1;
ETRACE ((_ETRACE,
- "event watching host at %ld - tag 0x%lx - host-addr 0x%lx, 0x%lx..0x%lx, handler 0x%lx, data 0x%lx\n",
- (long)sim_events_time (sd),
- (long)new_event,
- (long)new_event->host_addr,
- (long)new_event->lb,
- (long)new_event->ub,
- (long)new_event->handler,
- (long)new_event->data));
+ "event watching host at %" PRIi64 " - "
+ "tag %p - host-addr %p, 0x%x..0x%x, handler %p, data %p\n",
+ sim_events_time (sd),
+ new_event,
+ new_event->host_addr,
+ new_event->lb,
+ new_event->ub,
+ new_event->handler,
+ new_event->data));
return new_event;
}
#endif
@@ -830,12 +839,13 @@ sim_events_deschedule (SIM_DESC sd,
sim_event *dead = *ptr_to_current;
*ptr_to_current = dead->next;
ETRACE ((_ETRACE,
- "event/watch descheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx%s%s\n",
- (long) sim_events_time (sd),
- (long) event_to_remove,
- (long) dead->time_of_event,
- (long) dead->handler,
- (long) dead->data,
+ "event/watch descheduled at %" PRIi64 " - "
+ "tag %p - time %" PRIi64 ", handler %p, data %p%s%s\n",
+ sim_events_time (sd),
+ event_to_remove,
+ dead->time_of_event,
+ dead->handler,
+ dead->data,
(dead->trace != NULL) ? ", " : "",
(dead->trace != NULL) ? dead->trace : ""));
sim_events_free (sd, dead);
@@ -846,9 +856,9 @@ sim_events_deschedule (SIM_DESC sd,
}
}
ETRACE ((_ETRACE,
- "event/watch descheduled at %ld - tag 0x%lx - not found\n",
- (long) sim_events_time (sd),
- (long) event_to_remove));
+ "event/watch descheduled at %" PRIi64 " - tag %p - not found\n",
+ sim_events_time (sd),
+ event_to_remove));
}
#endif
@@ -1188,11 +1198,12 @@ sim_events_process (SIM_DESC sd)
sim_event_handler *handler = to_do->handler;
void *data = to_do->data;
ETRACE ((_ETRACE,
- "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
- (long) event_time,
- (long) to_do,
- (long) handler,
- (long) data,
+ "event issued at %" PRIi64 " - "
+ "tag %p - handler %p, data %p%s%s\n",
+ event_time,
+ to_do,
+ handler,
+ data,
(to_do->trace != NULL) ? ", " : "",
(to_do->trace != NULL) ? to_do->trace : ""));
sim_events_free (sd, to_do);
@@ -1216,11 +1227,11 @@ sim_events_process (SIM_DESC sd)
events->queue = to_do->next;
update_time_from_event (sd);
ETRACE ((_ETRACE,
- "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n",
- (long) event_time,
- (long) to_do,
- (long) handler,
- (long) data,
+ "event issued at %" PRIi64 " - tag %p - handler %p, data %p%s%s\n",
+ event_time,
+ to_do,
+ handler,
+ data,
(to_do->trace != NULL) ? ", " : "",
(to_do->trace != NULL) ? to_do->trace : ""));
sim_events_free (sd, to_do);