diff options
Diffstat (limited to 'include/lldb/API')
-rw-r--r-- | include/lldb/API/LLDB.h | 3 | ||||
-rw-r--r-- | include/lldb/API/SBCommandReturnObject.h | 52 | ||||
-rw-r--r-- | include/lldb/API/SBDebugger.h | 27 | ||||
-rw-r--r-- | include/lldb/API/SBDefines.h | 1 | ||||
-rw-r--r-- | include/lldb/API/SBError.h | 1 | ||||
-rw-r--r-- | include/lldb/API/SBFile.h | 47 | ||||
-rw-r--r-- | include/lldb/API/SBInstruction.h | 4 | ||||
-rw-r--r-- | include/lldb/API/SBInstructionList.h | 6 | ||||
-rw-r--r-- | include/lldb/API/SBProcess.h | 4 | ||||
-rw-r--r-- | include/lldb/API/SBStream.h | 4 | ||||
-rw-r--r-- | include/lldb/API/SBStructuredData.h | 2 | ||||
-rw-r--r-- | include/lldb/API/SBThread.h | 4 | ||||
-rw-r--r-- | include/lldb/API/SBThreadPlan.h | 6 |
13 files changed, 142 insertions, 19 deletions
diff --git a/include/lldb/API/LLDB.h b/include/lldb/API/LLDB.h index 0806ab700a94..75e2d70c0c39 100644 --- a/include/lldb/API/LLDB.h +++ b/include/lldb/API/LLDB.h @@ -13,8 +13,8 @@ #include "lldb/API/SBAttachInfo.h" #include "lldb/API/SBBlock.h" #include "lldb/API/SBBreakpoint.h" -#include "lldb/API/SBBreakpointName.h" #include "lldb/API/SBBreakpointLocation.h" +#include "lldb/API/SBBreakpointName.h" #include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBCommandInterpreter.h" #include "lldb/API/SBCommandReturnObject.h" @@ -28,6 +28,7 @@ #include "lldb/API/SBEvent.h" #include "lldb/API/SBExecutionContext.h" #include "lldb/API/SBExpressionOptions.h" +#include "lldb/API/SBFile.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFileSpecList.h" #include "lldb/API/SBFrame.h" diff --git a/include/lldb/API/SBCommandReturnObject.h b/include/lldb/API/SBCommandReturnObject.h index 2877afb9b8b0..e3fbacf85afc 100644 --- a/include/lldb/API/SBCommandReturnObject.h +++ b/include/lldb/API/SBCommandReturnObject.h @@ -15,23 +15,27 @@ #include "lldb/API/SBDefines.h" +namespace lldb_private { +class SBCommandReturnObjectImpl; +} + namespace lldb { class LLDB_API SBCommandReturnObject { public: SBCommandReturnObject(); + SBCommandReturnObject(lldb_private::CommandReturnObject &ref); + + // rvalue ctor+assignment are incompatible with Reproducers. + SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs); ~SBCommandReturnObject(); - const lldb::SBCommandReturnObject & + lldb::SBCommandReturnObject & operator=(const lldb::SBCommandReturnObject &rhs); - SBCommandReturnObject(lldb_private::CommandReturnObject *ptr); - - lldb_private::CommandReturnObject *Release(); - explicit operator bool() const; bool IsValid() const; @@ -40,13 +44,21 @@ public: const char *GetError(); - size_t PutOutput(FILE *fh); + size_t PutOutput(FILE *fh); // DEPRECATED + + size_t PutOutput(SBFile file); + + size_t PutOutput(FileSP file); size_t GetOutputSize(); size_t GetErrorSize(); - size_t PutError(FILE *fh); + size_t PutError(FILE *fh); // DEPRECATED + + size_t PutError(SBFile file); + + size_t PutError(FileSP file); void Clear(); @@ -64,14 +76,21 @@ public: bool GetDescription(lldb::SBStream &description); - // deprecated, these two functions do not take ownership of file handle - void SetImmediateOutputFile(FILE *fh); + void SetImmediateOutputFile(FILE *fh); // DEPRECATED - void SetImmediateErrorFile(FILE *fh); + void SetImmediateErrorFile(FILE *fh); // DEPRECATED - void SetImmediateOutputFile(FILE *fh, bool transfer_ownership); + void SetImmediateOutputFile(FILE *fh, bool transfer_ownership); // DEPRECATED - void SetImmediateErrorFile(FILE *fh, bool transfer_ownership); + void SetImmediateErrorFile(FILE *fh, bool transfer_ownership); // DEPRECATED + + void SetImmediateOutputFile(SBFile file); + + void SetImmediateErrorFile(SBFile file); + + void SetImmediateOutputFile(FileSP file); + + void SetImmediateErrorFile(FileSP file); void PutCString(const char *string, int len = -1); @@ -86,6 +105,9 @@ public: void SetError(const char *error_cstr); + // ref() is internal for LLDB only. + lldb_private::CommandReturnObject &ref() const; + protected: friend class SBCommandInterpreter; friend class SBOptions; @@ -96,12 +118,8 @@ protected: lldb_private::CommandReturnObject &operator*() const; - lldb_private::CommandReturnObject &ref() const; - - void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr); - private: - std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_up; + std::unique_ptr<lldb_private::SBCommandReturnObjectImpl> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBDebugger.h b/include/lldb/API/SBDebugger.h index 417cead24a8c..580f6281fbb6 100644 --- a/include/lldb/API/SBDebugger.h +++ b/include/lldb/API/SBDebugger.h @@ -88,6 +88,24 @@ public: FILE *GetErrorFileHandle(); + SBError SetInputFile(SBFile file); + + SBError SetOutputFile(SBFile file); + + SBError SetErrorFile(SBFile file); + + SBError SetInputFile(FileSP file); + + SBError SetOutputFile(FileSP file); + + SBError SetErrorFile(FileSP file); + + SBFile GetInputFile(); + + SBFile GetOutputFile(); + + SBFile GetErrorFile(); + void SaveInputTerminalState(); void RestoreInputTerminalState(); @@ -99,7 +117,14 @@ public: lldb::SBListener GetListener(); void HandleProcessEvent(const lldb::SBProcess &process, - const lldb::SBEvent &event, FILE *out, FILE *err); + const lldb::SBEvent &event, FILE *out, + FILE *err); // DEPRECATED + + void HandleProcessEvent(const lldb::SBProcess &process, + const lldb::SBEvent &event, SBFile out, SBFile err); + + void HandleProcessEvent(const lldb::SBProcess &process, + const lldb::SBEvent &event, FileSP out, FileSP err); lldb::SBTarget CreateTarget(const char *filename, const char *target_triple, const char *platform_name, diff --git a/include/lldb/API/SBDefines.h b/include/lldb/API/SBDefines.h index 838c84cece6d..68aca930d199 100644 --- a/include/lldb/API/SBDefines.h +++ b/include/lldb/API/SBDefines.h @@ -41,6 +41,7 @@ class LLDB_API SBEvent; class LLDB_API SBEventList; class LLDB_API SBExecutionContext; class LLDB_API SBExpressionOptions; +class LLDB_API SBFile; class LLDB_API SBFileSpec; class LLDB_API SBFileSpecList; class LLDB_API SBFrame; diff --git a/include/lldb/API/SBError.h b/include/lldb/API/SBError.h index b076f87b7669..3db2658d9fb7 100644 --- a/include/lldb/API/SBError.h +++ b/include/lldb/API/SBError.h @@ -70,6 +70,7 @@ protected: friend class SBTrace; friend class SBValue; friend class SBWatchpoint; + friend class SBFile; lldb_private::Status *get(); diff --git a/include/lldb/API/SBFile.h b/include/lldb/API/SBFile.h new file mode 100644 index 000000000000..7d6c14809923 --- /dev/null +++ b/include/lldb/API/SBFile.h @@ -0,0 +1,47 @@ +//===-- SBFile.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_SBFile_h_ +#define LLDB_SBFile_h_ + +#include "lldb/API/SBDefines.h" + +namespace lldb { + +class LLDB_API SBFile { + friend class SBInstruction; + friend class SBInstructionList; + friend class SBDebugger; + friend class SBCommandReturnObject; + friend class SBProcess; + +public: + SBFile(); + SBFile(FileSP file_sp); + SBFile(FILE *file, bool transfer_ownership); + SBFile(int fd, const char *mode, bool transfer_ownership); + ~SBFile(); + + SBError Read(uint8_t *buf, size_t num_bytes, size_t *bytes_read); + SBError Write(const uint8_t *buf, size_t num_bytes, size_t *bytes_written); + SBError Flush(); + bool IsValid() const; + SBError Close(); + + operator bool() const; + bool operator!() const; + + FileSP GetFile() const; + +private: + FileSP m_opaque_sp; +}; + +} // namespace lldb + +#endif // LLDB_SBFile_h_ diff --git a/include/lldb/API/SBInstruction.h b/include/lldb/API/SBInstruction.h index 0bb587795607..7d83a37ba5d6 100644 --- a/include/lldb/API/SBInstruction.h +++ b/include/lldb/API/SBInstruction.h @@ -55,6 +55,10 @@ public: void Print(FILE *out); + void Print(SBFile out); + + void Print(FileSP out); + bool GetDescription(lldb::SBStream &description); bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options); diff --git a/include/lldb/API/SBInstructionList.h b/include/lldb/API/SBInstructionList.h index 4434d50f471f..e203d0b80564 100644 --- a/include/lldb/API/SBInstructionList.h +++ b/include/lldb/API/SBInstructionList.h @@ -46,6 +46,10 @@ public: void Print(FILE *out); + void Print(SBFile out); + + void Print(FileSP out); + bool GetDescription(lldb::SBStream &description); bool DumpEmulationForAllInstructions(const char *triple); @@ -56,6 +60,8 @@ protected: friend class SBTarget; void SetDisassembler(const lldb::DisassemblerSP &opaque_sp); + bool GetDescription(lldb_private::Stream &description); + private: lldb::DisassemblerSP m_opaque_sp; diff --git a/include/lldb/API/SBProcess.h b/include/lldb/API/SBProcess.h index 863cb3ced674..8ab8bfa3a93e 100644 --- a/include/lldb/API/SBProcess.h +++ b/include/lldb/API/SBProcess.h @@ -67,6 +67,10 @@ public: void ReportEventState(const lldb::SBEvent &event, FILE *out) const; + void ReportEventState(const lldb::SBEvent &event, SBFile file) const; + + void ReportEventState(const lldb::SBEvent &event, FileSP file) const; + void AppendEventStateReport(const lldb::SBEvent &event, lldb::SBCommandReturnObject &result); diff --git a/include/lldb/API/SBStream.h b/include/lldb/API/SBStream.h index 8afbf4575621..b78c498e5f3d 100644 --- a/include/lldb/API/SBStream.h +++ b/include/lldb/API/SBStream.h @@ -39,6 +39,10 @@ public: void RedirectToFile(const char *path, bool append); + void RedirectToFile(lldb::SBFile file); + + void RedirectToFile(lldb::FileSP file); + void RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership); void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership); diff --git a/include/lldb/API/SBStructuredData.h b/include/lldb/API/SBStructuredData.h index 5b10133500ef..a090272e45ac 100644 --- a/include/lldb/API/SBStructuredData.h +++ b/include/lldb/API/SBStructuredData.h @@ -91,6 +91,8 @@ protected: friend class SBTraceOptions; friend class SBDebugger; friend class SBTarget; + friend class SBThread; + friend class SBThreadPlan; StructuredDataImplUP m_impl_up; }; diff --git a/include/lldb/API/SBThread.h b/include/lldb/API/SBThread.h index da8726a2a9b2..b5f1794f9fe0 100644 --- a/include/lldb/API/SBThread.h +++ b/include/lldb/API/SBThread.h @@ -122,6 +122,10 @@ public: SBError StepUsingScriptedThreadPlan(const char *script_class_name, bool resume_immediately); + SBError StepUsingScriptedThreadPlan(const char *script_class_name, + lldb::SBStructuredData &args_data, + bool resume_immediately); + SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line); void RunToAddress(lldb::addr_t addr); diff --git a/include/lldb/API/SBThreadPlan.h b/include/lldb/API/SBThreadPlan.h index 007e9e2de21a..dbe417e63749 100644 --- a/include/lldb/API/SBThreadPlan.h +++ b/include/lldb/API/SBThreadPlan.h @@ -28,6 +28,9 @@ public: SBThreadPlan(lldb::SBThread &thread, const char *class_name); + SBThreadPlan(lldb::SBThread &thread, const char *class_name, + lldb::SBStructuredData &args_data); + ~SBThreadPlan(); explicit operator bool() const; @@ -100,6 +103,9 @@ public: SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name); SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name, SBError &error); + SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name, + lldb::SBStructuredData &args_data, + SBError &error); private: friend class SBBreakpoint; |