public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Handle trying to use a native target with the wrong binary
@ 2022-05-31 14:30 Andrew Burgess
  2022-05-31 14:30 ` [PATCH 1/5] gdb/arm: move fetch of arm_gdbarch_tdep to a more inner scope Andrew Burgess
                   ` (5 more replies)
  0 siblings, 6 replies; 83+ messages in thread
From: Andrew Burgess @ 2022-05-31 14:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

This started when I accidentally tried to run a RISC-V binary on an
x86-64 native target and discovered that GDB died with an assertion.
I thought surely it must be easy to spot when a user makes this
mistake, right...

Patches #1 and #2 are nice cleanups in their own right, but are
required to allow patch #4.

Patches #3 and #4 are not actually required to solve the original
problem, but were a part of my journey to figuring this out, and will,
I think help catch any future issues in this area (of architecture
mismatch).

Patch #5 solves the original problem.

Thanks,
Andrew


---

Andrew Burgess (5):
  gdb/arm: move fetch of arm_gdbarch_tdep to a more inner scope
  gdb/mips: rewrite show_mask_address
  gdb: move the type cast into gdbarch_tdep
  gdb: ensure the cast in gdbarch_tdep is valid
  gdb: native target invalid architecture detection

 gdb/aarch64-fbsd-nat.c     |   4 +-
 gdb/aarch64-fbsd-tdep.c    |   6 +-
 gdb/aarch64-linux-nat.c    |  16 ++---
 gdb/aarch64-linux-tdep.c   |  10 +--
 gdb/aarch64-newlib-tdep.c  |   2 +-
 gdb/aarch64-tdep.c         |  48 +++++++-------
 gdb/aix-thread.c           |  28 ++++----
 gdb/alpha-linux-tdep.c     |   2 +-
 gdb/alpha-netbsd-tdep.c    |   2 +-
 gdb/alpha-obsd-tdep.c      |   2 +-
 gdb/alpha-tdep.c           |  14 ++--
 gdb/amd64-darwin-tdep.c    |   2 +-
 gdb/amd64-fbsd-nat.c       |   4 +-
 gdb/amd64-fbsd-tdep.c      |   4 +-
 gdb/amd64-linux-tdep.c     |   8 +--
 gdb/amd64-netbsd-tdep.c    |   2 +-
 gdb/amd64-obsd-tdep.c      |   2 +-
 gdb/amd64-sol2-tdep.c      |   2 +-
 gdb/amd64-tdep.c           |  34 +++++-----
 gdb/amd64-windows-tdep.c   |   2 +-
 gdb/arc-linux-tdep.c       |   4 +-
 gdb/arc-newlib-tdep.c      |   2 +-
 gdb/arc-tdep.c             |   8 +--
 gdb/arch-utils.c           |  14 +++-
 gdb/arch-utils.h           |   5 ++
 gdb/arm-fbsd-nat.c         |   4 +-
 gdb/arm-fbsd-tdep.c        |   6 +-
 gdb/arm-linux-nat.c        |   8 +--
 gdb/arm-linux-tdep.c       |   4 +-
 gdb/arm-netbsd-nat.c       |   8 +--
 gdb/arm-netbsd-tdep.c      |   4 +-
 gdb/arm-none-tdep.c        |   2 +-
 gdb/arm-obsd-tdep.c        |   2 +-
 gdb/arm-tdep.c             | 130 ++++++++++++++++++------------------
 gdb/arm-wince-tdep.c       |   2 +-
 gdb/avr-tdep.c             |  12 ++--
 gdb/bfin-tdep.c            |   4 +-
 gdb/cris-linux-tdep.c      |   2 +-
 gdb/cris-tdep.c            |  18 ++---
 gdb/frv-tdep.c             |   4 +-
 gdb/ft32-tdep.c            |   2 +-
 gdb/gdbarch.h              |  26 +++++++-
 gdb/hppa-bsd-tdep.c        |   2 +-
 gdb/hppa-linux-tdep.c      |   4 +-
 gdb/hppa-tdep.c            |  12 ++--
 gdb/i386-bsd-tdep.c        |   2 +-
 gdb/i386-darwin-tdep.c     |   4 +-
 gdb/i386-fbsd-tdep.c       |   4 +-
 gdb/i386-gnu-tdep.c        |   2 +-
 gdb/i386-go32-tdep.c       |   2 +-
 gdb/i386-linux-tdep.c      |   4 +-
 gdb/i386-netbsd-tdep.c     |   4 +-
 gdb/i386-nto-tdep.c        |   6 +-
 gdb/i386-obsd-tdep.c       |   2 +-
 gdb/i386-sol2-tdep.c       |   2 +-
 gdb/i386-tdep.c            |  98 +++++++++++++--------------
 gdb/i386-windows-tdep.c    |   2 +-
 gdb/i387-tdep.c            |  20 +++---
 gdb/ia64-linux-tdep.c      |   2 +-
 gdb/ia64-tdep.c            |  12 ++--
 gdb/inf-child.c            |  19 ++++++
 gdb/inf-child.h            |   2 +
 gdb/infcmd.c               |   8 +++
 gdb/loongarch-linux-nat.c  |   6 +-
 gdb/loongarch-linux-tdep.c |   8 +--
 gdb/loongarch-tdep.c       |  10 +--
 gdb/m32c-tdep.c            |  58 ++++++++--------
 gdb/m68hc11-tdep.c         |  12 ++--
 gdb/m68k-bsd-tdep.c        |   2 +-
 gdb/m68k-linux-tdep.c      |   2 +-
 gdb/m68k-tdep.c            |  38 +++++------
 gdb/mep-tdep.c             |   6 +-
 gdb/mips-linux-tdep.c      |   4 +-
 gdb/mips-tdep.c            |  85 ++++++++++++------------
 gdb/mn10300-tdep.c         |   2 +-
 gdb/mn10300-tdep.h         |   2 +-
 gdb/msp430-tdep.c          |  12 ++--
 gdb/nds32-tdep.c           |  20 +++---
 gdb/nios2-linux-tdep.c     |   2 +-
 gdb/nios2-tdep.c           |   4 +-
 gdb/or1k-tdep.c            |   8 +--
 gdb/ppc-fbsd-nat.c         |   4 +-
 gdb/ppc-fbsd-tdep.c        |   8 +--
 gdb/ppc-linux-nat.c        |  22 +++----
 gdb/ppc-linux-tdep.c       |  18 ++---
 gdb/ppc-netbsd-nat.c       |   6 +-
 gdb/ppc-netbsd-tdep.c      |   2 +-
 gdb/ppc-obsd-nat.c         |   4 +-
 gdb/ppc-obsd-tdep.c        |   2 +-
 gdb/ppc-sysv-tdep.c        |  22 +++----
 gdb/ppc64-tdep.c           |   2 +-
 gdb/riscv-linux-tdep.c     |   2 +-
 gdb/riscv-tdep.c           |  26 ++++----
 gdb/rl78-tdep.c            |   8 +--
 gdb/rs6000-aix-nat.c       |   6 +-
 gdb/rs6000-aix-tdep.c      |  16 ++---
 gdb/rs6000-lynx178-tdep.c  |   4 +-
 gdb/rs6000-tdep.c          | 132 ++++++++++++++++++-------------------
 gdb/rx-tdep.c              |   2 +-
 gdb/s390-linux-tdep.c      |  20 +++---
 gdb/s390-tdep.c            |  42 ++++++------
 gdb/sh-linux-tdep.c        |   2 +-
 gdb/sh-netbsd-tdep.c       |   2 +-
 gdb/sh-tdep.c              |   8 +--
 gdb/sparc-linux-tdep.c     |   4 +-
 gdb/sparc-netbsd-tdep.c    |   2 +-
 gdb/sparc-sol2-tdep.c      |   2 +-
 gdb/sparc-tdep.c           |  14 ++--
 gdb/sparc64-fbsd-tdep.c    |   2 +-
 gdb/sparc64-linux-tdep.c   |   4 +-
 gdb/sparc64-netbsd-tdep.c  |   2 +-
 gdb/sparc64-obsd-tdep.c    |   2 +-
 gdb/sparc64-sol2-tdep.c    |   2 +-
 gdb/sparc64-tdep.c         |  10 +--
 gdb/target-delegates.c     |  28 ++++++++
 gdb/target.h               |  13 +++-
 gdb/tic6x-linux-tdep.c     |   6 +-
 gdb/tic6x-tdep.c           |   6 +-
 gdb/v850-tdep.c            |   6 +-
 gdb/windows-nat.c          |   2 +-
 gdb/xtensa-linux-nat.c     |   4 +-
 gdb/xtensa-linux-tdep.c    |   2 +-
 gdb/xtensa-tdep.c          |  54 +++++++--------
 gdb/z80-tdep.c             |   8 +--
 124 files changed, 799 insertions(+), 693 deletions(-)

