>>>>> ">" == #SINHA SHARAD# <sinh0...@e.ntu.edu.sg> 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

Reply via email to