-
Notifications
You must be signed in to change notification settings - Fork 15.7k
[LLDB][Minidump] Minidump erase file on failure #108259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
022173d
8a51bd0
7150acb
233f5cc
cd89bcf
33b6474
cbfe997
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,21 @@ size_t ObjectFileMinidump::GetModuleSpecifications( | |
| return 0; | ||
| } | ||
|
|
||
| struct SaveCoreRequest { | ||
| SaveCoreRequest(MinidumpFileBuilder &builder) : m_builder(builder) {} | ||
|
|
||
| ~SaveCoreRequest() { | ||
| if (!m_success) | ||
| m_builder.DeleteFile(); | ||
|
Comment on lines
+62
to
+63
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should emit visible error message telling end user that saving minidump has failed instead of silently fail and remove minidump file.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll have to get the patch, it's one of my SBSaveCore API changes, but we now print the error when Plugin Manager returns, we could print twice, one specific for minidump |
||
| } | ||
|
|
||
| void SetSuccess() { m_success = true; } | ||
|
|
||
| private: | ||
| MinidumpFileBuilder &m_builder; | ||
| bool m_success = false; | ||
| }; | ||
|
|
||
| bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp, | ||
| lldb_private::SaveCoreOptions &options, | ||
| lldb_private::Status &error) { | ||
|
|
@@ -75,6 +90,7 @@ bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp, | |
| } | ||
| MinidumpFileBuilder builder(std::move(maybe_core_file.get()), process_sp, | ||
| options); | ||
| SaveCoreRequest request(builder); | ||
|
|
||
| Log *log = GetLog(LLDBLog::Object); | ||
| error = builder.AddHeaderAndCalculateDirectories(); | ||
|
|
@@ -133,5 +149,7 @@ bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp, | |
| return false; | ||
| } | ||
|
|
||
| request.SetSuccess(); | ||
|
|
||
| return true; | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per our naming convention, let's call this RAII class
FileRemoveHolder/DumpFailRemoveHolderor something similar, then the reader immediately know it is a RAII class. The currentSaveCoreRequestis not indicating its purpose.