#### nenin

• Multiple posting newcomer
• Posts: 95
##### Re: Debug problem with header files
« Reply #15 on: April 13, 2009, 02:31:40 pm »
I really need a reproducible test case to work with here, folks.
I know, and it is frustrating that I can't come up with a test case as I did for the previous problem. I am currently working on a fairly large program; and every now and then, when I set a break in a header file, the debugger fails. <***>
I confirm the same problem. I have a project with headers placed in root project folder and some subfolders. I can not enter breakpoint  in headers from start, and now I found that gdb kind of hung in template function, if I enter it by step and than place a new breakpoint inside. WinXP SP3, last TDM gcc.
« Last Edit: April 13, 2009, 05:28:01 pm by nenin »

#### RJP Computing

• Almost regular
• Posts: 135
##### Re: Debug problem with header files
« Reply #16 on: April 13, 2009, 03:06:00 pm »
I can work on an example, but do the inline templates of the example I posted have anything to do with that? I should also mention that the header is in a sub-directory that is three levels down. (<proj_root>\wxtools\wx\serialization\combobox.h)

I shouldn't need to ask this, but are you sure you're compiling without any optimization flags and with debugging info turned on?
Yes I have them on.
« Last Edit: April 13, 2009, 03:08:37 pm by RJP Computing »
- Ryan

Ubuntu/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, ATI Radeon 9600XT 256MB

#### ollydbg

• Developer
• Lives here!
• Posts: 5247
• OpenCV and Robotics
##### Re: Debug problem with header files
« Reply #17 on: April 13, 2009, 03:06:45 pm »
I have the interests for testing, if you can supply a test case.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

#### RJP Computing

• Almost regular
• Posts: 135
##### Re: Debug problem with header files
« Reply #18 on: April 13, 2009, 04:30:47 pm »
Alright I wrote a small example that shows the bug. I attached the source to this post. Just make a new console project and add the files to the project.

Here are some things I found:
• Only set a breakpoint in the file wxtools\wx\serialization\combobox.h. It will not set the breakpoint.
• If you set a breakpoint in a cpp (headerbrk.cpp) that includes the header then it will set the breakpoint properly.

- Ryan

Ubuntu/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, ATI Radeon 9600XT 256MB

#### TDragon

• Lives here!
• Posts: 936
##### Re: Debug problem with header files
« Reply #19 on: April 13, 2009, 06:21:41 pm »
Sorry, works fine for me. GCC 4.3.3 TDM-1, GDB 6.8-mingw-3. Screenshot attached.

http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

#### RJP Computing

• Almost regular
• Posts: 135
##### Re: Debug problem with header files
« Reply #20 on: April 13, 2009, 08:05:37 pm »
I am trying this using 'gdb.exe' and can't get it to stop. I tried in C::B and sure enough it is breaking like it should. So... I am assuming C::B is doing something right that I am not. Sorry for my noise, but I am trying to continue to use gdb so I would like some help. Can you use MSys or something and use just the 'gdb.exe'.

Also I understand that this is not a C::B related issue so should it be moved to a different forum/email/something?
- Ryan

Ubuntu/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, ATI Radeon 9600XT 256MB

#### TDragon

• Lives here!
• Posts: 936
##### Re: Debug problem with header files
« Reply #21 on: April 14, 2009, 12:54:03 am »
Before trying it in C::B, I tried it from command-line gdb with
Code: [Select]
break template_headerbrk.h:12which worked fine for me, as did
Code: [Select]
break "C:\path\to\headerbrk\wxtools\wx\serialization\template_headerbrk.h":12
So I have no idea what the problem on your end is.

And, yes, unless you come up with a scenario that breaks in C::B, I suspect this has gone off-topic.
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

#### RJP Computing

• Almost regular
• Posts: 135
##### Re: Debug problem with header files
« Reply #22 on: April 14, 2009, 03:38:41 am »
Before trying it in C::B, I tried it from command-line gdb with
Code: [Select]
break template_headerbrk.h:12which worked fine for me, as did
Code: [Select]
break "C:\path\to\headerbrk\wxtools\wx\serialization\template_headerbrk.h":12
So I have no idea what the problem on your end is.
Thanks. I had tried a few sytax's and now that works. I am not very familiar with gdb.exe so I was trying to follow the earlier post in this thread that was using gdb.exe. I will let my issues rest. Again thanks for your patience and understanding.

And, yes, unless you come up with a scenario that breaks in C::B, I suspect this has gone off-topic.
Correct. And sorry for the noise.
- Ryan

Ubuntu/WinXP, AMD Athlon 64 3000+, 1000MB RAM, AC 97 Audio, ATI Radeon 9600XT 256MB

#### nenin

• Multiple posting newcomer
• Posts: 95
##### Re: Debug problem with header files
« Reply #23 on: April 15, 2009, 10:39:12 am »
Quote
<***> So I have no idea what the problem on your end is. <***>
I figured out  a case (at least, my case). I have a complicated project structure, with sources in the set of folders.
C::B sets breakpoint as:
But in gdb console path to this line looks like:
"v01" is a folder, where template from "template_header.hpp" was instated.
So, if I send to gdb
it works. But C::B  can not set a breakpoint properly.

#### ollydbg

• Developer
• Lives here!
• Posts: 5247
• OpenCV and Robotics
##### Re: Debug problem with header files
« Reply #24 on: April 15, 2009, 11:56:25 am »
Quote
<***> So I have no idea what the problem on your end is. <***>
I figured out  a case (at least, my case). I have a complicated project structure, with sources in the set of folders.
C::B sets breakpoint as:
But in gdb console path to this line looks like:
"v01" is a folder, where template from "template_header.hpp" was instated.
So, if I send to gdb
it works. But C::B  can not set a breakpoint properly.

Maybe, this is the issue that cb treat differently with relative path and absolute path. I encountered this kind of problem when I want to debug into the wxWidgets source(at that time, I use wxPack), but it failed.

See the post:
http://forums.codeblocks.org/index.php/topic,9744.0.html

But no body replied there.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

#### TDragon

• Lives here!
• Posts: 936
##### Re: Debug problem with header files
« Reply #25 on: April 21, 2009, 04:00:03 am »
See the post:
http://forums.codeblocks.org/index.php/topic,9744.0.html

But no body replied there.
That might be because your issue there is almost entirely unrelated.

But in gdb console path to this line looks like:
"v01" is a folder, where template from "template_header.hpp" was instated.
So, if I send to gdb
it works. But C::B  can not set a breakpoint properly.
If verified, this appears to be a bug in GDB.
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

#### ollydbg

• Developer
• Lives here!
• Posts: 5247
• OpenCV and Robotics
##### Re: Debug problem with header files
« Reply #26 on: June 25, 2009, 06:53:09 pm »
I know, and it is frustrating that I can't come up with a test case as I did for the previous problem. I am currently working on a fairly large program; and every now and then, when I set a break in a header file, the debugger fails. I keep wondering if it is perhaps a problem with the project search directories, but I have not been able to identify anything obvious. Thanks again for your good work.
@rhf

I meet the same problem when I'm include an inline function header in many CPP files, then setting brekpoints may fails.

But I have solved the problem by adding GCC options. You can see this post, maybe, it's the cause of your problem.

http://forums.codeblocks.org/index.php/topic,10508.msg73723.html#msg73723

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

#### rhf

• Multiple posting newcomer
• Posts: 123
##### Re: Debug problem with header files
« Reply #27 on: June 25, 2009, 07:14:55 pm »
@rhf
I meet the same problem when I'm include an inline function header in many CPP files, then setting brekpoints may fails.
But I have solved the problem by adding GCC options. You can see this post, maybe, it's the cause of your problem.
http://forums.codeblocks.org/index.php/topic,10508.msg73723.html#msg73723
I have been following that thread. The next time I have the problem, which seems to occur only with my larger, more complicated projects, I will definitely try the compiler options. Thanks very much!