Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm executing a pro*c executable in linux and I've got segmentation fault error. But there is no core file dumped.

Thus, I want to debug the program using GDB debugging tool. However, I see that it is not installed on my Linux machine (a RHEL 5.3). How to install GDB debugging tool in linux? Do I need to download any package and install it, or does it come with RHEL?

Any help is appreciated.

share|improve this question
2  
sudo apt-get install gdb –  H2CO3 May 11 '12 at 7:09
1  
which distro??? –  Vineet Menon May 11 '12 at 7:09
4  
Don't ask questions when the answer can be easily found via Google. And you did not specify what distribution of Linux you are using. –  Hindol May 11 '12 at 7:13
    
below is distribution details: Enterprise Linux Enterprise Linux Server release 5.3 (Carthage) Red Hat Enterprise Linux Server release 5.3 (Tikanga) LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia‌​32:graphics-3.1-noarch –  smileybhuff May 11 '12 at 7:18
1  
@Hindol.. my question doesnt harm anything.. –  smileybhuff May 11 '12 at 7:20
show 1 more comment

migrated from stackoverflow.com May 11 '12 at 11:01

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 1 down vote accepted

First of all if you don't have a core dumped on your disk is because often by default the core size is limited to 0 byte, thus core are not dumped.

To check this and correct it, simply perform this in your shell just before running your program (in the same shell):

ulimit -c
ulimit -c unlimited

The first command will give you the limit size for core files, the second one will make it unlimited.

Now you can run your program and it will dump a core upon segmentation fault. You still need GDB though.

GDB is an installable package that come with the Red Hat installation DVDs. Red Hat offers a nice and simple interface to do this, check their online manual. Search for GDB, selct it and click Apply. It will request to insert the installation DVD.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.