2016-07-18 2 views
0

커널 모듈에서 API가 반환하는 내용을 알고 싶습니다. < vnos-module.ko>.gdb를 사용하여 Linux 커널 모듈 디버그

커널 모듈을 디버깅하기 위해 심볼 테이블을로드해야하는 몇 가지 형식에서 알 수 있습니다.

그래서 내가 한 것은 입니다. 1. .text .bss와 커널 모듈의 .data 섹션 주소를 찾으려고했습니다. 2. gdb에서 add-symbol-file 명령을 사용하여 기호 테이블 파일을 추가하십시오.

하지만 "/fabos/modules/vnos-module.ko...((디버깅 기호가 없습니다.) ... 완료되었습니다."라는 오류 메시지가 나타납니다.

여기에 누락 된 것이 있습니까?

[email protected]:/sys/module/vnos_module/sections# cat .text .data .bss 
0xf7f7f000 
0xf7fb7a30 
0xf7fc3da4 

[email protected]:/sys/module/vnos_module/sections# gdb /fabos/modules/vnos-module.ko 
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1 
Copyright (C) 2014 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. Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "i686-linux-gnu". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word"... 
Reading symbols from /fabos/modules/vnos-module.ko...(no debugging symbols found)...done. 
add-symbol-file /fabos/modules/vnos-module.ko 0xf7f7f000 -s .data 0xf7fb7a -s .bss 0xf7fc3da4 
add symbol table from file "/fabos/modules/vnos-module.ko" at 
     .text_addr = 0xf7f7f000 
     .data_addr = 0xf7fb7a30 
(y or n) y 

Reading symbols from /fabos/modules/vnos-module.ko...(no debugging symbols found)...done. 

도와주세요.

+1

파일에 기호가없는 경우 기호가 없습니다. 섹션의 주소를 알고 있어도 디버그 할 수 없습니다. 기호가있는 파일이나 바이너리에 해당하는 별도의 기호 파일을 얻어야합니다. –

+0

심볼을 통합하기 위해 모듈을 컴파일하는 방법이 있습니까? –

답변

2

내가 대답 할 수 없으므로 답변으로 작성하겠습니다. (하지만 100 % 확신 할 수 없기 때문에 코멘트 섹션 포스트가 더 많다는 것을 알고있다.)

디버깅 심볼을 사용하여 모듈을 컴파일해야한다. 그렇게하기 위해서 모듈은 스트립없이 컴파일되어야합니다. -g 옵션을 시도하고 커널 CONFIG_DEBUG_INFO=y에서 디버깅을 활성화 할 수도 있습니다.

제대로 작동하는지 확실하지 않습니다.

+0

고마워, 나는 시도 할 것이다. –

+0

예, 나에게 도움이되었습니다. API 반환 여부를 알고 싶었습니까? 그냥 "gdb vnos-module.ko"를주고 실행하면 효과가 없습니다. 허가 문제가 있습니다. –

+1

gdb에서 디버깅 할 루트 권한이 필요합니다. [여기] (http://stackoverflow.com/questions/25586972/why-is-gdb-requiring-root-permission-to-debug-user-programs) 누군가 비슷한 문제가있었습니다. "API 반환"이란 의미가 무엇인지 이해하지 못합니다. (그러나 내가 살고있는 곳에서는 아침 일찍 일어났습니다.) 나에게 설명해 주시면 최선을 다해 도와 드리겠습니다. – RoughTomato

관련 문제