This is the mail archive of the gdb@sourceware.org mailing list for the GDB 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: gdb crash when I try to print a std::queue (Windows)


On 2011-10-30 21:23, asmwarrior wrote:
> Is it possible just add a condition check like:
> 
> if(type_name==0)
>     return NULL;
> 
> 
I just test this code change by adding the above condition check, and this time, gdb does not crash, but no good information is show, it looks like:

(gdb) r
Starting program: e:\code\test_gdb\a1.exe
[New Thread 268.0x1098]

Program received signal SIGTRAP, Trace/breakpoint trap.
main () at e:\code\cb\test_code\gdbpython-demo\main.cpp:41
41          return 0;
(gdb) p q
$1 = {
  c = {<std::_Deque_base<std::basic_string<char, std::char_traits<char>, std::al
locator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > >> = {
      _M_impl = {<std::allocator<std::basic_string<char, std::char_traits<char>,
 std::allocator<char> > >> = {<__gnu_cxx::new_allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >> = {<No data fields>}, <No data
 fields>}, _M_map = 0xb89e98, _M_map_size = 8, _M_start = "a", _M_finish =
    <error reading variable: Cannot access memory at address 0xbaadf001>}}, <No
data fields>}}
(gdb) python print 1
1
(gdb) p v
$2 = {<std::_Vector_base<std::basic_string<char, std::char_traits<char>, std::al
locator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > > >> = {
    _M_impl = {<std::allocator<std::basic_string<char, std::char_traits<char>, s
td::allocator<char> > >> = {<__gnu_cxx::new_allocator<std::basic_string<char, st
d::char_traits<char>, std::allocator<char> > >> = {<No data fields>}, <No data f
ields>}, _M_start = 0xb89e70, _M_finish = 0xb89e7c,
      _M_end_of_storage = 0xb89e7c}}, <No data fields>}
(gdb) p a
No symbol "a" in current context.
(gdb) p stdStr
$3 = "std::string value Ref"
(gdb)

You can see, both the queue and the vector does not shown quite well. but std::string can still work well.


> --------------------------------------------------------------------
> BTW: if I build my test code under mingw gcc 4.6.2, then there's no crash here, and "p q" can correctly show the std::queue's contents from pretty printer.
> 
> BTW2: my friend xunxun can test the code under Win7, and it seems  there's no crash.

My friend xunxun is a gdb20111027 cvs version, and it has no crash under Win7.
I just use this gdb20111027 cvs on my WinXP, and it works quite well.

So, the conclusion should be:
This bug is introduced after 20111027, so it is nearly the last week. I hope the developers can find the regression introduced the last week. I'm not familiar with the gdb's source code, but I would like to test for you.

Thanks.
asmwarrior
ollydbg from codeblocks' forum


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