News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Breakpoints within unity files

Started by Womble, April 25, 2013, 01:05:29 PM

Previous topic - Next topic

Womble

Hi,

I am just in the process of moving a project over to C::B. The project compiles using unity files (i.e. the majority of .cpps are excluded from the build, and are instead included in a small subset of 'unity' files that are included in the build). I think this is a problem for debugging in C::B because as far as I can tell it requires that the original source file where you placed a breakpoint to be included in the build. Is this correct? If i just have a single file (say Test1.cpp ) built with a break point, this will hit as normal. If I include Test1.cpp from Test2.cpp and exclude Test1.cpp from the build, the breakpoint will not hit as the only file that is built is Test2.cpp.

If this is the case, do you think there is any workaround to get this to work? And if it's not the case any ideas what I'm doing wrong?

Thanks!

oBFusCATed

Does it work if you have it compiled normally, without including cpp files in other cpp files?
Does it work with command line gdb?
Do you have a test project?

I think that it should work fine, but I've not tried it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Womble

Yes, it works if I compile normally.

I haven't tried with command line, I will try it.

I don't have a test project that I can post here, but I can create one if you'd like. (In theory just creating a new hello world project, and including main.cpp from somewhere else should do the job).

Womble

(Thanks for the extremely fast reply btw!)

Womble

#4
Ok I just created a new console project, and excluded main.cpp from the build, and created a file called unity.cpp which included main.cpp. I ran this with a breakpoint in main.cpp and it worked. So it works as expected but there must be something wrong with my project.

In my larger project I get this output:

[debug]> break "/Volumes/MacData/Dev/Blah/Game/Main.cpp:232"
[debug]No source file named /Volumes/MacData/Dev/Blah/Game/Main.cpp.
[debug]Breakpoint 1 ("/Volumes/MacData/Dev/Blah/Game/Main.cpp:232) pending.

I thought the problem would be because Main.cpp is excluded from the project and included in a UnityXX.cpp.

oBFusCATed

Quote from: Womble on April 25, 2013, 01:31:29 PM
I thought the problem would be because Main.cpp is excluded from the project and included in a UnityXX.cpp.
Does it work if you don't use the unity including?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Womble

Quote from: oBFusCATed on April 25, 2013, 01:37:33 PM
Quote from: Womble on April 25, 2013, 01:31:29 PM
I thought the problem would be because Main.cpp is excluded from the project and included in a UnityXX.cpp.
Does it work if you don't use the unity including?

yes

Womble

(but in case you're suggesting that I simply don't use the unity files, that's not an ideal solution as the build takes *significantly* longer without them).

oBFusCATed

How many cores do you have?
There is no way (if you have more than 1 core), the unity type build to be faster.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Womble

Unity files are mainly faster because they save time on the opens/closes/seeks on the hard drive of all the files, not the compilation time so we still benefit massively from them.

Anyway it's working now, the unity files that are autogenerated were being generated with all uppercase filenames so it wasn't finding them!

Thanks!

oBFusCATed

Quote from: Womble on April 25, 2013, 05:42:33 PM
Anyway it's working now, the unity files that are autogenerated were being generated with all uppercase filenames so it wasn't finding them!
Heh, ok.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]