🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1052

"display" bug

#1052
From: Yanmeng Ba
Date: Fri, 27 Nov 2009 15:55
89 lines
3398 bytes
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
Technical Details
Message-ID: <327f979a-53cd-4a1a-a119-45df3155eb27@f16g2000yqm.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!f16g2000yqm.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f0ead4270c,bc212ae6a33891c8,start
X-Google-Attributes: gidf0ead4270c,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!f16g2000yqm.googlegroups.com!not-for-mail
From: Yanmeng Ba <bayanmeng@gmail.com>
Newsgroups: gnu.gdb.bug
Subject: "display" bug
Date: Fri, 27 Nov 2009 07:55:18 -0800 (PST)
Organization: http://groups.google.com
Lines: 90
Message-ID: <327f979a-53cd-4a1a-a119-45df3155eb27@f16g2000yqm.googlegroups.com>
NNTP-Posting-Host: 129.97.185.91
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1259337319 12547 127.0.0.1 (27 Nov 2009 15:55:19 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 27 Nov 2009 15:55:19 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: f16g2000yqm.googlegroups.com; posting-host=129.97.185.91; 
 posting-account=enoq_woAAACIYAypbr2aRbCd_Nx5hZng
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) 
 AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10,gzip(gfe),gzip(gfe)