stdcxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Wright <markwri...@internode.on.net>
Subject Re: __rw::__string_ref::size sigsegv
Date Thu, 20 Mar 2008 09:08:09 GMT
Hello Martin and everyone,

Thanks.  I added -D_RWSTDDEBUG to the Makefile like:

setstr : setstr.o
	CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include
-o setstr setstr.o -L/h/goanna/1/a_5.10_m64/c/lib  -R/h/goanna/1/a_5.10_m64/c/lib -lstd15D

setstr.o : setstr.cpp
	CC -D_RWSTDDEBUG -mt -g -xdebugformat=stabs -xs -m64 -library=%none -I/h/goanna/1/a_5.10_m64/c/include
-c setstr.cpp

clean:
	rm setstr setstr.o

compiled the following tiny program with Sun Studio 12 on Solaris 10u4 with stdcxx
compiled from subversion as 64 bit 15D:

#include <set>
#include <string>

std::set<std::string> setstr;

int main(int argc, char *argv[])
{
  std::copy(argv, argv + argc, std::inserter(setstr, setstr.end()));
  return 0;
}

and ran it, unfortunately though it still encounters a sigsegv.  So
I tried running it in dbx with Run Time Checking:

goanna% dbx setstr
Reading setstr
Reading ld.so.1
Reading libstd15D.so.4.2.0
Reading libCrun.so.1
Reading libm.so.2
Reading libthread.so.1
Reading libc.so.1
dbx: warning: undefined type number (0,72) at /h/goanna/2/eng/dev/stdcxx/setstr/setstr:setstr.cpp
stab #64 nJ_C_link_t(0,69):t(0,71)=*(0,72),
assuming type `(int {assumed})'
(dbx) check -all
access checking - ON
memuse checking - ON
(dbx) run
Running: setstr 
(process id 2876)
Reading rtcapihook.so
Reading libdl.so.1
Reading rtcaudit.so
Reading libmapmalloc.so.1
Reading libgen.so.1
Reading rtcboot.so
Reading librtc.so
RTC: Enabling Error Checking...
RTC: Running program...
Reading disasm.so
Read from uninitialized (rui) on thread 1:
Attempting to read 8 bytes at address 0x424818
    which is 32 bytes into a heap block of size 1280 bytes at 0x4247f8
This block was allocated from:
        [1] operator new() at 0xfffffd7fddb0a0e9 
        [2] __rw::__rw_allocate() at line 61 in "memory.cpp"
        [3] std::allocator<__rw::__rw_rb_tree_node<std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
> > >::allocate() at line 144 in "_allocator.h"
        [4] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::_C_add_new_buffer() at line 143 in "_tree.cc"
        [5] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::_C_get_link() at line 360 in "_tree.h"
        [6] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::_C_get_node() at line 393 in "_tree.h"
        [7] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::_C_init() at line 460 in "_tree.h"
        [8] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::__rb_tree() at line 56 in "_tree.cc"

Variable is 'this'
t@1 (l@1) stopped in std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::_C_pref at line 842 in file "string"
  842           return _RWSTD_REINTERPRET_CAST (_C_string_ref_type*, _C_data) - 1; 
(dbx) where
current thread: t@1
=>[1] std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::_C_pref(this = 0x424818), line 842 in "string"
  [2] std::basic_string<char,std::char_traits<char>,std::allocator<char> >::size(this
= 0x424818), line 247 in "string"
  [3] std::basic_string<char,std::char_traits<char>,std::allocator<char> >::size(this
= 0x424818), line 247 in "string"
  [4] std::basic_string<char,std::char_traits<char>,std::allocator<char> >::compare(this
= 0x424818, __str = CLASS), line 1186 in "string"
  [5] std::operator< <char,std::char_traits<char>,std::allocator<char> >(__lhs
= CLASS, __rhs = CLASS), line 1356 in "string"
  [6] std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >::operator()(this = 0x422778, __x = CLASS, __y = CLASS), line 94 in "_funcbase.h"
  [7] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::insert(this = 0x422748, __it = CLASS, __v = CLASS, __dup = false), line 356
in "_tree.cc"
  [8] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::insert(this = 0x422748, __it = CLASS, __x = CLASS, __dup = false), line 592
in "_tree.h"
  [9] std::set<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::insert(this = 0x422748, __it = CLASS, __x = CLASS), line 172 in "set"
  [10] std::insert_iterator<std::set<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > >::operator=(this = 0xfffffd7fffdfd530, __x = CLASS), line 501 in "_iterator.h"
  [11] std::copy<char**,std::insert_iterator<std::set<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > > >(__first = 0xfffffd7fffdfd618, __last = 0xfffffd7fffdfd620, __res
= CLASS), line 95 in "_algobase.h"
  [12] main(argc = 1, argv = 0xfffffd7fffdfd618), line 8 in "setstr.cpp"
(dbx) print -r *this
*this = {
    basic_string<char,std::char_traits<char>,std::allocator<char> >::_C_data
    = (nil)
    basic_string<char,std::char_traits<char>,std::allocator<char> >::npos
       = -1
    _C_null_ref                                                                  = struct
__rw::__null_ref<char,std::char_traits<char>,std::allocator<char> > /* STATIC
CLASS */
}
(dbx) cont
Read from unallocated (rua) on thread 1:
Attempting to read 8 bytes at address 0xfffffffffffffff8
t@1 (l@1) stopped in __rw::__string_ref<char,std::char_traits<char>,std::allocator<char>
>::size at line 211 in file "_strref.h"
  211           return _C_size._C_size;
(dbx) where
current thread: t@1
=>[1] __rw::__string_ref<char,std::char_traits<char>,std::allocator<char>
>::size(this = 0xffffffffffffffe8), line 211 in "_strref.h"
  [2] std::basic_string<char,std::char_traits<char>,std::allocator<char> >::size(this
= 0xffffffffffffffe8), line 247 in "string"
  [3] std::basic_string<char,std::char_traits<char>,std::allocator<char> >::size(this
= 0x424818), line 247 in "string"
  [4] std::basic_string<char,std::char_traits<char>,std::allocator<char> >::compare(this
= 0x424818, __str = CLASS), line 1186 in "string"
  [5] std::operator< <char,std::char_traits<char>,std::allocator<char> >(__lhs
= CLASS, __rhs = CLASS), line 1356 in "string"
  [6] std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >::operator()(this = 0x422778, __x = CLASS, __y = CLASS), line 94 in "_funcbase.h"
  [7] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::insert(this = 0x422748, __it = CLASS, __v = CLASS, __dup = false), line 356
in "_tree.cc"
  [8] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::insert(this = 0x422748, __it = CLASS, __x = CLASS, __dup = false), line 592
in "_tree.h"
  [9] std::set<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::insert(this = 0x422748, __it = CLASS, __x = CLASS), line 172 in "set"
  [10] std::insert_iterator<std::set<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > >::operator=(this = 0xfffffd7fffdfd530, __x = CLASS), line 501 in "_iterator.h"
  [11] std::copy<char**,std::insert_iterator<std::set<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > > >(__first = 0xfffffd7fffdfd618, __last = 0xfffffd7fffdfd620, __res
= CLASS), line 95 in "_algobase.h"
  [12] main(argc = 1, argv = 0xfffffd7fffdfd618), line 8 in "setstr.cpp"
(dbx) print -r *this
dbx: cannot access address 0xffffffffffffffe8
(dbx) frame 2
Current function is std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::size
  247           return _C_pref ()->size ();
(dbx) print -r *this
dbx: cannot access address 0xffffffffffffffe8
(dbx) frame 4
Current function is std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::compare
 1186       const size_type __n1    = size ();
(dbx) 
(dbx) print -r *this
*this = {
    basic_string<char,std::char_traits<char>,std::allocator<char> >::_C_data
    = (nil)
    basic_string<char,std::char_traits<char>,std::allocator<char> >::npos
       = -1
    _C_null_ref                                                                  = struct
__rw::__null_ref<char,std::char_traits<char>,std::allocator<char> > /* STATIC
CLASS */
}
(dbx) cont
signal SEGV (no mapping at the fault address) at 0xfffffd7fe3f3cd00
0xfffffd7fe3f3cd00: __rtc_catch_segv       :    pushq    %rbp
Current function is std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::size
  247           return _C_pref ()->size ();
(dbx) where
current thread: t@1
  [1] 0xfffffd7fd7405fcf(0xffffffffffffffe8, 0xfffffd7fffdfd4d8, 0xfffffd7fffdfd4d8, 0x0,
0xffffffffffffffe8, 0x4247f8), at 0xfffffd7fd7405fcf 
  [2] __sighndlr(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0xfffffd7fd9fd1216 
=>[3] std::basic_string<char,std::char_traits<char>,std::allocator<char>
>::size(this = 0x424818), line 247 in "string"
  [4] std::basic_string<char,std::char_traits<char>,std::allocator<char> >::compare(this
= 0x424818, __str = CLASS), line 1186 in "string"
  [5] std::operator< <char,std::char_traits<char>,std::allocator<char> >(__lhs
= CLASS, __rhs = CLASS), line 1356 in "string"
  [6] std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >::operator()(this = 0x422778, __x = CLASS, __y = CLASS), line 94 in "_funcbase.h"
  [7] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::insert(this = 0x422748, __it = CLASS, __v = CLASS, __dup = false), line 356
in "_tree.cc"
  [8] __rw::__rb_tree<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,__rw::__ident<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::basic_string<char,std::char_traits<char>,std::allocator<char> >
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::insert(this = 0x422748, __it = CLASS, __x = CLASS, __dup = false), line 592
in "_tree.h"
  [9] std::set<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > >::insert(this = 0x422748, __it = CLASS, __x = CLASS), line 172 in "set"
  [10] std::insert_iterator<std::set<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > >::operator=(this = 0xfffffd7fffdfd530, __x = CLASS), line 501 in "_iterator.h"
  [11] std::copy<char**,std::insert_iterator<std::set<std::basic_string<char,std::char_traits<char>,std::allocator<char>
>,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> > > > >(__first = 0xfffffd7fffdfd618, __last = 0xfffffd7fffdfd620, __res
= CLASS), line 95 in "_algobase.h"
  [12] main(argc = 1, argv = 0xfffffd7fffdfd618), line 8 in "setstr.cpp"
(dbx) print -r *this
*this = {
    basic_string<char,std::char_traits<char>,std::allocator<char> >::_C_data
    = (nil)
    basic_string<char,std::char_traits<char>,std::allocator<char> >::npos
       = -1
    _C_null_ref                                                                  = struct
__rw::__null_ref<char,std::char_traits<char>,std::allocator<char> > /* STATIC
CLASS */
}
(dbx) 

Thanks, Mark

-- 

Mime
View raw message