Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using gdb for debugging c project source code.
I compile as shown:

./configure --enable-debug CFLAGS="-g -o0" <br />
    make --debug=a


I want to debugging stop at specific file. so
when I set break point by using

(gdb) break main.c:672

it says :

No source file named main.c.
even when I pass specific function name (in main.c file) to break . it says: such function not defined.

my current directory has this main.c file. I am using Cygwin on widnows. when I set break point by using

(gdb) break main
it set break point at a main function of Cygwin file, not in my source code.


1.how can I fix my first problem?

2.just curious, how to avoid second problem, if there is same function name within Cygwin files and my source code?

Since I am new at linux c programming, I am having many troubles.
Please help, Many thanks in advance
Posted
Comments
Richard MacCutchan 3-Oct-13 4:01am    
It is not possible to give an answer as there is so much information missing from your question. I would strongly suggest you get the documentation for gdb and work through it carefully.
The_Inventor 3-Oct-13 4:11am    
When writing in C, the implementation is in the *.c file, while the declarations often are in the *.h file, especially functions. You can create structures, initialize them, and then use them. Often in the IDE where you write, compile, and link together into an executable file, *.exe.

Name your program something other than 'main'. If you are in debug mode and are running 'main.exe' you may set break points that are not hard coded, so:

(gdb) break line 672; might work. I don't like break points. They are distracting.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900