<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - Can't print std::string in (c)gdb" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24202&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gH_dAuoSknpgDmMohElTglirnLmkONco1tm_qYkaFnw&s=bKTfFKyncEgTMof03mh4lE1d4STR0tlbdOy3f4gRcpw&e=">24202</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Can't print std::string in (c)gdb
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>davidbrcz@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I can't print a single std::string using (c)gdb while it works perfectly fine
with g++. When running the binary from clang, gdb complains that "There is no
member named _M_dataplus.:"

Please find bellow a full copy and paste from my terminal showing the bug

[david@dhcp-38-199 code]$ g++ -v
Using built-in specs.
COLLECT_GCC=/bin/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__bugzilla.redhat.com_bugzilla&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gH_dAuoSknpgDmMohElTglirnLmkONco1tm_qYkaFnw&s=pUI2Yzl6bb1NAV_OAN0oyTXTVsX1uC1HpZoIuA9DYdc&e=">http://bugzilla.redhat.com/bugzilla</a> --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--disable-libgcj --with-default-libstdcxx-abi=c++98 --with-isl --enable-libmpx
--enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC) 

[david@dhcp-38-199 code]$ clang -v
clang version 3.6.1 (tags/RELEASE_361/final)
Target: x86_64-redhat-linux-gnu
Thread model: posix
Found candidate GCC installation: /bin/../lib/gcc/x86_64-redhat-linux/5.1.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/5.1.1
Selected GCC installation: /bin/../lib/gcc/x86_64-redhat-linux/5.1.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64

[david@dhcp-38-199 code]$ cat d.cpp
#include <iostream>
#include <string>


using namespace std;

int main(int argc, char *argv[])
{
    std::string s = "abc";
    getchar();
    return 0;
}

[david@dhcp-38-199 code]$ clang++ -g -std=c++11 d.cpp -o d
[david@dhcp-38-199 code]$ gdb ./d
GNU gdb (GDB) Fedora 7.9.1-17.fc22
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__gnu.org_licenses_gpl.html&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gH_dAuoSknpgDmMohElTglirnLmkONco1tm_qYkaFnw&s=Rkw_-KjchIEHTGrnG3H77rC07TMsmuLf7voj61cL9MQ&e=">http://gnu.org/licenses/gpl.html</a>>
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 "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gnu.org_software_gdb_bugs_&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gH_dAuoSknpgDmMohElTglirnLmkONco1tm_qYkaFnw&s=eOJOYH_0ZqkQH8Ix2wnxPw64TU-vQq438v5aOMeEycI&e=">http://www.gnu.org/software/gdb/bugs/</a>>.
Find the GDB manual and other documentation resources online at:
<<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gnu.org_software_gdb_documentation_&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gH_dAuoSknpgDmMohElTglirnLmkONco1tm_qYkaFnw&s=S5FyvFlA9VthzlvGXPeaxU5DooIHF9DKK61C0X6VNIE&e=">http://www.gnu.org/software/gdb/documentation/</a>>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./d...done.
(gdb) b 10
Breakpoint 1 at 0x400a08: file d.cpp, line 10.
(gdb) run
Starting program: /home/david/code/d 
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.21-7.fc22.x86_64

Breakpoint 1, main (argc=1, argv=0x7fffffffdc58) at d.cpp:10
10        getchar();
Missing separate debuginfos, use: dnf debuginfo-install
libgcc-5.1.1-4.fc22.x86_64 libstdc++-5.1.1-4.fc22.x86_64
(gdb) print s
Python Exception <class 'gdb.error'> There is no member named _M_dataplus.: 
$1 = 
(gdb) quit
A debugging session is active.

    Inferior 1 [process 8960] will be killed.

Quit anyway? (y or n) y

[david@dhcp-38-199 code]$ g++ -g -std=c++11 d.cpp -o d

[david@dhcp-38-199 code]$ gdb ./d
GNU gdb (GDB) Fedora 7.9.1-17.fc22
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__gnu.org_licenses_gpl.html&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gH_dAuoSknpgDmMohElTglirnLmkONco1tm_qYkaFnw&s=Rkw_-KjchIEHTGrnG3H77rC07TMsmuLf7voj61cL9MQ&e=">http://gnu.org/licenses/gpl.html</a>>
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 "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gnu.org_software_gdb_bugs_&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gH_dAuoSknpgDmMohElTglirnLmkONco1tm_qYkaFnw&s=eOJOYH_0ZqkQH8Ix2wnxPw64TU-vQq438v5aOMeEycI&e=">http://www.gnu.org/software/gdb/bugs/</a>>.
Find the GDB manual and other documentation resources online at:
<<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gnu.org_software_gdb_documentation_&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gH_dAuoSknpgDmMohElTglirnLmkONco1tm_qYkaFnw&s=S5FyvFlA9VthzlvGXPeaxU5DooIHF9DKK61C0X6VNIE&e=">http://www.gnu.org/software/gdb/documentation/</a>>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./d...done.
(gdb) b 10
Breakpoint 1 at 0x400993: file d.cpp, line 10.
(gdb) run
Starting program: /home/david/code/d 
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.21-7.fc22.x86_64

Breakpoint 1, main (argc=1, argv=0x7fffffffdc58) at d.cpp:10
10        getchar();
Missing separate debuginfos, use: dnf debuginfo-install
libgcc-5.1.1-4.fc22.x86_64 libstdc++-5.1.1-4.fc22.x86_64
(gdb) print s
$1 = "abc"
(gdb) quit
A debugging session is active.

    Inferior 1 [process 9037] will be killed.

Quit anyway? (y or n) y</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>