C-Block Component Debugging Logger (DbgLog class)

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.


Edit: Hey, if you’ve set up a proper DLL debugging environment for C-Blocks, please do share. This “printf()” stuff is exhausting. TIA!


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

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.


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…


void display(const char *fmt, ...)
{ // for diagnostic print statements
   va_list args = { 0 };
   va_start(args, fmt);
   vprintf(fmt, args);

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.


1 Like


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.