Skip to content

Instantly share code, notes, and snippets.

@danlark1
Last active April 18, 2022 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danlark1/d2aff9307f915dcfaf69789cbad8e458 to your computer and use it in GitHub Desktop.
Save danlark1/d2aff9307f915dcfaf69789cbad8e458 to your computer and use it in GitHub Desktop.
// In <algorithm>
// Declare an inline/weak variable.
extern void (*ExtremelyHackyCallThatYouWillNotOverride)()
__attribute__((weak)) = nullptr;
// ...
// Before the sort call
// ...
if (ExtremelyHackyCallThatYouWillNotOverride)
ExtremelyHackyCallThatYouWillNotOverride();
_VSTD::__sort<_Comp_ref>(_VSTD::__unwrap_iter(__first), _VSTD::__unwrap_iter(__last), _Comp_ref(__comp));
// ...
// main.cpp
#include <algorithm>
// Prints the stacktrace.
void backtrace_dumper();
int main(int argc, char** argv) {
ExtremelyHackyCallThatYouWillNotOverride = &backtrace_dumper;
return InvokeRealMain(argc, argv);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment