> ./hex16.com ./missing.txt --ftrace
That seems like magic. It seems you have to build with a special flag that tells GCC to put a nop at the start of each function. Then, before main runs, Cosmopolitan sees the --ftrace on the command line, and modifies the code in memory to replace those nops with calls to something that does the logging. See https://justine.lol/ftrace/.
BTW - llvm+clang support a similar feature called "X-ray" [1]. It's intended to allow for patching (and unpatching!) these entry/exit points at runtime, with calls to specific tracing / black box facilities or whatever your favorite logging mechanism might be. And it's not limited to x86_64.
"Detours is a library for instrumenting arbitrary Win32 functions Windows-compatible processors. Detours intercepts Win32 functions by re-writing the in-memory code for target functions."
Doesn't that just re-write the DLL import table? ie it only allows interception of a Win32 API calls, not interception of my function A calling my function B?
I suspect the combination of interests is a little out there. For instance, with game cheat developers, you tend to first at least have some interest in C++, then understanding memory scanning, then signature scanning, trampolining, and all of a sudden you have the skillset ingredients for authoring some rudimentary cheats. Advanced skills come with driver development, which you then pick up to figure out how to evade anti-cheat technology, etc.
But very few developers I know say, oh yeah, I was just interested directly in this sort of thing from the get-go and decided to pick up all of the specific skills to go straight to cheat development.
Usually, it's the guys who already have game development experience.
What in the world did Justine see before Cosmopolitan? Maybe debugging tech? An interest in creating her own libc and understanding syscalls? Just fascinating.
He's a force of nature, but god damn if I didn't learn a lot from him and his peers. Cheers to you and to him!
> Now if you have gdb available on $PATH, you would get a TUI (terminal user interace) showing the register contents and the backtrace of the crash
Can you use similar features with C++ development?
This reminds me a little bit about how "Wine" works, but because the support doesn't involve "everything an OS has to provide" the footprint is smaller.