Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:52

0001 //===-- SaveCoreOptions.h ---------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_SaveCoreOPTIONS_H
0010 #define LLDB_SOURCE_PLUGINS_OBJECTFILE_SaveCoreOPTIONS_H
0011 
0012 #include "lldb/Target/ThreadCollection.h"
0013 #include "lldb/Utility/FileSpec.h"
0014 #include "lldb/Utility/RangeMap.h"
0015 
0016 #include <optional>
0017 #include <string>
0018 #include <unordered_set>
0019 
0020 using MemoryRanges = lldb_private::RangeVector<lldb::addr_t, lldb::addr_t>;
0021 
0022 namespace lldb_private {
0023 
0024 class SaveCoreOptions {
0025 public:
0026   SaveCoreOptions(){};
0027   ~SaveCoreOptions() = default;
0028 
0029   lldb_private::Status SetPluginName(const char *name);
0030   std::optional<std::string> GetPluginName() const;
0031 
0032   void SetStyle(lldb::SaveCoreStyle style);
0033   lldb::SaveCoreStyle GetStyle() const;
0034 
0035   void SetOutputFile(lldb_private::FileSpec file);
0036   const std::optional<lldb_private::FileSpec> GetOutputFile() const;
0037 
0038   Status SetProcess(lldb::ProcessSP process_sp);
0039 
0040   Status AddThread(lldb::ThreadSP thread_sp);
0041   bool RemoveThread(lldb::ThreadSP thread_sp);
0042   bool ShouldThreadBeSaved(lldb::tid_t tid) const;
0043   bool HasSpecifiedThreads() const;
0044 
0045   Status EnsureValidConfiguration(lldb::ProcessSP process_sp) const;
0046   const MemoryRanges &GetCoreFileMemoryRanges() const;
0047 
0048   void AddMemoryRegionToSave(const lldb_private::MemoryRegionInfo &region);
0049 
0050   lldb_private::ThreadCollection::collection GetThreadsToSave() const;
0051 
0052   void Clear();
0053 
0054 private:
0055   void ClearProcessSpecificData();
0056 
0057   std::optional<std::string> m_plugin_name;
0058   std::optional<lldb_private::FileSpec> m_file;
0059   std::optional<lldb::SaveCoreStyle> m_style;
0060   lldb::ProcessSP m_process_sp;
0061   std::unordered_set<lldb::tid_t> m_threads_to_save;
0062   MemoryRanges m_regions_to_save;
0063 };
0064 } // namespace lldb_private
0065 
0066 #endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_SAVECOREOPTIONS_H