[PATCH] D42145: [lldb] Use vFlash commands when writing to target's flash memory regions

Owen Shaw via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 22:10:44 PST 2018

owenpshaw added inline comments.

Comment at: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp:814
           value = value - header->p_vaddr;
           found_offset = true;
labath wrote:
> Ok so the issue is that here we use the virtual address to compute the load bias, but at line 830 we add the bias to the physical address. This breaks as soon as these two addresses start to differ.
> Changing this to use the physical address as well fixes things, but as I said before, I'm not sure we should be using physical addresses here.
I don't know if there's another use case besides flash load that should definitely use the physical address, so I can't be much help answering that question.  I was mainly relying on tests to catch any issue caused by using physical addresses.

Could the value_is_offset flag be a tell here?  Looks like that load bias is only calculated if value_is_offset == false.  Would it make sense to always use virtual address in such a case?  It wouldn't affect the "target modules load" case, which always sets value_is_offset to true.



More information about the llvm-commits mailing list