Simple Debugger question

Just a simple question. Which compile flags do I need so that Debugger also shows the source code of my program? Currently I am only using -g, but that does not help. Or do I need to put the source code into the same folder as the executable?

-g should be enough. What do you see above source code area? “Source unavailable” or “… not found”? If it’s the latter then you can click it and point Debugger to the source file.

Have in mind that currently you also need -gno-column-info to be able to set breakpoints. See

1 Like

Afaik the sources have to be on query-enabled BFS.

When using the Debugger, I compile with -g (or -g0), then start from the terminal with “Debugger MyApp”, and there is a tab called images which directs to the source tree. From there you can insert breakpoints. Strangely, in the past I was able to set breakpoints on any line, now I can only set them on function entry points. Good luck.

The error message is “source file unavailable” and I can’t click to add a source file.
On the image tab in upper right corner below “File/Function” also is displayed, but the function names are.
Maybe that is because I use clang to compile?

BTW does this feature also works for other languages supported by gcc/clang or only C/C++?

Hm? I don’t think my sources are on query-enabled partitions and I still can use them in Debugger.

#15159, posted above :slight_smile:

Oueries are used to autolocate the file, otherwise you need to set the path manually, unless gcc was passed the absolute path on the command line and the file was not moved.

This should work for any language, as long as gcc provides the debuginfo allowing to find the file/line from an offset in the binary file. Other features (listing variables, for example) might require more work.

Note that when you build with -g, only your own code is built that way, so make sure to select one of your functions in the backtrace. If you are looking at disassembly for libbe or some other lib, you need to build that lib with -g, as well.