Created
January 21, 2014 21:41
-
-
Save simark/8548964 to your computer and use it in GitHub Desktop.
GDB Python finish breakpoint bug reproduction
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
class EnterBreakpoint(gdb.Breakpoint): | |
def __init__(self): | |
super(EnterBreakpoint, self).__init__("hopefully_notinlined") | |
def stop(self): | |
FinishBp() | |
class FinishBp(gdb.FinishBreakpoint): | |
def stop(self): | |
print("I am here") | |
EnterBreakpoint() |
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
// gcc -g test.c -O3 | |
// gdb -x finish.py a.out | |
#include <stdio.h> | |
int __attribute__ ((noinline)) hopefully_tailcalled(int n) { | |
return n * 3; | |
} | |
static __attribute__ ((noinline)) int hopefully_notinlined(int n) { | |
return hopefully_tailcalled(n); | |
} | |
static int hopefully_inlined(int n) { | |
return hopefully_notinlined(n); | |
} | |
int main(int argc, char **argv) { | |
int x; | |
x = hopefully_inlined(argc); | |
printf("%d\n", x); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment