Page MenuHomeFreeBSD

Introduce kdb-level watchpoint functions
ClosedPublic

Authored by mhorne on Mar 9 2021, 6:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 13, 7:47 PM
Unknown Object (File)
Oct 4 2024, 12:20 PM
Unknown Object (File)
Oct 2 2024, 5:09 AM
Unknown Object (File)
Sep 30 2024, 9:43 PM
Unknown Object (File)
Sep 30 2024, 6:11 PM
Unknown Object (File)
Sep 30 2024, 6:17 AM
Unknown Object (File)
Sep 28 2024, 3:25 AM
Unknown Object (File)
Sep 27 2024, 4:44 AM

Details

Summary

This basically mirrors what already exists in ddb, but provides a
slightly improved interface. It allows the caller to specify the
watchpoint access type, and returns more specific error codes to
differentiate failure cases.

These functions will be used to support hardware watchpoint use in
gdb(4). It is about the same amount of work to add per-arch calls there
than it is to lift this interface to KDB, so I opted for the latter.

Stubs are provided for architectures lacking hardware watchpoint logic
(mips, powerpc, riscv). Other architectures are handled in individual
commits, but presented here for easier review.

Removal of the ddb routines will be in a follow-up commit.

Summary of error codes:

  • ENXIO, not supported by platform
  • EBUSY, no free hardware watchpoints
  • EINVAL, invalid address, size, or access type
Test Plan

Tinderbox'd. Runtime testing done with later commits in the series.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 37869
Build 34758: arc lint + arc unit

Event Timeline

mhorne held this revision as a draft.
sys/sys/kdb.h
131

This particular value is unused, but maps to analogous execute bits in the supported debug register implementations, so I don't think it hurts to have.

mhorne published this revision for review.Mar 9 2021, 6:53 PM
mhorne edited the summary of this revision. (Show Details)
sys/amd64/amd64/db_trace.c
392–393

Is this line too long?

sys/x86/x86/dbreg.c
216

This is strange. Should it be #if defined(DDB) || defined(KDB) or do I miss something?

sys/x86/x86/dbreg.c
277

Why do we have both this db_md_set_watchpoint?

sys/x86/x86/dbreg.c
216

The #endifs are in different places. Still, this construct only makes sense under the original assumption that dbreg.c would always be compiled in.

I will update this review shortly.

277

The new function will replace db_md_set_watchpoint in the next commit, see D29156. Then, both ddb and gdb will use the new functions (D29173).

Rebase on top of changes to D29153. Remove some unneeded #ifdef lines.

jhb added inline comments.
sys/sys/kdb.h
131

I would probably just spell it '_X' rather than '_EXEC' FWIW.

This revision is now accepted and ready to land.Mar 19 2021, 6:28 PM