-
-
Save Mic92/bbc883220a7b43867dec32d39fa183aa to your computer and use it in GitHub Desktop.
better debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void foo(const char** const& argv, int const& argc, int const& r, std::string const& s) { | |
// gdb can now access everything (no optimized out variables) | |
__asm__("int3"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <unistd.h> | |
#include <string> | |
int main(int argc, const char** argv) { | |
std::string s = "abc"; | |
int r = write(fileno(stderr), "foo", sizeof("foo")); | |
// auto generate function that captures references to all variables | |
void foo(const char** const& argv, int const& argc, int const& r, std::string const& s); | |
foo(argv, argc, r, s); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment