diff options
author | Pavel Labath <labath@google.com> | 2018-02-27 22:14:33 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-02-27 22:14:33 +0000 |
commit | 029fb693722ee87cf0aebc75ba823d4ed020215a (patch) | |
tree | f6939628eacb5ebb1c58b6f97662c6f3521625d2 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h | |
parent | 3acdc6773444b0dea84a69e99024e07ebabc0c98 (diff) | |
download | bcm5719-llvm-029fb693722ee87cf0aebc75ba823d4ed020215a.tar.gz bcm5719-llvm-029fb693722ee87cf0aebc75ba823d4ed020215a.zip |
[lldb] Use vFlash commands when writing to target's flash memory regions
Summary:
When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region. A bare metal target may have this kind of setup.
- Update ObjectFileELF to set load addresses using physical addresses. A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address.
- Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications
- Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region
Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html
Reviewers: clayborg, labath
Reviewed By: labath
Subscribers: arichardson, emaste, mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D42145
Patch by Owen Shaw <llvm@owenpshaw.net>
llvm-svn: 326261
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index 42d1c4ecd66..10679e0b68d 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -144,6 +144,8 @@ public: size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, Status &error) override; + Status WriteObjectFile(std::vector<WriteEntry> entries) override; + size_t DoWriteMemory(lldb::addr_t addr, const void *buf, size_t size, Status &error) override; @@ -302,6 +304,11 @@ protected: int64_t m_breakpoint_pc_offset; lldb::tid_t m_initial_tid; // The initial thread ID, given by stub on attach + bool m_allow_flash_writes; + using FlashRangeVector = lldb_private::RangeVector<lldb::addr_t, size_t>; + using FlashRange = FlashRangeVector::Entry; + FlashRangeVector m_erased_flash_ranges; + //---------------------------------------------------------------------- // Accessors //---------------------------------------------------------------------- @@ -408,6 +415,12 @@ protected: Status UpdateAutomaticSignalFiltering() override; + Status FlashErase(lldb::addr_t addr, size_t size); + + Status FlashDone(); + + bool HasErased(FlashRange range); + private: //------------------------------------------------------------------ // For ProcessGDBRemote only |