dbx - attach to process, break when crash


 
Thread Tools Search this Thread
Top Forums Programming dbx - attach to process, break when crash
# 1  
Old 02-11-2011
dbx - attach to process, break when crash

Hey everyone,

I have a process that is crashing, and I'd like to have some way to see where it crashes. Is this possible?
# 2  
Old 02-14-2011
Let the process produce a core file

There are two ways you can deal with this problem.
The first, and most obvious one, is to run the program under the debugger (e.g.: dbx). When it crashes, you'll get the debugger's prompt and you can explore the location and causes of the crash.

Since running under the debugger may change the behavior of the program, you may want to let it run normally. If the program crashes due to certain signals (e.g.: SIGSEGV - indicating accessing a bad address, such as address 0), it can produce a core file, at least under Unix variants, including Linux. You can then use the debugger to look at the state of the program at the time of the crash and analyze the reason for the crash.

For example, if the name of the program is prog, then
use: dbx prog core
to explore the state of the program at the time of the crash.

The core file is not always produced even when the program crashes due to a signal such as SIGSEGV. The reason is that there is a limit on the size of the core file. Often, this limit is 0. You can change this limit to "unlimited" and then the core file will be produced when the need arises.
The command to change the core file size limit is shell dependent.
For example, under bash I am using: ulimit -c unlimited
under tcsh, I use: limit coredumpsize unlimited

# 3  
Old 02-14-2011
Wow, great! Thanks for the help, this exactly what I was looking for!

---------- Post updated at 10:28 AM ---------- Previous update was at 10:22 AM ----------

If the limit is exceeded, does that mean the core file will not be created at all? Or will it just be truncated? I guess both wouldn't help much.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Attach process with port 2222

Hi Team, is there any way, I can start any process for e.g. run a shell script (infinite loop) and attach it to port 2222? I am trying to create a scenario where an application will start running at port 2222 and I will telnet the same to confirm, application port is listening. So,... (1 Reply)
Discussion started by: vivekpandit7
1 Replies

2. AIX

How to set the break point using dbx?

Hi, I am trying to debug my project using dbx to understand the code and functionality of modules. I compiled all my C files using gcc -g flag to enable the debug option. I was able to get in to the debug mode using dbx. I was able to create breakpoints using stop at line no. "stop at... (7 Replies)
Discussion started by: Sachin1987
7 Replies

3. UNIX for Dummies Questions & Answers

How can I set DBX to break on an Access Violation?

I'm trying to debug a service crash, and would like to break on an access violation - is this possible? (0 Replies)
Discussion started by: ctote
0 Replies

4. Programming

Cannot get dbx to work correctly with a running process

Hi everyone, I've been struggling with this for a few weeks now. I'm trying to debug a running process with dbx on an AIX box. The command I'm using is 'dbx -a <pid> core' There is a function I can perform in my application that crashes this process, but it does not show up as crashed in... (0 Replies)
Discussion started by: ctote
0 Replies

5. Programming

AIX dbx - attaching to a process that is crashing

Hey everyone, I'm trying to attach to a process that is crashing so I can debug the source code. I've tried this: dbx -a PID stop at "file.cpp":line# However, nothing ever breaks. The service crashes and restarts, but I never see it hitting the code. I've tried to use a core file, but... (2 Replies)
Discussion started by: ctote
2 Replies

6. Programming

dbx - break on access violations

Hey everyone, Is there a way to make dbx break on access violations? (2 Replies)
Discussion started by: ctote
2 Replies

7. Solaris

process doesn't crash when i use the truss ??

Hi All, We a critical application running on the Sun Solaris platform. But, for some reasons the process get's killed abnormally in the production environment and not sure what was causing this. I thought i would use the truss command to trace the errors.. so i used the bellow command truss... (5 Replies)
Discussion started by: sudharma
5 Replies

8. UNIX for Advanced & Expert Users

How to attach an xterm to a process/thread ?

Hi folks, I would like to know how to hook up an xterm to another process. Here is a high level view of what I am looking for 1. Main program starts 2. It creates an new xterm window 3. It then forks a second process & passes the xterm handle to it 4. The second process uses the second... (4 Replies)
Discussion started by: RipClaw
4 Replies

9. UNIX for Advanced & Expert Users

attach process from another ssh session

Hi, I was logged in on a server, by ssh, with a vim open, when the battery of my laptop got empty. When I return to the server by ssh, I can see my previous ssh session still open, and the vim process running (ttyp0). Is there a way to attach that vim to my new session (ttyp4)? Here's part... (2 Replies)
Discussion started by: raphinou
2 Replies

10. Programming

Process crash when allocating memory

Hi I'm currently using C++ on a HP-UX 11i system (upgrading some libraries) and am encountering a problem with the process crashing when allocating memory via a call to new (a rather large array of objects are being created). Is there a way to find out what the sizes of the stack and heap are?... (1 Reply)
Discussion started by: themezzaman
1 Replies
Login or Register to Ask a Question