Skip to content

Instantly share code, notes, and snippets.

@mattip
Created December 22, 2014 19:20
Show Gist options
  • Save mattip/d8f093d408a62305c386 to your computer and use it in GitHub Desktop.
Save mattip/d8f093d408a62305c386 to your computer and use it in GitHub Desktop.
A convenience snippet to ease attaching a debugger when compiled with "make debug"
--- a/rpython/translator/c/genc.py Sun Dec 21 17:45:01 2014 +0200
+++ b/rpython/translator/c/genc.py Thu Dec 18 07:07:00 2014 +0200
@@ -462,7 +462,7 @@
else:
if self.translator.platform.name == 'msvc':
- mk.definition('DEBUGFLAGS', '-MD -Zi')
+ mk.definition('DEBUGFLAGS', '-MD -Zi -D_DEBUG')
else:
if self.config.translation.shared:
mk.definition('DEBUGFLAGS', '-O1 -g -fPIC')
diff -r 0422bc7c7898 -r b6e8b40a0f51 rpython/translator/c/src/entrypoint.c
--- a/rpython/translator/c/src/entrypoint.c Sun Dec 21 17:45:01 2014 +0200
+++ b/rpython/translator/c/src/entrypoint.c Thu Dec 18 07:07:00 2014 +0200
@@ -81,6 +81,13 @@
int PYPY_MAIN_FUNCTION(int argc, char *argv[])
{
+#if defined _WIN32 && defined _DEBUG
+ int c;
+ printf("Now would be a good time to 'attach to process' in a debugger\n");
+ printf("Press any key to continue ...");
+ c = _getch();
+ printf(" thanks\n");
+#endif
#ifdef PYPY_X86_CHECK_SSE2_DEFINED
pypy_x86_check_sse2();
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment