Re: Productivity in programming of C++ programmers

From: Siemel Naran (SiemelNaran_at_REMOVE.att.net)
Date: 08/14/04


Date: Sat, 14 Aug 2004 21:40:48 GMT


"lilburne" <lilburne@godzilla.net> wrote in message
news:2o79obF7ph62U1@uni-berlin.de...
> Siemel Naran wrote:

> >>Hmmm! Can you set a breakpoint or just step in?
> >
> > Both, at least on Borland 6! I just tried to set a breakpoint. I put
> > breakpoints in non-template functions. My file structure is: source
code in
> > src\libname\file.cpp, and the headers are include\libname\various.hpp.
Put
> > a breakpoint in any of the various files in the include directory, and
the
> > debugger will hit the breakpoint. Thinking about it, I think that in
debug
> > build the compiler makes all functions non-inline, so of course you
should
> > be able to step through it. Presumably if you debug the release .exe or
> > .lib or .dll, stepping through individual assembly instructions, you
won't
> > hit the breakpoint because if the code is really inline it won't be in
the
> > .exe. Anyway, I don't have the bandwidth to test this.
>
> Probably some weirdness in the linker too to make it work
> across libraries.

I think the reason is that I compiled my library parse.lib in debug mode
into a debug lib file. Then I compiled my example.exe, and linked against
the debug parse.lib file, and I was therefore able to put breakpoints in the
inline function. Had I linked against the release parse.lib file, that
would probably not have been the case.

In the past, I found that creating a release parse.lib file, then compiling
example.exe in debug mode and linking against the release parse.lib file
caused my program to mysteriously crash at runtime. The reason I think is
that the class headers of the parse library define STL member variables,
like std::string, std::deque, etc. The parse.lib compiled in release mode
links against the release STL files, performs various compiler
optimizations, etc. My example.cpp includes the same headers, but compiles
in debug mode, so it does not do various optimizations, assumes that the
parse.lib file will link against the debug STL files, etc. So if both
parse.lib and example.exe are compiled in release mode, or both in debug
mode, then it works fine.

When I get more time, I'm going to use the pointer to implementation idea,
and define a nested struct Imp, and define it with all the STL member
variables in the cpp file. This might allow me to compile and run a debug
example.exe linked against a debug parse.lib.



Relevant Pages

  • Re: Execution time debug vs. release
    ... Note that VS is doing more and more runtime checks in debug mode, ... You could check this out by compiling just one of your files in VS7 and VS8 with the ... speed with Task Manager showing 0% CPU time. ...
    (microsoft.public.vc.mfc)
  • Re: Debugging via ActiveSync
    ... Is your project running in Debug mode? ... If you are compiling for Release, then the executable will not have the symbolic information required to hit the breakpoint. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Clarion debugging
    ... > Other than making sure you're compiling in debug mode (Project->Edit, ... You are right - after stopping at a breakpoint i see the information i ... Do you known if it is possible to debug only the own writen code ...
    (comp.lang.clarion)
  • Re: Clarion debugging
    ... You can only see variable contents when you're stopped at a breakpoint, ... not while the app is running ... Other than making sure you're compiling in debug mode (Project->Edit, ...
    (comp.lang.clarion)
  • Re: "using" vs "= null" and object lifetime
    ... >> void SomeFunc() ... If you are compiling in debug mode, ... The reason for this is that code compiled in debug ...
    (microsoft.public.dotnet.languages.csharp)