[Lldb-commits] [lldb] [LLDB][SaveCore] Add SBCoreDumpOptions Object, and SBProcess::SaveCore() overload (PR #98403)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 10 22:57:53 PDT 2024
================
@@ -0,0 +1,59 @@
+//===-- SBCoreDumpOptions.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_SBCOREDUMPOPTIONS_H
+#define LLDB_API_SBCOREDUMPOPTIONS_H
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/Symbol/CoreDumpOptions.h"
+
+namespace lldb {
+
+class LLDB_API SBCoreDumpOptions {
+public:
+ SBCoreDumpOptions(const char *filePath);
+ SBCoreDumpOptions(const lldb::SBCoreDumpOptions &rhs);
+ ~SBCoreDumpOptions() = default;
+
+ const SBCoreDumpOptions &operator=(const lldb::SBCoreDumpOptions &rhs);
+
+ /// Set the Core dump plugin name.
+ ///
+ /// \param plugin Name of the object file plugin.
+ void SetCoreDumpPluginName(const char *plugin);
+
+ /// Get the Core dump plugin name, if set.
+ ///
+ /// \return The name of the plugin, or nullopt if not set.
+ const std::optional<const char *> GetCoreDumpPluginName() const;
----------------
clayborg wrote:
Jason is right: no std::optional in the public API. The std::optional should only be used in the internal lldb_private::CoreDumpOptions and the accessors for lldb_private::CoreDumpOptions should not return std::optional either, it should use it to return something like:
```
return m_optional.value_or(<default-value>);
```
The std::optional stuff is there just so we know when a user has set an option value in a command or on via the API. If the value hasn't been set, then we return a good default value.
This function should return `NULL` if there is no value.
https://github.com/llvm/llvm-project/pull/98403
More information about the lldb-commits
mailing list