Bug 497849

Summary: pstack truncates stack trace lines
Product: [Fedora] Fedora Reporter: Oliver Henshaw <oliver.henshaw>
Component: gdbAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: dvlasenk, jan.kratochvil
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: gdb-6.8.50.20090302-22.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-27 15:28:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
pstack of kded4 with truncated lines
none
similar gdb bt of kded4 without truncated lines none

Description Oliver Henshaw 2009-04-27 14:54:45 UTC
Description of problem:

Using pstack to sample the stack of running processes, I see some of the lines are truncated. The full line is printed when using gdb to sample the stack. For example,

pstack gives "QEventDispatcherGlib::processEvents (this=0x97c8948, flags="
gdb gives "QEventDispatcherGlib::processEvents (this=0x97c8948, flags={i = 36}) at kernel/qeventdispatcher_glib.cpp:32"

The "at blah/blah.cpp:XX" part is always missing for pstack, not sure whether that is by design or not. At first I thought that the incomplete arguments were due to the curly braces, but I see some lines in pstack with curly braces intact.

Version-Release number of selected component (if applicable):
$ rpm -q gdb
gdb-6.8-29.fc10.i386

Note:
I actually use a patched version of pstack, so that debug symbols are always read:
$ diff /usr/bin/pstack /home/henshaw/bin/mystack
32,36c32,37
< if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
<     readnever=--readnever
< else
<     readnever=
< fi
---
> #if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
> #    readnever=--readnever
> #else
> #    readnever=
> #fi
> readnever=


How reproducible:
Compare pstack and gdb backtrace, possibly for process with curly braces in function arguments.

Comment 1 Oliver Henshaw 2009-04-27 14:56:24 UTC
Created attachment 341436 [details]
pstack of kded4 with truncated lines

Comment 2 Oliver Henshaw 2009-04-27 14:57:52 UTC
Created attachment 341437 [details]
similar gdb bt of kded4 without truncated lines

Comment 3 Jan Kratochvil 2009-04-27 15:28:02 UTC
Thanks, fixed by:
* Mon Apr 27 2009 Jan Kratochvil <jan.kratochvil> - 6.8.50.20090302-22
- Fix pstack/gstack cutting very long lines (BZ 497849).

http://cvs.fedora.redhat.com/viewvc/rpms/gdb/devel/gdb-6.3-gstack-20050411.patch?r1=1.4&r2=1.5&view=patch

That -readnever should be removed one day, just the Archer branch archer-tromey-delayed-symfile is currently not fast enough.