2016-09-24 3 views
0

동료의 컴퓨터에 코어 덤프 파일이 있습니다.실행 파일은 다르지만 소스가 동일한 코어 덤프 파일 열기

우리는 모두 프로그램과 동일한 타사 *.so 파일 (예 : libmysqlclient18 및 여러 사내 파일)을 가지고 있습니다.

문제는 우리가 (동일한 소스에서) 소프트웨어를 독립적으로 컴파일하고 있으며 내 컴퓨터에서 GDB를 검사하기 위해 코어 덤프 파일을 사용하려고합니다.

내가 GDB에 코어 파일 내 실행 파일을로드하려고 내가 얻을 :

[email protected]:/mnt/hgfs/share/dir$ gdb prog core 
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 
Copyright (C) 2012 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". 
For bug reporting instructions, please see: 
<http://bugs.launchpad.net/gdb-linaro/>... 
Reading symbols from /mnt/hgfs/share/dir/prog...done. 

warning: exec file is newer than core file. 
[New LWP 4465] 
[New LWP 4462] 
[New LWP 4464] 

warning: Can't read pathname for load map: Input/output error. 
[Thread debugging using libthread_db enabled] 
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". 
Core was generated by `./prog'. 
Program terminated with signal 11, Segmentation fault. 
#0 0x002d3706 in ??() from /lib/i386-linux-gnu/libc.so.6 
(gdb) bt full 
#0 0x002d3706 in ??() from /lib/i386-linux-gnu/libc.so.6 
No symbol table info available. 
#1 0x00000000 in ??() 
No symbol table info available. 
(gdb) 

이 시나리오가 작동하려면이 수 있습니까? (나는 디버깅 심볼을 사용하여 소프트웨어를 컴파일한다.) 그렇지 않다면 내가 놓친 기술 내용은 무엇인가?

나는 그가 소스 코드를 수정할 수 있다는 것을 알고있다. 실행 파일은 달라 지겠지만, 그렇지 않다. 제 3자인 *.so 파일과 소스, 그들은 모두 일치합니다.

UPDATE :이 코멘트에 제안 사용자로 mkfs 명령을 libc6-dbg를 설치 한 후, 내가 GDB이 얻을 :

[email protected]:/mnt/hgfs/share/dir$ gdb prog core 
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 
Copyright (C) 2012 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". 
For bug reporting instructions, please see: 
<http://bugs.launchpad.net/gdb-linaro/>... 
Reading symbols from /mnt/hgfs/share/dir/prog...done. 

warning: exec file is newer than core file. 
[New LWP 4465] 
[New LWP 4462] 
[New LWP 4464] 

warning: Can't read pathname for load map: Input/output error. 
[Thread debugging using libthread_db enabled] 
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". 
Core was generated by `./prog'. 
Program terminated with signal 11, Segmentation fault. 
#0 0x002d3706 in _IO_helper_overflow (s=0x0, c=0) at vfprintf.c:2188 
2188 vfprintf.c: No such file or directory. 
(gdb) bt 
#0 0x002d3706 in _IO_helper_overflow (s=0x0, c=0) at vfprintf.c:2188 
#1 0x00000000 in ??() 
(gdb) bt full 
#0 0x002d3706 in _IO_helper_overflow (s=0x0, c=0) at vfprintf.c:2188 
     written = 47 
     target = <optimized out> 
     used = -1226838776 
#1 0x00000000 in ??() 
No symbol table info available. 
(gdb) 
+0

libc (예 : libc6-dbg 패키지)의 디버그 기호를 설치 했습니까? 또한, 찾고 있기 때문에.실행 파일의 경우 동료의 실행 파일과 코어 덤프를 temp 디렉토리에 넣고 거기에서 gdb를 실행할 수 있습니다. – mkfs

+0

컴파일러 플래그를 포함하여 빌드가 정확히 동일하면이 방법이 유용합니다. 빌드 env에 차이가 있다면 실행 파일을 공유하는 것이 훨씬 쉽습니다. –

+0

@MatthewFisher 플래그가 같고 동일한 Makefile을 사용합니다. – Paul

답변

0

이 시나리오가 작동하려면이 수 있습니까?

네,하지만 두 시스템에서 빌드하는 바이너리의 기호 레이아웃이 동일하거나 적어도 충분히 근접해야합니다. 로컬 사용자 이름, 소스 또는 설치 디렉토리의 경로 이름 및 호스트 이름과 같은 항목이 빌드 된 객체 파일에 누출되어 기호 불일치가 발생할 수 있습니다.

바이너리가 닫혀 있는지 확인하려면 diff <(nm a.out) <(nm b.out)을 실행하십시오. 차이는 거의 없습니다. 차이점이 많으면 바이너리가 충분히 근접하지 않습니다. 당신의 동료가 -O2으로 구축하는 경우, 당신은 -g (그리고 암시 -O0), 바이너리 빌드 :

나는이 귀하의 첫 번째 실수가 될 수 있습니다

물론, 활성화 디버깅 심볼 소프트웨어를 컴파일 은 일치하지 않는입니다.

당신은 정확히 당신의 동료가 함께 빌드 플래그와 함께 구축 할 필요가 (하지만 당신은 디버깅 심볼을 추가 할 수 있습니다, 당신의 동료가 -O2로 구축하는 경우, 예를 들어, 당신이 함께 -O2 -g 빌드해야한다).

P. 두 컴퓨터에 identical versions of system libraries 필요합니다.

+0

컴파일러 플래그가 같고 동일한 Makefile을 사용합니다. – Paul