no pstack for amd64

Bug #532000 reported by Michael Blakeley
74
This bug affects 14 people
Affects Status Importance Assigned to Milestone
pstack (Debian)
Fix Released
Undecided
Unassigned
pstack (Ubuntu)
Fix Released
Undecided
Unassigned
Nominated for Hardy by Liz Lin
Nominated for Lucid by Andrey
Nominated for Maverick by Andrey

Bug Description

Binary package hint: pstack

There is no pstack package available for amd64. This should be easy to fix, since pstack is available for amd64 on Fedora, centos, etc.

For developers, pstack is an extremely useful utility to dump the state of a running process. To work around its absence in ubuntu, I typically use 'wajig rpminstall' to install the centos version.

Tags: patch amd64

Related branches

Revision history for this message
Martin Milner (martin-milner) wrote :

I've been looking for an official pstack release for x64_86 for a long time so this addition would be very welcome.

Could you please explain the work around in a little more detail? I can't get success with 10.04.
I've converted and installed /pub/centos/5.4/os/x86_64/CentOS/pstack-1.2-7.2.2.x86_64.rpm
but also needed is a gstack script that I have manually got from gdb-6.8-37.el5. This package also contains gdb so we don't want to overwrite Ubuntu's gdb.
When I run pstack the output is blank. Thanks,

Revision history for this message
Michael Blakeley (mike+ubuntu) wrote :

It's been a little while, but I believe I extracted gstack from the rpm without installing it. You'll need rpm2cpio and cpio for this.

$ rpm2cpio gdb-6.3.0.0-1.132.EL4.x86_64.rpm | cpio -idmv
./usr/bin/gcore
./usr/bin/gdb
./usr/bin/gdbserver
./usr/bin/gdbtui
./usr/bin/gstack
./usr/share/doc/gdb-6.3.0.0
./usr/share/doc/gdb-6.3.0.0/COPYING
./usr/share/doc/gdb-6.3.0.0/COPYING.LIB
./usr/share/doc/gdb-6.3.0.0/NEWS
./usr/share/doc/gdb-6.3.0.0/README
./usr/share/info/annotate.info.gz
./usr/share/info/gdb.info.gz
./usr/share/info/gdbint.info.gz
./usr/share/info/stabs.info.gz
./usr/share/man/man1/gdb.1.gz
./usr/share/man/man1/gdbserver.1.gz
./usr/share/man/man1/gdbtui.1.gz
12185 blocks
$ ls usr/bin/gstack
usr/bin/gstack

Now you can put gstack wherever you like.

Revision history for this message
Alex Bleasdale (alexbleasdale) wrote :

Following the information outlined in the post by Michael Blakeley, I unpacked gdb (tried the version you referenced in your post and the latest on rpm.pbone.net) but in both cases executing gstack does what Martin described (output is blank).

Anyone had any luck getting this to work with Ubuntu 10.04?

Thanks,
A

Revision history for this message
Michael Blakeley (mike+ubuntu) wrote :

Very basic question: did you try sudo?

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.1 LTS"
$ pstack `pgrep cron`
$ sudo pstack `pgrep cron`
#0 0x00007f5350307370 in nanosleep () from /lib/libc.so.6
#1 0x00007f5350307200 in sleep () from /lib/libc.so.6
#2 0x0000000000403254 in ?? ()
#3 0x00007f535027bc4d in __libc_start_main () from /lib/libc.so.6
#4 0x0000000000402be9 in ?? ()
#5 0x00007fffa9c5bd78 in ?? ()
#6 0x000000000000001c in ?? ()
#7 0x0000000000000001 in ?? ()
#8 0x00007fffa9c5bf45 in ?? ()
#9 0x0000000000000000 in ?? ()

I suppose it's a bug that pstack doesn't report any errors from gdb. However, that isn't in the scope of this report.

Revision history for this message
Alex Bleasdale (alexbleasdale) wrote :

Hi Michael,

Yes, I tried sudo; also tried using backticks (`pgrep cron`) and using the pid. Here's what happened:

sudo pstack `pgrep cron`
Usage: pstack <process-id>

sudo pstack 1879
$

Was there anything else you did (aside from convert and install pstack from and use cpio to unpack gdb)? For the record, I'm using an amd64 build of 10.4.1.

tags: added: amd64
Revision history for this message
Greg Albrecht (ampledata) wrote :

Hey Alex, Were you attempting to run pstack on x86_64/amd64 or i386? I've had similar problems on x86_64/amd64.

Revision history for this message
Greg Albrecht (ampledata) wrote :

I've ported the gstack script from RedHat. This essentially replicates the functionality of pstack (which is i386 dependent) on non-i386 platforms (like amd64).

tags: added: patch
Revision history for this message
Andrey (iloveeclipse) wrote :

Hi,

I'm new in Ubuntu, so sorry for this probably silly question - to which release the fix goes into?

Is it planned to include it into the 10.04 or 10.10, or how one can find it out - are there any tags/plans/rules etc?

In case it does NOT get into 10.04, could somebody please describe how one can patch & build the related packages in 10.04? I really miss the pstack on Ubuntu, coming from RHEL where it simply works in each release.

Thank you!

