Add some precautions for platforms without PT_STEP support.

"nat/gdb_ptrace.h" defines PT_STEP as 9, if it is not defined. nat-ptrace.c
depends on this; inf_ptrace_target::resume() uses PT_STEP unconditionally
when its ``step'' argument is non-zero. Therefore,

- Add comment that nbsd-nat.c should include <sys/ptrace.h> directly,
  instead of "nat/gdb_ptrace.h".

- Add gdb_assert(step == 0) in nbsd_nat_target::resume() ifndef PT_STEP,
  before calling inf_ptrace_target::resume().
This commit is contained in:
rin 2020-12-14 02:05:07 +00:00
parent 9b9416d880
commit c85c1127ef
1 changed files with 4 additions and 0 deletions

View File

@ -27,6 +27,9 @@
#include "gdbarch.h"
#include <sys/types.h>
/* Use <sys/ptrace.h> directly, instead of "nat/gdb_ptrace.h". Otherwise,
PT_STEP will be defined unintentionally, which breaks platforms without
PT_STEP support. */
#include <sys/ptrace.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
@ -539,6 +542,7 @@ nbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
nbsd_resume (this, ptid_t (inf->pid, 0, 0), step, signal);
}
#else
gdb_assert(step == 0);
if (ptid.pid () == -1)
ptid = inferior_ptid;
inf_ptrace_target::resume (ptid, step, signal);