[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,42 @@
+//===-- CoreDumpOptions.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_COREDUMPOPTIONS_H
+#define LLDB_SOURCE_PLUGINS_OBJECTFILE_COREDUMPOPTIONS_H
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/lldb-forward.h"
+#include "lldb/lldb-types.h"
+
+#include <optional>
+#include <string>
+
+namespace lldb_private {
+
+class CoreDumpOptions {
+public:
+  CoreDumpOptions(const lldb_private::FileSpec &fspec)
+      : m_core_dump_file(std::move(fspec)){};
+  ~CoreDumpOptions() = default;
+
+  void SetCoreDumpPluginName(llvm::StringRef name);
+  std::optional<llvm::StringRef> GetCoreDumpPluginName() const;
+
+  void SetCoreDumpStyle(lldb::SaveCoreStyle style);
+  lldb::SaveCoreStyle GetCoreDumpStyle() const;
+
+  const lldb_private::FileSpec &GetOutputFile() const;
+
+private:
+  std::optional<std::string> m_core_dump_plugin_name;
+  const lldb_private::FileSpec m_core_dump_file;
----------------
clayborg wrote:

Remove `const` and change `m_core_dump_file ` to `m_file`. This is a CoreDumpOptions class so no need to repeat the name here in the instance variable.

https://github.com/llvm/llvm-project/pull/98403


More information about the lldb-commits mailing list