Jump to content
 English      
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
     Forums advanced search
HP.com Home
IT Resource Center Forums > HP-UX > languages and scripting

How to generate stackdump of a program on HP-UX

» 

IT Resource Center

» Login
» Register
» My profile
» Search knowledge base
» Forums
» Patch database
» Download drivers, software and firmware
» Warranty check
» Support Case Manager
» Software Update Manager
» Training and Education
» More maintenance and support options
» Online help
» Site map

Member icons
 
 HP moderator  HP moderator
 Expert in this area  Expert in this area
Member status
ITRC Pro ITRC Pro
250 points
ITRC Graduate ITRC Graduate
500 points
ITRC Wizard ITRC Wizard
1000 points
ITRC Royalty ITRC Royalty
2500 points
ITRC Pharaoh ITRC Pharaoh
7500 points
Olympian Olympian
20000 points
1-Star Olympian 1-Star Olympian
40000 points
2-Star Olympian 2-Star Olympian
80000 points
»  How to earn points
»  Support forums FAQs
Question status
Magical answer Magical answer
Message with a response that solved the author's question
Favorites status
Add to my favorites Add to my favorites
Delete from my favorites Delete from my favorites
This thread has been closed Thread closed
 

Content starts here
   Create a new message    Receive e-mail notification if a new reply is posted  Reply to this message
Author Subject: How to generate stackdump of a program on HP-UX      Add to my favorites
Leo Lai
Feb 28, 2006 19:57:55 GMT   

Hi,

On Solaris, it's easy to generate a stackdump of a program. I just execute pstack <pid>. 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!
Note: If you are the author of this question and wish to assign points to any of the answers, please login first.For more information on assigning points ,click here


Sort Answers By: Date or Points
Alain Tesserot
Feb 28, 2006 20:31:23 GMT  7 pts

In hpux the command is called getcore <pid>

The following link should get you started.
http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1662,00.html
Leo Lai
Mar 1, 2006 14:30:23 GMT    N/A: Question Author

I couldn't get "getcore <pid>" 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 [ <packcore_dir> ]. It doesn't look like it takes pid as an argument. Is there another getcore command that you're referring to?
James R. Ferguson This member has accumulated 80000 or more points
Mar 1, 2006 14:37:15 GMT  7 pts

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 This member has accumulated 7500 or more points
Mar 1, 2006 14:40:19 GMT  4 pts

not sure what a stackdump is but bt in gdb aka backtrace maybe what you are after ?
Leo Lai
Mar 1, 2006 14:46:39 GMT    N/A: Question Author

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
 
Create a new message    Receive e-mail notification if a new reply is posted   Reply to this message
 
 
Printable version
Privacy statement Using this site means you accept its terms
© 2009 Hewlett-Packard Development Company, L.P.