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)
May 5 2024, 11:28 PM
Unknown Object (File)
May 5 2024, 11:28 PM
Unknown Object (File)
May 5 2024, 11:28 PM
Unknown Object (File)
May 3 2024, 2:49 PM
Unknown Object (File)
Apr 23 2024, 2:22 AM
Unknown Object (File)
Apr 19 2024, 1:59 PM
Unknown Object (File)
Apr 19 2024, 10:17 AM
Unknown Object (File)
Feb 13 2024, 12:10 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.