Author Topic: [MinGW-gdb] new_allocator::deallocate() and SIGTRAP  (Read 10540 times)

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
[MinGW-gdb] new_allocator::deallocate() and SIGTRAP
« on: March 01, 2009, 12:47:50 pm »
I am using the current MinGW on current WinXP with wxWdigets from SVN.

I am not able to debug. Because the debugger pause everytime on
new_allocator::deallocate(). It happens about 20 times at startup of my application and over 100 times while running my application.

The debugger message is
Code
Program received signal SIGTRAP, Trace/breakpoint trap.
In _libkernel32_a_iname () ()
At
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:86


It is this piece of code
Code
     class new_allocator
     {
       // __p is not permitted to be a null pointer.
       void
       deallocate(pointer __p, size_type)
       { ::operator delete(__p); }


This is the callstack:
Code
#0 00000000    0x7c91120f in _libkernel32_a_iname() (??:??)
#1 00000000    0x7c97c201 in _libkernel32_a_iname() (??:??)
#2 00000000    0x7c97c63e in _libkernel32_a_iname() (??:??)
#3 00000000    0x7c97d826 in _libkernel32_a_iname() (??:??)
#4 00000000    0x7c959e1c in _libkernel32_a_iname() (??:??)
#5 00000000    0x7c937553 in _libkernel32_a_iname() (??:??)
#6 00000000    0x77bfc2de in _libkernel32_a_iname() (??:??)
#7 662214D5    operator delete(void*) () (??:??)

#8 663020FD    __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned) (this=0x2c1f488, __p=0x512370 "") (C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/ext/new_allocator.h:86)

#9 6633F3CB    std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_M_destroy(std::allocator<wchar_t> const&) (this=0x512370, __a=@0x2c1f558) (C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.tcc:371)

#10 6633F48C    std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_Rep::_M_dispose(std::allocator<wchar_t> const&) (this=0x512370, __a=@0x2c1f558) (C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:218)

#11 66340494    std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::assign(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) (this=0x2c1f9d8, __str=@0x2c1f6a8) (C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.tcc:256)

#12 663419E0    std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::operator=(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) (this=0x2c1f9d8, __str=@0x2c1f6a8) (C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:427)

#13 662F9FE4    wxString::operator=(wxString const&) (this=0x2c1f9d8, stringSrc=@0x2c1f6a8) (../../include/wx/string.h:1824)

#14 65B0DEC4    wxFileName::Assign(wxString const&, wxString const&, wxString const&, wxString const&, bool, wxPathFormat) (this=0x2c1f9b8, volume=@0x2c1f6d8, path=@0x2c1f6c8, name=@0x2c1f6b8, ext=@0x2c1f6a8, hasExt=true, format=wxPATH_NATIVE) (../../src/common/filename.cpp:352)

#15 65B0E5C6    wxFileName::Assign(wxString const&, wxPathFormat) (this=0x2c1f9b8, fullpath=@0x2c1fd08, format=wxPATH_NATIVE) (../../src/common/filename.cpp:457)

#16 004BE480    wxFileName::wxFileName(wxString const&, wxPathFormat) (this=0x2c1f9b8, fullpath=@0x2c1fd08, format=wxPATH_NATIVE) (C:/wxWidgets/include/wx/filename.h:127)

#17 0043EDA1    BFCore::VerifyFile(wxString const&, wxString const&, bool) (strFile1=@0x1c9ec2c, strFile2=@0x2c1fd08, bVerifyContent=false) (D:/Garage/projekte/blackfisk/trunk/src/BFCore.cpp:1341)

You can see that everytime there is wxString involved! Any idea about that?

In my debuger options "catch C++ exceptions" is deactivated!

Offline MoonKid

  • Almost regular
  • **
  • Posts: 180
Re: [MinGW-gdb] new_allocator::deallocate() and SIGTRAP
« Reply #1 on: March 02, 2009, 06:40:55 pm »
No Idea?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [MinGW-gdb] new_allocator::deallocate() and SIGTRAP
« Reply #2 on: March 03, 2009, 02:14:08 am »
no, the debugger works fine on my windows xp system. Which Mingw system do you use?
I personally use TDM-mingw.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline nanyu

  • Almost regular
  • **
  • Posts: 188
  • nanyu
Re: [MinGW-gdb] new_allocator::deallocate() and SIGTRAP
« Reply #3 on: March 03, 2009, 03:50:54 am »
 :D It's not a secret that the mingw32+gdb can debug nothing but a "Hello world" program.   :(

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5913
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: [MinGW-gdb] new_allocator::deallocate() and SIGTRAP
« Reply #4 on: March 03, 2009, 04:10:39 am »
:D It's not a secret that the mingw32+gdb can debug nothing but a "Hello world" program.   :(
I do not agree.
I do have some experience on debugging with gdb and mingw.

It works really ok in all the console mode applications. Trace, step, break point, watch, all works fine.

Several days ago, I try to debug a wxWidget program, I set a break point in the wxWidget source code( I link to the debug version of wxWidget library, so, I think I can trace it source code). Surely, these piece code will be called from the OnPaint() function of my main frame. But It doesn't stopped on that break point. :(

The only workaround is that I set a break point in my OnPaint(), after it's stopped ther, I Step into wxWidget source code. ..a little annoying.

Also, there are other nightmares of debugging the wxWidget source :(.


If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.