[lldb/Plugins] Improve error reporting with reading memory in Scripted Process
This patch improves the ScriptedPythonInterface::Dispatch method to support passing lldb_private types to the python implementation. This will allow, for instance, the Scripted Process python implementation to report errors when reading memory back to lldb. To do so, the Dispatch method will transform the private types in the parameter pack into `PythonObject`s to be able to pass them down to the python methods. Then, if the call succeeded, the transformed arguments will be converted back to their original type and re-assigned in the parameter pack, to ensure pointers and references behaviours are preserved. This patch also updates various scripted process python class and tests to reflect this change. rdar://100030995 Differential Revision: https://reviews.llvm.org/D134033 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
1 parent
288843a161
commit
7e01924e4e
14 files changed
+213
-77
No files matched your search
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "lldb/Host/Config.h"
|
||||
#include "lldb/Utility/Log.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
|
||||
#if LLDB_ENABLE_PYTHON
|
||||
@@ -120,8 +121,15 @@ ScriptedProcessPythonInterface::GetRegistersForThread(lldb::tid_t tid) {
|
||||
|
||||
lldb::DataExtractorSP ScriptedProcessPythonInterface::ReadMemoryAtAddress(
|
||||
lldb::addr_t address, size_t size, Status &error) {
|
||||
return Dispatch<lldb::DataExtractorSP>("read_memory_at_address", error,
|
||||
address, size);
|
||||
Status py_error;
|
||||
lldb::DataExtractorSP data_sp = Dispatch<lldb::DataExtractorSP>(
|
||||
"read_memory_at_address", py_error, address, size, error);
|
||||
|
||||
// If there was an error on the python call, surface it to the user.
|
||||
if (py_error.Fail())
|
||||
error = py_error;
|
||||
|
||||
return data_sp;
|
||||
}
|
||||
|
||||
StructuredData::ArraySP ScriptedProcessPythonInterface::GetLoadedImages() {
|
||||
|
||||
Reference in new issue
Block a user