Michael Gomes
Michael Gomes

Reputation: 43

eclipse CDT pretty-printing not working for strings

I am trying to Get gdb pretty-print working in eclipse, it seems to be working for all stl elements and containers baring std::string

basically if i have a vector like:

std::vector<std::string> m_vec = {"hello" , "world"};

each element of the vector shows a string and it shows the contents like "hello" and "world".

but if i have a code like

std::string m_string = "hello world";

m_string shows up empty, even though i can do string operations on the contents. Not sure why only strings alone is causing as issue with pretty print.

Any help/pointers would be much appreciated.

Edited:

Few more details regarding the setup:
    IDE: Eclipse Luna 4.4.2
    Compiler: Cygwin g++ 5.4.0
    Debugger: Cygwin gdb 7.10.1
    phython : Cygwin phython 3.6

Update: Don't know how exactly, but windows restart solved it, can see string now in preety-print.

Upvotes: 0

Views: 1086

Answers (1)

AmeyaVS
AmeyaVS

Reputation: 1054

For adding support for gdb pretty-printing in cygwin you need the following file available: /usr/share/gdb/auto-load/usr/bin/cygstdc++-6.dll-gdb.py

It is available in gcc-debuginfo-5.4.0-1 package in cygwin package installer.

Note: This might break once packages get updated in Cygwin repository. So you will need to again locate this file in the Cygwin package search.

Update: Check the version of python interpreter supported by gdb by running the following commands in the gdb console:

(cygwin console) $ gdb
(gdb) python
>import sys
>print(sys.version)
>end

You should see output something like this(in my case it defaults to python2.7 interpreter):

2.7.13 (default, Mar 13 2017, 20:56:15)
[GCC 5.4.0]

Upvotes: 1

Related Questions