You are not logged in.

#1 2017-07-31 10:19:26

nanxiao
Member
Registered: 2017-07-27
Posts: 21

[Solved]How to install g++ compiler's C++ source code package?

Hi all,

I am using gdb to debug C++ code, and want to drill down into g++ C++ library code: 

(gdb)
Single stepping until exit from function _ZNSi10_M_extractIbEERSiRT_@plt,
which has no line number information.
std::istream::_M_extract<bool> (this=0x7ffff689cea0, __v=@0x7ffff00059a4: false)
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/istream.tcc:86
86      /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/istream.tcc: No such file or directory.
(gdb)
89      in /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/istream.tcc
(gdb)
86      in /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/istream.tcc
(gdb)
89      in /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/istream.tcc
(gdb)
86      in /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/istream.tcc

Which package I should install to get libstdc++-v3 source code? I have installed libstdc++5, and it seems not the right package.

Thanks very much in advance!

Best Regards
Nan Xiao

Last edited by nanxiao (2017-08-01 07:05:21)

Offline

#2 2017-07-31 12:26:10

LaurentvdB
Member
Registered: 2017-04-24
Posts: 32

Re: [Solved]How to install g++ compiler's C++ source code package?

Hi,

The source code used to build gcc and friends can be found in the PKGBUILD of the gcc package. There are no separate source packages in Arch.

Remember that libraries and such are stripped during their build, which keeps them nice and small. If you want debugging symbols for a library in Arch, rebuild the package using its PKGBUILD without stripping it. See

man PKGBUILD

for details (add !strip to options essentially).

Hope it helps,
Laurent

Offline

#3 2017-07-31 13:25:18

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,384
Website

Re: [Solved]How to install g++ compiler's C++ source code package?

LaurentvdB wrote:

Remember that libraries and such are stripped during their build, which keeps them nice and small.

Except for the libraries in gcc-libs.


Edit:  Try this in gdb:

set substitute-path /build/gcc/src/gcc-build/x86_64-unknown-linux-gnu/libstdc++-v3/include /usr/include/c++/7.1.1

Offline

#4 2017-07-31 13:55:14

LaurentvdB
Member
Registered: 2017-04-24
Posts: 32

Re: [Solved]How to install g++ compiler's C++ source code package?

Allan wrote:
LaurentvdB wrote:

Remember that libraries and such are stripped during their build, which keeps them nice and small.

Except for the libraries in gcc-libs.

[...]

Good one. Quite logical, but I did not think about that yet and it is even in the PKGBUILD I mentioned before.

Last edited by LaurentvdB (2017-07-31 14:00:42)

Offline

Board footer

Powered by FluxBB