Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===-- SBSaveCoreOptions.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_API_SBSAVECOREOPTIONS_H
0010 #define LLDB_API_SBSAVECOREOPTIONS_H
0011 
0012 #include "lldb/API/SBDefines.h"
0013 #include "lldb/API/SBError.h"
0014 #include "lldb/API/SBFileSpec.h"
0015 #include "lldb/API/SBProcess.h"
0016 #include "lldb/API/SBThread.h"
0017 #include "lldb/API/SBThreadCollection.h"
0018 
0019 namespace lldb {
0020 
0021 class LLDB_API SBSaveCoreOptions {
0022 public:
0023   SBSaveCoreOptions();
0024   SBSaveCoreOptions(const lldb::SBSaveCoreOptions &rhs);
0025   ~SBSaveCoreOptions();
0026 
0027   const SBSaveCoreOptions &operator=(const lldb::SBSaveCoreOptions &rhs);
0028 
0029   /// Set the plugin name. Supplying null or empty string will reset
0030   /// the option.
0031   ///
0032   /// \param plugin
0033   ///   Name of the object file plugin.
0034   SBError SetPluginName(const char *plugin);
0035 
0036   /// Get the Core dump plugin name, if set.
0037   ///
0038   /// \return
0039   ///   The name of the plugin, or null if not set.
0040   const char *GetPluginName() const;
0041 
0042   /// Set the Core dump style.
0043   ///
0044   /// \param style
0045   ///   The style of the core dump.
0046   void SetStyle(lldb::SaveCoreStyle style);
0047 
0048   /// Get the Core dump style, if set.
0049   ///
0050   /// \return
0051   ///   The core dump style, or undefined if not set.
0052   lldb::SaveCoreStyle GetStyle() const;
0053 
0054   /// Set the output file path
0055   ///
0056   /// \param
0057   ///   output_file a \class SBFileSpec object that describes the output file.
0058   void SetOutputFile(SBFileSpec output_file);
0059 
0060   /// Get the output file spec
0061   ///
0062   /// \return
0063   ///   The output file spec.
0064   SBFileSpec GetOutputFile() const;
0065 
0066   /// Set the process to save, or unset if supplied with a default constructed
0067   /// process.
0068   ///
0069   /// \param process
0070   ///   The process to save.
0071   ///
0072   /// \return
0073   ///   Success if process was set, otherwise an error
0074   ///
0075   /// \note
0076   ///   This will clear all process specific options if a different process
0077   ///   is specified than the current set process, either explicitly from this
0078   ///   api, or implicitly from any function that requires a process.
0079   SBError SetProcess(lldb::SBProcess process);
0080 
0081   /// Add a thread to save in the core file.
0082   ///
0083   /// \param thread
0084   ///   The thread to save.
0085   ///
0086   /// \note
0087   ///   This will set the process if it is not already set, or return
0088   ///   and error if the SBThread is not from the set process.
0089   SBError AddThread(lldb::SBThread thread);
0090 
0091   /// Remove a thread from the list of threads to save.
0092   ///
0093   /// \param thread
0094   ///   The thread to remove.
0095   ///
0096   /// \return
0097   ///   True if the thread was removed, false if it was not in the list.
0098   bool RemoveThread(lldb::SBThread thread);
0099 
0100   /// Add a memory region to save in the core file.
0101   ///
0102   /// \param region
0103   ///   The memory region to save.
0104   ///
0105   /// \returns
0106   ///   An empty SBError upon success, or an error if the region is invalid.
0107   ///
0108   /// \note
0109   ///   Ranges that overlapped will be unioned into a single region, this also
0110   ///   supercedes stack minification. Specifying full regions and a non-custom
0111   ///   core style will include the specified regions and union them with all
0112   ///   style specific regions.
0113   SBError AddMemoryRegionToSave(const SBMemoryRegionInfo &region);
0114 
0115   /// Get an unsorted copy of all threads to save
0116   ///
0117   /// \returns
0118   ///   An unsorted copy of all threads to save. If no process is specified
0119   ///   an empty collection will be returned.
0120   SBThreadCollection GetThreadsToSave() const;
0121 
0122   /// Reset all options.
0123   void Clear();
0124 
0125 protected:
0126   friend class SBProcess;
0127   friend class SBThreadCollection;
0128   lldb_private::SaveCoreOptions &ref() const;
0129 
0130 private:
0131   std::unique_ptr<lldb_private::SaveCoreOptions> m_opaque_up;
0132 }; // SBSaveCoreOptions
0133 } // namespace lldb
0134 
0135 #endif // LLDB_API_SBSAVECOREOPTIONS_H