I have a script, which runs gdb with command file like this:
set logging file file_name
set logging on
thread apply all bt
q
y
Why pstack is much faster than this script? Can I achive that fastness with gdb somehow?
EDIT: The difference was gdb versions. I used gdb-7.10, and it took about 14 sec to dump stack traces. with gdb 7.0.1, which pstack used, it took 2 sec. Most of time went for gdb-7.10 on loading symbols from our lib, and I couldn't found the appropriate option for -readnever
in the new version.
On my system at least
pstack
is a shell script that runs gdb, so you can probably see exactly what is being run by just looking in thepstack
executable.I suspect that the interesting part of the script might well be:
Actually
set pagination no
is the same asset height 0
, so you can forget theset pagination no
part.The
set height 0
andset width 0
turn off any attempt by gdb to display the output wrapped to your terminal width, and presented page at a time.I expect that this wrapping, and page at a time output, causes a lot of additional processing everytime gdb prints anything.
There's not much else in the
pstack
script that is different to your script, so I don't see what else it could be.