Eclipse/CDT Pretty Printing With Remote Debugging
Question: I'm trying to add pretty printing for STL objects in my Eclipse/CDT (Mars
release) to remote debug application running in an ARM board.

I can succesfully debug my application using Eclipse and gdbserver. For this
purpose I use the following gdbinit file:

    
    
    set sysroot remote:/
    

Then I'm trying to follow the steps available in teh Eclipse Wiki to have the
pretty printing for STL structures: <http://wiki.eclipse.org/CDT/User/FAQ>

I downloaded successfully the files from SVN, and added the indicated lines to
my gdbinit file, which became:

    
    
    set sysroot remote:/    
    python
    import sys
    sys.path.insert(0, '/home/rvcpu/prettyprinting')
    from libstdcxx.v6.printers import register_libstdcxx_printers
    register_libstdcxx_printers (None)
    end
    

When I start the Debug session I get the following error on the gdb trace:

    
    
    418,226 12-gdb-set target-wide-charset UTF-32
    418,227 12^done
    418,227 (gdb) 
    418,228 13-gdb-set dprintf-style call
    418,228 13^done
    418,228 (gdb) 
    418,232 14source /home/rvcpu/CodeSourcery/Sourcery_G++_Lite/bin/gdbinit
    418,232 &"source /home/rvcpu/CodeSourcery/Sourcery_G++_Lite/bin/gdbinit\n"
    418,232 =cmd-param-changed,param="sysroot",value="remote:/"
    

I believe I must indicate to GDB, somehow, that the python script is located
on my host computer, not the target. Does anyone know how to do that?

Thanks, Bernardo


Answer: You should add that lines to .gdbinit on host machine and python directory
with "libstdcxx" library should be on host machine too. And if you have python
directory in subdirectory "prettyprinting", you should set that directory
which contain libstdcxx directory. So if you has printers here:

    
    
    /home/rvcpu/prettyprinting/python/libstdcxx/v6/
    

you need to insert

    
    
    /home/rvcpu/prettyprinting/python/
    

to your sys.path in python code of .gdbinit.

