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)
Mon, Dec 9, 5:33 PM
Unknown Object (File)
Wed, Dec 4, 3:39 PM
Unknown Object (File)
Wed, Dec 4, 3:39 PM
Unknown Object (File)
Wed, Dec 4, 3:39 PM
Unknown Object (File)
Wed, Dec 4, 3:39 PM
Unknown Object (File)
Wed, Dec 4, 3:17 PM
Unknown Object (File)
Mon, Dec 2, 7:14 AM
Unknown Object (File)
Mon, Dec 2, 7:13 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.