[Lldb-commits] [PATCH] Minimal API support for non-8-bit byte targets
Matthew Gardiner
mg11 at csr.com
Mon Oct 20 06:09:33 PDT 2014
Hi clayborg, emaste,
In order to write applications with the lldb C++ API which support non-8-bit bytes targets, it is necessary to extend the API somewhat.
To use lldb's ReadMemory interface, which accepts a buffer sized by the host's definition of a byte, I have added the following "discovery" functions:
SBSection::GetTargetByteSize
SBTarget::GetCodeByteSize
SBTarget::GetDataByteSize
additionally I have added SBTarget::ResolveFileAddress, which resolves a file address to a section. With the above discovery functions, my test C++ application, can correctly deduce the host buffer allocation necessary, and decode the read data, for an address read on the target.
I added SBTarget::ReadMemory too, so that my test application can read memory (straight from the object file) without a running process. This function merely being a wrapper on the existent Target::ReadMemory.
(As an aside I added SBTarget::GetPlatform, since I found this useful as a sanity check when using my test C++ application.)
For each C++ API routine I have added a test case. I've run these case on linux and FreeBSD to my satisfaction. I've assumed that these tests will work on MACH-O, so I did not decorate them with "@dwarf_test". Feel free to comment if this is considered to be a poor omission.
http://reviews.llvm.org/D5867
Files:
include/lldb/API/SBSection.h
include/lldb/API/SBTarget.h
include/lldb/Target/Target.h
scripts/Python/interface/SBSection.i
scripts/Python/interface/SBTarget.i
source/API/SBSection.cpp
source/API/SBTarget.cpp
source/Target/Target.cpp
test/lldbtest.py
test/python_api/section/Makefile
test/python_api/section/TestSectionAPI.py
test/python_api/section/main.c
test/python_api/target/TestTargetAPI.py
test/python_api/target/main.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5867.15138.patch
Type: text/x-patch
Size: 22011 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20141020/cf6db12f/attachment.bin>
More information about the lldb-commits
mailing list