This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
[psim] Fix to events.c assertion failure
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>, powerpc-psim at ci dot com dot au
- Subject: [psim] Fix to events.c assertion failure
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Thu, 27 Apr 2000 10:31:58 +1000
- Organization: Cygnus Solutions
Hello,
The attatched patch hopefully fixes an assertion failure in events.c
that several people were reporting. Can people please let me know how
it goes (quickly, the 5.0 boat is now departing...)
I should note that the patch as it stands contains additions to the
event tracing, I'll be separating that out when it comes to the actual
checkin.
Andrew
Wed Apr 26 16:08:42 2000 Andrew Cagney <cagney@b1.cygnus.com>
* events.c (event_queue_process): Call update_time_from_event
every time an event is removed from the queue.
(update_time_from_event): Delete assertion that a negative
time_from_event implies an empty event queue. Add more tracing.
Index: events.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/events.c,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 events.c
*** events.c 1999/04/16 01:35:09 1.1.1.1
--- events.c 2000/04/26 06:33:28
*************** update_time_from_event(event_queue *even
*** 161,168 ****
events->time_of_event = current_time - 1;
events->time_from_event = -1;
}
ASSERT(current_time == event_queue_time(events));
- ASSERT((events->time_from_event >= 0) == (events->queue != NULL));
}
STATIC_INLINE_EVENTS\
--- 161,185 ----
events->time_of_event = current_time - 1;
events->time_from_event = -1;
}
+ if (WITH_TRACE && ppc_trace[trace_events])
+ {
+ event_entry *event;
+ int i;
+ for (event = events->queue, i = 0;
+ event != NULL;
+ event = event->next, i++)
+ {
+ TRACE(trace_events, ("event time-from-event - time %ld, delta %ld - event %d, tag 0x%lx, time %ld, handler 0x%lx, data 0x%lx\n",
+ (long)current_time,
+ (long)events->time_from_event,
+ i,
+ (long)event,
+ (long)event->time_of_event,
+ (long)event->handler,
+ (long)event->data));
+ }
+ }
ASSERT(current_time == event_queue_time(events));
}
STATIC_INLINE_EVENTS\
*************** event_queue_process(event_queue *events)
*** 369,386 ****
event_handler *handler = to_do->handler;
void *data = to_do->data;
events->queue = to_do->next;
! TRACE(trace_events, ("event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx\n",
(long)event_time,
(long)to_do,
(long)handler,
(long)data));
zfree(to_do);
handler(data);
}
events->processing = 0;
! /* re-caculate time for new events */
! update_time_from_event(events);
}
--- 386,407 ----
event_handler *handler = to_do->handler;
void *data = to_do->data;
events->queue = to_do->next;
! TRACE(trace_events, ("event issued at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx\n",
(long)event_time,
(long)to_do,
+ (long)to_do->time_of_event,
(long)handler,
(long)data));
zfree(to_do);
+ /* Always re-compute the time to the next event so that HANDLER()
+ can safely insert new events into the queue. */
+ update_time_from_event(events);
handler(data);
}
events->processing = 0;
! ASSERT(events->time_from_event > 0);
! ASSERT(events->queue != NULL); /* always poll event */
}
Index: interrupts.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/interrupts.c,v
retrieving revision 1.1.1.2
diff -p -r1.1.1.2 interrupts.c
*** interrupts.c 1999/04/26 18:33:26 1.1.1.2
--- interrupts.c 2000/04/26 06:33:28
*************** deliver_hardware_interrupt(void *data)
*** 469,475 ****
unsigned_word cia = cpu_get_program_counter(processor);
unsigned_word nia = perform_oea_interrupt(processor,
cia, 0x00900, 0, 0, 0, 0);
! TRACE(trace_interrupts, ("decrementer interrupt - cia=0x%lx time=0x%lx\n",
(unsigned long)cia,
(unsigned long)event_queue_time(psim_event_queue(cpu_system(processor)))
));
--- 469,475 ----
unsigned_word cia = cpu_get_program_counter(processor);
unsigned_word nia = perform_oea_interrupt(processor,
cia, 0x00900, 0, 0, 0, 0);
! TRACE(trace_interrupts, ("decrementer interrupt - cia 0x%lx, time %ld\n",
(unsigned long)cia,
(unsigned long)event_queue_time(psim_event_queue(cpu_system(processor)))
));