Error using DDD debugger c, no source for printf.c

506 Views Asked by At

I am using DDD for debugging in C. I get the following error:

DDD: No source

[file-location]/printf.c: No such file or directory

The error occurs at the following line of code:

printf("i = %d\n", i);

My guess is that it is not reading the printf command correctly. How do I fix this? I uninstalled then reinstalled but the same error.

1

There are 1 best solutions below

0
On

It's almost certainly trying to step into the printf function as part of your debugging session (see here for a good answer covering the difference between that and step over, amongst other things(a)).

It's just saying it doesn't have the source code for that function (it's usually part of the C library itself, not something you wrote).

You could possibly find/install the source code but I suspect it's unnecessary - I think you can safely assume that the C library functions work as advertised, so just step over the calls rather than into them.


(a) Based on the documentation, DDD appears to use Step for step-into and Next for step-over. It also has Finish which appears to be step-out-of and an Until I've not seen elsewhere, which steps until you reach a higher address (so executing entire loops in one go without having to step through every iteration).