aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-06-06 09:42:15 -0600
committerTom Tromey <tromey@adacore.com>2024-12-16 11:18:20 -0700
commit3d6744493634e704b6977924a0cc8082886523f5 (patch)
tree0238ad065b7d0372311b8e900df1d13376e27147 /gdb/python
parent59d25b31eb54130f1115aae20da4ac9ccaa15a53 (diff)
downloadbinutils-3d6744493634e704b6977924a0cc8082886523f5.zip
binutils-3d6744493634e704b6977924a0cc8082886523f5.tar.gz
binutils-3d6744493634e704b6977924a0cc8082886523f5.tar.bz2
Greatly speed up rbreak
While debugging another issue, I noticed that 'rbreak' on a large program was very slow. In particular, with 'maint time 1': (gdb) with pagination off -- rbreak ^command_display [...] Command execution time: 1940.646332 (cpu), 1960.771517 (wall) "ps" also reported that, after this command, gdb's VSZ was 4619360. Looking into this, I found something strange. When 'rbreak' found a function "f" in file "file.adb", it would try to set the breakpoint using "break 'file.adb':'f'". This then interacted somewhat poorly with linespec. linespec first expands all the symtabs matching "file.adb", but in this program this results in thousands of CU expansions (probably due to inlining, but I did not investigate). There is probably a linespec bug here. It would make more sense for it to combine the file- and symbol- lookups, as this is more efficient. I plan to file a bug about this at least. I tracked this "file:function" style of linespec to the earliest days of gdb. Back then, "break function" would only break on the first "function" that was found -- it wasn't until much later that we changed gdb to break on all matching functions. So, I think that rbreak was written this way to try to work around this limitation, and it seems to me that this change obsoleted the need for rbreak to mention the file at all. That is, "break file:function" is redundant now, because plain "break function" will redo that same work -- just more efficiently. (The only exception to this is the case where a file is given to rbreak -- here the extra filtering is still needed.) This patch implements this. On the aforementioned large program, with this patch, rbreak still sets all the desired breakpoints (879 of them) but is now much faster: (gdb) with pagination off -- rbreak ^command_display [...] Command execution time: 91.702648 (cpu), 92.770430 (wall) It also reduces the VSZ number to 2539216. Regression tested on x86-64 Fedora 40. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=14340 Approved-By: Pedro Alves <pedro@palves.net>
Diffstat (limited to 'gdb/python')
0 files changed, 0 insertions, 0 deletions