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)
Wed, Mar 20, 2:26 AM
Unknown Object (File)
Jan 12 2024, 2:46 AM
Unknown Object (File)
Jan 8 2024, 10:38 PM
Unknown Object (File)
Dec 21 2023, 6:30 PM
Unknown Object (File)
Nov 20 2023, 10:08 PM
Unknown Object (File)
Nov 7 2023, 4:20 AM
Unknown Object (File)
Nov 5 2023, 3:17 AM
Unknown Object (File)
Oct 11 2023, 8:40 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.