Debug through include file

Started by blairon, February 04, 2012, 04:30:22 PM

Previous topic - Next topic

blairon

Hello,
in some consol application I can't debug through the include file.
I only debug through the main file.

CommonTater

Are these include files also part of your project?

You cannot internally debug library functions (such as printf()) because they are extracted from pre-compiled code in library files that have no debugging symbols.

If the files in question are part of your own project, make sure you've set both the compiler and linker to include debugging symbols for your project and then rebuild the whole project before debugging.



blairon

Yes these include files are part of the project and both the compiler and the linker include debugging information.
But still in debug mode, the debugger don't want to step into functions defined in the included files.

TimoVJL

Example for that.#include <stdio.h>
#include "foo3.c"
int main(void)
{
printf("from main\n");
#include "foo2.c"
foo3();
return 0;
}
// foo2.c
printf("from foo2.c\n");
// foo3.c
void foo3(void)
{
printf("from foo3\n");
}
May the source be with you

CommonTater

#4
Quote from: blairon on February 05, 2012, 09:59:42 AM
Yes these include files are part of the project and both the compiler and the linker include debugging information.
But still in debug mode, the debugger don't want to step into functions defined in the included files.

Ok... lets double check...

On your main menu click Project -> Project Options
On the Compiler tab select Debug Information = Full
On the Linker tab select Debug Information  = Code View & Coff (for x86) or Code View (for x64)
Close the dialog with the OK button.

Now select Project -> Rebuild <project name>

You should now be able to run your entire project in the debugger.  It should step into your project's  files but it will not step into library calls; such as functions from stdio.h or stdlib.h ...

If this still doesn't work, use Project -> Zip Files, and upload the zipped project here... so we can see the problem for ourselves.

blairon

OK,
I made a simple test,
here it is

Bitbeisser

Quote from: blairon on February 05, 2012, 04:21:25 PM
OK,
I made a simple test,
here it is
Sorry, but that doesn't make any sense.

For one, you did not include actually your include file into the hw2 project.

Ans second, you seem to have in general misunderstanding about the used of  "#include" in C.
It is not supposed to use to include files like other (mainly interpreted languages), it's intended to be used for "header" fiiles (hence the usual .h extension!), which should contain only definitions for functions, types and variables defined "elsewhere" as well as macros. But never actual code. For that, there should be not even a reason to trace into an "include" file in the first place...

Ralf

blairon

OK,
what do you mean by hw2 project,
how do you share a reusable code portion with a lot of different programs?
thanks

frankie

This is a known limitation of PellesC IDE.
Unlike M$ VC++, and maybe other debuggers, PellesC doesn't consider source code in header files.
Maybe Pelle will change his mind on next release.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide