• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: STL vector debugging
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: STL vector debugging


  • Subject: Re: STL vector debugging
  • From: Robb Olsen-Albright <email@hidden>
  • Date: Tue, 7 Feb 2006 10:05:43 -0800

Thanks Chris ( and Steve & Bruce) for suggestions.
I did try -gfull, no effect on member shown.
Also I tried the debug STL switch you mentioned below. That does add a couple of members, but they seem to be related to the bounds checking etc, not to being able to see data in the debugger.
And yes, the gcc implementation of stl uses begin and end pointers instead of a size member, so I won't be seeing that value without a method call.

So, I'm pretty much back to needing a plugin data formatter. (or, I know, I can just use method calls in the formatting string for less control)

I am still interested in knowing what the Vector.plist file is supposed to be doing  and why it's not doing it :)

I will also file an enhancement request for better built in data formatters for STL (at least CW level, would be cool if it could rival VS 2005)

-robb

On 06 Feb 06, at 2:37 PM, Chris Espinosa wrote:


On Feb 6, 2006, at 1:08 PM, Robb Olsen-Albright wrote:

The Mac team where I work (well, it's me and one other developer)  is working on converting our fairly large cross-platform Codewarrior project to Xcode (isn't everybody :) )

My question is regarding debugging code that uses STL vectors.
<snip>
The first thing I'd do is turn on STL debug mode in Xcode.  It's unfortunately only documented in the gcc 3.3 release notes:

STL debugging mode for C++

By default, libstdc++ is built with efficiency in mind, and therefore performs little or no error checking that is not required by the C++ standard. This release adds support for the libstdc++ debug mode, which performs run-time checking for correct usage of the C++ standard library. Incorrect usage (such as passing an iterator to the wrong container, or passing an invalid range to a generic algorithm) will result in a clear error message followed by an abort, rather than an unpredictable crash.

To enable STL debugging mode, compile your application with the -D_GLIBCXX_DEBUG compile flag. Note that this flag changes the sizes and behavior of standard class templates such as std::vector, and therefore you can only link code compiled with debug mode and code compiled without debug mode if no instantiation of a container is passed between the two translation units. This does not mean that you are required to recompile your entire application: for instance, if one source file uses std::vector but std::vector doesn't occur in its public interface, that file can be recompiled in debug mode even if the rest of the program is not compiled in debug mode.

When it is not feasible to recompile your application, or when only specific containers need checking, debugging containers are available as GNU extensions. These debugging containers are functionally equivalent to the containers used in debug mode, e.g., __gnu_debug::vector<int> is equivalent to std::vector<int> in debug mode, but the __gnu_debug versions can be used in either release or debug mode without changing semantics.

Pedantic debug mode checks not only for errors, but also for usages that rely on GNU extensions and that, while correct, may not be portable to other compilers. In pedantic mode, for example, constructing an std::string with a null pointer will result in an abort, not an exception. Pedantic debug mode is not the default. To enable pedantic debug mode, compile your program with both -D_GLIBCXX_DEBUG and -D_GLIBCXX_DEBUG_PEDANTIC.

STL debugging mode is recommended during developent or when you suspect an error caused by incorrect use of the C++ standard library. It is not recommended for deployment builds, because it introduces substantial overhead.



Chris


robb olsen-albright
email@hidden
vernier software & technology
portland, or


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: STL vector debugging
      • From: Chris Friesen <email@hidden>
References: 
 >STL vector debugging (From: Robb Olsen-Albright <email@hidden>)

  • Prev by Date: Re: "vector" Framework
  • Next by Date: generating a core file in 10.4.4.
  • Previous by thread: Re: STL vector debugging
  • Next by thread: Re: STL vector debugging
  • Index(es):
    • Date
    • Thread