Bug 21170 - Selected architecture arm is not compatible with reported target architecture i386:x86-64
Summary: Selected architecture arm is not compatible with reported target architecture...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 7.12.1
: P2 normal
Target Milestone: 13.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-16 09:08 UTC by Murat Kaya
Modified: 2023-03-02 16:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2023-02-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Murat Kaya 2017-02-16 09:08:47 UTC
##### SOURCE CODE ###########
root@mksecurity:~# cat arm.c

    #include <stdio.h>

    void foo(const char *s) {

        printf("%s", s);
    }

    int main(void) {
        foo("Hello World");
        return 0;
     }

#### READELF INFORMATION #######
root@mksecurity:~# arm-linux-gnueabihf-readelf -h arm.bin
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x495
  Start of program headers:          52 (bytes into file)
  Start of section headers:          9556 (bytes into file)
  Flags:                             0x5000400, Version5 EABI, hard-float ABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         9
  Size of section headers:           40 (bytes)
  Number of section headers:         36
  Section header string table index: 35

###### DEBUGGING #########

gdb-peda$ r
Starting program: /root/arm.bin 
warning: Selected architecture arm is not compatible with reported target architecture i386:x86-64
warning: Architecture rejected target-supplied description
/build/gdb-A87voC/gdb-7.12/gdb/i387-tdep.c:919: internal-error: void i387_supply_xsave(regcache*, int, const void*): Assertion `tdep->st0_regnum >= I386_ST0_REGNUM' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.

Aborted (core dumped)
Comment 1 Tom Tromey 2023-02-22 13:40:07 UTC
Confirmed.  gdb shouldn't crash here.
Comment 2 Tom Tromey 2023-03-02 16:36:51 UTC
This seems to have been fixed in gdb 13.
While 12 crashes for me, with 13 I get:

(gdb) r
Starting program: /home/tromey/gdb/PRs/pr-21170-wrong-arch/simple_main 
/bin/bash: line 1: /home/tromey/gdb/PRs/pr-21170-wrong-arch/simple_main: cannot execute binary file: Exec format error
/bin/bash: line 1: /home/tromey/gdb/PRs/pr-21170-wrong-arch/simple_main: Success
During startup program exited with code 126.