-- 
2.25.4


^ permalink raw reply	[flat|nested] 83+ messages in thread

end of thread, other threads:[~2022-07-26 11:05 UTC | newest]

Thread overview: 83+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-31 14:30 [PATCH 0/5] Handle trying to use a native target with the wrong binary Andrew Burgess
2022-05-31 14:30 ` [PATCH 1/5] gdb/arm: move fetch of arm_gdbarch_tdep to a more inner scope Andrew Burgess
2022-06-01  7:58   ` Luis Machado
2022-05-31 14:30 ` [PATCH 2/5] gdb/mips: rewrite show_mask_address Andrew Burgess
2022-05-31 14:30 ` [PATCH 3/5] gdb: move the type cast into gdbarch_tdep Andrew Burgess
2022-06-01  8:01   ` Luis Machado
2022-05-31 14:30 ` [PATCH 4/5] gdb: ensure the cast in gdbarch_tdep is valid Andrew Burgess
2022-05-31 16:04   ` John Baldwin
2022-05-31 17:22     ` Andrew Burgess
2022-05-31 14:30 ` [PATCH 5/5] gdb: native target invalid architecture detection Andrew Burgess
2022-05-31 16:08   ` John Baldwin
2022-05-31 16:51     ` Andrew Burgess
2022-06-01  8:25       ` Luis Machado
2022-06-01 21:06         ` John Baldwin
2022-06-01 21:21           ` Christophe Lyon
2022-06-02 14:56             ` John Baldwin
2022-06-06 14:38         ` Andrew Burgess
2022-06-06 17:48           ` Andrew Burgess
2022-06-07 11:03             ` Luis Machado
2022-06-07 18:42               ` Pedro Alves
2022-06-07 20:15                 ` Pedro Alves
2022-06-08  8:18                   ` Luis Machado
2022-06-08 10:17                     ` Pedro Alves
2022-06-08  7:54                 ` Luis Machado
2022-06-08 10:12                   ` Pedro Alves
2022-06-08 11:20                     ` [PATCH v2] aarch64: Add fallback if ARM_CC_FOR_TARGET not set (was: Re: [PATCH 5/5] gdb: native target invalid architecture detection) Pedro Alves
2022-06-08 12:50                       ` Luis Machado
2022-06-08 13:23                         ` Pedro Alves
2022-06-08 13:38                       ` Andrew Burgess
2022-06-08 19:01                       ` John Baldwin
2022-06-08 21:48                         ` Pedro Alves
2022-06-09 16:31                           ` John Baldwin
2022-06-10 13:08 ` [PATCHv2 0/6] Handle trying to use a native target with the wrong binary Andrew Burgess
2022-06-10 13:08   ` [PATCHv2 1/6] gdb/arm: move fetch of arm_gdbarch_tdep to a more inner scope Andrew Burgess
2022-06-10 13:08   ` [PATCHv2 2/6] gdb/mips: rewrite show_mask_address Andrew Burgess
2022-06-10 13:08   ` [PATCHv2 3/6] gdb/arm: avoid undefined behaviour in arm_frame_is_thumb Andrew Burgess
2022-06-10 15:21     ` Luis Machado
2022-06-10 15:49       ` Andrew Burgess
2022-06-10 16:29         ` Luis Machado
2022-06-10 13:08   ` [PATCHv2 4/6] gdb: move the type cast into gdbarch_tdep Andrew Burgess
2022-06-10 16:35     ` Luis Machado
2022-06-10 13:08   ` [PATCHv2 5/6] gdb: ensure the cast in gdbarch_tdep is valid Andrew Burgess
2022-06-10 13:08   ` [PATCHv2 6/6] gdb: native target invalid architecture detection Andrew Burgess
2022-06-10 16:20     ` John Baldwin
2022-06-10 16:31     ` Luis Machado
2022-06-13 16:15   ` [PATCHv3 0/6] Handle trying to use a native target with the wrong binary Andrew Burgess
2022-06-13 16:15     ` [PATCHv3 1/6] gdb/arm: move fetch of arm_gdbarch_tdep to a more inner scope Andrew Burgess
2022-06-13 16:15     ` [PATCHv3 2/6] gdb/mips: rewrite show_mask_address Andrew Burgess
2022-06-13 16:15     ` [PATCHv3 3/6] gdb: select suitable thread for gdbarch_adjust_breakpoint_address Andrew Burgess
2022-06-14  9:45       ` Luis Machado
2022-06-14 14:05         ` Andrew Burgess
2022-06-24 16:58       ` Pedro Alves
2022-06-13 16:15     ` [PATCHv3 4/6] gdb: move the type cast into gdbarch_tdep Andrew Burgess
2022-06-13 16:15     ` [PATCHv3 5/6] gdb: ensure the cast in gdbarch_tdep is valid Andrew Burgess
2022-06-24 18:15       ` Pedro Alves
2022-06-13 16:15     ` [PATCHv3 6/6] gdb: native target invalid architecture detection Andrew Burgess
2022-06-24 19:23       ` Pedro Alves
2022-06-27 16:27         ` Andrew Burgess
2022-06-27 21:38           ` Pedro Alves
2022-06-28 10:37             ` Andrew Burgess
2022-06-28 12:42               ` [PATCH v2] gdb+gdbserver/Linux: avoid reading registers while going through shell (was: Re: [PATCHv3 6/6] gdb: native target invalid architecture detection) Pedro Alves
2022-06-28 14:21                 ` Andrew Burgess
2022-06-29 15:17                 ` Simon Marchi
2022-06-29 16:22                   ` [PATCH] Fix GDBserver regression due to change to avoid reading shell registers Pedro Alves
2022-06-29 16:38                     ` Simon Marchi
2022-06-30  9:33             ` [PATCHv3 6/6] gdb: native target invalid architecture detection Andrew Burgess
2022-06-30 11:44               ` Pedro Alves
2022-07-11 10:47                 ` Andrew Burgess
2022-06-24 10:15     ` [PATCHv3 0/6] Handle trying to use a native target with the wrong binary Andrew Burgess
2022-06-28 14:28     ` [PATCHv4 0/6] Detect invalid casts of gdbarch_tdep structures Andrew Burgess
2022-06-28 14:28       ` [PATCHv4 1/6] gdb/arm: move fetch of arm_gdbarch_tdep to a more inner scope Andrew Burgess
2022-06-28 14:28       ` [PATCHv4 2/6] gdb/mips: rewrite show_mask_address Andrew Burgess
2022-06-28 14:28       ` [PATCHv4 3/6] gdb: select suitable thread for gdbarch_adjust_breakpoint_address Andrew Burgess
2022-06-28 14:28       ` [PATCHv4 4/6] gdb: move the type cast into gdbarch_tdep Andrew Burgess
2022-06-28 14:28       ` [PATCHv4 5/6] gdbsupport: add checked_static_cast Andrew Burgess
2022-06-28 14:28       ` [PATCHv4 6/6] gdb: ensure the cast in gdbarch_tdep is valid Andrew Burgess
2022-07-11 10:46       ` [PATCHv4 0/6] Detect invalid casts of gdbarch_tdep structures Andrew Burgess
2022-07-21 18:21         ` Andrew Burgess
2022-07-22  0:50           ` Luis Machado
2022-07-23  0:02             ` [PATCH] Rename gdbarch_tdep template function to gdbarch_tdep_cast for g++ 4.8 Mark Wielaard
2022-07-25 11:19               ` Andrew Burgess
2022-07-25 11:27                 ` Mark Wielaard
2022-07-26 11:05                   ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).