Stepping through code from a library

General questions regarding the usage of CodeLite
fireball
CodeLite Curious
Posts: 2
Joined: Thu Jun 30, 2011 5:28 pm
Genuine User: Yes
IDE Question: C++
Contact:

Stepping through code from a library

Post by fireball »

Hi,

I am an inexperienced programmer and have the following question.

I have a C project and it uses a static linked library (that I created myself). I need to debug some code in this project and am stepping through the code in debug mode (using gdb, gcc). When the function from the library gets called, codelite editor does not show the C code of the function from the library and therefore I cannot step through the code from the library.

Thinking about it, such behaviour may be expected. A library contains object code and not the source code, so codelite editor is not aware of the source code of the library and may not show the source file from the library as I step through the code. However, the "Call Stack" tab in the Debugger pane shows the called function from the library and the "Locals" pane shows the local variables from the function in the library.

So, is it possible to step through the code from the library using codelite's editor when I want to debug the C project which links to that library ? And if so, how ?

A simple solution would be to forget about libraries and linking and copy over all the source code from the library to the C project, but I don't want that since I want to modify and reuse that library in other projects.

I appreciate any help. Thanks!
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Stepping through code from a library

Post by eranif »

codelite is just a another front end for gdb
You will need to make sure that your library is built with debug information and the sources are available

Eran
Make sure you have read the HOW TO POST thread
fireball
CodeLite Curious
Posts: 2
Joined: Thu Jun 30, 2011 5:28 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Stepping through code from a library

Post by fireball »

The library is built with debug information and the source is also available since I created that library.

Stepping through the code in debug mode, the local variables of the function from the library will get updated in the pane but I cannot see which line gets executed each time I step through the code.

So it should be possible then to do what I want ?

By the way. the project uses a custom makefile and I believe the makefile contains information about the include directory where a header file of the library resides and information about where to find the library (I the -l and -L switches to the makefile, and the project compiles and links succesfully) but no information about the source file directory of the library.
Last edited by fireball on Thu Jun 30, 2011 6:22 pm, edited 1 time in total.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Stepping through code from a library

Post by eranif »

If codelite can not locate the source file, it means that gdb provides a path that does not exist on the local machine.
can you post a screenshot of the debugging where the current executed line is inside a function inside the library ?

Make sure that the 'Call stack' tab is selected and the 'File' column is shown properly

Eran
Make sure you have read the HOW TO POST thread
Post Reply