News for hackers. Stuff that matters.
Re:How to build highly-debuggable C++ binaries by VikingCoder on Monday July 29, 2024 @02:15PM (#41102481)
Back in VS6 days, I did a similar thing, but I generated a GUID for the first line of every function.

STACKTRACE("e0957136-fed3-414d-80b9-8bbf84f3fa03");

With the GUID, I could see where functions moved as they were refactored.

I would write out the GUID to a thread-local file handle, along with a time-stamp, and an "enter" or "exit" when an RAII object left the stack.

Then I could retrospectively debug after running my program. I could see the callstack, and step through in time. I would walk my source and record GUID-to-filename/linenumber in a map. Then I could dump out a Visual Studio output that had the file name and line number, and execution time... allowing me to step forward and back through the execution.

Stone knives and bearskins.

Re:How to build highly-debuggable C++ binaries by trentnelson on Tuesday July 30, 2024 @12:52PM (#41111304)
That's neat. The modern equivalent to that these days, on Windows, is to leverage ETW and Windows Performance Analyzer. Potentially with a custom plugin that can visualize your specific perf data as a first-class WPA citizen (i.e. indistinguishable from any other perf data being analyzed, which means you can group/query/filter etc. just like anything else).

I wrote a plugin for a past employer to visualize our internal product event hierarchy performance as if it were a normal C/C++ call stack, it was pretty cool. ETW and WPA are phenomenal tools. I miss them both dearly when on Linux.