簡體   English   中英

為什么 gdb 向我抱怨沒有可用的源(使用 g++ -ggdb3)

[英]Why gdb complain to me that No Source Available (with g++ -ggdb3)

由於某種原因,我昨天重新安裝了我的操作系統(manjaro linux),並通過pacman安裝了gccgdb ,然后我編寫了一個非常小的示例程序來確保我的環境正確,因為我是 linux 和 gdb 的初學者。 編譯后,它按照我的預期進行。 然后想通過gdb看看STL源碼,所以用tui mode打開了我的gdb 一開始一切似乎都很正常,但我的 gdb 無法進入我想看到的ss.insert() ,屏幕頂部有[ No Source Available ] 而且我發現operator<<的源文件目錄和重裝系統前的版本不一樣, /usr/shared/c++/已經不存在了!

這是GCC(g++)gdb的版本信息

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-werror gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC) 
GNU gdb (GDB) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

捕獲gdb

為什么 gdb 向我抱怨沒有可用的源(使用 g++ -ggdb3)

因為您已在libstdc++中停止,該目錄構建在臨時目錄(此處為/build/gcc/src/gcc-build/... )中,並且您的計算機上不存在該目錄。

這是不可能,你實際上需要看源operator<<()但如果你真的想這樣做,安裝GCC的來源和使用(gdb) directory指向GDB相關人士透露。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM