From c85c1127ef9b8c80334cadcb98f0a24cd8cadc09 Mon Sep 17 00:00:00 2001 From: rin Date: Mon, 14 Dec 2020 02:05:07 +0000 Subject: [PATCH] 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 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(). --- external/gpl3/gdb/dist/gdb/nbsd-nat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/external/gpl3/gdb/dist/gdb/nbsd-nat.c b/external/gpl3/gdb/dist/gdb/nbsd-nat.c index 9f1a0274b6f2..a400c9754d2f 100644 --- a/external/gpl3/gdb/dist/gdb/nbsd-nat.c +++ b/external/gpl3/gdb/dist/gdb/nbsd-nat.c @@ -27,6 +27,9 @@ #include "gdbarch.h" #include +/* Use directly, instead of "nat/gdb_ptrace.h". Otherwise, + PT_STEP will be defined unintentionally, which breaks platforms without + PT_STEP support. */ #include #include #include @@ -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);