Regards,
Andrei

Revision history for this message
Steven G. Madere (steve-stevemadere) wrote :

The patch is soooo close but not quite there.

As it turns out, the standard Ubuntu install has this symlink

/bin/sh -> /bin/dash

This breaks the gstack.sh script since of course all good gnu developers
assume that
/bin/sh is linked to /bin/bash.

So,,,,

The patch needs to be modified so that the top line reads
#!/bin/bash

rather than
#!/bin/sh

That is the reason that some people are getting null output.

I'm going to guess that Greg Albrecht got fed up with the
difficult to debug sh->dash thing and replaced the one on his
test system with sh->bash some time ago. Thus, he didn't
realize that his patch does not work on a clean Ubuntu 10.04 install.

Revision history for this message
Greg Albrecht (ampledata) wrote :

@steven: close! i was actually calling gstack.sh directly with bash. my bad.

I didn't see anyone mention that they were getting null output. Had I seen that, I could've reacted quicker.

In any case, I'll go ahead and re-do the patch and post updated instructions on patching 10.04/10.10.

Thanks.

Changed in pstack (Ubuntu):
status: New → Confirmed
Revision history for this message
Thomas Preud'homme (robotux) wrote :
Changed in pstack (Debian):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pstack - 1.3.1-1

---------------
pstack (1.3.1-1) unstable; urgency=low

  * New upstream release
    + Drop all patches.
    + Add support for armel architecture.
  * debian/copyright:
    + Add missing hyphen in license statement: "GPL2+" -> "GPL-2+".
    + Give GPL-2+ its own License paragraph.
  * debian/control:
    + Reflect the new support of armel architecture.
  * debian/rules:
    + Remove no longer needed BINDIR and MANDIR variables.

pstack (1.2-6) unstable; urgency=low

  * Fix compilation on i386: definition of __ASSEMPLY not needed.

pstack (1.2-5) unstable; urgency=low

  * Add support for amd64. (LP: #532000)
  * Write pid in capital letter in long description, since it is an acronym.

pstack (1.2-4) unstable; urgency=low

  * debian/rules:
    + Use dpkg-buildflags to set build flags (CPPFLAGS, CFLAGS and LDFLAGS).
  * debian/copyright:
    + Document global license and copyright.
    + Set email and website of new upstream. (Closes: #608547)
  * debian/watch:
    + Set new URI to upstream resources.
  * debian/control:
    + Set DMUA flag.
    + Add a Homepage field.
 -- Ubuntu Archive Auto-Sync <email address hidden> Mon, 17 Oct 2011 13:46:36 +0000

Changed in pstack (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Andrey (iloveeclipse) wrote :

Hi,

could somebody please describe how one can build the related packages (I'm running 11.04 64 bit)?

I've tried to use the code from here: https://launchpad.net/ubuntu/+source/pstack/1.3.1-1
After building the binary package with "fakeroot debian/rules binary" I have a pstack executable which produces just crap (below example just using nautilus process but it produces similar crap with any running process I've tried):

 $ ./pstack 1595

1595: nautilus
(No symbols found)
0x7f12ebe59f03: ???? (100000006, 100000007, 30000000f, 300000011, 30000000c, 30000000d) + fddfe9c4
crawl: Input/output error
Error tracing through process 1595
0x100000003: ????

Any help on this?

Regards,
Andrey

Revision history for this message
Thomas Preud'homme (robotux) wrote : Re: [Bug 532000] Re: no pstack for amd64

Le lundi 17 octobre 2011 23:24:55, vous avez écrit :
> Hi,
>
> could somebody please describe how one can build the related packages
> (I'm running 11.04 64 bit)?
>
> I've tried to use the code from here:
> https://launchpad.net/ubuntu/+source/pstack/1.3.1-1 After building the
> binary package with "fakeroot debian/rules binary" I have a pstack
> executable which produces just crap (below example just using nautilus
> process but it produces similar crap with any running process I've tried):
>
> $ ./pstack 1595
>
> 1595: nautilus
> (No symbols found)
> 0x7f12ebe59f03: ???? (100000006, 100000007, 30000000f, 300000011,
> 30000000c, 30000000d) + fddfe9c4 crawl: Input/output error
> Error tracing through process 1595
> 0x100000003: ????
>
> Any help on this?
>
> Regards,
> Andrey
I'm looking into this. The code works on the small examples I used to do the
porting but indeed doesn't seem to work on bigger ones. It seems something
makes the stack layout to change on the big examples, although I don't know
what. I tried compiling my small test case with -O2 and -O3 but it doesn't
seems to make any big different. Anyway, I'm looking into it.

Thanks for your interest in pstack.

Best regards,

Thomas Preud'homme

Revision history for this message
Luca Clementi (luca-clementi) wrote :

I am also the same problem described by Andrey (iloveeclipse).

    # cat /etc/issue
    Ubuntu 12.04.2 LTS \n \l

Shouldn't this bug be marked as open?

Luca

Revision history for this message
Carsten Hoffmann (choffmann) wrote :

I have created a new bug, based on my experiences and the comments from Luca Clementi and Andrey: https://bugs.launchpad.net/ubuntu/+source/pstack/+bug/1609419

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.