]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdbserver/linux-low.cc
Fix crash in aarch64-linux gdbserver
authorPedro Alves <pedro@palves.net>
Wed, 7 Feb 2024 18:48:16 +0000 (18:48 +0000)
committerPedro Alves <pedro@palves.net>
Fri, 9 Feb 2024 11:58:40 +0000 (11:58 +0000)
commit38065394e9646db0aff89b58d1d09f94bb1f626e
tree97d62159d064ba91fa51f39757db9c3cd7c69934
parent41e115853eef32304e3e6fcd7feb4ec116090ee0
Fix crash in aarch64-linux gdbserver

Since commit 393a6b5947d0 ("Thread options & clone events (Linux
GDBserver)"), aarch64-linux gdbserver crashes when the inferior
vforks.  This happens in aarch64_get_debug_reg_state:

  struct process_info *proc = find_process_pid (pid);

  return &proc->priv->arch_private->debug_reg_state;

Here, find_process_pid returns nullptr -- the new inferior hasn't yet
been created in linux_process_target::handle_extended_wait.

This patch fixes the problem by having
linux_process_target::handle_extended_wait create the child process
earlier, before the child LWP is created.  This is what the function
did before it was reorganized by the commit referred above.

Change-Id: Ib8b3a2e6048c3ad2b91a92ea4430da507db03c50
Co-Authored-By: Tom Tromey <tromey@adacore.com>
gdbserver/linux-low.cc