Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a process that is spinning out of control under Linux, and I would like to create a dump file that I can take to my dev machine, and examine there.

In Windows, it is possible to create a "minidump" of a running program in several different ways, including ADVPlus and Windows Task Manager, by going to the Processes tab and right-click selecting "Create Dump File."

Is there a way to accomplish this in Linux?

I would need call stacks, heap and stack memory (especially stack), exceptions and all the rest.

share|improve this question
    
Wondering if any of the replies was helpful to you? – Valentin Jul 29 '12 at 12:54
    
@Valentin: From an educational perspective, yes, the replies were helpful and I upvoted them. However they did not answer the question I actually asked, which was how to construct a dump file which I can then take to a dev machine and examine. I was looking for something analogous to a Windows minidump file. – John Dibling Aug 1 '12 at 21:44
up vote 4 down vote accepted

Well the way to create a dump file is:

   gcore - Generate a core file for a running process

SYNOPSIS gcore [-o filename] pid

share|improve this answer
pmap <PID>

or

strace -f -o xxx -p <PID> 

might be the tools you are looking for.

pmap shows you an overview about the memory usage of the provided process. strace tracks down every action a process takes. With -f you tell strace to also consider watching over child processes and -o xxx tells strace to write the output to a file. You can also start a new process by using strace, e.g. with

strace cat /etc/passwd

If you are interested in specific information only, such as what files were opened, you can start strace accordingly:

strace -f -o xxx -e trace=open -p <PID>
share|improve this answer

Try this:

cat /proc/<pid>/smaps > mem.txt

This link might also help you.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .