diff options
author | Leonard Mosescu <mosescu@google.com> | 2018-06-11 21:19:26 +0000 |
---|---|---|
committer | Leonard Mosescu <mosescu@google.com> | 2018-06-11 21:19:26 +0000 |
commit | e1bb51789d8e01a13069f7204e95ad91ac2f6035 (patch) | |
tree | a1a55822ec738c6269dc8c8410b27ed90b45e225 /lldb/packages/Python/lldbsuite/test/functionalities | |
parent | ed32baa84bb32fd150de6f04e9b73c3e723767c8 (diff) | |
download | bcm5719-llvm-e1bb51789d8e01a13069f7204e95ad91ac2f6035.tar.gz bcm5719-llvm-e1bb51789d8e01a13069f7204e95ad91ac2f6035.zip |
Add a new SBTarget::LoadCore() overload which surfaces errors if the load fails
There was no way to find out what's wrong if SBProcess SBTarget::LoadCore(const char *core_file) failed.
Additionally, the implementation was unconditionally setting sb_process, so it wasn't even possible to check if the return SBProcess is valid.
This change adds a new overload which surfaces the errors and also returns a valid SBProcess only if the core load succeeds:
SBProcess SBTarget::LoadCore(const char *core_file, SBError &error);
Differential Revision: https://reviews.llvm.org/D48049
llvm-svn: 334439
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py index 0153f563cc8..5960215f804 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py @@ -59,6 +59,24 @@ class MiniDumpNewTestCase(TestBase): self.dbg.SetOutputFileHandle(None, False) self.dbg.SetErrorFileHandle(None, False) + def test_loadcore_error_status(self): + """Test the SBTarget.LoadCore(core, error) overload.""" + self.dbg.CreateTarget(None) + self.target = self.dbg.GetSelectedTarget() + error = lldb.SBError() + self.process = self.target.LoadCore("linux-x86_64.dmp", error) + self.assertTrue(self.process, PROCESS_IS_VALID) + self.assertTrue(error.Success()) + + def test_loadcore_error_status_failure(self): + """Test the SBTarget.LoadCore(core, error) overload.""" + self.dbg.CreateTarget(None) + self.target = self.dbg.GetSelectedTarget() + error = lldb.SBError() + self.process = self.target.LoadCore("non-existent.dmp", error) + self.assertFalse(self.process, PROCESS_IS_VALID) + self.assertTrue(error.Fail()) + def test_process_info_in_minidump(self): """Test that lldb can read the process information from the Minidump.""" # target create -c linux-x86_64.dmp |