GDB는 "파일 형식 인식되지 않음"으로 ELF 64 비트 프로그램을 실행하지 못합니다.

StackOverflow https://stackoverflow.com/questions/275471

  •  07-07-2019
  •  | 
  •  

문제

GDB를 사용하여 디버그를하려고합니다 (성가신 Segfault를 찾기 위해). 내가 달릴 때 :

gdb ./filename

명령 줄에서 다음 오류가 발생합니다.

This GDB was configured as "i686-pc-linux-
gnu"..."/path/exec": not in executable 
format: File format not recognized

내가 실행할 때 :

file /path/executable/

다음 정보를 얻습니다.

 ELF 64-bit LSB executable, AMD x86-64,
 version 1 (SYSV), for GNU/Linux 2.4.0, 
 dynamically linked (uses shared libs), not stripped

GDB 6.1을 사용하고 있으며 실행 파일은 GCC 버전 3.4.6으로 컴파일됩니다.

나는 GDB를 사용하는 관점에서 물에서 조금 벗어나지 만,이 경우에도 잘 작동해야한다고 말할 수 있습니다. 무엇이 잘못되고 있는지 아이디어가 있습니까?

도움이 되었습니까?

해결책

실행 파일은 64 비트 (x86-64)이고 디버거는 32 비트 (i686-pc-linux) 빌드입니다. 디버거의 64 비트 (x86-64) 버전을 설치해야 할 수도 있습니다.

다른 팁

이것이 당신의 문제인지 확실하지 않지만, 나는이 상황에 자주 직면했습니다. 빌드 트리의 실행 파일 인 Make/Automake에 의해 빌드는 이진이 아니라 스크립트이므로 GDB를 사용할 수 없습니다. 다른 GDB가 스크립트를 디버깅하려고 시도하기 때문에 응용 프로그램을 설치하고 디렉토리를 변경하십시오.

이 질문은 "./filename"및 "/path/executable"을 나타냅니다. 이것들은 같은 파일입니까?

사후 분석을 수행하는 경우 실행됩니다.

gdb executable-file core-file

핵심 파일을 무시하려는 경우 실행됩니다.

gdb executable-file

두 경우 모두, 'executable-file'디버깅하려는 이진의 경로 이름을 의미합니다. 대부분은 일반적으로 디버그 빌드의 소스 코드가 있기 때문에 실제로 현재 디렉토리의 간단한 파일 이름입니다.

Solaris에서 64 비트의 GDB 빌드는 32 비트 및 64 비트 실행 파이브를 모두 디버깅 할 수 있어야합니다 (최근 버전의 GDB에 문제가 있었지만). 32 비트 GDB가 반드시 64 비트 실행 파이브를 디버깅 할 수 있다는 점은 확실하지 않습니다.

확인해야 할 것은 실제로 BFD 라이브러리입니다. 그만큼 이진 파일 디스크립터 도서관은 Binutils / GDB가 실제로 바이너리를 구문 분석하고 처리하는 데 사용하는 것입니다 (ELF / A.out 등).

objdump를 통해 현재 지원되는 플랫폼을 볼 수 있습니다.

# objdump -H

objdump: supported targets: elf32-powerpc aixcoff-rs6000 elf32-powerpcle ppcboot elf64-powerpc elf64-powerpcle elf64-little elf64-big elf32-little elf32-big srec symbolsrec tekhex binary ihex
objdump: supported architectures: rs6000:6000 rs6000:rs1 rs6000:rsc rs6000:rs2 powerpc:common powerpc:common64 powerpc:603 powerpc:EC603e powerpc:604 powerpc:403 powerpc:601 powerpc:620 powerpc:630 powerpc:a35 powerpc:rs64ii powerpc:rs64iii powerpc:7400 powerpc:e500 powerpc:MPC8XX powerpc:750

The following PPC specific disassembler options are supported for use with
the -M switch:
  booke|booke32|booke64    Disassemble the BookE instructions
  e300                     Disassemble the e300 instructions
  e500|e500x2              Disassemble the e500 instructions
  efs                      Disassemble the EFS instructions
  power4                   Disassemble the Power4 instructions
  power5                   Disassemble the Power5 instructions
  power6                   Disassemble the Power6 instructions
  32                       Do not disassemble 64-bit instructions
  64                       Allow disassembly of 64-bit instructions

GNU 디버거 (GNU 디버거)gdb)는 X86_64 아키텍처를 지원하지 않습니다.

그래서 시도하십시오 LLDB 디버거 (lldb) 교체하는 것을 목표로합니다. i386, x86-64 및 ARM 명령 세트를 지원합니다.

Linux에서 BSD/OS X에서 기본적으로 다음을 통해 설치할 수 있습니다. sudo apt-get install lldb (또는 사용 yum).

보다: GDB에서 LLDB 명령 맵 자세한 정보는 페이지를 보려면 페이지입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top