-
Notifications
You must be signed in to change notification settings - Fork 15.7k
[LLDB][SaveCore] Add SBSaveCoreOptions Object, and SBProcess::SaveCore() overload #98403
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4752ada
Create CoreDumpOption class, and SB equivalent
Jlalond 3acae92
Finish all the plumbing and successfully migrate TestProcessSaveCoreM…
Jlalond e842579
Add descriptions to sbcoredumpoptions methods. Run git-clang-format
Jlalond 2673674
Code review feedback on all API's, fix tests, and remove default beha…
Jlalond 92bc0b3
Code review feedback. Run git-clang-format. Run Python Format
Jlalond d4d702d
Revert TestMinidump.py as it only had a line added, and assign the er…
Jlalond 117d71a
Add omitted test description
Jlalond 06c0538
Have SBProcess savecore always call the method with core dump options…
Jlalond 21df337
Further code review feedback and formatting.
Jlalond b2f6d60
Another round of feedback, remove instrumentation and reorder private…
Jlalond 1785ad3
Add the error string that Greg recommended after I had saved changes …
Jlalond 6edb284
Rename every to SaveCoreOptions, fix null string setting the optional…
Jlalond 1e95cc7
Fix upper case and return error if plugin name returns an error
Jlalond d555d84
Fix test that got accidentally set to error.success()
Jlalond File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| //===-- SBSaveCoreOptions.h -------------------------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLDB_API_SBSaveCoreOPTIONS_H | ||
| #define LLDB_API_SBSaveCoreOPTIONS_H | ||
|
|
||
| #include "lldb/API/SBDefines.h" | ||
| #include "lldb/Symbol/SaveCoreOptions.h" | ||
|
|
||
| namespace lldb { | ||
|
|
||
| class LLDB_API SBSaveCoreOptions { | ||
| public: | ||
| SBSaveCoreOptions(); | ||
| SBSaveCoreOptions(const lldb::SBSaveCoreOptions &rhs); | ||
| ~SBSaveCoreOptions() = default; | ||
|
|
||
| const SBSaveCoreOptions &operator=(const lldb::SBSaveCoreOptions &rhs); | ||
|
|
||
| /// Set the plugin name. Supplying null or empty string will reset | ||
| /// the option. | ||
| /// | ||
| /// \param plugin Name of the object file plugin. | ||
| SBError SetPluginName(const char *plugin); | ||
|
|
||
| /// Get the Core dump plugin name, if set. | ||
| /// | ||
| /// \return The name of the plugin, or null if not set. | ||
| const char *GetPluginName() const; | ||
|
|
||
| /// Set the Core dump style. | ||
| /// | ||
| /// \param style The style of the core dump. | ||
| void SetStyle(lldb::SaveCoreStyle style); | ||
|
|
||
| /// Get the Core dump style, if set. | ||
| /// | ||
| /// \return The core dump style, or undefined if not set. | ||
| lldb::SaveCoreStyle GetStyle() const; | ||
|
|
||
| /// Set the output file path | ||
| /// | ||
| /// \param output_file a | ||
| /// \class SBFileSpec object that describes the output file. | ||
| void SetOutputFile(SBFileSpec output_file); | ||
|
|
||
| /// Get the output file spec | ||
| /// | ||
| /// \return The output file spec. | ||
| SBFileSpec GetOutputFile() const; | ||
|
|
||
| /// Reset all options. | ||
| void Clear(); | ||
|
|
||
| protected: | ||
| friend class SBProcess; | ||
| lldb_private::SaveCoreOptions &ref() const; | ||
|
|
||
| private: | ||
| std::unique_ptr<lldb_private::SaveCoreOptions> m_opaque_up; | ||
| }; // SBSaveCoreOptions | ||
| } // namespace lldb | ||
|
|
||
| #endif // LLDB_API_SBSaveCoreOPTIONS_H | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| //===-- SaveCoreOptions.h ---------------------------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_SaveCoreOPTIONS_H | ||
| #define LLDB_SOURCE_PLUGINS_OBJECTFILE_SaveCoreOPTIONS_H | ||
|
|
||
| #include "lldb/Utility/FileSpec.h" | ||
| #include "lldb/lldb-forward.h" | ||
| #include "lldb/lldb-types.h" | ||
|
|
||
| #include <optional> | ||
| #include <string> | ||
|
|
||
| namespace lldb_private { | ||
|
|
||
| class SaveCoreOptions { | ||
| public: | ||
| SaveCoreOptions(){}; | ||
| ~SaveCoreOptions() = default; | ||
|
|
||
| lldb_private::Status SetPluginName(const char *name); | ||
| std::optional<std::string> GetPluginName() const; | ||
|
|
||
| void SetStyle(lldb::SaveCoreStyle style); | ||
| lldb::SaveCoreStyle GetStyle() const; | ||
|
|
||
| void SetOutputFile(lldb_private::FileSpec file); | ||
| const std::optional<lldb_private::FileSpec> GetOutputFile() const; | ||
|
|
||
| void Clear(); | ||
|
|
||
| private: | ||
| std::optional<std::string> m_plugin_name; | ||
| std::optional<lldb_private::FileSpec> m_file; | ||
| std::optional<lldb::SaveCoreStyle> m_style; | ||
| }; | ||
| } // namespace lldb_private | ||
|
|
||
| #endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_SaveCoreOPTIONS_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| //===-- SBSaveCoreOptions.cpp -----------------------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "lldb/API/SBSaveCoreOptions.h" | ||
| #include "lldb/API/SBError.h" | ||
| #include "lldb/API/SBFileSpec.h" | ||
| #include "lldb/Host/FileSystem.h" | ||
| #include "lldb/Symbol/SaveCoreOptions.h" | ||
| #include "lldb/Utility/Instrumentation.h" | ||
|
|
||
| #include "Utils.h" | ||
|
|
||
| using namespace lldb; | ||
|
|
||
| SBSaveCoreOptions::SBSaveCoreOptions() { | ||
| LLDB_INSTRUMENT_VA(this) | ||
|
|
||
| m_opaque_up = std::make_unique<lldb_private::SaveCoreOptions>(); | ||
| } | ||
|
|
||
| SBSaveCoreOptions::SBSaveCoreOptions(const SBSaveCoreOptions &rhs) { | ||
| LLDB_INSTRUMENT_VA(this, rhs); | ||
|
|
||
| m_opaque_up = clone(rhs.m_opaque_up); | ||
| } | ||
|
|
||
| const SBSaveCoreOptions & | ||
| SBSaveCoreOptions::operator=(const SBSaveCoreOptions &rhs) { | ||
| LLDB_INSTRUMENT_VA(this, rhs); | ||
|
|
||
| if (this != &rhs) | ||
| m_opaque_up = clone(rhs.m_opaque_up); | ||
| return *this; | ||
| } | ||
|
|
||
| SBError SBSaveCoreOptions::SetPluginName(const char *name) { | ||
| LLDB_INSTRUMENT_VA(this, name); | ||
| lldb_private::Status error = m_opaque_up->SetPluginName(name); | ||
| return SBError(error); | ||
| } | ||
|
|
||
| void SBSaveCoreOptions::SetStyle(lldb::SaveCoreStyle style) { | ||
| LLDB_INSTRUMENT_VA(this, style); | ||
| m_opaque_up->SetStyle(style); | ||
| } | ||
|
|
||
| void SBSaveCoreOptions::SetOutputFile(lldb::SBFileSpec file_spec) { | ||
| LLDB_INSTRUMENT_VA(this, file_spec); | ||
| m_opaque_up->SetOutputFile(file_spec.ref()); | ||
| } | ||
|
|
||
| const char *SBSaveCoreOptions::GetPluginName() const { | ||
| LLDB_INSTRUMENT_VA(this); | ||
| const auto name = m_opaque_up->GetPluginName(); | ||
| if (!name) | ||
| return nullptr; | ||
| return lldb_private::ConstString(name.value()).GetCString(); | ||
| } | ||
|
|
||
| SBFileSpec SBSaveCoreOptions::GetOutputFile() const { | ||
| LLDB_INSTRUMENT_VA(this); | ||
| const auto file_spec = m_opaque_up->GetOutputFile(); | ||
| if (file_spec) | ||
| return SBFileSpec(file_spec.value()); | ||
| return SBFileSpec(); | ||
| } | ||
|
|
||
| lldb::SaveCoreStyle SBSaveCoreOptions::GetStyle() const { | ||
| LLDB_INSTRUMENT_VA(this); | ||
| return m_opaque_up->GetStyle(); | ||
| } | ||
|
|
||
| void SBSaveCoreOptions::Clear() { | ||
| LLDB_INSTRUMENT_VA(this); | ||
| m_opaque_up->Clear(); | ||
| } | ||
|
|
||
| lldb_private::SaveCoreOptions &SBSaveCoreOptions::ref() const { | ||
| return *m_opaque_up.get(); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.