RDunn
October 14, 2023, 6:57pm
1
If you’re using QSpice’s C-Block display() function for debugging, you might want to check this out.
A preview of the DbgLog class is available in the dev branch of my GitHub repo in the Miscellany folder . Documentation is here (PDF) .
As always, let me know if you find this useful or find any issues.
–robert
Edit: Hey, if you’ve set up a proper DLL debugging environment for C-Blocks, please do share. This “printf()” stuff is exhausting. TIA!
5 Likes
Perry
October 15, 2023, 9:44am
2
What a nice little helper for debugging!
Many thanks for sharing. It already makes my work easier.
And as always - good documentation makes things even better.
Thank you, Perry
RDunn
October 25, 2023, 5:25pm
3
FYI, I’ve moved the DbgLog class into a different folder on the main branch of my GitHub repo. It is now located here .
Note: A new version that adds support for compiling with MSVC will be on the dev branch shortly.
–robert
Hi @RDunn @Engelhardt
Any clue why does the display function has a very long sleep?
what exactly is the function for this sleep?
I changed the both msleep from 30 to 3 (just random) and still looked just fine…
Thanks
Arief,
void display(const char *fmt, ...)
{ // for diagnostic print statements
msleep(30);
fflush(stdout);
va_list args = { 0 };
va_start(args, fmt);
vprintf(fmt, args);
va_end(args);
fflush(stdout);
msleep(30);
}
So the thread that reads stdout from the simulator doesn’t miss any output. It can be overwhelmed. Bracketing the output with 30ms will make certain, that no characters are dropped.
–Mike
1 Like
Understood…
I removed the msleep(), and still work just fine in my case. But I will keep it in mind in case the display() drop any strings for future test case.