This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to get debug mode version of libstdc++ when compiling GCC


>#include <vector>
>
>int main(int,char **) {
>  std::vector<int> v;
>  v[3] = 2;
>}
>
>with -D_GLIBCXX_DEBUG would result in a
>runtime error mesage. Wonderful!

Indeed.

gcc-3.4:

%COMP.sh "-g -O2 -D_GLIBCXX_DEBUG" debug_test.cc
<bkoz@roscoe> /home/bkoz %a.out
/mnt/hd/bld/gcc/i686-pc-linux-gnu/libstdc++-v3/include/debug/vector:192:
    error: attempt to subscript container with out-of-bounds index 3, but
    container only holds 0 elements.
 
Objects involved in the operation:
sequence "this" @ 0x0xbffff290 {
  type = N15__gnu_debug_def6vectorIiSaIiEEE;
}
Abort (core dumped)


-benjamin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]