Author Topic: Breakpoints within unity files  (Read 7046 times)

Offline Womble

  • Single posting newcomer
  • *
  • Posts: 7
Breakpoints within unity files
« on: April 25, 2013, 01:05:29 pm »
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!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Breakpoints within unity files
« Reply #1 on: April 25, 2013, 01:17:01 pm »
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!]

Offline Womble

  • Single posting newcomer
  • *
  • Posts: 7
Re: Breakpoints within unity files
« Reply #2 on: April 25, 2013, 01:22:40 pm »
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).

Offline Womble

  • Single posting newcomer
  • *
  • Posts: 7
Re: Breakpoints within unity files
« Reply #3 on: April 25, 2013, 01:23:47 pm »
(Thanks for the extremely fast reply btw!)

Offline Womble

  • Single posting newcomer
  • *
  • Posts: 7
Re: Breakpoints within unity files
« Reply #4 on: April 25, 2013, 01:31:29 pm »
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.
« Last Edit: April 25, 2013, 01:33:51 pm by Womble »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Breakpoints within unity files
« Reply #5 on: April 25, 2013, 01:37:33 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!]

Offline Womble

  • Single posting newcomer
  • *
  • Posts: 7
Re: Breakpoints within unity files
« Reply #6 on: April 25, 2013, 01:38:27 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

Offline Womble

  • Single posting newcomer
  • *
  • Posts: 7
Re: Breakpoints within unity files
« Reply #7 on: April 25, 2013, 03:45:03 pm »
(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).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Breakpoints within unity files
« Reply #8 on: April 25, 2013, 05:20:08 pm »
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!]

Offline Womble

  • Single posting newcomer
  • *
  • Posts: 7
Re: Breakpoints within unity files
« Reply #9 on: April 25, 2013, 05:42:33 pm »
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!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Breakpoints within unity files
« Reply #10 on: April 25, 2013, 06:53:32 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!]