Skip to content

Commit

Permalink
Bluesim: Fix function call arguments in debug function
Browse files Browse the repository at this point in the history
The EventQueue::print() function was calling bk_clock_name() with the
wrong number of arguments, but fortunately print() is not used anywhere,
as it only exists for use when debugging.  The issue is resolved by
adding an additional parameter to print().  However, since so many
functions in the EventQueue class take the tSimStateHdl as an argument,
it might make sense for the EventQueue constructor to take that value
and store it.
  • Loading branch information
quark17 committed May 28, 2024
1 parent e9e4ac6 commit e6f95a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/bluesim/event_queue.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/* we need these for the debugging routines only */
#include "priority.h"
extern "C" const char* bk_clock_name(tClock handle);
extern "C" const char* bk_clock_name(tSimStateHdl simHdl, tClock handle);


/* Fundamental heap operations */
Expand Down Expand Up @@ -222,7 +222,7 @@ void EventQueue::clear()
}

/* Print the event queue contents (for debugging) */
void EventQueue::print() const
void EventQueue::print(tSimStateHdl simHdl) const
{
printf("Event queue:\n");
for (unsigned int i = 0; i < count; ++i)
Expand All @@ -231,6 +231,6 @@ void EventQueue::print() const
events[i].fn, events[i].data.ptr, events[i].at,
priority_group_name(priority_group(events[i].priority)),
priority_slot_name(priority_slot(events[i].priority)),
bk_clock_name(priority_clock(events[i].priority)));
bk_clock_name(simHdl, priority_clock(events[i].priority)));
}
}
2 changes: 1 addition & 1 deletion src/bluesim/event_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class EventQueue
void clear();

// debugging utility function
void print() const;
void print(tSimStateHdl simHdl) const;

private: // heap maintenance functions
bool isValid();
Expand Down

0 comments on commit e6f95a7

Please sign in to comment.