This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
breakpoints/2230: gdb does not handle a large number of breakpoints gracefully
- From: tneuman at users dot sourceforge dot net
- To: gdb-gnats at sources dot redhat dot com
- Date: 18 Feb 2007 00:40:32 -0000
- Subject: breakpoints/2230: gdb does not handle a large number of breakpoints gracefully
- Reply-to: tneuman at users dot sourceforge dot net
>Number: 2230
>Category: breakpoints
>Synopsis: gdb does not handle a large number of breakpoints gracefully
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sun Feb 18 00:48:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: tneuman@users.sourceforge.net
>Release: GNU gdb 6.6
>Organization:
>Environment:
Linux jaiman 2.6.17-11-generic #2 SMP Thu Feb 1 18:03:05 UTC 2007 x86_64 GNU/Linux
gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
This GDB was configured as "x86_64-unknown-linux-gnu".
>Description:
When setting a large number of breakpoints, breakpoint handling slows down considerably. For example, when setting 50000 breakpoints (via a program, all by "tbreak *addr" with unique addresses), the first 10000 breakpoints are set reasonably fast (about 10s), but the whole 50000 breakpoints take about 8m. Probably a data structure does not scale.
While I noticed it for generated breakpoints on addressses, in occurs on more traditional breakpoints, too. See "How-To-Repeat" for an example.
>How-To-Repeat:
Execute the following script (also attached):
#!/bin/sh
echo 'int main() { int a=0;' > foo.c
for line in `seq 1 50000` ; do echo '++a;' ; done >> foo.c
echo '}' >> foo.c
gcc -o foo -g -O0 foo.c
echo 'set height 100000' > breakpoints
for line in `seq 1 50000` ; do echo tbreak foo.c:$line ; done >> breakpoints
time gdb foo -batch -x breakpoints
It tries to set 50000 different breakpoints, which takes quite a while.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="gdbtestcase"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gdbtestcase"
IyEvYmluL3NoCmVjaG8gJ2ludCBtYWluKCkgeyBpbnQgYT0wOycgPiBmb28uYwpmb3IgbGluZSBp
biBgc2VxIDEgNTAwMDBgIDsgZG8gZWNobyAnKythOycgOyBkb25lID4+IGZvby5jCmVjaG8gJ30n
ID4+IGZvby5jCmdjYyAtbyBmb28gLWcgLU8wIGZvby5jCmVjaG8gJ3NldCBoZWlnaHQgMTAwMDAw
JyA+IGJyZWFrcG9pbnRzCmZvciBsaW5lIGluIGBzZXEgMSA1MDAwMGAgOyBkbyBlY2hvIHRicmVh
ayBmb28uYzokbGluZSA7IGRvbmUgPj4gYnJlYWtwb2ludHMKdGltZSBnZGIgZm9vIC1iYXRjaCAt
eCBicmVha3BvaW50cwoK