aboutsummaryrefslogtreecommitdiff
path: root/gdb/riscv-linux-nat.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2023-07-14 08:39:24 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2023-07-14 08:39:24 -0700
commita4a688ffa46533bf26d5d27dc7f75c22d90fd638 (patch)
treefd2a899df1fc435a910b32bdcbd2352eb93e5966 /gdb/riscv-linux-nat.c
parent97b6e0f6c88d02eac1df0254cdd5c80f40f4869d (diff)
downloadgdb-a4a688ffa46533bf26d5d27dc7f75c22d90fd638.zip
gdb-a4a688ffa46533bf26d5d27dc7f75c22d90fd638.tar.gz
gdb-a4a688ffa46533bf26d5d27dc7f75c22d90fd638.tar.bz2
*-linux-nat: Handle null inferior in read_description.
Don't invoke ptrace in the target read_description method if there is not an active inferior to query via ptrace. Instead, use the default register set for the architecture. Previously the native target could report an error from a failed ptrace operation when fetching a tdesc without an attached process. For example on Linux x86-64: (gdb) target native Done. Use the "run" command to start a process. (gdb) unset tdesc filename Couldn't get CS register: No such process.
Diffstat (limited to 'gdb/riscv-linux-nat.c')
-rw-r--r--gdb/riscv-linux-nat.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/riscv-linux-nat.c b/gdb/riscv-linux-nat.c
index 8be4a5a..9492cb6 100644
--- a/gdb/riscv-linux-nat.c
+++ b/gdb/riscv-linux-nat.c
@@ -201,6 +201,9 @@ fill_fpregset (const struct regcache *regcache, prfpregset_t *fpregs,
const struct target_desc *
riscv_linux_nat_target::read_description ()
{
+ if (inferior_ptid == null_ptid)
+ return this->beneath ()->read_description ();
+
const struct riscv_gdbarch_features features
= riscv_linux_read_features (inferior_ptid.pid ());
return riscv_lookup_target_description (features);