Page MenuHomeFreeBSD

amd64: allow gdb(4) to write to most registers
ClosedPublic

Authored by mhorne on Dec 16 2020, 8:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 2, 9:12 AM
Unknown Object (File)
Mon, Dec 2, 9:11 AM
Unknown Object (File)
Mon, Dec 2, 9:11 AM
Unknown Object (File)
Mon, Dec 2, 9:10 AM
Unknown Object (File)
Mon, Dec 2, 9:10 AM
Unknown Object (File)
Mon, Dec 2, 8:47 AM
Unknown Object (File)
Nov 12 2024, 10:54 PM
Unknown Object (File)
Oct 30 2024, 8:10 AM
Subscribers

Details

Summary

Similar to the recent patch to arm's gdb stub in rS368414.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Can we lift the condition out and just have two switches? Not sure if that’s any better but it seems sort of ugly as is.

In D27642#617763, @cem wrote:

Can we lift the condition out and just have two switches? Not sure if that’s any better but it seems sort of ugly as is.

I'm not sure which is worse/better. I'm fine with either approach.

This revision is now accepted and ready to land.Dec 17 2020, 5:33 PM

Update to use two switch statements. This version fits vertically on a single screen, and more closely matches the formatting of gdb_cpu_setreg().

This revision now requires review to proceed.Dec 17 2020, 8:10 PM

Fix typo, GDB_REG_RIP -> GDB_REG_PC.

sys/amd64/amd64/gdb_machdep.c
103 ↗(On Diff #80855)

I think the two switch statements is fine. I think the style of the case bodies is perhaps atypical for FreeBSD though.

Ah, I see it matches getreg. Oh well.

Changing getreg to use the new constants might be a nice followup as well.

This revision is now accepted and ready to land.Dec 17 2020, 9:01 PM
sys/amd64/amd64/gdb_machdep.c
103 ↗(On Diff #80855)

Yeah, this is a bit of a weird construct with no ideal way to format it. With expanded case bodies the function becomes unreasonably long, so this is the best option, to my eye.

I am planning on that follow-up to getreg().

This revision was automatically updated to reflect the committed changes.