Page MenuHomeFreeBSD

Add support for writing to guest memory in the debug server.
ClosedPublic

Authored by jhb on May 18 2019, 6:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 10:40 AM
Unknown Object (File)
Wed, Nov 6, 9:19 PM
Unknown Object (File)
Oct 15 2024, 4:19 AM
Unknown Object (File)
Oct 7 2024, 10:35 AM
Unknown Object (File)
Sep 30 2024, 10:15 AM
Unknown Object (File)
Sep 21 2024, 5:03 AM
Unknown Object (File)
Sep 20 2024, 5:41 AM
Unknown Object (File)
Sep 11 2024, 6:03 PM

Details

Summary
  • Add a write_mem counterpart to read_mem to handle writes to MMIO.
  • Add support for the GDB 'M' packet to write bytes to the guest's memory. For MMIO writes, attempt to batch writes up into words. This is imprecise, but if you write a single 2 or 4-byte aligned word, it should be treated as a single MMIO write operation.
  • While here, tidy up the parsing of the 'm' command used for reading memory to match 'M'.
Test Plan
  • gdb tried to use this early on to set breakpoints

Diff Detail

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

Event Timeline

scottph added a subscriber: scottph.

gdb_read_mem and gdb_write_mem could conceivably be factored together, though I'm not sure the complexity of that would be worth it. With or without that, this patch looks good to me.

This revision is now accepted and ready to land.May 21 2019, 9:03 PM

I did consider merging the read and write mem functions, but I was worried it might be a bit messy. I might still try it as a followup and see how it looks.

markj added a subscriber: markj.
markj added inline comments.
usr.sbin/bhyve/gdb.c
887 ↗(On Diff #57535)

Extra ws after ==, ditto below.

jhb marked an inline comment as done.May 24 2019, 12:29 AM
This revision was automatically updated to reflect the committed changes.