From cbd79b6c8490f92c749512dbaf5cd8452e3941e4 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Mon, 22 Apr 2013 18:26:52 +0000 Subject: Providing a dummy RegisterContext to secure against faulty Python OS plugins that do not return a valid RegisterContext The RegisterContextDummy exports a PC with a constant 0xFFFFFFFFFFFFFFFF value llvm-svn: 180033 --- .../Plugins/OperatingSystem/Python/OperatingSystemPython.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp') diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp index 6e2aadb7fde..a7aaedb9a0c 100644 --- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -33,6 +33,7 @@ #include "lldb/Target/ThreadList.h" #include "lldb/Target/Thread.h" #include "Plugins/Process/Utility/DynamicRegisterInfo.h" +#include "Plugins/Process/Utility/RegisterContextDummy.h" #include "Plugins/Process/Utility/RegisterContextMemory.h" #include "Plugins/Process/Utility/ThreadMemory.h" @@ -333,6 +334,13 @@ OperatingSystemPython::CreateRegisterContextForThread (Thread *thread, addr_t re } } } + // if we still have no register data, fallback on a dummy context to avoid crashing + if (!reg_ctx_sp) + { + if (log) + log->Printf ("OperatingSystemPython::CreateRegisterContextForThread (tid = 0x%" PRIx64 ") forcing a dummy register context", thread->GetID()); + reg_ctx_sp.reset(new RegisterContextDummy(*thread,0,target.GetArchitecture().GetAddressByteSize())); + } return reg_ctx_sp; } -- cgit v1.2.3