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)
Dec 20 2023, 8:35 AM
Unknown Object (File)
Dec 12 2023, 12:37 PM
Unknown Object (File)
Dec 1 2023, 12:24 PM
Unknown Object (File)
Dec 1 2023, 12:24 PM
Unknown Object (File)
Nov 7 2023, 4:33 PM
Unknown Object (File)
Nov 7 2023, 4:31 PM
Unknown Object (File)
Nov 7 2023, 8:46 AM
Unknown Object (File)
Oct 6 2023, 3:17 PM
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.