Page MenuHomeFreeBSD

gdb: allow setting/removing hardware watchpoints
ClosedPublic

Authored by mhorne on Mar 9 2021, 9:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Oct 12, 9:22 PM
Unknown Object (File)
Oct 3 2024, 7:42 PM
Unknown Object (File)
Oct 1 2024, 7:17 PM
Unknown Object (File)
Oct 1 2024, 4:04 PM
Unknown Object (File)
Oct 1 2024, 7:11 AM
Unknown Object (File)
Oct 1 2024, 7:11 AM
Unknown Object (File)
Oct 1 2024, 4:21 AM
Unknown Object (File)
Sep 30 2024, 12:57 AM

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
rG FreeBSD src repository
Lint
Lint Not Applicable
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
644

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

662

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

671

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

698

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

sys/gdb/gdb_main.c
662

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

671

Yep, it's meant to send an errno.

698

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.Mar 16 2021, 4:25 PM
markj added inline comments.
sys/gdb/gdb_main.c
965

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