설치된 패키지에 디버그 기호를 설치하는 방법은 무엇입니까?


8

'Qt Creator'디버거에서 프로그램을 실행하여 프로그램 작동 방식을 보려고합니다.더 나은 방향을 위해 어셈블리 코드를 볼뿐만 아니라 MS Visual Studio 6.0에서 사용되는 호출 스택 창에서 시스템 (코어) 유틸리티도 완전히보고 싶습니다.유틸리티의 경우 'Qt Creator'디버거는 디버그 기호를 사용할 수 없다는 것만 표시합니다.(때로는 시스템이 개발자를 위해 버그 보고서를 생성합니다. 버그 보고서 대화 상자에서 특정 프로그램에 대해서만 이러한 기호를 설치하도록 요청했습니다.) 핵심 디버그 기호를 어떻게 얻을 수 있습니까? (전체 우분투를 번역하지 않고)'Update Manager'를 사용하여 정기적으로 업데이트를 설치합니다

/sys/kernel/debug/x86
디렉토리에 하나의 빈 파일 만 포함되어 있습니다 .'Ubuntu 소프트웨어 센터 '에서 파일을 찾지 못했거나 http://packages.ubuntu.com/precise/x11/의 일부 패키지가찾아보세요.) 감사합니다!

8

Packages in Ubuntu have their debugging symbols stored in a separate repo. To download these debugging symbols, run (copy and paste):

printf "deb http://ddebs.ubuntu.com %s main restricted universe multiverse\n" $(lsb_release -cs){,-updates,-security,-proposed} | \
 sudo tee -a /etc/apt/sources.list.d/ddebs.list

to add the repo links into /etc/apt/sources.list.d/ddebs.list (This makes it easier to remove the repo). Alternatively, you can also copy each of the deb links into Software Sources and add them from there (Note that you'll likely need to replace $(lsb_release -cs) with the Ubuntu release that you're running).

To download the debugging symbols for package, you can just install package-dbgsym or, in some cases, package-dbg. Note that packages from a PPA don't have debugging symbols available from repos, and that it's the maintainer's responsibility to provide a package that contains the debugging symbols, usually in a package named package-dbg.

Debugging symbols are installed in /usr/lib/debug, although gdb automatically reads in debugging symbols if available and that you don't manually need to specify a location to look in. Depending on the Debhelper Compatibility version of the package, debugging symbols may either be located in a folder with the name of the build ID located inside .build-id (>= 9), or may be located relative to where the executable would be installed (< 9). For example, if you were looking for the location of the debugging symbols for /usr/bin/zip, and the version is less than 9, it would be in /usr/lib/debug/usr/bin/zip.

To remove all debugging symbols and the repo, run sudo apt-get remove \.*-dbgsym to remove all -dbgsym packages, and sudo rm /etc/apt/sources.list.d/ddebs.list to remove the debugging symbols repo.


5

Adding to saircot859's answer. You also have to install the GPG key for the repositories as described here: https://wiki.ubuntu.com/Debug%20Symbol%20Packages

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 428D7C01 C8CAB6595FDFF622

4

Adding to Evans answer: On Ubuntu 18.04 and later you use the command

sudo apt install ubuntu-dbgsym-keyring

to install the GPG keys. (According to https://wiki.ubuntu.com/Debug%20Symbol%20Packages )