C++ Builder IDE >> setting breakpoints

by g » Tue, 29 Nov 2005 00:28:18 GMT


Anybody know why the IDE refuses to let me set a breakpoint in a header. The function body is defined in the header itself. I was breaking in the source all morning and something has caused the IDE to stop letting me break/debug at that line of code.

It was working fine ...then pafffffFF. Any attempt to set the breakpoint and the IDE greys them out (dark green actually) and puts an X thru it... no stopping here.

I've rebuilt all the .obj, touched the header and rebuilt the app from scratch. Borland still thinks it shouldn't stop there but it definitely SHOULD.

Any ideas. The project is definitely rebuilt from scratch.. some "intelligent" caching or something might be at fault.

?

thanks

G



C++ Builder IDE >> setting breakpoints

by Ron Sawyer » Tue, 29 Nov 2005 02:23:22 GMT


I don't know the answer for sure, but I would try deleting the .tds file.





C++ Builder IDE >> setting breakpoints

by g » Tue, 29 Nov 2005 16:37:10 GMT


thanks again,

I can step thru the code but I can't set the breakpoint. I'll try deleting the .tds later and rebuilding for the moment however I can go step by step. not ideal but then again nothing in this world is :)


thanks for your help, I appreciate it.

G





setting breakpoints

by Andrue Cope [TeamB] » Tue, 29 Nov 2005 17:09:44 GMT





I wish I did. Sometimes it will let you, sometimes it won't. You will
probably find you can step through it though so it knows there's code
for those lines :-/

--
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html


setting breakpoints

by Chris Uzdavinis » Tue, 29 Nov 2005 22:06:03 GMT

"g" < XXXX@XXXXX.COM > writes:


If you don't mind doing a little work, there is a trick you can do to
prevent inline functions from expanding inline. Perhaps that would
help.

First, remove all the function definitions from your header. Put them
into a new file called "file.ipp". Now the header simply has
prototypes and class declarations, etc, but no functionality.

Next, add the following to the BOTTOM of your header:

#ifdef INLINE_CODE
#include "file.ipp"
#endif //INLINE_CODE

(Inside the header "guards" #ifndef file_h\n#define file_h\n...#endif)


Finally, if you don't have a .cpp file, make one. Now add the
following to the TOP of that file:

#ifndef INLINE_CODE
#include "file.ipp"
#endif //INLINE_CODE


Finally, in the .ipp file, you need to change the "inline" keyword
into something that conditionally expands to "inline" or to nothing,
depending on whether INLINE_CODE is defined or not. This can be done
with another header to put the code in one place:

#ifdef INLINE_CODE
#define INLINE inline
#else
#define INLINE
#endif // INLINE_CODE

If the above were placed in "inline.hpp" or in some other common
header, you need to include it from your file.hpp which wishes to use
the macro.

Now you can control with a compile-time macro whether your code is
built into the .cpp as bona-fide functions, or is inlined as usual.
I'd guess that the debug info would more readily attach to real
functions rather than inlined functions. This is also very useful for
debugging in general, since inlined functions can cause issues with
debuggers. Finally, it can be great for speeding up compile times
while you're in development, since the header is smaller, and is
presumably included in many places. (Thus, you are reducing the
amount of code compiled by a multiplier of the number of times the
header is included.)

Yes, it takes a little effort, but it certainly adds a lot of
flexibility to your build options--in a portable way.


--
Chris (TeamB);


Similar Threads

1. Problem setting Breakpoint in Unit Test

I have a project I am writing unit tests for and I am having a problem
with one of the tests. I set a break point at the beginning of the
test and found which statement was causing the problem. I need to run
the test again so I can step into the offending statement instead of
over it, but the test run now refuses to stop on the break point! What
gives??

2. Can't set breakpoint - CSharp/C#

3. Setting Breakpoints for Variables

Are you looking for:

Trace.Assert (from System.Diagnostics) as in:

     private void button1_Click(object sender, System.EventArgs e)
      {
         int iVar = 4;
         Trace.Assert(iVar > 4, "This integer is less than five");
      }

On Thu, 04 Mar 2004 11:14:59 -0500, Mortimer Schnurd
< XXXX@XXXXX.COM > wrote:

>Hi folks,
>I am just learning C# and need some help with setting debugger
>breakpoints. In VB 6, I could easily set breakpoints on variables
>which either change in value or evaluate to a specific value. It
>appears C# does not allow you to do this (at least not easily). This
>functionality was extremely useful in many instances of VB 6
>debugging. 
>
>Is there some way in which I can emulate this same functionality in
>C#? I've tried various methods including throwing an exception base on
>an evaluation of a variable. This does allow the program to break into
>debugger at that point but does not allow you to continue.
>
>Any guidance would be appreciated.

4. Setting breakpoints in a mixed mode file?

5. Cannot set breakpoint in a certain project

Hi.  Ive been using Visual C++ for two years on an application.  The 
application is one solution, containing 10 projects.  9 of the projects build 
libraries (*.lib).  I've been debugging the application for 2 years.   One 
thing that has been happening for several months is a genuine mystery:   

I cannot set breakpoints in one of the libraries (source code).   I can 
create the breakpoint in the source code editor, but when I attach to the 
application, I get a warning message:

"he following breakpoint cannot be set
    At MyFile.cpp, line 123
The Common Language Runtime was unable to set the breakpoint

And the breakpoint, indeed, does not function.  This problem holds for every 
function in this one library (project).  But only this one project:  all 
other projects in the solution have no problem with breakpoints.

Another clue:  When I am stepping lines in the debugger, and I step down 
into any function in the library with the problem,  Visual C++ shows the 
source code, and kind of steps thru it, but it takes several steps to move 
one source code line, almost as if each "step" steps one line of assembly. 

The variables "watch" display does not work for this one library, either.

All this is compiled in the Debug configuration, not Release.

The mysterious thing is that the problem is only with the one Library 
(project) in this solution:  My other 8 libraries work fine.

So my question is:   Does anyone have any ideas what would cause Visual C++ 
to be unable to set a breakpoint (at attach time) in one particular project 
(library) when all other projects in the solution have no problem.

Thanks in advance for any help.

6. Can not set breakpoint in VC++ 6.0

7. How to set breakpoint in intrinsic function?

Profiling my code shows lots of time spent in an intrinsic function, EXP().  
I can't actually find any instances of this function within the source code 
I've written, so I think that another intrinsic function is actually calling 
EXP().  So I can't set a breakpoint in the normal manner of just clicking on 
the line.  I've tried to use the advanced syntax, but I don't know the source 
name for the intrinsic function.  Any other ideas how I can set a breakpoint 
for the function EXP(), or at least figure out where it's being called from 
my code?

I'm using Compaq Visual Fortran inside of the Visual Developer Studio.  
Since the HP merger, support for this compiler is poor, but I figure that I'm 
really asking a question about the Dev Studio anyway.

8. Setting Breakpoint Conditions with MS VC++ Version 7