Bug 12127 - gdb with python support still get crash on showing uninitialized local variables
Summary: gdb with python support still get crash on showing uninitialized local variables
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: python (show other bugs)
Version: 7.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-16 01:13 UTC by asmwarrior
Modified: 2014-05-28 19:43 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
gdb log about the crash (2.38 KB, text/plain)
2013-05-07 05:08 UTC, asmwarrior
Details

Note You need to log in before you can comment on or make changes to this bug.
Description asmwarrior 2010-10-16 01:13:34 UTC
Hi, I still get gdb crashed when showing local variables. Here is the test code:

OS: windows xp
GDB: clean gdb cvs snapshot weekly 2010 10 12 build with python support
GCC: TDM-MinGW GCC 4.5.1
so, the program is build with -g (by default, it use the dwarf-2 format, I have just tested by using -gdwarf-3, there's the same crash)

it seems gdb crashed when trying to show the vector : std::vector<std::string> v = {"a", "b", "c"}; , this is an uninitialized variable.

Tested under codeblocks IDE
Just set a break-point in the first statement of main().
-----------------------------------------------------------------------------------------------
#include <wx/wx.h>
#include <string>
#include <map>
#include <list>
#include <stack>
#include <vector>


int main()
{
wxString wxStr(L"wxString"); // ********set a break-point here *******
wxStr += L" Value";
std::string stdStr("std::string");
stdStr.append(" value");
std::map<int, std::string> m;
m[0] = "000";
m[1] = "111";
wxString& wxStrRef = wxStr;
wxStrRef += L" Ref";
std::string& stdStrRef = stdStr;
stdStrRef += " Ref";


std::list<std::string> l = {"a", "b", "c"};
std::vector<std::string> v = {"a", "b", "c"};


std::stack<std::string> s;
s.push("a");
s.push("b");


return 0;
}
---------------------------------------------------------------------------------------------------


Here is the full debugger log :

---------------------------------------------------------------------------------------------------
Command-line: D:\code\mingw451tdm\bin\gdb.exe -nx -fullname -quiet -args bin/cmd.exe
Working dir : F:\cb\test_code\gdbpython-demo\
> set prompt >>>>>>cb_gdb:
Reading symbols from F:\cb\test_code\gdbpython-demo/bin/cmd.exe...done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.2.50.20101012
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set new-console on
>>>>>>cb_gdb:
> set disassembly-flavor intel
>>>>>>cb_gdb:
> catch throw
Catchpoint 1 (throw)
>>>>>>cb_gdb:
> source F:\cb\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> source D:\code\mingw451tdm\bin\stl.gdb
source D:\code\mingw451tdm\bin\wx.gdb

>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
> directory F:/cb/test_code/gdbpython-demo/
>>>>>>cb_gdb:
> break "F:/cb/test_code/gdbpython-demo/main.cpp:10"
Breakpoint 2 at 0x4013d3: file F:\cb\test_code\gdbpython-demo\main.cpp, line 10.
>>>>>>cb_gdb:
> run
gdb: windows_init_thread_list
[New Thread 2128.0x55c]
Breakpoint 2, main () at F:\cb\test_code\gdbpython-demo\main.cpp:10
F:\cb\test_code\gdbpython-demo\main.cpp:10:126:beg:0x4013d3
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> info locals
stdStr = Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
OverflowError: long int too large to convert to int
m = std::map with 2009251885 elementsTraceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 353, in next
n = self.rbiter.next()
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 297, in next
if node.dereference()['_M_right']:
RuntimeError: Attempt to dereference a generic pointer.
stdStrRef =
s = std::stack wrapping: std::deque with -521291805 elements = {<error reading variable s (Cannot access memory at address 0x80)>
wxStr = UnicodeEncodeError: 'gbk' codec can't encode character u'\uffff' in position 0: illegal multibyte sequence
wxStrRef = @0x40b9c6
l = std::list = {
[0] = <error reading variable l (Cannot access memory at address 0x50000069)>
v = std::vector of length -37952, capacity -519864265 = {Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x90000cb6
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x90909084
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xe77d74
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x458b0e68
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x78b0ffcc
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xe7fffff9
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xfff91191
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x909090b7
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xffffff84
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xf3
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x96ff2ef4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x70
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x96fed2f4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x96fee670
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x6c745270
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x657a6947
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x7061653c
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x6c7451f4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x657a6947
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x7061653c
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xcccccbf4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x90ccccc0
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x90909084
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x8868205e
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xe87c96f4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xfff9e930
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x8908757f
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x45c6d869
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x46f600db
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xe740107
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x560c75f3
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xffaf99dc
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length
= len)
RuntimeError: Cannot access memory at address 0xb6e9f3
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xff32fff4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x89e07d7d
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xdb33fc71
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xfc5d8937
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x9700a05c
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x37e85670
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x84fffa26
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x890575b4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x3bebe071
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xd10467f
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xffffff4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x840c44fd
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x11750c51
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x578b6f3
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x16e7fff4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x88fff904
, , Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", li
ne 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xe8565700
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xffffe5e4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x560c75f3
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xfc61f3dc
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xe04589f3
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xe7e85647
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x89ffffcc
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x48ebfc71
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x90909084
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xec458b84
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x8b007f
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x33dc457d
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x90c340b4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x90909084
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x64e8657f
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x1895
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xd44588f4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xbf48881
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x458afff4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x640189d0
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x1895
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x89f08af4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x31ffd069
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xf9f5dddc
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x344689f3
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xfc6577
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xfffc4d77
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x10dc
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xe0458af4
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xf9e89edc
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x8c2f3
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0x90909084
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
RuntimeError: Cannot access memory at address 0xe77d8084
, Traceback (most recent call last):
File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in to_string
return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
Run

---------------------------------------------------------------------------


So, it seems this problem still exist.



Here are some reference:

1.
andr's reply of my original post in gdb maillist
http://sourceware.org/ml/gdb/2010-06/msg00082.html


2.
andr's post in QT site
http://labs.qt.nokia.com/2009/06/22/peek-and-poke/#comment-4269


Itâs ânot readyâ yet. The gdb python âpretty-printersâ have serious
problems with uninitialized and/or damaged C++ objects. I understand
work to fix that is going on, but from my point of view it is not ready
for shipping yet.


3. gdb bugzilla
http://sourceware.org/bugzilla/show_bug.cgi?id=11407


The bug seems been fixed, but I think it still exists.


Asmwarrior
ollydbg from Codeblocks' forum


The related discussion can be found in :
http://sourceware.org/ml/gdb/2010-10/msg00062.html
Comment 1 asmwarrior 2012-03-03 14:01:13 UTC
I have some work around patches to filter out the uninitialized local variables by compare the current instruction line and the declaration line of the variable. Thus avoid the crash.

See: http://sourceware.org/ml/gdb-patches/2011-12/msg00034.html
Comment 2 asmwarrior 2013-05-07 05:08:44 UTC
Created attachment 7017 [details]
gdb log about the crash
Comment 3 asmwarrior 2013-05-07 05:09:29 UTC
Today, I managed to find one crash problem. See the debug log (crash.txt) as attachment. 
I use the same sample program to create a "a1.exe", then one debugger_gdb to start a debugee_gdb, then let the debugee_gdb to load stlc++ python script, then a1.exe was loaded in debugee_gdb, and I can make debugee_gdb crash when simply type "p v" command (At the time v is a std::vector auto variable which was not initialized).

Look at the bt, you can see that gdb (in apply_val_pretty_printer function call) try to malloc a big buffer which size is 2009291924.
Comment 4 asmwarrior 2013-05-07 06:01:09 UTC
(gdb) up
#4  0x0046ecfe in print_string_repr (printer=0x31075f8,
    hint=0x58a91e8 "string", stream=0x2ec2f68, recurse=1, options=0x298f9d4,
    language=0x7ee360 <cplus_language_defn>, gdbarch=0x2ebd520)
    at ../../gdb/gdb/python/py-prettyprint.c:336
336               val_print_string (type, encoding, addr, (int) length,
(gdb) l
331               make_cleanup (free_current_contents, &encoding);
332               gdbpy_extract_lazy_string (py_str, &addr, &type,
333                                          &length, &encoding);
334
335               local_opts.addressprint = 0;
336               val_print_string (type, encoding, addr, (int) length,
337                                 stream, &local_opts);
338             }
339           else
340             {
(gdb) p length
$9 = 2009291924
(gdb) p local_opts
$10 = {pretty = Val_pretty_default, prettyprint_arrays = 0,
  prettyprint_structs = 0, vtblprint = 0, unionprint = 1, addressprint = 0,
  objectprint = 0, print_max = 200, repeat_count_threshold = 10,
  output_format = 0, format = 0, stop_print_at_null = 0,
  print_array_indexes = 0, deref_ref = 0, static_field_print = 1,
  pascal_static_field_print = 1, raw = 0, summary = 0, symbol_print = 1}
(gdb)

See the log above, it looks like the gdbpy_extract_lazy_string gives the wrong value "length = 2009291924", and the local_opts.print_max = 200. So in this case, do we need to compare those two values, and set length to local_opts.print_max?

Yuanhui Zhang
Comment 5 asmwarrior 2013-05-07 06:16:45 UTC
 gdb/python/py-prettyprint.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c
index b50e757..e0dd92b 100644
--- a/gdb/python/py-prettyprint.c
+++ b/gdb/python/py-prettyprint.c
@@ -332,7 +332,9 @@ print_string_repr (PyObject *printer, const char *hint,
 	  gdbpy_extract_lazy_string (py_str, &addr, &type,
 				     &length, &encoding);
 
-	  local_opts.addressprint = 0;
+	  if (length > local_opts.print_max)
+	    length = local_opts.print_max;
+          local_opts.addressprint = 0;
 	  val_print_string (type, encoding, addr, (int) length,
 			    stream, &local_opts);
 	}

-------------------------
The above patch fix the crash problem, but I'm not sure it was good or just a workaround.

Yuanhui Zhang
Comment 6 asmwarrior 2013-11-24 07:31:38 UTC
OK, I think the pushed fix in Bug #16196 (https://sourceware.org/bugzilla/show_bug.cgi?id=16196#c2) should also fix this bug.

Look at the crash report in comment 2, I have such backtrace:

#0  malloc_failure (size=2009291924) at ../../gdb/gdb/utils.c:1049
#1  0x00634f3a in xmalloc (size=2009291924)
    at ../../gdb/gdb/common/common-utils.c:53
#2  0x004e4bc7 in read_string (addr=2293384, len=2009291924, width=1,
    fetchlimit=200, byte_order=BFD_ENDIAN_LITTLE, buffer=0x298f584,
    bytes_read=0x298f588) at ../../gdb/gdb/valprint.c:1804
#3  0x004e66f8 in val_print_string (elttype=0x4bad438, encoding=0x0,
    addr=2293384, len=2009291924, stream=0x2ec2f68, options=0x298f5e4)
    at ../../gdb/gdb/valprint.c:2475
#4  0x0046ecfe in print_string_repr (printer=0x31075f8,
    hint=0x58a91e8 "string", stream=0x2ec2f68, recurse=1, options=0x298f9d4,
    language=0x7ee360 <cplus_language_defn>, gdbarch=0x2ebd520)
    at ../../gdb/gdb/python/py-prettyprint.c:336

The final reason is that xmalloc(size=2009291924) get a two large and random size value.

My fix in comment 5 try to limit the size in function print_string_repr(), which is located as 4th frame in the backtrace above.

The fix in Bug #16196 did a better job, because it limit the size in read_string() function, which is second frame in the backtrace, so it fixed in a lower level. Many other cases which call read_string() is fixed now.

I just build the current gdb git HEAD, and did some test again, GDB.exe did not crash on showing un-initialized variables.

So, I personally think this bug is fixed now, what do you guys think?

Thanks.
Comment 7 Doug Evans 2013-12-19 16:29:52 UTC
See the text for PR 16286 for more discussion of this issue.
Comment 8 Jackie Rosen 2014-02-16 19:42:58 UTC Comment hidden (spam)