This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi! The following patch adds two functions to the simulator framework to compute the time which remains before an event occurs. I'm using this for some 68hc11 simulator print commands (called from gdb) to tell when a particular event (such as an interrupt) will occur. Stephane The ChangeLog is for gdb/sim/common 2000-06-25 Stephane Carrez <Stephane.Carrez@worldnet.fr> * sim-events.c (sim_events_remain_time): New function returning the time that remains before the event is raised. * hw-events.c (hw_event_remain_time): Likewise. * sim-events.h (sim_events_remain_time): Declare. * hw-events.h (hw_event_remain_time): Declare.
diff -Nrup --exclude-from=gdb-exclude.lst /src/gnu/cygnus/gdb/sim/common/hw-events.c gdb/sim/common/hw-events.c --- /src/gnu/cygnus/gdb/sim/common/hw-events.c Fri Apr 16 03:34:57 1999 +++ gdb/sim/common/hw-events.c Mon Feb 21 09:00:23 2000 @@ -164,6 +164,15 @@ hw_event_queue_time (struct hw *me) return sim_events_time (hw_system (me)); } +/* Returns the time that remains before the event is raised. */ +signed64 +hw_event_remain_time (struct hw *me, struct hw_event *event) +{ + signed64 t; + + t = sim_events_remain_time (hw_system (me), event->real); + return t; +} /* Only worry about this compling on ANSI systems. Build with `make test-hw-events' in sim/<cpu> directory*/ diff -Nrup --exclude-from=gdb-exclude.lst /src/gnu/cygnus/gdb/sim/common/hw-events.h gdb/sim/common/hw-events.h --- /src/gnu/cygnus/gdb/sim/common/hw-events.h Fri Apr 16 03:34:57 1999 +++ gdb/sim/common/hw-events.h Mon Feb 21 09:00:23 2000 @@ -58,4 +58,8 @@ void hw_event_queue_deschedule signed64 hw_event_queue_time (struct hw *me); +/* Returns the time that remains before the event is raised. */ +signed64 hw_event_remain_time +(struct hw *me, struct hw_event *event); + #endif diff -Nrup --exclude-from=gdb-exclude.lst /src/gnu/cygnus/gdb/sim/common/sim-events.c gdb/sim/common/sim-events.c --- /src/gnu/cygnus/gdb/sim/common/sim-events.c Thu Jun 1 01:02:36 2000 +++ gdb/sim/common/sim-events.c Sun Jun 25 22:19:33 2000 @@ -379,6 +379,19 @@ sim_events_elapsed_time (SIM_DESC sd) } +/* Returns the time that remains before the event is raised. */ +INLINE_SIM_EVENTS\ +(signed64) +sim_events_remain_time (SIM_DESC sd, sim_event *event) +{ + if (event == 0) + return 0; + + return (event->time_of_event - sim_events_time (sd)); +} + + + STATIC_INLINE_SIM_EVENTS\ (void) update_time_from_event (SIM_DESC sd) diff -Nrup --exclude-from=gdb-exclude.lst /src/gnu/cygnus/gdb/sim/common/sim-events.h gdb/sim/common/sim-events.h --- /src/gnu/cygnus/gdb/sim/common/sim-events.h Fri Apr 16 03:34:57 1999 +++ gdb/sim/common/sim-events.h Mon Feb 21 09:00:23 2000 @@ -268,4 +268,10 @@ INLINE_SIM_EVENTS\ (unsigned long) sim_events_elapsed_time (SIM_DESC sd); +/* Returns the time that remains before the event is raised. */ +INLINE_SIM_EVENTS\ +(signed64) sim_events_remain_time +(SIM_DESC sd, sim_event *event); + + #endif
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |