Hello everyone, I use the GDB 7.0 with python extension to periodically attach GDB to a running process and output some variable values. The process I am investigating is quite simple: it prints out the value of a variable which decrease by 1 every 3 seconds. My method is quite simple and straightforward:
import sys import gdb import time while True: print "attach" gdb.execute("attach 31127") gdb.execute("break 14") gdb.execute("continue") gdb.execute("display i") gdb.execute("detach") time.sleep(6) end However, each time I "display" the value of variable i, the number of value printed is proportional to the number of the run. Partial of the results displayed in my terminal is as follows: attach 0xb808b430 in __kernel_vsyscall () Breakpoint 4 at 0x804840c: file beer-process.c, line 14. Breakpoint 1, main () at beer-process.c:14 14 PrintMessage( i ); 3: i = 99961 2: i = 99961 1: i = 99961 attach 0xb808b430 in __kernel_vsyscall () Breakpoint 5 at 0x804840c: file beer-process.c, line 14. Breakpoint 1, main () at beer-process.c:14 14 PrintMessage( i ); 4: i = 99958 3: i = 99958 2: i = 99958 1: i = 99958 attach 0xb808b430 in __kernel_vsyscall () Breakpoint 6 at 0x804840c: file beer-process.c, line 14. Breakpoint 1, main () at beer-process.c:14 14 PrintMessage( i ); 5: i = 99955 4: i = 99955 3: i = 99955 2: i = 99955 1: i = 99955 attach 0xb808b430 in __kernel_vsyscall () Breakpoint 7 at 0x804840c: file beer-process.c, line 14. Breakpoint 1, main () at beer-process.c:14 14 PrintMessage( i ); 6: i = 99952 5: i = 99952 4: i = 99952 3: i = 99952 2: i = 99952 1: i = 99952 attach 0xb808b430 in __kernel_vsyscall () Breakpoint 8 at 0x804840c: file beer-process.c, line 14. Breakpoint 1, main () at beer-process.c:14 14 PrintMessage( i ); 7: i = 99949 6: i = 99949 5: i = 99949 4: i = 99949 3: i = 99949 2: i = 99949 1: i = 99949 It is really weird that it prints more and more values as the the run goes on. I am not sure whether this is a bug in GDB. If it is not a bug, could anyone give me some insights on how to fix my problem here ? Thanks a lot in advance. best, Yanmeng Ba _______________________________________________ bug-gdb mailing list bug-gdb@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gdb