Operating System - Linux
1748197 Members
2600 Online
108759 Solutions
New Discussion юеВ

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

 
Leo Lai
Occasional Contributor

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!
5 REPLIES 5
Alain Tesserot
Frequent Advisor

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
Leo Lai
Occasional Contributor

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?
James R. Ferguson
Acclaimed Contributor

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...
Alex Glennie
Honored Contributor

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 ?
Leo Lai
Occasional Contributor

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