단일 디렉토리에있는 소스 파일을 재귀 적으로 검색하기 위해 유닉스에서 gdb를 언급하는 방법 예 : 하나의 모듈에 다른 buiding 블록이있는 경우. a는 b, c, d의 상위 디렉토리입니다. 여기서 b, c, d는 하위 디렉토리입니다. 이고 원본 파일은 b, c, b로 배포됩니다. gdb에 모든 소스 파일이 (상위 디렉토리)에 있다는 것을 언급하면됩니다. gdb는 프로그램을 디버깅하는 동안 참조로 사용하고 소스 파일을 재귀 적으로 검색합니다.gdb 소스 디렉토리 검색
17
A
답변
16
아니면 디렉토리 srcdir
에 소스 프로그램 prog
디버깅을 위해이 같은 작업을 수행 할 수 있습니다
gdb `find srcdir -type d -printf '-d %p '` prog
나는 그것이 당신의 질문에 직접적인 대답 생각합니다. 실행 파일에 컴파일 디렉토리가 없거나 gdb 버전 6.6 이상이없는 경우에도 유용합니다.
5
(gdb) help files
Specifying and examining files.
List of commands:
add-shared-symbol-files -- Load the symbols from shared objects in the dynamic linkers link map
add-symbol-file -- Load symbols from FILE
add-symbol-file-from-memory -- Load the symbols out of memory from a dynamically loaded object file
cd -- Set working directory to DIR for debugger and program being debugged
core-file -- Use FILE as core dump for examining memory and registers
directory -- Add directory DIR to beginning of search path for source files
edit -- Edit specified file or function
exec-file -- Use FILE as program for getting contents of pure memory
file -- Use FILE as program to be debugged
forward-search -- Search for regular expression (see regex(3)) from last line listed
generate-core-file -- Save a core file with the current state of the debugged process
(gdb) help directory
Add directory DIR to beginning of search path for source files.
Forget cached info on source file locations and line positions.
DIR can also be $cwd for the current working directory, or $cdir for the
directory in which the source file was compiled into object code.
With no argument, reset the search path to $cdir:$cwd, the default.
21
(gdb) set substitute-path /usr/src/include /mnt/include
gdb의 최근 버전 (6.6 이상)에서만 사용 가능합니다.
관련 문제
- 1. 디렉토리 검색
- 2. 소스 디렉토리 MSVC
- 3. YUI 소스 디렉토리 필터
- 4. 소스 코드에서 mipsel-gdb 중단 점
- 5. GDB - 외부 라이브러리 디버그, 소스 코드 있음
- 6. 디렉토리 검색 방법?
- 7. 윅스 속성 : 디렉토리 검색 :
- 8. sbt를 사용하여 소스 디렉토리 제외
- 9. 혼합 언어 소스 디렉토리 레이아웃
- 10. Visual Studio 2010의 소스 디렉토리
- 11. 현재 활성 디렉토리 검색 필터
- 12. 디렉토리 bash 스크립트를 통해 검색
- 13. C#에서 재귀 검색 디렉토리
- 14. 프로젝트 생각 : PDF 디렉토리 검색
- 15. 재귀 디렉토리 검색 자 PHP
- 16. Eclipse에서 첨부 소스 검색
- 17. C# 소스 코드 검색
- 18. 검색 엔진을위한 소스 코드
- 19. 원격 디버깅을 위해 gdb 컴파일
- 20. 소스 패키지에서 데비안 디렉토리 가져 오기
- 21. 소스 제어 (hg)로 홈 디렉토리 넣기
- 22. 소스 코드 디렉토리 : "common"및 "include"?
- 23. 오픈 소스 테마/플러그인 디렉토리 엔진
- 24. InstallShield : 소스 및 대상 디렉토리 및 파일
- 25. SVN, 외부 소스 프로젝트 용 디렉토리 설정
- 26. 나중에 GDB 용 GCC를 사용하여 프로그램의 소스 코드를 바이너리에 임베드
- 27. cURL - 웹 사이트 소스 검색
- 28. 동적 웹 사이트의 소스 검색
- 29. WCF 서비스의 호출 소스 검색
- 30. GDB 디버거 문제 -
"set directories"는 최신 버전에서도 사용할 수 있습니다. – ernesto
또한'set substitute-path/home/me/project c : \\ Users \\ me \\ project'와 같은 Windows에서도 작동합니다. –
다른 컴퓨터에 코어 파일을로드하면 소스 경로가 다를 수 있습니다. '$ gdb program corefile' 또는'$ gdb -c corefile program'의 경우에는 대체 할 수 없습니다. 이 경우'$ gdb program'을 실행하고'(gdb) set substitute-path/home/me/project/my/new/path'를 대체하고 corefile'(gdb) core-file corefile'을 적재해야합니다. –