This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: Archer in Cygwin help
2009/5/22 Paul Pluzhnikov <ppluzhnikov@google.com>:
> On Thu, May 21, 2009 at 10:01 AM, Sreejith <sreejithsmadhavan@gmail.com> wrote:
>
>> (gdb) python import gdb.libstdcxx.v6.printers
>> Traceback (most recent call last):
>> ?File "<string>", line 1, in <module>
>> ?File "/home/sreejith/archer/install/share/gdb/python/gdb/libstdcxx/v6/printers
>> .py", line 19, in <module>
>> ? ?import itertools
>> ImportError: No module named itertools
>> Error while executing Python code.
>> (gdb)
>
> Please see this message and thread:
> http://sources.redhat.com/ml/archer/2008-q4/msg00463.html
>
> I think you have to either install Python in a place GDB expects it,
> or set PYTHONPATH appropriately.
Thanks Paul. Before I try your suggestions, I did make install once
again for the branch:
http://sourceware.org/git/gitweb.cgi?p=archer.git;a=tree;h=refs/heads/archer-tromey-python;hb=archer-tromey-python
This time I could import gdb.libstdcxx.v6.printers which Phil
suggested. Still for STL containers, 'print' is not behaving as
expected. Please see the log:
(gdb) python print 10
10
(gdb) python import gdb.libstdcxx.v6.printers
(gdb)
(gdb) l
1 #include <list>
2
3 using namespace std;
4
5 int main()
6 {
7 list<int> myList;
8 for(int i=0; i<10; i++)
9 {
10 myList.push_back(i);
(gdb) l
11 }
12 return 0;
13 }
14
(gdb) break 12
Breakpoint 1 at 0x401139: file list.cpp, line 12.
(gdb) run
Starting program: /cygdrive/c/eclipse/archer-build/src/a.exe
[New Thread 3912.0x172c]
[New Thread 3912.0x104c]
Breakpoint 1, main () at list.cpp:12
12 return 0;
(gdb) python print myList
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'myList' is not defined
Error while executing Python code.
(gdb) print myList
$1 = {<_List_base<int, std::allocator<int> >> = {
_M_impl = {<allocator<std::_List_node<int> >> =
{<new_allocator<std::_List_node<int> >> = {<No data fields>}, <No data
fields>}, _M_node = {
_M_next = 0x682150, _M_prev = 0x6821e0}}}, <No data fields>}
(gdb)
Looks like libstdcxx.v6.printers are not known to gdb. I am wondering
how importing libstdcxx.v6.printers alone tells gdb to use new python
printers for STL. Do I need to execute some register command after
importing libstdcxx.v6.printers? Please give your suggestions.
-Sreejith