Error while executing Python code.
python
import sys
sys.path.insert(0, '')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
source C:\MinGW\bin\stl.gdb
Traceback (most recent call last):
File "<string>", line 3, in <module>
ImportError: No module named libstdcxx.v6.printers
C:\MinGW\bin\stl.gdb:5: Error in sourced command file:
Error while executing Python code.
(gdb) source C:\MinGW\bin\stl.gdb
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "c:\mingw\share\gdb/python/../../gcc-4.9.2/python/libstdcxx/v6/printers.p
y", line 1023, in register_libstdcxx_printers
gdb.printing.register_pretty_printer(obj, libstdcxx_printer)
File "c:\mingw\share\gdb/python/gdb/printing.py", line 146, in register_pretty
_printer
printer.name)
RuntimeError: pretty-printer already registered: libstdc++-v6
C:\MinGW\bin\stl.gdb:6: Error in sourced command file:
Error while executing Python code.
(gdb)
register_libstdcxx_printers (None)
Breakpoint 1, main ()
at D:\Program\Practice Program\PrettyPrinterCheck\main.cpp:41
41 cout<<s;
(gdb) print p
$1 = {first = 13, second = 14}
(gdb) print m
$2 = std::map with 1 elements = {[2] = 1}
(gdb) print v
$3 = std::vector of length 1, capacity 1 = {10}
(gdb) print q
$4 = std::queue wrapping: std::deque with 2 elements = {10, 11}
(gdb) print s
$5 = "Hello"
Yes, you should remove that line, because the std pretty printer is registered when it is imported, see my answer here:Code(gdb) source C:\MinGW\bin\stl.gdb
Traceback (most recent call last):
File "<string>", line 4, in <module>
File "c:\mingw\share\gdb/python/../../gcc-4.9.2/python/libstdcxx/v6/printers.p
y", line 1023, in register_libstdcxx_printers
gdb.printing.register_pretty_printer(obj, libstdcxx_printer)
File "c:\mingw\share\gdb/python/gdb/printing.py", line 146, in register_pretty
_printer
printer.name)
RuntimeError: pretty-printer already registered: libstdc++-v6
C:\MinGW\bin\stl.gdb:6: Error in sourced command file:
Error while executing Python code.
(gdb)
then I removedCodefrom my stl.gdb and I didn't get any error in command promptregister_libstdcxx_printers (None)
but getting same error in code blockFrom the command line, I see it works OK, but you should get the same result in C::B, I have no idea, do you have two different version of GDBs in your system?
What should I do?
Edit:My gdb version 7.8.1
I tried to debug in command line:CodeBreakpoint 1, main ()
at D:\Program\Practice Program\PrettyPrinterCheck\main.cpp:41
41 cout<<s;
(gdb) print p
$1 = {first = 13, second = 14}
(gdb) print m
$2 = std::map with 1 elements = {[2] = 1}
(gdb) print v
$3 = std::vector of length 1, capacity 1 = {10}
(gdb) print q
$4 = std::queue wrapping: std::deque with 2 elements = {10, 11}
(gdb) print s
$5 = "Hello"
python
import sys
sys.path.insert(0, 'C:\MinGW\share\gcc-4.9.2\python')
from libstdcxx.v6.printers import register_libstdcxx_printers
end
I have only one GDB. I have attached my settings->compiler->toolchain config.I want to see the "full debugger log" when the problem you mentioned in the first post happens. I mean the log message when you have problems in shown in yy.png.
my current stl.gdb fileCodepython
import sys
sys.path.insert(0, 'C:\MinGW\share\gcc-4.9.2\python')
from libstdcxx.v6.printers import register_libstdcxx_printers
end
after this I am not getting any error in C::B debugger prompt but still pretty printers are not working in C:B while in command prompt it is working.
I want to see the "full debugger log" when the problem you mentioned in the first post happens. I mean the log message when you have problems in shown in yy.png.
python
import sys
sys.path.insert(0, '')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
[debug]> print q
[debug]$4 = {c = {<std::_Deque_base<int, std::allocator<int> >> = {_M_impl = {<std::allocator<int>> = {<__gnu_cxx::new_allocator<int>> = {<No data fields>}, <No data fields>}, _M_map = 0x5427e0, _M_map_size = 8, _M_start = {_M_cur = 0x544d00, _M_first = 0x544d00, _M_last = 0x544f00, _M_node = 0x5427f8}, _M_finish = {_M_cur = 0x544d08, _M_first = 0x544d00, _M_last = 0x544f00, _M_node = 0x5427f8}}}, <No data fields>}}
[debug]>>>>>>cb_gdb:
$4 = {c = {<std::_Deque_base<int, std::allocator<int> >> = {_M_impl = {<std::allocator<int>> = {<__gnu_cxx::new_allocator<int>> = {<No data fields>}, <No data fields>}, _M_map = 0x5427e0, _M_map_size = 8, _M_start = {_M_cur = 0x544d00, _M_first = 0x544d00, _M_last = 0x544f00, _M_node = 0x5427f8}, _M_finish = {_M_cur = 0x544d08, _M_first = 0x544d00, _M_last = 0x544f00, _M_node = 0x5427f8}}}, <No data fields>}}
> print m
[debug]> print m
[debug]$5 = {_M_t = {_M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<int const, int> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, int> > >> = {<No data fields>}, <No data fields>}, _M_key_compare = {<std::binary_function<int, int, bool>> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red, _M_parent = 0x544fc0, _M_left = 0x544fc0, _M_right = 0x544fc0}, _M_node_count = 1}}}
[debug]>>>>>>cb_gdb:
$5 = {_M_t = {_M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<int const, int> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, int> > >> = {<No data fields>}, <No data fields>}, _M_key_compare = {<std::binary_function<int, int, bool>> = {<No data fields>}, <No data fields>}, _M_header = {_M_color = std::_S_red, _M_parent = 0x544fc0, _M_left = 0x544fc0, _M_right = 0x544fc0}, _M_node_count = 1}}}
[debug]> source C:\MinGW\bin\stl.gdb
What is the result when you type "info pretty-printer" in C::B's gdb debug panel?
Also, can you show the full log when you debug the same command in the windows command line.
> info pretty-printer
[debug]> info pretty-printer
[debug]global pretty-printers:
[debug] builtin
[debug] mpx_bound128
[debug]>>>>>>cb_gdb:
global pretty-printers:
builtin
mpx_bound128
Interesting, so you could try to add the line "register_libstdcxx_printers (None)" back to stl.gdb file, and see whether it works again.Code> info pretty-printer
[debug]> info pretty-printer
[debug]global pretty-printers:
[debug] builtin
[debug] mpx_bound128
[debug]>>>>>>cb_gdb:
global pretty-printers:
builtin
mpx_bound128
Now pretty printers are not working in cmd too.
Interesting, so you could try to add the line "register_libstdcxx_printers (None)" back to stl.gdb file, and see whether it works again.