[v2,0/4] Handle null inferiors in target::read_description

Message ID 20230706172337.39099-1-jhb@FreeBSD.org
Headers
Series Handle null inferiors in target::read_description |

Message

John Baldwin July 6, 2023, 5:23 p.m. UTC
  Change since V1:

- Call the beneath target's read_description method instead of
  returning nullptr.

- ppc-linux-nat now calls the beneath method instead of calling
  ppc_linux_match_description with ppc_linux_no_features.
  ppc_linux_no_features has a wordsize of 0, so
  ppc_linux_match_description would have hit an assertion failure.

- mips-linux-nat is slightly smarter in that it only falls back to
  assuming no DSP if have_dsp < 0.  If have_dsp has previously been
  read and the result cached, then there's no ptrace call to avoid.

- Simplifications to the have_native_target helper function suggested
  by Simon.

John Baldwin (4):
  *-fbsd-nat: Handle null inferior in read_description.
  *-linux-nat: Handle null inferior in read_description.
  Add a have_native_target helper function for use with require.
  Test that native targets can read a tdesc without a process attached.

 gdb/aarch64-fbsd-nat.c                        |  3 +++
 gdb/aarch64-linux-nat.c                       |  3 +++
 gdb/amd64-fbsd-nat.c                          |  3 +++
 gdb/arm-fbsd-nat.c                            |  3 +++
 gdb/arm-linux-nat.c                           |  3 +++
 gdb/i386-fbsd-nat.c                           |  3 +++
 gdb/mips-linux-nat.c                          |  4 +++
 gdb/ppc-linux-nat.c                           |  3 +++
 gdb/riscv-linux-nat.c                         |  3 +++
 gdb/s390-linux-nat.c                          |  3 +++
 .../gdb.base/auto-connect-native-target.exp   | 18 +------------
 .../gdb.base/native-target-noproc-tdesc.exp   | 27 +++++++++++++++++++
 gdb/testsuite/lib/gdb.exp                     | 14 ++++++++++
 gdb/x86-linux-nat.c                           |  3 +++
 14 files changed, 76 insertions(+), 17 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/native-target-noproc-tdesc.exp
  

Comments

Tom Tromey July 7, 2023, 4:15 p.m. UTC | #1
>>>>> "John" == John Baldwin <jhb@FreeBSD.org> writes:

John> Change since V1:
John> - Call the beneath target's read_description method instead of
John>   returning nullptr.

FWIW, I read through these.  I didn't see any red flags, but then again,
I'm not sure I really understand the underlying scenario very well.

I didn't want this to go un-answered, though.  IMO it is ok.

Tom