Page MenuHomeFreeBSD

gdb: allow setting/removing hardware watchpoints
ClosedPublic

Authored by mhorne on Mar 9 2021, 9:13 PM.

Details

Summary

Handle the 'z' and 'Z' remote packets for manipulating hardware
watchpoints.

This could be expanded quite easily to support hardware or software
breakpoints as well.

https://sourceware.org/gdb/onlinedocs/gdb/Packets.html

Test Plan

Basic usage testing on amd64, arm64, armv7.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mhorne requested review of this revision.Mar 9 2021, 9:13 PM

Seems reasonable to me!

sys/gdb/gdb_main.c
643

Seems like the if error / goto fail can be extract from the individual switch cases and moved after the switch.

661

That’s the expected behavior by clients if functionality isn’t implemented? (As opposed to an explicit error?)

670

Do errnos make reasonable values here? I forget what tx_err does.

697

It doesn’t matter that the type may not match the breakpoint at addr?

sys/gdb/gdb_main.c
661

Yes. It's the same as the default case for the big switch in gdb_trap().

670

Yep, it's meant to send an errno.

697

At the moment, no. Our hw debug implementations don't look at this when they select which watchpoint to remove (some don't even look at length).

Improve error handling per cem's note.

Make required code conditional on options gdb as well.

This revision is now accepted and ready to land.Tue, Mar 16, 4:25 PM
markj added inline comments.
sys/gdb/gdb_main.c
964

We don't seem to need the braces here or in the case below.