[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regarding debugging with GDB
From: |
Tom Tromey |
Subject: |
Re: Regarding debugging with GDB |
Date: |
Sat, 23 Oct 2010 17:17:04 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>>>>> ">" == #SINHA SHARAD# <address@hidden> writes:
>> Hi, Sorry for asking my question related to GDB here. I could not
>> find an appropriate GDB mailing list where I could post my question.
>> I have multiple C source files in a project. I use a makefile to
>> compile the files and generate the executable. I then use another
>> script file to run the executable because the script file provides
>> certain parameters to the executable. Now, the executable throws up
>> segmentation fault some time after the script has been invoked. So, I
>> try to use GDB to locate the error. However, it simply shows me the
>> parameters passed in the script and exits without any information on
>> the segmentation fault. Can you please tell me how to locate which
>> of the nearly 30 source files is causing the problem of invalid
>> pointer? I am using GCC 4.1.2 with Fedora 12.
Edit your script; where it invokes the program you want to debug, insert
"gdb --args". That will work fine as long as you aren't using I/O
redirections.
Otherwise, you can modify the environment in gdb and pass parameters to
your program as well. This is all documented in the manual.
Tom