User forums > Using Code::Blocks

How to add gcc option "-femit-class-debug-always" to a single cpp file in cbp

(1/1)

ollydbg:
Hi, when debugging Code::Blocks's plugin, I always see "incomplete type" message when gdb try to inspect some variables.

Those variable types (such as a variable has the type wxCommandEvent) are defined in wxWidgets library, but the debugee is linking to the release version of the wxWidgets library.

The solution to this kinds of issue is to adding the g++ build option "-femit-class-debug-always" when building the project(cbp file).

But I don't want to every cpp files in the cbp file to have such option, because there are so many cpp files in the project, once this option is added, I need to rebuild the whole project.

What I need is to enable this option only on a single cpp file(I just debug this file). How can I do that?

Any ideas? It looks like I need to tweak the build option on the single cpp file. So, something in the cpp file's property dialog? See the image shot below.

Thanks.

There are some discussion about the  "-femit-class-debug-always" option:

1, [solved] Creating a gdb Pretty-Printer for wxIPV4address

2, GDB can not show the type info of wxCommandEvent

ollydbg:
OK, I think I find the solution.

See below:

I just edit the cpp file 's build option dialog, check on the option: use the custom command to build this file.


--- Code: ---$compiler $options -femit-class-debug-always $includes -c $file -o $object

--- End code ---

And now, I can see the variables contents now under GDB.

I think this is a nice feature which can help use to debug the client code which link to a release version of a third part library.


EDIT:

Oh, no, I see the problem still exists.



ollydbg:
There is a detailed discussion and test code here in github:

add option "-femit-class-debug-always" for a single cpp file, but gdb still shows <incomplete type> when debug in this cpp file  Issue #9  ssbssa/gdb

ollydbg:
FYI:

This problem is totally solved now.

See the solution here:

https://github.com/ssbssa/gdb/issues/9#issuecomment-1980016412

That actual change you need to do is to change the build option for a single cpp file to:


--- Code: ---$compiler $options -DNOPCH -femit-class-debug-always $includes -c $file -o $object
--- End code ---

Happy coding and happy debugging.

Navigation

[0] Message Index

Go to full version