Re: How to generate stackdump of a program on HP-UX (214 Views)
Reply
Occasional Contributor
Leo Lai
Posts: 6
Registered: ‎12-12-2005
Message 1 of 6 (214 Views)

How to generate stackdump of a program on HP-UX

Hi,

On Solaris, it's easy to generate a stackdump of a program. I just execute pstack . Is there a similar way to do this on HP-UX? I want to write a script that generates period stackdumps of a C++ process without killing the process.

Thanks!
Frequent Advisor
Alain Tesserot
Posts: 42
Registered: ‎06-02-2005
Message 2 of 6 (214 Views)

Re: How to generate stackdump of a program on HP-UX

In hpux the command is called getcore

The following link should get you started.
http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1662,00.html
Occasional Contributor
Leo Lai
Posts: 6
Registered: ‎12-12-2005
Message 3 of 6 (214 Views)

Re: How to generate stackdump of a program on HP-UX

I couldn't get "getcore " to work. Are you talking about the getcore command in gdb? When I execute `help getcore` in gdb, it tells me the correct usage of getcore is: getcore [ ]. It doesn't look like it takes pid as an argument. Is there another getcore command that you're referring to?
Acclaimed Contributor
James R. Ferguson
Posts: 21,184
Registered: ‎07-06-2000
Message 4 of 6 (214 Views)

Re: How to generate stackdump of a program on HP-UX

Hi Leo:

If you are Itanium based, have a look at the manpages for 'U_STACK_TRACE(3X)' and 'unwind(5)'.

Regards!

...JRF...
Honored Contributor
Alex Glennie
Posts: 4,068
Registered: ‎05-07-2000
Message 5 of 6 (214 Views)

Re: How to generate stackdump of a program on HP-UX

not sure what a stackdump is but bt in gdb aka backtrace maybe what you are after ?
Email : alex_glennie@hotmail.com
Occasional Contributor
Leo Lai
Posts: 6
Registered: ‎12-12-2005
Message 6 of 6 (214 Views)

Re: How to generate stackdump of a program on HP-UX

Thanks all, but a developer at my company has provided me with the simplest way. I will share it with you here:

> gdb $EXE -pid $PID -command /home2/devuser3/bin/dropStack.txt > $OUTPUTFILE

$EXE is the full path to the executable,
$PID is the pid
$OUTPUTFILE is where you want to redirect output to

The content of the dropStack.txt file is:
set height 0
thread apply all bt
detach
quit
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.