aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API
diff options
context:
space:
mode:
authorJacob Lalonde <jalalonde@fb.com>2025-05-09 15:49:54 -0700
committerGitHub <noreply@github.com>2025-05-09 15:49:54 -0700
commit7517a1bb486f397d45a776e127445596e00c55eb (patch)
treeb7dbc2f13383d87d184d6c534c7a4ca764da02f0 /lldb/source/API
parent0eae457be346d1e7380f4aebbbc333c146c41885 (diff)
downloadllvm-7517a1bb486f397d45a776e127445596e00c55eb.zip
llvm-7517a1bb486f397d45a776e127445596e00c55eb.tar.gz
llvm-7517a1bb486f397d45a776e127445596e00c55eb.tar.bz2
[LLDB][SBSaveCoreOptions] Add new API to expose the expected core size in bytes (#138169)
My current internal work requires some sensitivity to IO usage. I had a work around to calculate the expected size of a Minidump, but I've added this PR so an automated system could look at the expected size of an LLDB generated Minidump and then choose if it has the space or wants to generate it. There are some prerequisites to calculating the correct size, so I have the API take a reference for an SBError, I originally tried to return an SBError and instead take a uint64_t reference, but this made the API very difficult to use in python. Added a test case as well.
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBSaveCoreOptions.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lldb/source/API/SBSaveCoreOptions.cpp b/lldb/source/API/SBSaveCoreOptions.cpp
index 35b9da5..e101f6a 100644
--- a/lldb/source/API/SBSaveCoreOptions.cpp
+++ b/lldb/source/API/SBSaveCoreOptions.cpp
@@ -114,6 +114,20 @@ void SBSaveCoreOptions::Clear() {
m_opaque_up->Clear();
}
+uint64_t SBSaveCoreOptions::GetCurrentSizeInBytes(SBError &error) {
+ LLDB_INSTRUMENT_VA(this, error);
+ llvm::Expected<uint64_t> expected_bytes =
+ m_opaque_up->GetCurrentSizeInBytes();
+ if (!expected_bytes) {
+ error =
+ SBError(lldb_private::Status::FromError(expected_bytes.takeError()));
+ return 0;
+ }
+ // Clear the error, so if the clearer uses it we set it to success.
+ error.Clear();
+ return *expected_bytes;
+}
+
lldb_private::SaveCoreOptions &SBSaveCoreOptions::ref() const {
return *m_opaque_up.get();
}