Merge ^/vendor/lldb/dist up to its last change, and resolve conflicts.
This commit is contained in:
commit
9dba64be95
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/clang1000-import/; revision=357058
@ -149,6 +149,6 @@ The LLDB project page http://lldb.llvm.org/ has many different resources for
|
|||||||
users -- the gdb/lldb command equivalence page http://lldb.llvm.org/lldb-gdb.html can
|
users -- the gdb/lldb command equivalence page http://lldb.llvm.org/lldb-gdb.html can
|
||||||
be especially helpful for users coming from gdb.
|
be especially helpful for users coming from gdb.
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
To report bugs, please visit http://llvm.org/bugs/
|
To report bugs, please visit https://bugs.llvm.org/
|
||||||
.Sh AUTHOR
|
.Sh AUTHOR
|
||||||
Maintained by the LLDB Team, http://lldb.llvm.org/
|
Maintained by the LLDB Team, http://lldb.llvm.org/
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
#include "lldb/API/SBAttachInfo.h"
|
#include "lldb/API/SBAttachInfo.h"
|
||||||
#include "lldb/API/SBBlock.h"
|
#include "lldb/API/SBBlock.h"
|
||||||
#include "lldb/API/SBBreakpoint.h"
|
#include "lldb/API/SBBreakpoint.h"
|
||||||
#include "lldb/API/SBBreakpointName.h"
|
|
||||||
#include "lldb/API/SBBreakpointLocation.h"
|
#include "lldb/API/SBBreakpointLocation.h"
|
||||||
|
#include "lldb/API/SBBreakpointName.h"
|
||||||
#include "lldb/API/SBBroadcaster.h"
|
#include "lldb/API/SBBroadcaster.h"
|
||||||
#include "lldb/API/SBCommandInterpreter.h"
|
#include "lldb/API/SBCommandInterpreter.h"
|
||||||
#include "lldb/API/SBCommandReturnObject.h"
|
#include "lldb/API/SBCommandReturnObject.h"
|
||||||
@ -28,6 +28,7 @@
|
|||||||
#include "lldb/API/SBEvent.h"
|
#include "lldb/API/SBEvent.h"
|
||||||
#include "lldb/API/SBExecutionContext.h"
|
#include "lldb/API/SBExecutionContext.h"
|
||||||
#include "lldb/API/SBExpressionOptions.h"
|
#include "lldb/API/SBExpressionOptions.h"
|
||||||
|
#include "lldb/API/SBFile.h"
|
||||||
#include "lldb/API/SBFileSpec.h"
|
#include "lldb/API/SBFileSpec.h"
|
||||||
#include "lldb/API/SBFileSpecList.h"
|
#include "lldb/API/SBFileSpecList.h"
|
||||||
#include "lldb/API/SBFrame.h"
|
#include "lldb/API/SBFrame.h"
|
||||||
|
@ -15,23 +15,27 @@
|
|||||||
|
|
||||||
#include "lldb/API/SBDefines.h"
|
#include "lldb/API/SBDefines.h"
|
||||||
|
|
||||||
|
namespace lldb_private {
|
||||||
|
class SBCommandReturnObjectImpl;
|
||||||
|
}
|
||||||
|
|
||||||
namespace lldb {
|
namespace lldb {
|
||||||
|
|
||||||
class LLDB_API SBCommandReturnObject {
|
class LLDB_API SBCommandReturnObject {
|
||||||
public:
|
public:
|
||||||
SBCommandReturnObject();
|
SBCommandReturnObject();
|
||||||
|
|
||||||
|
SBCommandReturnObject(lldb_private::CommandReturnObject &ref);
|
||||||
|
|
||||||
|
// rvalue ctor+assignment are incompatible with Reproducers.
|
||||||
|
|
||||||
SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs);
|
SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs);
|
||||||
|
|
||||||
~SBCommandReturnObject();
|
~SBCommandReturnObject();
|
||||||
|
|
||||||
const lldb::SBCommandReturnObject &
|
lldb::SBCommandReturnObject &
|
||||||
operator=(const lldb::SBCommandReturnObject &rhs);
|
operator=(const lldb::SBCommandReturnObject &rhs);
|
||||||
|
|
||||||
SBCommandReturnObject(lldb_private::CommandReturnObject *ptr);
|
|
||||||
|
|
||||||
lldb_private::CommandReturnObject *Release();
|
|
||||||
|
|
||||||
explicit operator bool() const;
|
explicit operator bool() const;
|
||||||
|
|
||||||
bool IsValid() const;
|
bool IsValid() const;
|
||||||
@ -40,13 +44,21 @@ class LLDB_API SBCommandReturnObject {
|
|||||||
|
|
||||||
const char *GetError();
|
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 GetOutputSize();
|
||||||
|
|
||||||
size_t GetErrorSize();
|
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();
|
void Clear();
|
||||||
|
|
||||||
@ -64,14 +76,21 @@ class LLDB_API SBCommandReturnObject {
|
|||||||
|
|
||||||
bool GetDescription(lldb::SBStream &description);
|
bool GetDescription(lldb::SBStream &description);
|
||||||
|
|
||||||
// deprecated, these two functions do not take ownership of file handle
|
void SetImmediateOutputFile(FILE *fh); // DEPRECATED
|
||||||
void SetImmediateOutputFile(FILE *fh);
|
|
||||||
|
|
||||||
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);
|
void PutCString(const char *string, int len = -1);
|
||||||
|
|
||||||
@ -86,6 +105,9 @@ class LLDB_API SBCommandReturnObject {
|
|||||||
|
|
||||||
void SetError(const char *error_cstr);
|
void SetError(const char *error_cstr);
|
||||||
|
|
||||||
|
// ref() is internal for LLDB only.
|
||||||
|
lldb_private::CommandReturnObject &ref() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class SBCommandInterpreter;
|
friend class SBCommandInterpreter;
|
||||||
friend class SBOptions;
|
friend class SBOptions;
|
||||||
@ -96,12 +118,8 @@ class LLDB_API SBCommandReturnObject {
|
|||||||
|
|
||||||
lldb_private::CommandReturnObject &operator*() const;
|
lldb_private::CommandReturnObject &operator*() const;
|
||||||
|
|
||||||
lldb_private::CommandReturnObject &ref() const;
|
|
||||||
|
|
||||||
void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_up;
|
std::unique_ptr<lldb_private::SBCommandReturnObjectImpl> m_opaque_up;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace lldb
|
} // namespace lldb
|
||||||
|
@ -88,6 +88,24 @@ class LLDB_API SBDebugger {
|
|||||||
|
|
||||||
FILE *GetErrorFileHandle();
|
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 SaveInputTerminalState();
|
||||||
|
|
||||||
void RestoreInputTerminalState();
|
void RestoreInputTerminalState();
|
||||||
@ -99,7 +117,14 @@ class LLDB_API SBDebugger {
|
|||||||
lldb::SBListener GetListener();
|
lldb::SBListener GetListener();
|
||||||
|
|
||||||
void HandleProcessEvent(const lldb::SBProcess &process,
|
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,
|
lldb::SBTarget CreateTarget(const char *filename, const char *target_triple,
|
||||||
const char *platform_name,
|
const char *platform_name,
|
||||||
|
@ -41,6 +41,7 @@ class LLDB_API SBEvent;
|
|||||||
class LLDB_API SBEventList;
|
class LLDB_API SBEventList;
|
||||||
class LLDB_API SBExecutionContext;
|
class LLDB_API SBExecutionContext;
|
||||||
class LLDB_API SBExpressionOptions;
|
class LLDB_API SBExpressionOptions;
|
||||||
|
class LLDB_API SBFile;
|
||||||
class LLDB_API SBFileSpec;
|
class LLDB_API SBFileSpec;
|
||||||
class LLDB_API SBFileSpecList;
|
class LLDB_API SBFileSpecList;
|
||||||
class LLDB_API SBFrame;
|
class LLDB_API SBFrame;
|
||||||
|
@ -70,6 +70,7 @@ class LLDB_API SBError {
|
|||||||
friend class SBTrace;
|
friend class SBTrace;
|
||||||
friend class SBValue;
|
friend class SBValue;
|
||||||
friend class SBWatchpoint;
|
friend class SBWatchpoint;
|
||||||
|
friend class SBFile;
|
||||||
|
|
||||||
lldb_private::Status *get();
|
lldb_private::Status *get();
|
||||||
|
|
||||||
|
47
contrib/llvm-project/lldb/include/lldb/API/SBFile.h
Normal file
47
contrib/llvm-project/lldb/include/lldb/API/SBFile.h
Normal file
@ -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_
|
@ -55,6 +55,10 @@ class LLDB_API SBInstruction {
|
|||||||
|
|
||||||
void Print(FILE *out);
|
void Print(FILE *out);
|
||||||
|
|
||||||
|
void Print(SBFile out);
|
||||||
|
|
||||||
|
void Print(FileSP out);
|
||||||
|
|
||||||
bool GetDescription(lldb::SBStream &description);
|
bool GetDescription(lldb::SBStream &description);
|
||||||
|
|
||||||
bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
|
bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
|
||||||
|
@ -46,6 +46,10 @@ class LLDB_API SBInstructionList {
|
|||||||
|
|
||||||
void Print(FILE *out);
|
void Print(FILE *out);
|
||||||
|
|
||||||
|
void Print(SBFile out);
|
||||||
|
|
||||||
|
void Print(FileSP out);
|
||||||
|
|
||||||
bool GetDescription(lldb::SBStream &description);
|
bool GetDescription(lldb::SBStream &description);
|
||||||
|
|
||||||
bool DumpEmulationForAllInstructions(const char *triple);
|
bool DumpEmulationForAllInstructions(const char *triple);
|
||||||
@ -56,6 +60,8 @@ class LLDB_API SBInstructionList {
|
|||||||
friend class SBTarget;
|
friend class SBTarget;
|
||||||
|
|
||||||
void SetDisassembler(const lldb::DisassemblerSP &opaque_sp);
|
void SetDisassembler(const lldb::DisassemblerSP &opaque_sp);
|
||||||
|
bool GetDescription(lldb_private::Stream &description);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
lldb::DisassemblerSP m_opaque_sp;
|
lldb::DisassemblerSP m_opaque_sp;
|
||||||
|
@ -67,6 +67,10 @@ class LLDB_API SBProcess {
|
|||||||
|
|
||||||
void ReportEventState(const lldb::SBEvent &event, FILE *out) const;
|
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,
|
void AppendEventStateReport(const lldb::SBEvent &event,
|
||||||
lldb::SBCommandReturnObject &result);
|
lldb::SBCommandReturnObject &result);
|
||||||
|
|
||||||
|
@ -39,6 +39,10 @@ class LLDB_API SBStream {
|
|||||||
|
|
||||||
void RedirectToFile(const char *path, bool append);
|
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 RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership);
|
||||||
|
|
||||||
void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);
|
void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);
|
||||||
|
@ -91,6 +91,8 @@ class SBStructuredData {
|
|||||||
friend class SBTraceOptions;
|
friend class SBTraceOptions;
|
||||||
friend class SBDebugger;
|
friend class SBDebugger;
|
||||||
friend class SBTarget;
|
friend class SBTarget;
|
||||||
|
friend class SBThread;
|
||||||
|
friend class SBThreadPlan;
|
||||||
|
|
||||||
StructuredDataImplUP m_impl_up;
|
StructuredDataImplUP m_impl_up;
|
||||||
};
|
};
|
||||||
|
@ -122,6 +122,10 @@ class LLDB_API SBThread {
|
|||||||
SBError StepUsingScriptedThreadPlan(const char *script_class_name,
|
SBError StepUsingScriptedThreadPlan(const char *script_class_name,
|
||||||
bool resume_immediately);
|
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);
|
SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line);
|
||||||
|
|
||||||
void RunToAddress(lldb::addr_t addr);
|
void RunToAddress(lldb::addr_t addr);
|
||||||
|
@ -28,6 +28,9 @@ class LLDB_API SBThreadPlan {
|
|||||||
|
|
||||||
SBThreadPlan(lldb::SBThread &thread, const char *class_name);
|
SBThreadPlan(lldb::SBThread &thread, const char *class_name);
|
||||||
|
|
||||||
|
SBThreadPlan(lldb::SBThread &thread, const char *class_name,
|
||||||
|
lldb::SBStructuredData &args_data);
|
||||||
|
|
||||||
~SBThreadPlan();
|
~SBThreadPlan();
|
||||||
|
|
||||||
explicit operator bool() const;
|
explicit operator bool() const;
|
||||||
@ -100,6 +103,9 @@ class LLDB_API SBThreadPlan {
|
|||||||
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name);
|
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name);
|
||||||
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
|
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
|
||||||
SBError &error);
|
SBError &error);
|
||||||
|
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
|
||||||
|
lldb::SBStructuredData &args_data,
|
||||||
|
SBError &error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class SBBreakpoint;
|
friend class SBBreakpoint;
|
||||||
|
@ -67,7 +67,7 @@ class BreakpointLocation
|
|||||||
|
|
||||||
// The next section deals with various breakpoint options.
|
// The next section deals with various breakpoint options.
|
||||||
|
|
||||||
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
|
/// If \a enabled is \b true, enable the breakpoint, if \b false disable it.
|
||||||
void SetEnabled(bool enabled);
|
void SetEnabled(bool enabled);
|
||||||
|
|
||||||
/// Check the Enable/Disable state.
|
/// Check the Enable/Disable state.
|
||||||
|
@ -107,6 +107,12 @@ friend class Breakpoint;
|
|||||||
/// \param[in] ignore
|
/// \param[in] ignore
|
||||||
/// How many breakpoint hits we should ignore before stopping.
|
/// How many breakpoint hits we should ignore before stopping.
|
||||||
///
|
///
|
||||||
|
/// \param[in] one_shot
|
||||||
|
/// Should this breakpoint delete itself after being hit once.
|
||||||
|
///
|
||||||
|
/// \param[in] auto_continue
|
||||||
|
/// Should this breakpoint auto-continue after running its commands.
|
||||||
|
///
|
||||||
BreakpointOptions(const char *condition, bool enabled = true,
|
BreakpointOptions(const char *condition, bool enabled = true,
|
||||||
int32_t ignore = 0, bool one_shot = false,
|
int32_t ignore = 0, bool one_shot = false,
|
||||||
bool auto_continue = false);
|
bool auto_continue = false);
|
||||||
@ -319,7 +325,10 @@ friend class Breakpoint;
|
|||||||
|
|
||||||
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
|
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
|
||||||
|
|
||||||
/// Returns true if the breakpoint option has a callback set.
|
/// Check if the breakpoint option has a callback set.
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// If the breakpoint option has a callback, \b true otherwise \b false.
|
||||||
bool HasCallback() const;
|
bool HasCallback() const;
|
||||||
|
|
||||||
/// This is the default empty callback.
|
/// This is the default empty callback.
|
||||||
@ -367,22 +376,32 @@ friend class Breakpoint;
|
|||||||
void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up);
|
void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// For BreakpointOptions only
|
/// For BreakpointOptions only
|
||||||
BreakpointHitCallback m_callback; // This is the callback function pointer
|
|
||||||
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
|
/// This is the callback function pointer
|
||||||
|
BreakpointHitCallback m_callback;
|
||||||
|
/// This is the client data for the callback
|
||||||
|
lldb::BatonSP m_callback_baton_sp;
|
||||||
bool m_baton_is_command_baton;
|
bool m_baton_is_command_baton;
|
||||||
bool m_callback_is_synchronous;
|
bool m_callback_is_synchronous;
|
||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
|
/// If set, the breakpoint delete itself after being hit once.
|
||||||
bool m_one_shot;
|
bool m_one_shot;
|
||||||
uint32_t m_ignore_count; // Number of times to ignore this breakpoint
|
/// Number of times to ignore this breakpoint.
|
||||||
std::unique_ptr<ThreadSpec>
|
uint32_t m_ignore_count;
|
||||||
m_thread_spec_up; // Thread for which this breakpoint will take
|
/// Thread for which this breakpoint will stop.
|
||||||
std::string m_condition_text; // The condition to test.
|
std::unique_ptr<ThreadSpec> m_thread_spec_up;
|
||||||
size_t m_condition_text_hash; // Its hash, so that locations know when the
|
/// The condition to test.
|
||||||
// condition is updated.
|
std::string m_condition_text;
|
||||||
bool m_auto_continue; // If set, auto-continue from breakpoint.
|
/// Its hash, so that locations know when the condition is updated.
|
||||||
Flags m_set_flags; // Which options are set at this level. Drawn
|
size_t m_condition_text_hash;
|
||||||
// from BreakpointOptions::SetOptionsFlags.
|
/// If set, inject breakpoint condition into process.
|
||||||
|
bool m_inject_condition;
|
||||||
|
/// If set, auto-continue from breakpoint.
|
||||||
|
bool m_auto_continue;
|
||||||
|
/// Which options are set at this level.
|
||||||
|
/// Drawn from BreakpointOptions::SetOptionsFlags.
|
||||||
|
Flags m_set_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace lldb_private
|
} // namespace lldb_private
|
||||||
|
@ -41,8 +41,8 @@ class BreakpointResolverAddress : public BreakpointResolver {
|
|||||||
ModuleList &modules) override;
|
ModuleList &modules) override;
|
||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context, Address *addr,
|
SymbolContext &context,
|
||||||
bool containing) override;
|
Address *addr) override;
|
||||||
|
|
||||||
lldb::SearchDepth GetDepth() override;
|
lldb::SearchDepth GetDepth() override;
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ class BreakpointResolverFileLine : public BreakpointResolver {
|
|||||||
~BreakpointResolverFileLine() override;
|
~BreakpointResolverFileLine() override;
|
||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context, Address *addr,
|
SymbolContext &context,
|
||||||
bool containing) override;
|
Address *addr) override;
|
||||||
|
|
||||||
lldb::SearchDepth GetDepth() override;
|
lldb::SearchDepth GetDepth() override;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace lldb_private {
|
|||||||
class BreakpointResolverFileRegex : public BreakpointResolver {
|
class BreakpointResolverFileRegex : public BreakpointResolver {
|
||||||
public:
|
public:
|
||||||
BreakpointResolverFileRegex(
|
BreakpointResolverFileRegex(
|
||||||
Breakpoint *bkpt, RegularExpression ®ex,
|
Breakpoint *bkpt, RegularExpression regex,
|
||||||
const std::unordered_set<std::string> &func_name_set, bool exact_match);
|
const std::unordered_set<std::string> &func_name_set, bool exact_match);
|
||||||
|
|
||||||
static BreakpointResolver *
|
static BreakpointResolver *
|
||||||
@ -37,8 +37,8 @@ class BreakpointResolverFileRegex : public BreakpointResolver {
|
|||||||
~BreakpointResolverFileRegex() override;
|
~BreakpointResolverFileRegex() override;
|
||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context, Address *addr,
|
SymbolContext &context,
|
||||||
bool containing) override;
|
Address *addr) override;
|
||||||
|
|
||||||
lldb::SearchDepth GetDepth() override;
|
lldb::SearchDepth GetDepth() override;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class BreakpointResolverName : public BreakpointResolver {
|
|||||||
|
|
||||||
// Creates a function breakpoint by regular expression. Takes over control
|
// Creates a function breakpoint by regular expression. Takes over control
|
||||||
// of the lifespan of func_regex.
|
// of the lifespan of func_regex.
|
||||||
BreakpointResolverName(Breakpoint *bkpt, RegularExpression &func_regex,
|
BreakpointResolverName(Breakpoint *bkpt, RegularExpression func_regex,
|
||||||
lldb::LanguageType language, lldb::addr_t offset,
|
lldb::LanguageType language, lldb::addr_t offset,
|
||||||
bool skip_prologue);
|
bool skip_prologue);
|
||||||
|
|
||||||
@ -58,8 +58,8 @@ class BreakpointResolverName : public BreakpointResolver {
|
|||||||
~BreakpointResolverName() override;
|
~BreakpointResolverName() override;
|
||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context, Address *addr,
|
SymbolContext &context,
|
||||||
bool containing) override;
|
Address *addr) override;
|
||||||
|
|
||||||
lldb::SearchDepth GetDepth() override;
|
lldb::SearchDepth GetDepth() override;
|
||||||
|
|
||||||
|
@ -26,8 +26,7 @@ class BreakpointResolverScripted : public BreakpointResolver {
|
|||||||
BreakpointResolverScripted(Breakpoint *bkpt,
|
BreakpointResolverScripted(Breakpoint *bkpt,
|
||||||
const llvm::StringRef class_name,
|
const llvm::StringRef class_name,
|
||||||
lldb::SearchDepth depth,
|
lldb::SearchDepth depth,
|
||||||
StructuredDataImpl *args_data,
|
StructuredDataImpl *args_data);
|
||||||
ScriptInterpreter &script_interp);
|
|
||||||
|
|
||||||
~BreakpointResolverScripted() override;
|
~BreakpointResolverScripted() override;
|
||||||
|
|
||||||
@ -39,8 +38,8 @@ class BreakpointResolverScripted : public BreakpointResolver {
|
|||||||
StructuredData::ObjectSP SerializeToStructuredData() override;
|
StructuredData::ObjectSP SerializeToStructuredData() override;
|
||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context, Address *addr,
|
SymbolContext &context,
|
||||||
bool containing) override;
|
Address *addr) override;
|
||||||
|
|
||||||
lldb::SearchDepth GetDepth() override;
|
lldb::SearchDepth GetDepth() override;
|
||||||
|
|
||||||
|
@ -338,6 +338,23 @@ class Address {
|
|||||||
bool ResolveAddressUsingFileSections(lldb::addr_t addr,
|
bool ResolveAddressUsingFileSections(lldb::addr_t addr,
|
||||||
const SectionList *sections);
|
const SectionList *sections);
|
||||||
|
|
||||||
|
/// Resolve this address to its containing function and optionally get
|
||||||
|
/// that function's address range.
|
||||||
|
///
|
||||||
|
/// \param[out] sym_ctx
|
||||||
|
/// The symbol context describing the function in which this address lies
|
||||||
|
///
|
||||||
|
/// \parm[out] addr_range_ptr
|
||||||
|
/// Pointer to the AddressRange to fill in with the function's address
|
||||||
|
/// range. Caller may pass null if they don't need the address range.
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// Returns \b false if the function/symbol could not be resolved
|
||||||
|
/// or if the address range was requested and could not be resolved;
|
||||||
|
/// returns \b true otherwise.
|
||||||
|
bool ResolveFunctionScope(lldb_private::SymbolContext &sym_ctx,
|
||||||
|
lldb_private::AddressRange *addr_range_ptr = nullptr);
|
||||||
|
|
||||||
/// Set the address to represent \a load_addr.
|
/// Set the address to represent \a load_addr.
|
||||||
///
|
///
|
||||||
/// The address will attempt to find a loaded section within \a target that
|
/// The address will attempt to find a loaded section within \a target that
|
||||||
|
@ -34,8 +34,8 @@ class AddressResolverFileLine : public AddressResolver {
|
|||||||
~AddressResolverFileLine() override;
|
~AddressResolverFileLine() override;
|
||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context, Address *addr,
|
SymbolContext &context,
|
||||||
bool containing) override;
|
Address *addr) override;
|
||||||
|
|
||||||
lldb::SearchDepth GetDepth() override;
|
lldb::SearchDepth GetDepth() override;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class AddressResolverName : public AddressResolver {
|
|||||||
|
|
||||||
// Creates a function breakpoint by regular expression. Takes over control
|
// Creates a function breakpoint by regular expression. Takes over control
|
||||||
// of the lifespan of func_regex.
|
// of the lifespan of func_regex.
|
||||||
AddressResolverName(RegularExpression &func_regex);
|
AddressResolverName(RegularExpression func_regex);
|
||||||
|
|
||||||
AddressResolverName(const char *class_name, const char *method,
|
AddressResolverName(const char *class_name, const char *method,
|
||||||
AddressResolver::MatchType type);
|
AddressResolver::MatchType type);
|
||||||
@ -39,8 +39,8 @@ class AddressResolverName : public AddressResolver {
|
|||||||
~AddressResolverName() override;
|
~AddressResolverName() override;
|
||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context, Address *addr,
|
SymbolContext &context,
|
||||||
bool containing) override;
|
Address *addr) override;
|
||||||
|
|
||||||
lldb::SearchDepth GetDepth() override;
|
lldb::SearchDepth GetDepth() override;
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "lldb/Core/FormatEntity.h"
|
#include "lldb/Core/FormatEntity.h"
|
||||||
#include "lldb/Core/IOHandler.h"
|
#include "lldb/Core/IOHandler.h"
|
||||||
#include "lldb/Core/SourceManager.h"
|
#include "lldb/Core/SourceManager.h"
|
||||||
|
#include "lldb/Core/StreamFile.h"
|
||||||
#include "lldb/Core/UserSettingsController.h"
|
#include "lldb/Core/UserSettingsController.h"
|
||||||
#include "lldb/Host/HostThread.h"
|
#include "lldb/Host/HostThread.h"
|
||||||
#include "lldb/Host/Terminal.h"
|
#include "lldb/Host/Terminal.h"
|
||||||
@ -113,20 +114,29 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
|||||||
|
|
||||||
void SetAsyncExecution(bool async);
|
void SetAsyncExecution(bool async);
|
||||||
|
|
||||||
lldb::StreamFileSP GetInputFile() { return m_input_file_sp; }
|
lldb::FileSP GetInputFileSP() { return m_input_file_sp; }
|
||||||
|
|
||||||
lldb::StreamFileSP GetOutputFile() { return m_output_file_sp; }
|
lldb::StreamFileSP GetOutputStreamSP() { return m_output_stream_sp; }
|
||||||
|
|
||||||
lldb::StreamFileSP GetErrorFile() { return m_error_file_sp; }
|
lldb::StreamFileSP GetErrorStreamSP() { return m_error_stream_sp; }
|
||||||
|
|
||||||
|
File &GetInputFile() { return *m_input_file_sp; }
|
||||||
|
|
||||||
|
File &GetOutputFile() { return m_output_stream_sp->GetFile(); }
|
||||||
|
|
||||||
|
File &GetErrorFile() { return m_error_stream_sp->GetFile(); }
|
||||||
|
|
||||||
|
StreamFile &GetOutputStream() { return *m_output_stream_sp; }
|
||||||
|
|
||||||
|
StreamFile &GetErrorStream() { return *m_error_stream_sp; }
|
||||||
|
|
||||||
repro::DataRecorder *GetInputRecorder();
|
repro::DataRecorder *GetInputRecorder();
|
||||||
|
|
||||||
void SetInputFileHandle(FILE *fh, bool tranfer_ownership,
|
void SetInputFile(lldb::FileSP file, repro::DataRecorder *recorder = nullptr);
|
||||||
repro::DataRecorder *recorder = nullptr);
|
|
||||||
|
|
||||||
void SetOutputFileHandle(FILE *fh, bool tranfer_ownership);
|
void SetOutputFile(lldb::FileSP file);
|
||||||
|
|
||||||
void SetErrorFileHandle(FILE *fh, bool tranfer_ownership);
|
void SetErrorFile(lldb::FileSP file);
|
||||||
|
|
||||||
void SaveInputTerminalState();
|
void SaveInputTerminalState();
|
||||||
|
|
||||||
@ -174,7 +184,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
|||||||
|
|
||||||
// If any of the streams are not set, set them to the in/out/err stream of
|
// If any of the streams are not set, set them to the in/out/err stream of
|
||||||
// the top most input reader to ensure they at least have something
|
// the top most input reader to ensure they at least have something
|
||||||
void AdoptTopIOHandlerFilesIfInvalid(lldb::StreamFileSP &in,
|
void AdoptTopIOHandlerFilesIfInvalid(lldb::FileSP &in,
|
||||||
lldb::StreamFileSP &out,
|
lldb::StreamFileSP &out,
|
||||||
lldb::StreamFileSP &err);
|
lldb::StreamFileSP &err);
|
||||||
|
|
||||||
@ -311,7 +321,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
|||||||
// selected target, or if no target is present you want to prime the dummy
|
// selected target, or if no target is present you want to prime the dummy
|
||||||
// target with entities that will be copied over to new targets.
|
// target with entities that will be copied over to new targets.
|
||||||
Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
|
Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
|
||||||
Target *GetDummyTarget();
|
Target *GetDummyTarget() { return m_dummy_target_sp.get(); }
|
||||||
|
|
||||||
lldb::BroadcasterManagerSP GetBroadcasterManager() {
|
lldb::BroadcasterManagerSP GetBroadcasterManager() {
|
||||||
return m_broadcaster_manager_sp;
|
return m_broadcaster_manager_sp;
|
||||||
@ -345,9 +355,10 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
|||||||
|
|
||||||
void HandleThreadEvent(const lldb::EventSP &event_sp);
|
void HandleThreadEvent(const lldb::EventSP &event_sp);
|
||||||
|
|
||||||
size_t GetProcessSTDOUT(Process *process, Stream *stream);
|
// Ensures two threads don't attempt to flush process output in parallel.
|
||||||
|
std::mutex m_output_flush_mutex;
|
||||||
size_t GetProcessSTDERR(Process *process, Stream *stream);
|
void FlushProcessOutput(Process &process, bool flush_stdout,
|
||||||
|
bool flush_stderr);
|
||||||
|
|
||||||
SourceManager::SourceFileCache &GetSourceFileCache() {
|
SourceManager::SourceFileCache &GetSourceFileCache() {
|
||||||
return m_source_file_cache;
|
return m_source_file_cache;
|
||||||
@ -355,9 +366,10 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
|||||||
|
|
||||||
void InstanceInitialize();
|
void InstanceInitialize();
|
||||||
|
|
||||||
lldb::StreamFileSP m_input_file_sp;
|
// these should never be NULL
|
||||||
lldb::StreamFileSP m_output_file_sp;
|
lldb::FileSP m_input_file_sp;
|
||||||
lldb::StreamFileSP m_error_file_sp;
|
lldb::StreamFileSP m_output_stream_sp;
|
||||||
|
lldb::StreamFileSP m_error_stream_sp;
|
||||||
|
|
||||||
/// Used for shadowing the input file when capturing a reproducer.
|
/// Used for shadowing the input file when capturing a reproducer.
|
||||||
repro::DataRecorder *m_input_recorder;
|
repro::DataRecorder *m_input_recorder;
|
||||||
@ -399,6 +411,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
|||||||
Broadcaster m_sync_broadcaster;
|
Broadcaster m_sync_broadcaster;
|
||||||
lldb::ListenerSP m_forward_listener_sp;
|
lldb::ListenerSP m_forward_listener_sp;
|
||||||
llvm::once_flag m_clear_once;
|
llvm::once_flag m_clear_once;
|
||||||
|
lldb::TargetSP m_dummy_target_sp;
|
||||||
|
|
||||||
// Events for m_sync_broadcaster
|
// Events for m_sync_broadcaster
|
||||||
enum {
|
enum {
|
||||||
|
@ -37,8 +37,8 @@ class FileLineResolver : public Searcher {
|
|||||||
~FileLineResolver() override;
|
~FileLineResolver() override;
|
||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context, Address *addr,
|
SymbolContext &context,
|
||||||
bool containing) override;
|
Address *addr) override;
|
||||||
|
|
||||||
lldb::SearchDepth GetDepth() override;
|
lldb::SearchDepth GetDepth() override;
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@ class Stream;
|
|||||||
/// A class that contains a mutable list of FileSpec objects.
|
/// A class that contains a mutable list of FileSpec objects.
|
||||||
class FileSpecList {
|
class FileSpecList {
|
||||||
public:
|
public:
|
||||||
|
typedef std::vector<FileSpec> collection;
|
||||||
|
typedef collection::const_iterator const_iterator;
|
||||||
|
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
///
|
///
|
||||||
/// Initialize this object with an empty file list.
|
/// Initialize this object with an empty file list.
|
||||||
@ -76,6 +79,15 @@ class FileSpecList {
|
|||||||
/// \b true if the file was appended, \b false otherwise.
|
/// \b true if the file was appended, \b false otherwise.
|
||||||
bool AppendIfUnique(const FileSpec &file);
|
bool AppendIfUnique(const FileSpec &file);
|
||||||
|
|
||||||
|
/// Inserts a new FileSpec into the FileSpecList constructed in-place with
|
||||||
|
/// the given arguments.
|
||||||
|
///
|
||||||
|
/// \param[in] args
|
||||||
|
/// Arguments to create the FileSpec
|
||||||
|
template <class... Args> void EmplaceBack(Args &&... args) {
|
||||||
|
m_files.emplace_back(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
/// Clears the file list.
|
/// Clears the file list.
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
@ -182,9 +194,10 @@ class FileSpecList {
|
|||||||
static size_t GetFilesMatchingPartialPath(const char *path, bool dir_okay,
|
static size_t GetFilesMatchingPartialPath(const char *path, bool dir_okay,
|
||||||
FileSpecList &matches);
|
FileSpecList &matches);
|
||||||
|
|
||||||
|
const_iterator begin() const { return m_files.begin(); }
|
||||||
|
const_iterator end() const { return m_files.end(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::vector<FileSpec>
|
|
||||||
collection; ///< The collection type for the file list.
|
|
||||||
collection m_files; ///< A collection of FileSpec objects.
|
collection m_files; ///< A collection of FileSpec objects.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ class FormatEntity {
|
|||||||
llvm::StringRef &variable_name,
|
llvm::StringRef &variable_name,
|
||||||
llvm::StringRef &variable_format);
|
llvm::StringRef &variable_format);
|
||||||
|
|
||||||
static size_t AutoComplete(lldb_private::CompletionRequest &request);
|
static void AutoComplete(lldb_private::CompletionRequest &request);
|
||||||
|
|
||||||
// Format the current elements into the stream \a s.
|
// Format the current elements into the stream \a s.
|
||||||
//
|
//
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#define liblldb_IOHandler_h_
|
#define liblldb_IOHandler_h_
|
||||||
|
|
||||||
#include "lldb/Core/ValueObjectList.h"
|
#include "lldb/Core/ValueObjectList.h"
|
||||||
|
#include "lldb/Utility/CompletionRequest.h"
|
||||||
#include "lldb/Utility/ConstString.h"
|
#include "lldb/Utility/ConstString.h"
|
||||||
#include "lldb/Utility/Flags.h"
|
#include "lldb/Utility/Flags.h"
|
||||||
#include "lldb/Utility/Predicate.h"
|
#include "lldb/Utility/Predicate.h"
|
||||||
@ -57,8 +58,7 @@ class IOHandler {
|
|||||||
IOHandler(Debugger &debugger, IOHandler::Type type);
|
IOHandler(Debugger &debugger, IOHandler::Type type);
|
||||||
|
|
||||||
IOHandler(Debugger &debugger, IOHandler::Type type,
|
IOHandler(Debugger &debugger, IOHandler::Type type,
|
||||||
const lldb::StreamFileSP &input_sp,
|
const lldb::FileSP &input_sp, const lldb::StreamFileSP &output_sp,
|
||||||
const lldb::StreamFileSP &output_sp,
|
|
||||||
const lldb::StreamFileSP &error_sp, uint32_t flags,
|
const lldb::StreamFileSP &error_sp, uint32_t flags,
|
||||||
repro::DataRecorder *data_recorder);
|
repro::DataRecorder *data_recorder);
|
||||||
|
|
||||||
@ -122,11 +122,11 @@ class IOHandler {
|
|||||||
|
|
||||||
FILE *GetErrorFILE();
|
FILE *GetErrorFILE();
|
||||||
|
|
||||||
lldb::StreamFileSP &GetInputStreamFile();
|
lldb::FileSP &GetInputFileSP();
|
||||||
|
|
||||||
lldb::StreamFileSP &GetOutputStreamFile();
|
lldb::StreamFileSP &GetOutputStreamFileSP();
|
||||||
|
|
||||||
lldb::StreamFileSP &GetErrorStreamFile();
|
lldb::StreamFileSP &GetErrorStreamFileSP();
|
||||||
|
|
||||||
Debugger &GetDebugger() { return m_debugger; }
|
Debugger &GetDebugger() { return m_debugger; }
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ class IOHandler {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Debugger &m_debugger;
|
Debugger &m_debugger;
|
||||||
lldb::StreamFileSP m_input_sp;
|
lldb::FileSP m_input_sp;
|
||||||
lldb::StreamFileSP m_output_sp;
|
lldb::StreamFileSP m_output_sp;
|
||||||
lldb::StreamFileSP m_error_sp;
|
lldb::StreamFileSP m_error_sp;
|
||||||
repro::DataRecorder *m_data_recorder;
|
repro::DataRecorder *m_data_recorder;
|
||||||
@ -198,10 +198,8 @@ class IOHandlerDelegate {
|
|||||||
|
|
||||||
virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
|
virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
|
||||||
|
|
||||||
virtual int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
|
virtual void IOHandlerComplete(IOHandler &io_handler,
|
||||||
const char *cursor, const char *last_char,
|
CompletionRequest &request);
|
||||||
int skip_first_n_matches, int max_matches,
|
|
||||||
StringList &matches, StringList &descriptions);
|
|
||||||
|
|
||||||
virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
|
virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
|
||||||
|
|
||||||
@ -334,7 +332,7 @@ class IOHandlerEditline : public IOHandler {
|
|||||||
repro::DataRecorder *data_recorder);
|
repro::DataRecorder *data_recorder);
|
||||||
|
|
||||||
IOHandlerEditline(Debugger &debugger, IOHandler::Type type,
|
IOHandlerEditline(Debugger &debugger, IOHandler::Type type,
|
||||||
const lldb::StreamFileSP &input_sp,
|
const lldb::FileSP &input_sp,
|
||||||
const lldb::StreamFileSP &output_sp,
|
const lldb::StreamFileSP &output_sp,
|
||||||
const lldb::StreamFileSP &error_sp, uint32_t flags,
|
const lldb::StreamFileSP &error_sp, uint32_t flags,
|
||||||
const char *editline_name, // Used for saving history files
|
const char *editline_name, // Used for saving history files
|
||||||
@ -350,7 +348,7 @@ class IOHandlerEditline : public IOHandler {
|
|||||||
const char *, bool, bool, uint32_t,
|
const char *, bool, bool, uint32_t,
|
||||||
IOHandlerDelegate &) = delete;
|
IOHandlerDelegate &) = delete;
|
||||||
|
|
||||||
IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::StreamFileSP &,
|
IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::FileSP &,
|
||||||
const lldb::StreamFileSP &, const lldb::StreamFileSP &,
|
const lldb::StreamFileSP &, const lldb::StreamFileSP &,
|
||||||
uint32_t, const char *, const char *, const char *, bool,
|
uint32_t, const char *, const char *, const char *, bool,
|
||||||
bool, uint32_t, IOHandlerDelegate &) = delete;
|
bool, uint32_t, IOHandlerDelegate &) = delete;
|
||||||
@ -415,11 +413,7 @@ class IOHandlerEditline : public IOHandler {
|
|||||||
static int FixIndentationCallback(Editline *editline, const StringList &lines,
|
static int FixIndentationCallback(Editline *editline, const StringList &lines,
|
||||||
int cursor_position, void *baton);
|
int cursor_position, void *baton);
|
||||||
|
|
||||||
static int AutoCompleteCallback(const char *current_line, const char *cursor,
|
static void AutoCompleteCallback(CompletionRequest &request, void *baton);
|
||||||
const char *last_char,
|
|
||||||
int skip_first_n_matches, int max_matches,
|
|
||||||
StringList &matches, StringList &descriptions,
|
|
||||||
void *baton);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -437,6 +431,7 @@ class IOHandlerEditline : public IOHandler {
|
|||||||
bool m_interrupt_exits;
|
bool m_interrupt_exits;
|
||||||
bool m_editing; // Set to true when fetching a line manually (not using
|
bool m_editing; // Set to true when fetching a line manually (not using
|
||||||
// libedit)
|
// libedit)
|
||||||
|
std::string m_line_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
// The order of base classes is important. Look at the constructor of
|
// The order of base classes is important. Look at the constructor of
|
||||||
@ -450,10 +445,8 @@ class IOHandlerConfirm : public IOHandlerDelegate, public IOHandlerEditline {
|
|||||||
|
|
||||||
bool GetResponse() const { return m_user_response; }
|
bool GetResponse() const { return m_user_response; }
|
||||||
|
|
||||||
int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
|
void IOHandlerComplete(IOHandler &io_handler,
|
||||||
const char *cursor, const char *last_char,
|
CompletionRequest &request) override;
|
||||||
int skip_first_n_matches, int max_matches,
|
|
||||||
StringList &matches, StringList &descriptions) override;
|
|
||||||
|
|
||||||
void IOHandlerInputComplete(IOHandler &io_handler,
|
void IOHandlerInputComplete(IOHandler &io_handler,
|
||||||
std::string &data) override;
|
std::string &data) override;
|
||||||
|
@ -84,9 +84,6 @@ class LoadedModuleInfoList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(LoadedModuleInfo const &rhs) const {
|
bool operator==(LoadedModuleInfo const &rhs) const {
|
||||||
if (e_num != rhs.e_num)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < e_num; ++i) {
|
for (size_t i = 0; i < e_num; ++i) {
|
||||||
if (m_has[i] != rhs.m_has[i])
|
if (m_has[i] != rhs.m_has[i])
|
||||||
return false;
|
return false;
|
||||||
|
@ -49,21 +49,7 @@ class Mangled {
|
|||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
///
|
///
|
||||||
/// Initialize with both mangled and demangled names empty.
|
/// Initialize with both mangled and demangled names empty.
|
||||||
Mangled();
|
Mangled() = default;
|
||||||
|
|
||||||
/// Construct with name.
|
|
||||||
///
|
|
||||||
/// Constructor with an optional string and a boolean indicating if it is
|
|
||||||
/// the mangled version.
|
|
||||||
///
|
|
||||||
/// \param[in] name
|
|
||||||
/// The already const name to copy into this object.
|
|
||||||
///
|
|
||||||
/// \param[in] is_mangled
|
|
||||||
/// If \b true then \a name is a mangled name, if \b false then
|
|
||||||
/// \a name is demangled.
|
|
||||||
Mangled(ConstString name, bool is_mangled);
|
|
||||||
Mangled(llvm::StringRef name, bool is_mangled);
|
|
||||||
|
|
||||||
/// Construct with name.
|
/// Construct with name.
|
||||||
///
|
///
|
||||||
@ -76,12 +62,6 @@ class Mangled {
|
|||||||
|
|
||||||
explicit Mangled(llvm::StringRef name);
|
explicit Mangled(llvm::StringRef name);
|
||||||
|
|
||||||
/// Destructor
|
|
||||||
///
|
|
||||||
/// Releases its ref counts on the mangled and demangled strings that live
|
|
||||||
/// in the global string pool.
|
|
||||||
~Mangled();
|
|
||||||
|
|
||||||
/// Convert to pointer operator.
|
/// Convert to pointer operator.
|
||||||
///
|
///
|
||||||
/// This allows code to check a Mangled object to see if it contains a valid
|
/// This allows code to check a Mangled object to see if it contains a valid
|
||||||
|
@ -49,7 +49,6 @@ class Symbol;
|
|||||||
class SymbolContext;
|
class SymbolContext;
|
||||||
class SymbolContextList;
|
class SymbolContextList;
|
||||||
class SymbolFile;
|
class SymbolFile;
|
||||||
class SymbolVendor;
|
|
||||||
class Symtab;
|
class Symtab;
|
||||||
class Target;
|
class Target;
|
||||||
class TypeList;
|
class TypeList;
|
||||||
@ -67,8 +66,8 @@ class VariableList;
|
|||||||
/// accessors are called. For example the object file (ObjectFile)
|
/// accessors are called. For example the object file (ObjectFile)
|
||||||
/// representation will only be parsed if the object file is requested using
|
/// representation will only be parsed if the object file is requested using
|
||||||
/// the Module::GetObjectFile() is called. The debug symbols will only be
|
/// the Module::GetObjectFile() is called. The debug symbols will only be
|
||||||
/// parsed if the symbol vendor (SymbolVendor) is requested using the
|
/// parsed if the symbol file (SymbolFile) is requested using the
|
||||||
/// Module::GetSymbolVendor() is called.
|
/// Module::GetSymbolFile() method.
|
||||||
///
|
///
|
||||||
/// The module will parse more detailed information as more queries are made.
|
/// The module will parse more detailed information as more queries are made.
|
||||||
class Module : public std::enable_shared_from_this<Module>,
|
class Module : public std::enable_shared_from_this<Module>,
|
||||||
@ -247,13 +246,13 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
ConstString name,
|
ConstString name,
|
||||||
lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
|
lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
|
||||||
|
|
||||||
size_t FindSymbolsWithNameAndType(ConstString name,
|
void FindSymbolsWithNameAndType(ConstString name,
|
||||||
lldb::SymbolType symbol_type,
|
lldb::SymbolType symbol_type,
|
||||||
SymbolContextList &sc_list);
|
SymbolContextList &sc_list);
|
||||||
|
|
||||||
size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
|
void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
|
||||||
lldb::SymbolType symbol_type,
|
lldb::SymbolType symbol_type,
|
||||||
SymbolContextList &sc_list);
|
SymbolContextList &sc_list);
|
||||||
|
|
||||||
/// Find a function symbols in the object file's symbol table.
|
/// Find a function symbols in the object file's symbol table.
|
||||||
///
|
///
|
||||||
@ -267,11 +266,8 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
///
|
///
|
||||||
/// \param[out] sc_list
|
/// \param[out] sc_list
|
||||||
/// A list to append any matching symbol contexts to.
|
/// A list to append any matching symbol contexts to.
|
||||||
///
|
void FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
|
||||||
/// \return
|
SymbolContextList &sc_list);
|
||||||
/// The number of symbol contexts that were added to \a sc_list
|
|
||||||
size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
|
|
||||||
SymbolContextList &sc_list);
|
|
||||||
|
|
||||||
/// Find compile units by partial or full path.
|
/// Find compile units by partial or full path.
|
||||||
///
|
///
|
||||||
@ -281,19 +277,10 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
/// \param[in] path
|
/// \param[in] path
|
||||||
/// The name of the function we are looking for.
|
/// The name of the function we are looking for.
|
||||||
///
|
///
|
||||||
/// \param[in] append
|
|
||||||
/// If \b true, then append any compile units that were found
|
|
||||||
/// to \a sc_list. If \b false, then the \a sc_list is cleared
|
|
||||||
/// and the contents of \a sc_list are replaced.
|
|
||||||
///
|
|
||||||
/// \param[out] sc_list
|
/// \param[out] sc_list
|
||||||
/// A symbol context list that gets filled in with all of the
|
/// A symbol context list that gets filled in with all of the
|
||||||
/// matches.
|
/// matches.
|
||||||
///
|
void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list);
|
||||||
/// \return
|
|
||||||
/// The number of matches added to \a sc_list.
|
|
||||||
size_t FindCompileUnits(const FileSpec &path, bool append,
|
|
||||||
SymbolContextList &sc_list);
|
|
||||||
|
|
||||||
/// Find functions by name.
|
/// Find functions by name.
|
||||||
///
|
///
|
||||||
@ -313,21 +300,13 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
/// names, base names, C++ methods, or ObjC selectors.
|
/// names, base names, C++ methods, or ObjC selectors.
|
||||||
/// See FunctionNameType for more details.
|
/// See FunctionNameType for more details.
|
||||||
///
|
///
|
||||||
/// \param[in] append
|
|
||||||
/// If \b true, any matches will be appended to \a sc_list, else
|
|
||||||
/// matches replace the contents of \a sc_list.
|
|
||||||
///
|
|
||||||
/// \param[out] sc_list
|
/// \param[out] sc_list
|
||||||
/// A symbol context list that gets filled in with all of the
|
/// A symbol context list that gets filled in with all of the
|
||||||
/// matches.
|
/// matches.
|
||||||
///
|
void FindFunctions(ConstString name,
|
||||||
/// \return
|
const CompilerDeclContext *parent_decl_ctx,
|
||||||
/// The number of matches added to \a sc_list.
|
lldb::FunctionNameType name_type_mask, bool symbols_ok,
|
||||||
size_t FindFunctions(ConstString name,
|
bool inlines_ok, SymbolContextList &sc_list);
|
||||||
const CompilerDeclContext *parent_decl_ctx,
|
|
||||||
lldb::FunctionNameType name_type_mask, bool symbols_ok,
|
|
||||||
bool inlines_ok, bool append,
|
|
||||||
SymbolContextList &sc_list);
|
|
||||||
|
|
||||||
/// Find functions by name.
|
/// Find functions by name.
|
||||||
///
|
///
|
||||||
@ -345,12 +324,8 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
/// \param[out] sc_list
|
/// \param[out] sc_list
|
||||||
/// A symbol context list that gets filled in with all of the
|
/// A symbol context list that gets filled in with all of the
|
||||||
/// matches.
|
/// matches.
|
||||||
///
|
void FindFunctions(const RegularExpression ®ex, bool symbols_ok,
|
||||||
/// \return
|
bool inlines_ok, SymbolContextList &sc_list);
|
||||||
/// The number of matches added to \a sc_list.
|
|
||||||
size_t FindFunctions(const RegularExpression ®ex, bool symbols_ok,
|
|
||||||
bool inlines_ok, bool append,
|
|
||||||
SymbolContextList &sc_list);
|
|
||||||
|
|
||||||
/// Find addresses by file/line
|
/// Find addresses by file/line
|
||||||
///
|
///
|
||||||
@ -395,11 +370,9 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
/// \param[in] variable_list
|
/// \param[in] variable_list
|
||||||
/// A list of variables that gets the matches appended to.
|
/// A list of variables that gets the matches appended to.
|
||||||
///
|
///
|
||||||
/// \return
|
void FindGlobalVariables(ConstString name,
|
||||||
/// The number of matches added to \a variable_list.
|
const CompilerDeclContext *parent_decl_ctx,
|
||||||
size_t FindGlobalVariables(ConstString name,
|
size_t max_matches, VariableList &variable_list);
|
||||||
const CompilerDeclContext *parent_decl_ctx,
|
|
||||||
size_t max_matches, VariableList &variable_list);
|
|
||||||
|
|
||||||
/// Find global and static variables by regular expression.
|
/// Find global and static variables by regular expression.
|
||||||
///
|
///
|
||||||
@ -413,17 +386,14 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
/// \param[in] variable_list
|
/// \param[in] variable_list
|
||||||
/// A list of variables that gets the matches appended to.
|
/// A list of variables that gets the matches appended to.
|
||||||
///
|
///
|
||||||
/// \return
|
void FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
|
||||||
/// The number of matches added to \a variable_list.
|
VariableList &variable_list);
|
||||||
size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
|
|
||||||
VariableList &variable_list);
|
|
||||||
|
|
||||||
/// Find types by name.
|
/// Find types by name.
|
||||||
///
|
///
|
||||||
/// Type lookups in modules go through the SymbolVendor (which will use one
|
/// Type lookups in modules go through the SymbolFile. The SymbolFile needs to
|
||||||
/// or more SymbolFile subclasses). The SymbolFile needs to be able to
|
/// be able to lookup types by basename and not the fully qualified typename.
|
||||||
/// lookup types by basename and not the fully qualified typename. This
|
/// This allows the type accelerator tables to stay small, even with heavily
|
||||||
/// allows the type accelerator tables to stay small, even with heavily
|
|
||||||
/// templatized C++. The type search will then narrow down the search
|
/// templatized C++. The type search will then narrow down the search
|
||||||
/// results. If "exact_match" is true, then the type search will only match
|
/// results. If "exact_match" is true, then the type search will only match
|
||||||
/// exact type name matches. If "exact_match" is false, the type will match
|
/// exact type name matches. If "exact_match" is false, the type will match
|
||||||
@ -449,13 +419,19 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
/// \param[out] type_list
|
/// \param[out] type_list
|
||||||
/// A type list gets populated with any matches.
|
/// A type list gets populated with any matches.
|
||||||
///
|
///
|
||||||
/// \return
|
void
|
||||||
/// The number of matches added to \a type_list.
|
|
||||||
size_t
|
|
||||||
FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
|
FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
|
||||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
||||||
TypeList &types);
|
TypeList &types);
|
||||||
|
|
||||||
|
/// Find types by name.
|
||||||
|
///
|
||||||
|
/// This behaves like the other FindTypes method but allows to
|
||||||
|
/// specify a DeclContext and a language for the type being searched
|
||||||
|
/// for.
|
||||||
|
void FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages,
|
||||||
|
TypeMap &types);
|
||||||
|
|
||||||
lldb::TypeSP FindFirstType(const SymbolContext &sc,
|
lldb::TypeSP FindFirstType(const SymbolContext &sc,
|
||||||
ConstString type_name, bool exact_match);
|
ConstString type_name, bool exact_match);
|
||||||
|
|
||||||
@ -473,11 +449,9 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
/// \param[out] type_list
|
/// \param[out] type_list
|
||||||
/// A type list gets populated with any matches.
|
/// A type list gets populated with any matches.
|
||||||
///
|
///
|
||||||
/// \return
|
void FindTypesInNamespace(ConstString type_name,
|
||||||
/// The number of matches added to \a type_list.
|
const CompilerDeclContext *parent_decl_ctx,
|
||||||
size_t FindTypesInNamespace(ConstString type_name,
|
size_t max_matches, TypeList &type_list);
|
||||||
const CompilerDeclContext *parent_decl_ctx,
|
|
||||||
size_t max_matches, TypeList &type_list);
|
|
||||||
|
|
||||||
/// Get const accessor for the module architecture.
|
/// Get const accessor for the module architecture.
|
||||||
///
|
///
|
||||||
@ -638,27 +612,19 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
|
ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
|
||||||
lldb::addr_t header_addr, Status &error,
|
lldb::addr_t header_addr, Status &error,
|
||||||
size_t size_to_read = 512);
|
size_t size_to_read = 512);
|
||||||
/// Get the symbol vendor interface for the current architecture.
|
|
||||||
///
|
|
||||||
/// If the symbol vendor file has not been located yet, this function will
|
|
||||||
/// find the best SymbolVendor plug-in that can use the current object file.
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// If this module does not have a valid object file, or no
|
|
||||||
/// plug-in can be found that can use the object file, nullptr will
|
|
||||||
/// be returned, else a valid symbol vendor plug-in interface
|
|
||||||
/// will be returned. The returned pointer is owned by this
|
|
||||||
/// object and remains valid as long as the object is around.
|
|
||||||
virtual SymbolVendor *
|
|
||||||
GetSymbolVendor(bool can_create = true,
|
|
||||||
lldb_private::Stream *feedback_strm = nullptr);
|
|
||||||
|
|
||||||
/// Get accessor the type list for this module.
|
/// Get the module's symbol file
|
||||||
///
|
///
|
||||||
/// \return
|
/// If the symbol file has already been loaded, this function returns it. All
|
||||||
/// A valid type list pointer, or nullptr if there is no valid
|
/// arguments are ignored. If the symbol file has not been located yet, and
|
||||||
/// symbol vendor for this module.
|
/// the can_create argument is false, the function returns nullptr. If
|
||||||
TypeList *GetTypeList();
|
/// can_create is true, this function will find the best SymbolFile plug-in
|
||||||
|
/// that can use the current object file. feedback_strm, if not null, is used
|
||||||
|
/// to report the details of the search process.
|
||||||
|
virtual SymbolFile *GetSymbolFile(bool can_create = true,
|
||||||
|
Stream *feedback_strm = nullptr);
|
||||||
|
|
||||||
|
Symtab *GetSymtab();
|
||||||
|
|
||||||
/// Get a reference to the UUID value contained in this object.
|
/// Get a reference to the UUID value contained in this object.
|
||||||
///
|
///
|
||||||
@ -819,7 +785,8 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
|
|
||||||
bool GetIsDynamicLinkEditor();
|
bool GetIsDynamicLinkEditor();
|
||||||
|
|
||||||
TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language);
|
llvm::Expected<TypeSystem &>
|
||||||
|
GetTypeSystemForLanguage(lldb::LanguageType language);
|
||||||
|
|
||||||
// Special error functions that can do printf style formatting that will
|
// Special error functions that can do printf style formatting that will
|
||||||
// prepend the message with something appropriate for this module (like the
|
// prepend the message with something appropriate for this module (like the
|
||||||
@ -848,7 +815,7 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
// when the module first gets created.
|
// when the module first gets created.
|
||||||
bool FileHasChanged() const;
|
bool FileHasChanged() const;
|
||||||
|
|
||||||
// SymbolVendor, SymbolFile and ObjectFile member objects should lock the
|
// SymbolFile and ObjectFile member objects should lock the
|
||||||
// module mutex to avoid deadlocks.
|
// module mutex to avoid deadlocks.
|
||||||
std::recursive_mutex &GetMutex() const { return m_mutex; }
|
std::recursive_mutex &GetMutex() const { return m_mutex; }
|
||||||
|
|
||||||
@ -896,16 +863,19 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
|
bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
|
||||||
bool RemapSourceFile(const char *, std::string &) const = delete;
|
bool RemapSourceFile(const char *, std::string &) const = delete;
|
||||||
|
|
||||||
|
/// Update the ArchSpec to a more specific variant.
|
||||||
|
bool MergeArchitecture(const ArchSpec &arch_spec);
|
||||||
|
|
||||||
/// \class LookupInfo Module.h "lldb/Core/Module.h"
|
/// \class LookupInfo Module.h "lldb/Core/Module.h"
|
||||||
/// A class that encapsulates name lookup information.
|
/// A class that encapsulates name lookup information.
|
||||||
///
|
///
|
||||||
/// Users can type a wide variety of partial names when setting breakpoints
|
/// Users can type a wide variety of partial names when setting breakpoints
|
||||||
/// by name or when looking for functions by name. SymbolVendor and
|
/// by name or when looking for functions by name. The SymbolFile object is
|
||||||
/// SymbolFile objects are only required to implement name lookup for
|
/// only required to implement name lookup for function basenames and for
|
||||||
/// function basenames and for fully mangled names. This means if the user
|
/// fully mangled names. This means if the user types in a partial name, we
|
||||||
/// types in a partial name, we must reduce this to a name lookup that will
|
/// must reduce this to a name lookup that will work with all SymbolFile
|
||||||
/// work with all SymbolFile objects. So we might reduce a name lookup to
|
/// objects. So we might reduce a name lookup to look for a basename, and then
|
||||||
/// look for a basename, and then prune out any results that don't match.
|
/// prune out any results that don't match.
|
||||||
///
|
///
|
||||||
/// The "m_name" member variable represents the name as it was typed by the
|
/// The "m_name" member variable represents the name as it was typed by the
|
||||||
/// user. "m_lookup_name" will be the name we actually search for through
|
/// user. "m_lookup_name" will be the name we actually search for through
|
||||||
@ -1012,7 +982,7 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
/// ObjectFile instances for the debug info
|
/// ObjectFile instances for the debug info
|
||||||
|
|
||||||
std::atomic<bool> m_did_load_objfile{false};
|
std::atomic<bool> m_did_load_objfile{false};
|
||||||
std::atomic<bool> m_did_load_symbol_vendor{false};
|
std::atomic<bool> m_did_load_symfile{false};
|
||||||
std::atomic<bool> m_did_set_uuid{false};
|
std::atomic<bool> m_did_set_uuid{false};
|
||||||
mutable bool m_file_has_changed : 1,
|
mutable bool m_file_has_changed : 1,
|
||||||
m_first_file_changed_log : 1; /// See if the module was modified after it
|
m_first_file_changed_log : 1; /// See if the module was modified after it
|
||||||
@ -1072,9 +1042,9 @@ class Module : public std::enable_shared_from_this<Module>,
|
|||||||
private:
|
private:
|
||||||
Module(); // Only used internally by CreateJITModule ()
|
Module(); // Only used internally by CreateJITModule ()
|
||||||
|
|
||||||
size_t FindTypes_Impl(
|
void FindTypes_Impl(
|
||||||
ConstString name, const CompilerDeclContext *parent_decl_ctx,
|
ConstString name, const CompilerDeclContext *parent_decl_ctx,
|
||||||
bool append, size_t max_matches,
|
size_t max_matches,
|
||||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
||||||
TypeMap &types);
|
TypeMap &types);
|
||||||
|
|
||||||
|
@ -247,35 +247,24 @@ class ModuleList {
|
|||||||
/// \param[in] path
|
/// \param[in] path
|
||||||
/// The name of the compile unit we are looking for.
|
/// The name of the compile unit we are looking for.
|
||||||
///
|
///
|
||||||
/// \param[in] append
|
|
||||||
/// If \b true, then append any compile units that were found
|
|
||||||
/// to \a sc_list. If \b false, then the \a sc_list is cleared
|
|
||||||
/// and the contents of \a sc_list are replaced.
|
|
||||||
///
|
|
||||||
/// \param[out] sc_list
|
/// \param[out] sc_list
|
||||||
/// A symbol context list that gets filled in with all of the
|
/// A symbol context list that gets filled in with all of the
|
||||||
/// matches.
|
/// matches.
|
||||||
///
|
void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list) const;
|
||||||
/// \return
|
|
||||||
/// The number of matches added to \a sc_list.
|
|
||||||
size_t FindCompileUnits(const FileSpec &path, bool append,
|
|
||||||
SymbolContextList &sc_list) const;
|
|
||||||
|
|
||||||
/// \see Module::FindFunctions ()
|
/// \see Module::FindFunctions ()
|
||||||
size_t FindFunctions(ConstString name,
|
void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask,
|
||||||
lldb::FunctionNameType name_type_mask,
|
bool include_symbols, bool include_inlines,
|
||||||
bool include_symbols, bool include_inlines, bool append,
|
SymbolContextList &sc_list) const;
|
||||||
SymbolContextList &sc_list) const;
|
|
||||||
|
|
||||||
/// \see Module::FindFunctionSymbols ()
|
/// \see Module::FindFunctionSymbols ()
|
||||||
size_t FindFunctionSymbols(ConstString name,
|
void FindFunctionSymbols(ConstString name,
|
||||||
lldb::FunctionNameType name_type_mask,
|
lldb::FunctionNameType name_type_mask,
|
||||||
SymbolContextList &sc_list);
|
SymbolContextList &sc_list);
|
||||||
|
|
||||||
/// \see Module::FindFunctions ()
|
/// \see Module::FindFunctions ()
|
||||||
size_t FindFunctions(const RegularExpression &name, bool include_symbols,
|
void FindFunctions(const RegularExpression &name, bool include_symbols,
|
||||||
bool include_inlines, bool append,
|
bool include_inlines, SymbolContextList &sc_list);
|
||||||
SymbolContextList &sc_list);
|
|
||||||
|
|
||||||
/// Find global and static variables by name.
|
/// Find global and static variables by name.
|
||||||
///
|
///
|
||||||
@ -289,11 +278,8 @@ class ModuleList {
|
|||||||
///
|
///
|
||||||
/// \param[in] variable_list
|
/// \param[in] variable_list
|
||||||
/// A list of variables that gets the matches appended to.
|
/// A list of variables that gets the matches appended to.
|
||||||
///
|
void FindGlobalVariables(ConstString name, size_t max_matches,
|
||||||
/// \return
|
VariableList &variable_list) const;
|
||||||
/// The number of matches added to \a variable_list.
|
|
||||||
size_t FindGlobalVariables(ConstString name, size_t max_matches,
|
|
||||||
VariableList &variable_list) const;
|
|
||||||
|
|
||||||
/// Find global and static variables by regular expression.
|
/// Find global and static variables by regular expression.
|
||||||
///
|
///
|
||||||
@ -306,11 +292,8 @@ class ModuleList {
|
|||||||
///
|
///
|
||||||
/// \param[in] variable_list
|
/// \param[in] variable_list
|
||||||
/// A list of variables that gets the matches appended to.
|
/// A list of variables that gets the matches appended to.
|
||||||
///
|
void FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
|
||||||
/// \return
|
VariableList &variable_list) const;
|
||||||
/// The number of matches added to \a variable_list.
|
|
||||||
size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
|
|
||||||
VariableList &variable_list) const;
|
|
||||||
|
|
||||||
/// Finds the first module whose file specification matches \a file_spec.
|
/// Finds the first module whose file specification matches \a file_spec.
|
||||||
///
|
///
|
||||||
@ -337,11 +320,8 @@ class ModuleList {
|
|||||||
/// \param[out] matching_module_list
|
/// \param[out] matching_module_list
|
||||||
/// A module list that gets filled in with any modules that
|
/// A module list that gets filled in with any modules that
|
||||||
/// match the search criteria.
|
/// match the search criteria.
|
||||||
///
|
void FindModules(const ModuleSpec &module_spec,
|
||||||
/// \return
|
ModuleList &matching_module_list) const;
|
||||||
/// The number of matching modules found by the search.
|
|
||||||
size_t FindModules(const ModuleSpec &module_spec,
|
|
||||||
ModuleList &matching_module_list) const;
|
|
||||||
|
|
||||||
lldb::ModuleSP FindModule(const Module *module_ptr) const;
|
lldb::ModuleSP FindModule(const Module *module_ptr) const;
|
||||||
|
|
||||||
@ -354,15 +334,13 @@ class ModuleList {
|
|||||||
|
|
||||||
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const;
|
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const;
|
||||||
|
|
||||||
size_t FindSymbolsWithNameAndType(ConstString name,
|
void FindSymbolsWithNameAndType(ConstString name,
|
||||||
lldb::SymbolType symbol_type,
|
lldb::SymbolType symbol_type,
|
||||||
SymbolContextList &sc_list,
|
SymbolContextList &sc_list) const;
|
||||||
bool append = false) const;
|
|
||||||
|
|
||||||
size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
|
void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
|
||||||
lldb::SymbolType symbol_type,
|
lldb::SymbolType symbol_type,
|
||||||
SymbolContextList &sc_list,
|
SymbolContextList &sc_list) const;
|
||||||
bool append = false) const;
|
|
||||||
|
|
||||||
/// Find types by name.
|
/// Find types by name.
|
||||||
///
|
///
|
||||||
@ -393,12 +371,10 @@ class ModuleList {
|
|||||||
/// \param[out] type_list
|
/// \param[out] type_list
|
||||||
/// A type list gets populated with any matches.
|
/// A type list gets populated with any matches.
|
||||||
///
|
///
|
||||||
/// \return
|
void FindTypes(Module *search_first, ConstString name,
|
||||||
/// The number of matches added to \a type_list.
|
bool name_is_fully_qualified, size_t max_matches,
|
||||||
size_t FindTypes(Module *search_first, ConstString name,
|
llvm::DenseSet<SymbolFile *> &searched_symbol_files,
|
||||||
bool name_is_fully_qualified, size_t max_matches,
|
TypeList &types) const;
|
||||||
llvm::DenseSet<SymbolFile *> &searched_symbol_files,
|
|
||||||
TypeList &types) const;
|
|
||||||
|
|
||||||
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
|
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
|
||||||
|
|
||||||
@ -476,6 +452,7 @@ class ModuleList {
|
|||||||
/// \return
|
/// \return
|
||||||
/// The number of modules in the module list.
|
/// The number of modules in the module list.
|
||||||
size_t GetSize() const;
|
size_t GetSize() const;
|
||||||
|
bool IsEmpty() const { return !GetSize(); }
|
||||||
|
|
||||||
bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors,
|
bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors,
|
||||||
Stream *feedback_stream = nullptr,
|
Stream *feedback_stream = nullptr,
|
||||||
@ -494,8 +471,8 @@ class ModuleList {
|
|||||||
|
|
||||||
static bool RemoveSharedModule(lldb::ModuleSP &module_sp);
|
static bool RemoveSharedModule(lldb::ModuleSP &module_sp);
|
||||||
|
|
||||||
static size_t FindSharedModules(const ModuleSpec &module_spec,
|
static void FindSharedModules(const ModuleSpec &module_spec,
|
||||||
ModuleList &matching_module_list);
|
ModuleList &matching_module_list);
|
||||||
|
|
||||||
static size_t RemoveOrphanSharedModules(bool mandatory);
|
static size_t RemoveOrphanSharedModules(bool mandatory);
|
||||||
|
|
||||||
|
@ -380,8 +380,8 @@ class ModuleSpecList {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t FindMatchingModuleSpecs(const ModuleSpec &module_spec,
|
void FindMatchingModuleSpecs(const ModuleSpec &module_spec,
|
||||||
ModuleSpecList &matching_list) const {
|
ModuleSpecList &matching_list) const {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
bool exact_arch_match = true;
|
bool exact_arch_match = true;
|
||||||
const size_t initial_match_count = matching_list.GetSize();
|
const size_t initial_match_count = matching_list.GetSize();
|
||||||
@ -400,7 +400,6 @@ class ModuleSpecList {
|
|||||||
matching_list.Append(spec);
|
matching_list.Append(spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return matching_list.GetSize() - initial_match_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dump(Stream &strm) {
|
void Dump(Stream &strm) {
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#define liblldb_PluginManager_h_
|
#define liblldb_PluginManager_h_
|
||||||
|
|
||||||
#include "lldb/Core/Architecture.h"
|
#include "lldb/Core/Architecture.h"
|
||||||
|
#include "lldb/Symbol/TypeSystem.h"
|
||||||
|
#include "lldb/Utility/CompletionRequest.h"
|
||||||
#include "lldb/Utility/FileSpec.h"
|
#include "lldb/Utility/FileSpec.h"
|
||||||
#include "lldb/Utility/Status.h"
|
#include "lldb/Utility/Status.h"
|
||||||
#include "lldb/lldb-enumerations.h"
|
#include "lldb/lldb-enumerations.h"
|
||||||
@ -228,8 +230,8 @@ class PluginManager {
|
|||||||
|
|
||||||
static const char *GetPlatformPluginDescriptionAtIndex(uint32_t idx);
|
static const char *GetPlatformPluginDescriptionAtIndex(uint32_t idx);
|
||||||
|
|
||||||
static size_t AutoCompletePlatformName(llvm::StringRef partial_name,
|
static void AutoCompletePlatformName(llvm::StringRef partial_name,
|
||||||
StringList &matches);
|
CompletionRequest &request);
|
||||||
// Process
|
// Process
|
||||||
static bool
|
static bool
|
||||||
RegisterPlugin(ConstString name, const char *description,
|
RegisterPlugin(ConstString name, const char *description,
|
||||||
@ -383,10 +385,10 @@ class PluginManager {
|
|||||||
GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
|
GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
|
||||||
|
|
||||||
// TypeSystem
|
// TypeSystem
|
||||||
static bool RegisterPlugin(
|
static bool RegisterPlugin(ConstString name, const char *description,
|
||||||
ConstString name, const char *description,
|
TypeSystemCreateInstance create_callback,
|
||||||
TypeSystemCreateInstance create_callback,
|
LanguageSet supported_languages_for_types,
|
||||||
TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
|
LanguageSet supported_languages_for_expressions);
|
||||||
|
|
||||||
static bool UnregisterPlugin(TypeSystemCreateInstance create_callback);
|
static bool UnregisterPlugin(TypeSystemCreateInstance create_callback);
|
||||||
|
|
||||||
@ -396,18 +398,14 @@ class PluginManager {
|
|||||||
static TypeSystemCreateInstance
|
static TypeSystemCreateInstance
|
||||||
GetTypeSystemCreateCallbackForPluginName(ConstString name);
|
GetTypeSystemCreateCallbackForPluginName(ConstString name);
|
||||||
|
|
||||||
static TypeSystemEnumerateSupportedLanguages
|
static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes();
|
||||||
GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
|
|
||||||
|
|
||||||
static TypeSystemEnumerateSupportedLanguages
|
static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
|
||||||
GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
|
|
||||||
ConstString name);
|
|
||||||
|
|
||||||
// REPL
|
// REPL
|
||||||
static bool
|
static bool RegisterPlugin(ConstString name, const char *description,
|
||||||
RegisterPlugin(ConstString name, const char *description,
|
REPLCreateInstance create_callback,
|
||||||
REPLCreateInstance create_callback,
|
LanguageSet supported_languages);
|
||||||
REPLEnumerateSupportedLanguages enumerate_languages_callback);
|
|
||||||
|
|
||||||
static bool UnregisterPlugin(REPLCreateInstance create_callback);
|
static bool UnregisterPlugin(REPLCreateInstance create_callback);
|
||||||
|
|
||||||
@ -416,12 +414,7 @@ class PluginManager {
|
|||||||
static REPLCreateInstance
|
static REPLCreateInstance
|
||||||
GetREPLCreateCallbackForPluginName(ConstString name);
|
GetREPLCreateCallbackForPluginName(ConstString name);
|
||||||
|
|
||||||
static REPLEnumerateSupportedLanguages
|
static LanguageSet GetREPLAllTypeSystemSupportedLanguages();
|
||||||
GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
|
|
||||||
|
|
||||||
static REPLEnumerateSupportedLanguages
|
|
||||||
GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName(
|
|
||||||
ConstString name);
|
|
||||||
|
|
||||||
// Some plug-ins might register a DebuggerInitializeCallback callback when
|
// Some plug-ins might register a DebuggerInitializeCallback callback when
|
||||||
// registering the plug-in. After a new Debugger instance is created, this
|
// registering the plug-in. After a new Debugger instance is created, this
|
||||||
@ -439,32 +432,28 @@ class PluginManager {
|
|||||||
ConstString description, bool is_global_property);
|
ConstString description, bool is_global_property);
|
||||||
|
|
||||||
static lldb::OptionValuePropertiesSP
|
static lldb::OptionValuePropertiesSP
|
||||||
GetSettingForPlatformPlugin(Debugger &debugger,
|
GetSettingForPlatformPlugin(Debugger &debugger, ConstString setting_name);
|
||||||
ConstString setting_name);
|
|
||||||
|
|
||||||
static bool CreateSettingForPlatformPlugin(
|
static bool CreateSettingForPlatformPlugin(
|
||||||
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
||||||
ConstString description, bool is_global_property);
|
ConstString description, bool is_global_property);
|
||||||
|
|
||||||
static lldb::OptionValuePropertiesSP
|
static lldb::OptionValuePropertiesSP
|
||||||
GetSettingForProcessPlugin(Debugger &debugger,
|
GetSettingForProcessPlugin(Debugger &debugger, ConstString setting_name);
|
||||||
ConstString setting_name);
|
|
||||||
|
|
||||||
static bool CreateSettingForProcessPlugin(
|
static bool CreateSettingForProcessPlugin(
|
||||||
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
||||||
ConstString description, bool is_global_property);
|
ConstString description, bool is_global_property);
|
||||||
|
|
||||||
static lldb::OptionValuePropertiesSP
|
static lldb::OptionValuePropertiesSP
|
||||||
GetSettingForSymbolFilePlugin(Debugger &debugger,
|
GetSettingForSymbolFilePlugin(Debugger &debugger, ConstString setting_name);
|
||||||
ConstString setting_name);
|
|
||||||
|
|
||||||
static bool CreateSettingForSymbolFilePlugin(
|
static bool CreateSettingForSymbolFilePlugin(
|
||||||
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
||||||
ConstString description, bool is_global_property);
|
ConstString description, bool is_global_property);
|
||||||
|
|
||||||
static lldb::OptionValuePropertiesSP
|
static lldb::OptionValuePropertiesSP
|
||||||
GetSettingForJITLoaderPlugin(Debugger &debugger,
|
GetSettingForJITLoaderPlugin(Debugger &debugger, ConstString setting_name);
|
||||||
ConstString setting_name);
|
|
||||||
|
|
||||||
static bool CreateSettingForJITLoaderPlugin(
|
static bool CreateSettingForJITLoaderPlugin(
|
||||||
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
// Base class for all options.
|
||||||
|
class Property<string name, string type> {
|
||||||
|
string Name = name;
|
||||||
|
string Type = type;
|
||||||
|
string Definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets the description for the property that should be displayed to the user.
|
||||||
|
class Desc<string description> {
|
||||||
|
string Description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Marks the property as global.
|
||||||
|
class Global {
|
||||||
|
bit Global = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DefaultTrue {
|
||||||
|
int DefaultUnsignedValue = 1;
|
||||||
|
bit HasDefaultUnsignedValue = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DefaultFalse {
|
||||||
|
int DefaultUnsignedValue = 0;
|
||||||
|
bit HasDefaultUnsignedValue = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gives the property a default string value.
|
||||||
|
class DefaultStringValue<string value> {
|
||||||
|
string DefaultStringValue = value;
|
||||||
|
bit HasDefaultStringValue = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gives the property a default enum value.
|
||||||
|
class DefaultEnumValue<string value> {
|
||||||
|
string DefaultEnumValue = value;
|
||||||
|
bit HasDefaultEnumValue = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gives the property a default string value.
|
||||||
|
class DefaultUnsignedValue<int value> {
|
||||||
|
int DefaultUnsignedValue = value;
|
||||||
|
bit HasDefaultUnsignedValue = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gives the property enum values.
|
||||||
|
class EnumValues<string enum> {
|
||||||
|
string EnumValues = enum;
|
||||||
|
}
|
@ -52,8 +52,8 @@ class Searcher {
|
|||||||
virtual ~Searcher();
|
virtual ~Searcher();
|
||||||
|
|
||||||
virtual CallbackReturn SearchCallback(SearchFilter &filter,
|
virtual CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context, Address *addr,
|
SymbolContext &context,
|
||||||
bool complete) = 0;
|
Address *addr) = 0;
|
||||||
|
|
||||||
virtual lldb::SearchDepth GetDepth() = 0;
|
virtual lldb::SearchDepth GetDepth() = 0;
|
||||||
|
|
||||||
|
@ -43,9 +43,8 @@ class SectionList {
|
|||||||
const_iterator begin() { return m_sections.begin(); }
|
const_iterator begin() { return m_sections.begin(); }
|
||||||
const_iterator end() { return m_sections.end(); }
|
const_iterator end() { return m_sections.end(); }
|
||||||
|
|
||||||
SectionList();
|
/// Create an empty list.
|
||||||
|
SectionList() = default;
|
||||||
~SectionList();
|
|
||||||
|
|
||||||
SectionList &operator=(const SectionList &rhs);
|
SectionList &operator=(const SectionList &rhs);
|
||||||
|
|
||||||
|
@ -30,23 +30,27 @@ class StreamFile : public Stream {
|
|||||||
|
|
||||||
StreamFile(const char *path);
|
StreamFile(const char *path);
|
||||||
|
|
||||||
StreamFile(const char *path, uint32_t options,
|
StreamFile(const char *path, File::OpenOptions options,
|
||||||
uint32_t permissions = lldb::eFilePermissionsFileDefault);
|
uint32_t permissions = lldb::eFilePermissionsFileDefault);
|
||||||
|
|
||||||
StreamFile(FILE *fh, bool transfer_ownership);
|
StreamFile(FILE *fh, bool transfer_ownership);
|
||||||
|
|
||||||
|
StreamFile(std::shared_ptr<File> file) : m_file_sp(file) { assert(file); };
|
||||||
|
|
||||||
~StreamFile() override;
|
~StreamFile() override;
|
||||||
|
|
||||||
File &GetFile() { return m_file; }
|
File &GetFile() { return *m_file_sp; }
|
||||||
|
|
||||||
const File &GetFile() const { return m_file; }
|
const File &GetFile() const { return *m_file_sp; }
|
||||||
|
|
||||||
|
std::shared_ptr<File> GetFileSP() { return m_file_sp; }
|
||||||
|
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Classes that inherit from StreamFile can see and modify these
|
// Classes that inherit from StreamFile can see and modify these
|
||||||
File m_file;
|
std::shared_ptr<File> m_file_sp; // never NULL
|
||||||
size_t WriteImpl(const void *s, size_t length) override;
|
size_t WriteImpl(const void *s, size_t length) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -54,7 +54,8 @@ class StructuredDataImpl {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data_sp->Dump(stream);
|
llvm::json::OStream s(stream.AsRawOstream());
|
||||||
|
m_data_sp->Serialize(s);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,6 @@ class Value {
|
|||||||
uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx);
|
uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx);
|
||||||
|
|
||||||
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
|
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
|
||||||
uint32_t data_offset,
|
|
||||||
Module *module); // Can be nullptr
|
Module *module); // Can be nullptr
|
||||||
|
|
||||||
static const char *GetValueTypeAsCString(ValueType context_type);
|
static const char *GetValueTypeAsCString(ValueType context_type);
|
||||||
|
@ -22,7 +22,7 @@ typedef uint32_t dw_uleb128_t;
|
|||||||
typedef int32_t dw_sleb128_t;
|
typedef int32_t dw_sleb128_t;
|
||||||
typedef uint16_t dw_attr_t;
|
typedef uint16_t dw_attr_t;
|
||||||
typedef uint16_t dw_form_t;
|
typedef uint16_t dw_form_t;
|
||||||
typedef uint16_t dw_tag_t;
|
typedef llvm::dwarf::Tag dw_tag_t;
|
||||||
typedef uint64_t dw_addr_t; // Dwarf address define that must be big enough for
|
typedef uint64_t dw_addr_t; // Dwarf address define that must be big enough for
|
||||||
// any addresses in the compile units that get
|
// any addresses in the compile units that get
|
||||||
// parsed
|
// parsed
|
||||||
|
@ -47,7 +47,7 @@ static inline ConstString GetValidTypeName_Impl(ConstString type) {
|
|||||||
return type;
|
return type;
|
||||||
|
|
||||||
std::string type_cstr(type.AsCString());
|
std::string type_cstr(type.AsCString());
|
||||||
lldb_utility::StringLexer type_lexer(type_cstr);
|
StringLexer type_lexer(type_cstr);
|
||||||
|
|
||||||
type_lexer.AdvanceIf("class ");
|
type_lexer.AdvanceIf("class ");
|
||||||
type_lexer.AdvanceIf("enum ");
|
type_lexer.AdvanceIf("enum ");
|
||||||
@ -65,9 +65,9 @@ template <typename KeyType, typename ValueType> class FormattersContainer;
|
|||||||
template <typename KeyType, typename ValueType> class FormatMap {
|
template <typename KeyType, typename ValueType> class FormatMap {
|
||||||
public:
|
public:
|
||||||
typedef typename ValueType::SharedPointer ValueSP;
|
typedef typename ValueType::SharedPointer ValueSP;
|
||||||
typedef std::map<KeyType, ValueSP> MapType;
|
typedef std::vector<std::pair<KeyType, ValueSP>> MapType;
|
||||||
typedef typename MapType::iterator MapIterator;
|
typedef typename MapType::iterator MapIterator;
|
||||||
typedef std::function<bool(KeyType, const ValueSP &)> ForEachCallback;
|
typedef std::function<bool(const KeyType &, const ValueSP &)> ForEachCallback;
|
||||||
|
|
||||||
FormatMap(IFormatChangeListener *lst)
|
FormatMap(IFormatChangeListener *lst)
|
||||||
: m_map(), m_map_mutex(), listener(lst) {}
|
: m_map(), m_map_mutex(), listener(lst) {}
|
||||||
@ -79,20 +79,22 @@ template <typename KeyType, typename ValueType> class FormatMap {
|
|||||||
entry->GetRevision() = 0;
|
entry->GetRevision() = 0;
|
||||||
|
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||||
m_map[name] = entry;
|
Delete(name);
|
||||||
|
m_map.emplace_back(std::move(name), std::move(entry));
|
||||||
if (listener)
|
if (listener)
|
||||||
listener->Changed();
|
listener->Changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Delete(KeyType name) {
|
bool Delete(const KeyType &name) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||||
MapIterator iter = m_map.find(name);
|
for (MapIterator iter = m_map.begin(); iter != m_map.end(); ++iter)
|
||||||
if (iter == m_map.end())
|
if (iter->first == name) {
|
||||||
return false;
|
m_map.erase(iter);
|
||||||
m_map.erase(name);
|
if (listener)
|
||||||
if (listener)
|
listener->Changed();
|
||||||
listener->Changed();
|
return true;
|
||||||
return true;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear() {
|
void Clear() {
|
||||||
@ -102,22 +104,22 @@ template <typename KeyType, typename ValueType> class FormatMap {
|
|||||||
listener->Changed();
|
listener->Changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Get(KeyType name, ValueSP &entry) {
|
bool Get(const KeyType &name, ValueSP &entry) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||||
MapIterator iter = m_map.find(name);
|
for (const auto &pos : m_map)
|
||||||
if (iter == m_map.end())
|
if (pos.first == name) {
|
||||||
return false;
|
entry = pos.second;
|
||||||
entry = iter->second;
|
return true;
|
||||||
return true;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForEach(ForEachCallback callback) {
|
void ForEach(ForEachCallback callback) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||||
MapIterator pos, end = m_map.end();
|
for (const auto &pos : m_map) {
|
||||||
for (pos = m_map.begin(); pos != end; pos++) {
|
const KeyType &type = pos.first;
|
||||||
KeyType type = pos->first;
|
if (!callback(type, pos.second))
|
||||||
if (!callback(type, pos->second))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,28 +129,17 @@ template <typename KeyType, typename ValueType> class FormatMap {
|
|||||||
|
|
||||||
ValueSP GetValueAtIndex(size_t index) {
|
ValueSP GetValueAtIndex(size_t index) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||||
MapIterator iter = m_map.begin();
|
if (index >= m_map.size())
|
||||||
MapIterator end = m_map.end();
|
return ValueSP();
|
||||||
while (index > 0) {
|
return m_map[index].second;
|
||||||
iter++;
|
|
||||||
index--;
|
|
||||||
if (end == iter)
|
|
||||||
return ValueSP();
|
|
||||||
}
|
|
||||||
return iter->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If caller holds the mutex we could return a reference without copy ctor.
|
||||||
KeyType GetKeyAtIndex(size_t index) {
|
KeyType GetKeyAtIndex(size_t index) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||||
MapIterator iter = m_map.begin();
|
if (index >= m_map.size())
|
||||||
MapIterator end = m_map.end();
|
return {};
|
||||||
while (index > 0) {
|
return m_map[index].first;
|
||||||
iter++;
|
|
||||||
index--;
|
|
||||||
if (end == iter)
|
|
||||||
return KeyType();
|
|
||||||
}
|
|
||||||
return iter->first;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -171,8 +162,8 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
|||||||
public:
|
public:
|
||||||
typedef typename BackEndType::MapType MapType;
|
typedef typename BackEndType::MapType MapType;
|
||||||
typedef typename MapType::iterator MapIterator;
|
typedef typename MapType::iterator MapIterator;
|
||||||
typedef typename MapType::key_type MapKeyType;
|
typedef KeyType MapKeyType;
|
||||||
typedef typename MapType::mapped_type MapValueType;
|
typedef std::shared_ptr<ValueType> MapValueType;
|
||||||
typedef typename BackEndType::ForEachCallback ForEachCallback;
|
typedef typename BackEndType::ForEachCallback ForEachCallback;
|
||||||
typedef typename std::shared_ptr<FormattersContainer<KeyType, ValueType>>
|
typedef typename std::shared_ptr<FormattersContainer<KeyType, ValueType>>
|
||||||
SharedPointer;
|
SharedPointer;
|
||||||
@ -182,8 +173,8 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
|||||||
FormattersContainer(std::string name, IFormatChangeListener *lst)
|
FormattersContainer(std::string name, IFormatChangeListener *lst)
|
||||||
: m_format_map(lst), m_name(name) {}
|
: m_format_map(lst), m_name(name) {}
|
||||||
|
|
||||||
void Add(const MapKeyType &type, const MapValueType &entry) {
|
void Add(MapKeyType type, const MapValueType &entry) {
|
||||||
Add_Impl(type, entry, static_cast<KeyType *>(nullptr));
|
Add_Impl(std::move(type), entry, static_cast<KeyType *>(nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Delete(ConstString type) {
|
bool Delete(ConstString type) {
|
||||||
@ -233,9 +224,9 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
|||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(FormattersContainer);
|
DISALLOW_COPY_AND_ASSIGN(FormattersContainer);
|
||||||
|
|
||||||
void Add_Impl(const MapKeyType &type, const MapValueType &entry,
|
void Add_Impl(MapKeyType type, const MapValueType &entry,
|
||||||
lldb::RegularExpressionSP *dummy) {
|
RegularExpression *dummy) {
|
||||||
m_format_map.Add(type, entry);
|
m_format_map.Add(std::move(type), entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Add_Impl(ConstString type, const MapValueType &entry,
|
void Add_Impl(ConstString type, const MapValueType &entry,
|
||||||
@ -247,12 +238,12 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
|||||||
return m_format_map.Delete(type);
|
return m_format_map.Delete(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Delete_Impl(ConstString type, lldb::RegularExpressionSP *dummy) {
|
bool Delete_Impl(ConstString type, RegularExpression *dummy) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
||||||
MapIterator pos, end = m_format_map.map().end();
|
MapIterator pos, end = m_format_map.map().end();
|
||||||
for (pos = m_format_map.map().begin(); pos != end; pos++) {
|
for (pos = m_format_map.map().begin(); pos != end; pos++) {
|
||||||
lldb::RegularExpressionSP regex = pos->first;
|
const RegularExpression ®ex = pos->first;
|
||||||
if (type.GetStringRef() == regex->GetText()) {
|
if (type.GetStringRef() == regex.GetText()) {
|
||||||
m_format_map.map().erase(pos);
|
m_format_map.map().erase(pos);
|
||||||
if (m_format_map.listener)
|
if (m_format_map.listener)
|
||||||
m_format_map.listener->Changed();
|
m_format_map.listener->Changed();
|
||||||
@ -282,24 +273,23 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lldb::TypeNameSpecifierImplSP
|
lldb::TypeNameSpecifierImplSP
|
||||||
GetTypeNameSpecifierAtIndex_Impl(size_t index,
|
GetTypeNameSpecifierAtIndex_Impl(size_t index, RegularExpression *dummy) {
|
||||||
lldb::RegularExpressionSP *dummy) {
|
RegularExpression regex = m_format_map.GetKeyAtIndex(index);
|
||||||
lldb::RegularExpressionSP regex = m_format_map.GetKeyAtIndex(index);
|
if (regex == RegularExpression())
|
||||||
if (regex.get() == nullptr)
|
|
||||||
return lldb::TypeNameSpecifierImplSP();
|
return lldb::TypeNameSpecifierImplSP();
|
||||||
return lldb::TypeNameSpecifierImplSP(
|
return lldb::TypeNameSpecifierImplSP(
|
||||||
new TypeNameSpecifierImpl(regex->GetText().str().c_str(), true));
|
new TypeNameSpecifierImpl(regex.GetText().str().c_str(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Get_Impl(ConstString key, MapValueType &value,
|
bool Get_Impl(ConstString key, MapValueType &value,
|
||||||
lldb::RegularExpressionSP *dummy) {
|
RegularExpression *dummy) {
|
||||||
llvm::StringRef key_str = key.GetStringRef();
|
llvm::StringRef key_str = key.GetStringRef();
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
||||||
MapIterator pos, end = m_format_map.map().end();
|
// Patterns are matched in reverse-chronological order.
|
||||||
for (pos = m_format_map.map().begin(); pos != end; pos++) {
|
for (const auto &pos : llvm::reverse(m_format_map.map())) {
|
||||||
lldb::RegularExpressionSP regex = pos->first;
|
const RegularExpression ®ex = pos.first;
|
||||||
if (regex->Execute(key_str)) {
|
if (regex.Execute(key_str)) {
|
||||||
value = pos->second;
|
value = pos.second;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,13 +297,12 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool GetExact_Impl(ConstString key, MapValueType &value,
|
bool GetExact_Impl(ConstString key, MapValueType &value,
|
||||||
lldb::RegularExpressionSP *dummy) {
|
RegularExpression *dummy) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
||||||
MapIterator pos, end = m_format_map.map().end();
|
for (const auto &pos : m_format_map.map()) {
|
||||||
for (pos = m_format_map.map().begin(); pos != end; pos++) {
|
const RegularExpression ®ex = pos.first;
|
||||||
lldb::RegularExpressionSP regex = pos->first;
|
if (regex.GetText() == key.GetStringRef()) {
|
||||||
if (regex->GetText() == key.GetStringRef()) {
|
value = pos.second;
|
||||||
value = pos->second;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,238 +24,121 @@ class StringPrinter {
|
|||||||
|
|
||||||
enum class GetPrintableElementType { ASCII, UTF8 };
|
enum class GetPrintableElementType { ASCII, UTF8 };
|
||||||
|
|
||||||
class ReadStringAndDumpToStreamOptions {
|
class DumpToStreamOptions {
|
||||||
public:
|
public:
|
||||||
ReadStringAndDumpToStreamOptions()
|
DumpToStreamOptions() = default;
|
||||||
: m_location(0), m_process_sp(), m_stream(nullptr), m_prefix_token(),
|
|
||||||
m_suffix_token(), m_quote('"'), m_source_size(0),
|
|
||||||
m_needs_zero_termination(true), m_escape_non_printables(true),
|
|
||||||
m_ignore_max_length(false), m_zero_is_terminator(true),
|
|
||||||
m_language_type(lldb::eLanguageTypeUnknown) {}
|
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions(ValueObject &valobj);
|
void SetStream(Stream *s) { m_stream = s; }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetLocation(uint64_t l) {
|
|
||||||
m_location = l;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t GetLocation() const { return m_location; }
|
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetProcessSP(lldb::ProcessSP p) {
|
|
||||||
m_process_sp = p;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
lldb::ProcessSP GetProcessSP() const { return m_process_sp; }
|
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetStream(Stream *s) {
|
|
||||||
m_stream = s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Stream *GetStream() const { return m_stream; }
|
Stream *GetStream() const { return m_stream; }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetPrefixToken(const std::string &p) {
|
void SetPrefixToken(const std::string &p) { m_prefix_token = p; }
|
||||||
m_prefix_token = p;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetPrefixToken(std::nullptr_t) {
|
void SetPrefixToken(std::nullptr_t) { m_prefix_token.clear(); }
|
||||||
m_prefix_token.clear();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
|
const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetSuffixToken(const std::string &p) {
|
void SetSuffixToken(const std::string &p) { m_suffix_token = p; }
|
||||||
m_suffix_token = p;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetSuffixToken(std::nullptr_t) {
|
void SetSuffixToken(std::nullptr_t) { m_suffix_token.clear(); }
|
||||||
m_suffix_token.clear();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
|
const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetQuote(char q) {
|
void SetQuote(char q) { m_quote = q; }
|
||||||
m_quote = q;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
char GetQuote() const { return m_quote; }
|
char GetQuote() const { return m_quote; }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetSourceSize(uint32_t s) {
|
void SetSourceSize(uint32_t s) { m_source_size = s; }
|
||||||
m_source_size = s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t GetSourceSize() const { return m_source_size; }
|
uint32_t GetSourceSize() const { return m_source_size; }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetNeedsZeroTermination(bool z) {
|
void SetNeedsZeroTermination(bool z) { m_needs_zero_termination = z; }
|
||||||
m_needs_zero_termination = z;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetNeedsZeroTermination() const { return m_needs_zero_termination; }
|
bool GetNeedsZeroTermination() const { return m_needs_zero_termination; }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetBinaryZeroIsTerminator(bool e) {
|
void SetBinaryZeroIsTerminator(bool e) { m_zero_is_terminator = e; }
|
||||||
m_zero_is_terminator = e;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
|
bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetEscapeNonPrintables(bool e) {
|
void SetEscapeNonPrintables(bool e) { m_escape_non_printables = e; }
|
||||||
m_escape_non_printables = e;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
|
bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetIgnoreMaxLength(bool e) {
|
void SetIgnoreMaxLength(bool e) { m_ignore_max_length = e; }
|
||||||
m_ignore_max_length = e;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetIgnoreMaxLength() const { return m_ignore_max_length; }
|
bool GetIgnoreMaxLength() const { return m_ignore_max_length; }
|
||||||
|
|
||||||
ReadStringAndDumpToStreamOptions &SetLanguage(lldb::LanguageType l) {
|
void SetLanguage(lldb::LanguageType l) { m_language_type = l; }
|
||||||
m_language_type = l;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
lldb::LanguageType GetLanguage() const
|
lldb::LanguageType GetLanguage() const { return m_language_type; }
|
||||||
|
|
||||||
{
|
|
||||||
return m_language_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint64_t m_location;
|
/// The used output stream.
|
||||||
lldb::ProcessSP m_process_sp;
|
Stream *m_stream = nullptr;
|
||||||
Stream *m_stream;
|
/// String that should be printed before the heading quote character.
|
||||||
std::string m_prefix_token;
|
std::string m_prefix_token;
|
||||||
|
/// String that should be printed after the trailing quote character.
|
||||||
std::string m_suffix_token;
|
std::string m_suffix_token;
|
||||||
char m_quote;
|
/// The quote character that should surround the string.
|
||||||
uint32_t m_source_size;
|
char m_quote = '"';
|
||||||
bool m_needs_zero_termination;
|
/// The length of the memory region that should be dumped in bytes.
|
||||||
bool m_escape_non_printables;
|
uint32_t m_source_size = 0;
|
||||||
bool m_ignore_max_length;
|
bool m_needs_zero_termination = true;
|
||||||
bool m_zero_is_terminator;
|
/// True iff non-printable characters should be escaped when dumping
|
||||||
lldb::LanguageType m_language_type;
|
/// them to the stream.
|
||||||
|
bool m_escape_non_printables = true;
|
||||||
|
/// True iff the max-string-summary-length setting of the target should
|
||||||
|
/// be ignored.
|
||||||
|
bool m_ignore_max_length = false;
|
||||||
|
/// True iff a zero bytes ('\0') should terminate the memory region that
|
||||||
|
/// is being dumped.
|
||||||
|
bool m_zero_is_terminator = true;
|
||||||
|
/// The language that the generated string literal is supposed to be valid
|
||||||
|
/// for. This changes for example what and how certain characters are
|
||||||
|
/// escaped.
|
||||||
|
/// For example, printing the a string containing only a quote (") char
|
||||||
|
/// with eLanguageTypeC would escape the quote character.
|
||||||
|
lldb::LanguageType m_language_type = lldb::eLanguageTypeUnknown;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReadBufferAndDumpToStreamOptions {
|
class ReadStringAndDumpToStreamOptions : public DumpToStreamOptions {
|
||||||
public:
|
public:
|
||||||
ReadBufferAndDumpToStreamOptions()
|
ReadStringAndDumpToStreamOptions() = default;
|
||||||
: m_data(), m_stream(nullptr), m_prefix_token(), m_suffix_token(),
|
|
||||||
m_quote('"'), m_source_size(0), m_escape_non_printables(true),
|
ReadStringAndDumpToStreamOptions(ValueObject &valobj);
|
||||||
m_zero_is_terminator(true), m_is_truncated(false),
|
|
||||||
m_language_type(lldb::eLanguageTypeUnknown) {}
|
void SetLocation(uint64_t l) { m_location = l; }
|
||||||
|
|
||||||
|
uint64_t GetLocation() const { return m_location; }
|
||||||
|
|
||||||
|
void SetProcessSP(lldb::ProcessSP p) { m_process_sp = p; }
|
||||||
|
|
||||||
|
lldb::ProcessSP GetProcessSP() const { return m_process_sp; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint64_t m_location = 0;
|
||||||
|
lldb::ProcessSP m_process_sp;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ReadBufferAndDumpToStreamOptions : public DumpToStreamOptions {
|
||||||
|
public:
|
||||||
|
ReadBufferAndDumpToStreamOptions() = default;
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions(ValueObject &valobj);
|
ReadBufferAndDumpToStreamOptions(ValueObject &valobj);
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions(
|
ReadBufferAndDumpToStreamOptions(
|
||||||
const ReadStringAndDumpToStreamOptions &options);
|
const ReadStringAndDumpToStreamOptions &options);
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetData(DataExtractor d) {
|
void SetData(DataExtractor d) { m_data = d; }
|
||||||
m_data = d;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
lldb_private::DataExtractor GetData() const { return m_data; }
|
lldb_private::DataExtractor GetData() const { return m_data; }
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetStream(Stream *s) {
|
void SetIsTruncated(bool t) { m_is_truncated = t; }
|
||||||
m_stream = s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
Stream *GetStream() const { return m_stream; }
|
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetPrefixToken(const std::string &p) {
|
|
||||||
m_prefix_token = p;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetPrefixToken(std::nullptr_t) {
|
|
||||||
m_prefix_token.clear();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
|
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetSuffixToken(const std::string &p) {
|
|
||||||
m_suffix_token = p;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetSuffixToken(std::nullptr_t) {
|
|
||||||
m_suffix_token.clear();
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
|
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetQuote(char q) {
|
|
||||||
m_quote = q;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
char GetQuote() const { return m_quote; }
|
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetSourceSize(uint32_t s) {
|
|
||||||
m_source_size = s;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t GetSourceSize() const { return m_source_size; }
|
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetEscapeNonPrintables(bool e) {
|
|
||||||
m_escape_non_printables = e;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
|
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetBinaryZeroIsTerminator(bool e) {
|
|
||||||
m_zero_is_terminator = e;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
|
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetIsTruncated(bool t) {
|
|
||||||
m_is_truncated = t;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetIsTruncated() const { return m_is_truncated; }
|
bool GetIsTruncated() const { return m_is_truncated; }
|
||||||
|
|
||||||
ReadBufferAndDumpToStreamOptions &SetLanguage(lldb::LanguageType l) {
|
|
||||||
m_language_type = l;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
lldb::LanguageType GetLanguage() const
|
|
||||||
|
|
||||||
{
|
|
||||||
return m_language_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DataExtractor m_data;
|
DataExtractor m_data;
|
||||||
Stream *m_stream;
|
bool m_is_truncated = false;
|
||||||
std::string m_prefix_token;
|
|
||||||
std::string m_suffix_token;
|
|
||||||
char m_quote;
|
|
||||||
uint32_t m_source_size;
|
|
||||||
bool m_escape_non_printables;
|
|
||||||
bool m_zero_is_terminator;
|
|
||||||
bool m_is_truncated;
|
|
||||||
lldb::LanguageType m_language_type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// I can't use a std::unique_ptr for this because the Deleter is a template
|
// I can't use a std::unique_ptr for this because the Deleter is a template
|
||||||
|
@ -26,7 +26,7 @@ namespace lldb_private {
|
|||||||
template <typename FormatterImpl> class FormatterContainerPair {
|
template <typename FormatterImpl> class FormatterContainerPair {
|
||||||
public:
|
public:
|
||||||
typedef FormattersContainer<ConstString, FormatterImpl> ExactMatchContainer;
|
typedef FormattersContainer<ConstString, FormatterImpl> ExactMatchContainer;
|
||||||
typedef FormattersContainer<lldb::RegularExpressionSP, FormatterImpl>
|
typedef FormattersContainer<RegularExpression, FormatterImpl>
|
||||||
RegexMatchContainer;
|
RegexMatchContainer;
|
||||||
|
|
||||||
typedef typename ExactMatchContainer::MapType ExactMatchMap;
|
typedef typename ExactMatchContainer::MapType ExactMatchMap;
|
||||||
|
@ -50,15 +50,8 @@ class DWARFExpression {
|
|||||||
/// \param[in] data
|
/// \param[in] data
|
||||||
/// A data extractor configured to read the DWARF location expression's
|
/// A data extractor configured to read the DWARF location expression's
|
||||||
/// bytecode.
|
/// bytecode.
|
||||||
///
|
|
||||||
/// \param[in] data_offset
|
|
||||||
/// The offset of the location expression in the extractor.
|
|
||||||
///
|
|
||||||
/// \param[in] data_length
|
|
||||||
/// The byte length of the location expression.
|
|
||||||
DWARFExpression(lldb::ModuleSP module, const DataExtractor &data,
|
DWARFExpression(lldb::ModuleSP module, const DataExtractor &data,
|
||||||
const DWARFUnit *dwarf_cu, lldb::offset_t data_offset,
|
const DWARFUnit *dwarf_cu);
|
||||||
lldb::offset_t data_length);
|
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~DWARFExpression();
|
virtual ~DWARFExpression();
|
||||||
@ -211,12 +204,6 @@ class DWARFExpression {
|
|||||||
/// in the case where an expression needs to be evaluated while building
|
/// in the case where an expression needs to be evaluated while building
|
||||||
/// the stack frame list, this short-cut is available.
|
/// the stack frame list, this short-cut is available.
|
||||||
///
|
///
|
||||||
/// \param[in] offset
|
|
||||||
/// The offset of the location expression in the data extractor.
|
|
||||||
///
|
|
||||||
/// \param[in] length
|
|
||||||
/// The length in bytes of the location expression.
|
|
||||||
///
|
|
||||||
/// \param[in] reg_set
|
/// \param[in] reg_set
|
||||||
/// The call-frame-info style register kind.
|
/// The call-frame-info style register kind.
|
||||||
///
|
///
|
||||||
@ -236,8 +223,7 @@ class DWARFExpression {
|
|||||||
/// details of the failure are provided through it.
|
/// details of the failure are provided through it.
|
||||||
static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
|
static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
|
||||||
lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
|
lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
|
||||||
const DWARFUnit *dwarf_cu, const lldb::offset_t offset,
|
const DWARFUnit *dwarf_cu,
|
||||||
const lldb::offset_t length,
|
|
||||||
const lldb::RegisterKind reg_set,
|
const lldb::RegisterKind reg_set,
|
||||||
const Value *initial_value_ptr,
|
const Value *initial_value_ptr,
|
||||||
const Value *object_address_ptr, Value &result,
|
const Value *object_address_ptr, Value &result,
|
||||||
@ -252,10 +238,6 @@ class DWARFExpression {
|
|||||||
lldb::addr_t loclist_base_load_addr,
|
lldb::addr_t loclist_base_load_addr,
|
||||||
lldb::addr_t address, ABI *abi);
|
lldb::addr_t address, ABI *abi);
|
||||||
|
|
||||||
static size_t LocationListSize(const DWARFUnit *dwarf_cu,
|
|
||||||
const DataExtractor &debug_loc_data,
|
|
||||||
lldb::offset_t offset);
|
|
||||||
|
|
||||||
static bool PrintDWARFExpression(Stream &s, const DataExtractor &data,
|
static bool PrintDWARFExpression(Stream &s, const DataExtractor &data,
|
||||||
int address_size, int dwarf_ref_size,
|
int address_size, int dwarf_ref_size,
|
||||||
bool location_expression);
|
bool location_expression);
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "lldb/lldb-defines.h"
|
#include "lldb/lldb-defines.h"
|
||||||
#include "lldb/lldb-types.h"
|
#include "lldb/lldb-types.h"
|
||||||
|
|
||||||
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -23,7 +24,6 @@ enum DiagnosticOrigin {
|
|||||||
eDiagnosticOriginUnknown = 0,
|
eDiagnosticOriginUnknown = 0,
|
||||||
eDiagnosticOriginLLDB,
|
eDiagnosticOriginLLDB,
|
||||||
eDiagnosticOriginClang,
|
eDiagnosticOriginClang,
|
||||||
eDiagnosticOriginGo,
|
|
||||||
eDiagnosticOriginSwift,
|
eDiagnosticOriginSwift,
|
||||||
eDiagnosticOriginLLVM
|
eDiagnosticOriginLLVM
|
||||||
};
|
};
|
||||||
@ -47,7 +47,6 @@ class Diagnostic {
|
|||||||
switch (kind) {
|
switch (kind) {
|
||||||
case eDiagnosticOriginUnknown:
|
case eDiagnosticOriginUnknown:
|
||||||
case eDiagnosticOriginLLDB:
|
case eDiagnosticOriginLLDB:
|
||||||
case eDiagnosticOriginGo:
|
|
||||||
case eDiagnosticOriginLLVM:
|
case eDiagnosticOriginLLVM:
|
||||||
return true;
|
return true;
|
||||||
case eDiagnosticOriginClang:
|
case eDiagnosticOriginClang:
|
||||||
@ -89,7 +88,7 @@ class Diagnostic {
|
|||||||
uint32_t m_compiler_id; // Compiler-specific diagnostic ID
|
uint32_t m_compiler_id; // Compiler-specific diagnostic ID
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Diagnostic *> DiagnosticList;
|
typedef std::vector<std::unique_ptr<Diagnostic>> DiagnosticList;
|
||||||
|
|
||||||
class DiagnosticManager {
|
class DiagnosticManager {
|
||||||
public:
|
public:
|
||||||
@ -98,45 +97,33 @@ class DiagnosticManager {
|
|||||||
m_fixed_expression.clear();
|
m_fixed_expression.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The diagnostic manager holds a list of diagnostics, which are owned by the
|
|
||||||
// manager.
|
|
||||||
const DiagnosticList &Diagnostics() { return m_diagnostics; }
|
const DiagnosticList &Diagnostics() { return m_diagnostics; }
|
||||||
|
|
||||||
~DiagnosticManager() {
|
bool HasFixIts() const {
|
||||||
for (Diagnostic *diag : m_diagnostics) {
|
return llvm::any_of(m_diagnostics,
|
||||||
delete diag;
|
[](const std::unique_ptr<Diagnostic> &diag) {
|
||||||
}
|
return diag->HasFixIts();
|
||||||
}
|
});
|
||||||
|
|
||||||
bool HasFixIts() {
|
|
||||||
for (Diagnostic *diag : m_diagnostics) {
|
|
||||||
if (diag->HasFixIts())
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddDiagnostic(llvm::StringRef message, DiagnosticSeverity severity,
|
void AddDiagnostic(llvm::StringRef message, DiagnosticSeverity severity,
|
||||||
DiagnosticOrigin origin,
|
DiagnosticOrigin origin,
|
||||||
uint32_t compiler_id = LLDB_INVALID_COMPILER_ID) {
|
uint32_t compiler_id = LLDB_INVALID_COMPILER_ID) {
|
||||||
m_diagnostics.push_back(
|
m_diagnostics.emplace_back(
|
||||||
new Diagnostic(message, severity, origin, compiler_id));
|
std::make_unique<Diagnostic>(message, severity, origin, compiler_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddDiagnostic(Diagnostic *diagnostic) {
|
void AddDiagnostic(std::unique_ptr<Diagnostic> diagnostic) {
|
||||||
m_diagnostics.push_back(diagnostic);
|
m_diagnostics.push_back(std::move(diagnostic));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyDiagnostics(DiagnosticManager &otherDiagnostics);
|
|
||||||
|
|
||||||
size_t Printf(DiagnosticSeverity severity, const char *format, ...)
|
size_t Printf(DiagnosticSeverity severity, const char *format, ...)
|
||||||
__attribute__((format(printf, 3, 4)));
|
__attribute__((format(printf, 3, 4)));
|
||||||
size_t PutString(DiagnosticSeverity severity, llvm::StringRef str);
|
void PutString(DiagnosticSeverity severity, llvm::StringRef str);
|
||||||
|
|
||||||
void AppendMessageToDiagnostic(llvm::StringRef str) {
|
void AppendMessageToDiagnostic(llvm::StringRef str) {
|
||||||
if (!m_diagnostics.empty()) {
|
if (!m_diagnostics.empty())
|
||||||
m_diagnostics.back()->AppendMessage(str);
|
m_diagnostics.back()->AppendMessage(str);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns a string containing errors in this format:
|
// Returns a string containing errors in this format:
|
||||||
@ -153,7 +140,6 @@ class DiagnosticManager {
|
|||||||
// Moves fixed_expression to the internal storage.
|
// Moves fixed_expression to the internal storage.
|
||||||
void SetFixedExpression(std::string fixed_expression) {
|
void SetFixedExpression(std::string fixed_expression) {
|
||||||
m_fixed_expression = std::move(fixed_expression);
|
m_fixed_expression = std::move(fixed_expression);
|
||||||
fixed_expression.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -17,20 +17,27 @@
|
|||||||
namespace lldb_private {
|
namespace lldb_private {
|
||||||
|
|
||||||
class ExpressionSourceCode {
|
class ExpressionSourceCode {
|
||||||
|
protected:
|
||||||
|
enum Wrapping : bool {
|
||||||
|
Wrap = true,
|
||||||
|
NoWrap = false,
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool NeedsWrapping() const { return m_wrap; }
|
bool NeedsWrapping() const { return m_wrap == Wrap; }
|
||||||
|
|
||||||
const char *GetName() const { return m_name.c_str(); }
|
const char *GetName() const { return m_name.c_str(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ExpressionSourceCode(const char *name, const char *prefix, const char *body,
|
ExpressionSourceCode(llvm::StringRef name, llvm::StringRef prefix,
|
||||||
bool wrap)
|
llvm::StringRef body, Wrapping wrap)
|
||||||
: m_name(name), m_prefix(prefix), m_body(body), m_wrap(wrap) {}
|
: m_name(name.str()), m_prefix(prefix.str()), m_body(body.str()),
|
||||||
|
m_wrap(wrap) {}
|
||||||
|
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
std::string m_prefix;
|
std::string m_prefix;
|
||||||
std::string m_body;
|
std::string m_body;
|
||||||
bool m_wrap;
|
Wrapping m_wrap;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace lldb_private
|
} // namespace lldb_private
|
||||||
|
@ -103,22 +103,6 @@ class LLVMUserExpression : public UserExpression {
|
|||||||
/// when running the
|
/// when running the
|
||||||
/// expression.
|
/// expression.
|
||||||
lldb::ModuleWP m_jit_module_wp;
|
lldb::ModuleWP m_jit_module_wp;
|
||||||
bool m_enforce_valid_object; ///< True if the expression parser should enforce
|
|
||||||
///the presence of a valid class pointer
|
|
||||||
/// in order to generate the expression as a method.
|
|
||||||
bool m_in_cplusplus_method; ///< True if the expression is compiled as a C++
|
|
||||||
///member function (true if it was parsed
|
|
||||||
/// when exe_ctx was in a C++ method).
|
|
||||||
bool m_in_objectivec_method; ///< True if the expression is compiled as an
|
|
||||||
///Objective-C method (true if it was parsed
|
|
||||||
/// when exe_ctx was in an Objective-C method).
|
|
||||||
bool m_in_static_method; ///< True if the expression is compiled as a static
|
|
||||||
///(or class) method (currently true if it
|
|
||||||
/// was parsed when exe_ctx was in an Objective-C class method).
|
|
||||||
bool m_needs_object_ptr; ///< True if "this" or "self" must be looked up and
|
|
||||||
///passed in. False if the expression
|
|
||||||
/// doesn't really use them and they can be NULL.
|
|
||||||
bool m_const_object; ///< True if "this" is const.
|
|
||||||
Target *m_target; ///< The target for storing persistent data like types and
|
Target *m_target; ///< The target for storing persistent data like types and
|
||||||
///variables.
|
///variables.
|
||||||
|
|
||||||
|
@ -115,8 +115,6 @@ class Materializer {
|
|||||||
void SetOffset(uint32_t offset) { m_offset = offset; }
|
void SetOffset(uint32_t offset) { m_offset = offset; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetSizeAndAlignmentFromType(CompilerType &type);
|
|
||||||
|
|
||||||
uint32_t m_alignment;
|
uint32_t m_alignment;
|
||||||
uint32_t m_size;
|
uint32_t m_size;
|
||||||
uint32_t m_offset;
|
uint32_t m_offset;
|
||||||
|
@ -103,10 +103,8 @@ class REPL : public IOHandlerDelegate {
|
|||||||
void IOHandlerInputComplete(IOHandler &io_handler,
|
void IOHandlerInputComplete(IOHandler &io_handler,
|
||||||
std::string &line) override;
|
std::string &line) override;
|
||||||
|
|
||||||
int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
|
void IOHandlerComplete(IOHandler &io_handler,
|
||||||
const char *cursor, const char *last_char,
|
CompletionRequest &request) override;
|
||||||
int skip_first_n_matches, int max_matches,
|
|
||||||
StringList &matches, StringList &descriptions) override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static int CalculateActualIndentation(const StringList &lines);
|
static int CalculateActualIndentation(const StringList &lines);
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
|
#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
|
||||||
|
|
||||||
|
#cmakedefine01 HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
#cmakedefine01 HAVE_SYS_EVENT_H
|
#cmakedefine01 HAVE_SYS_EVENT_H
|
||||||
|
|
||||||
#cmakedefine01 HAVE_PPOLL
|
#cmakedefine01 HAVE_PPOLL
|
||||||
@ -33,4 +35,6 @@
|
|||||||
#cmakedefine HAVE_LIBCOMPRESSION
|
#cmakedefine HAVE_LIBCOMPRESSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#cmakedefine01 LLDB_ENABLE_LZMA
|
||||||
|
|
||||||
#endif // #ifndef LLDB_HOST_CONFIG_H
|
#endif // #ifndef LLDB_HOST_CONFIG_H
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "lldb/Host/ConnectionFileDescriptor.h"
|
#include "lldb/Host/ConnectionFileDescriptor.h"
|
||||||
|
#include "lldb/Utility/CompletionRequest.h"
|
||||||
#include "lldb/Utility/FileSpec.h"
|
#include "lldb/Utility/FileSpec.h"
|
||||||
#include "lldb/Utility/Predicate.h"
|
#include "lldb/Utility/Predicate.h"
|
||||||
|
|
||||||
@ -97,11 +98,7 @@ typedef int (*FixIndentationCallbackType)(Editline *editline,
|
|||||||
const StringList &lines,
|
const StringList &lines,
|
||||||
int cursor_position, void *baton);
|
int cursor_position, void *baton);
|
||||||
|
|
||||||
typedef int (*CompleteCallbackType)(const char *current_line,
|
typedef void (*CompleteCallbackType)(CompletionRequest &request, void *baton);
|
||||||
const char *cursor, const char *last_char,
|
|
||||||
int skip_first_n_matches, int max_matches,
|
|
||||||
StringList &matches,
|
|
||||||
StringList &descriptions, void *baton);
|
|
||||||
|
|
||||||
/// Status used to decide when and how to start editing another line in
|
/// Status used to decide when and how to start editing another line in
|
||||||
/// multi-line sessions
|
/// multi-line sessions
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "lldb/Utility/IOObject.h"
|
#include "lldb/Utility/IOObject.h"
|
||||||
#include "lldb/Utility/Status.h"
|
#include "lldb/Utility/Status.h"
|
||||||
#include "lldb/lldb-private.h"
|
#include "lldb/lldb-private.h"
|
||||||
|
#include "llvm/ADT/BitmaskEnum.h"
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -21,11 +22,15 @@
|
|||||||
|
|
||||||
namespace lldb_private {
|
namespace lldb_private {
|
||||||
|
|
||||||
|
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
|
||||||
|
|
||||||
/// \class File File.h "lldb/Host/File.h"
|
/// \class File File.h "lldb/Host/File.h"
|
||||||
/// A file class.
|
/// An abstract base class for files.
|
||||||
///
|
///
|
||||||
/// A file class that divides abstracts the LLDB core from host file
|
/// Files will often be NativeFiles, which provides a wrapper
|
||||||
/// functionality.
|
/// around host OS file functionality. But it
|
||||||
|
/// is also possible to subclass file to provide objects that have file
|
||||||
|
/// or stream functionality but are not backed by any host OS file.
|
||||||
class File : public IOObject {
|
class File : public IOObject {
|
||||||
public:
|
public:
|
||||||
static int kInvalidDescriptor;
|
static int kInvalidDescriptor;
|
||||||
@ -33,7 +38,12 @@ class File : public IOObject {
|
|||||||
|
|
||||||
// NB this enum is used in the lldb platform gdb-remote packet
|
// NB this enum is used in the lldb platform gdb-remote packet
|
||||||
// vFile:open: and existing values cannot be modified.
|
// vFile:open: and existing values cannot be modified.
|
||||||
enum OpenOptions {
|
//
|
||||||
|
// FIXME
|
||||||
|
// These values do not match the values used by GDB
|
||||||
|
// * https://sourceware.org/gdb/onlinedocs/gdb/Open-Flags.html#Open-Flags
|
||||||
|
// * rdar://problem/46788934
|
||||||
|
enum OpenOptions : uint32_t {
|
||||||
eOpenOptionRead = (1u << 0), // Open file for reading
|
eOpenOptionRead = (1u << 0), // Open file for reading
|
||||||
eOpenOptionWrite = (1u << 1), // Open file for writing
|
eOpenOptionWrite = (1u << 1), // Open file for writing
|
||||||
eOpenOptionAppend =
|
eOpenOptionAppend =
|
||||||
@ -45,129 +55,106 @@ class File : public IOObject {
|
|||||||
(1u << 6), // Can create file only if it doesn't already exist
|
(1u << 6), // Can create file only if it doesn't already exist
|
||||||
eOpenOptionDontFollowSymlinks = (1u << 7),
|
eOpenOptionDontFollowSymlinks = (1u << 7),
|
||||||
eOpenOptionCloseOnExec =
|
eOpenOptionCloseOnExec =
|
||||||
(1u << 8) // Close the file when executing a new process
|
(1u << 8), // Close the file when executing a new process
|
||||||
|
LLVM_MARK_AS_BITMASK_ENUM(/* largest_value= */ eOpenOptionCloseOnExec)
|
||||||
};
|
};
|
||||||
|
|
||||||
static mode_t ConvertOpenOptionsForPOSIXOpen(uint32_t open_options);
|
static mode_t ConvertOpenOptionsForPOSIXOpen(OpenOptions open_options);
|
||||||
|
static llvm::Expected<OpenOptions> GetOptionsFromMode(llvm::StringRef mode);
|
||||||
|
static bool DescriptorIsValid(int descriptor) { return descriptor >= 0; };
|
||||||
|
static llvm::Expected<const char *>
|
||||||
|
GetStreamOpenModeFromOptions(OpenOptions options);
|
||||||
|
|
||||||
File()
|
File()
|
||||||
: IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
|
: IOObject(eFDTypeFile), m_is_interactive(eLazyBoolCalculate),
|
||||||
m_stream(kInvalidStream), m_options(0), m_own_stream(false),
|
|
||||||
m_is_interactive(eLazyBoolCalculate),
|
|
||||||
m_is_real_terminal(eLazyBoolCalculate),
|
m_is_real_terminal(eLazyBoolCalculate),
|
||||||
m_supports_colors(eLazyBoolCalculate) {}
|
m_supports_colors(eLazyBoolCalculate){};
|
||||||
|
|
||||||
File(FILE *fh, bool transfer_ownership)
|
/// Read bytes from a file from the current file position into buf.
|
||||||
: IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
|
|
||||||
m_stream(fh), m_options(0), m_own_stream(transfer_ownership),
|
|
||||||
m_is_interactive(eLazyBoolCalculate),
|
|
||||||
m_is_real_terminal(eLazyBoolCalculate),
|
|
||||||
m_supports_colors(eLazyBoolCalculate) {}
|
|
||||||
|
|
||||||
File(int fd, bool transfer_ownership)
|
|
||||||
: IOObject(eFDTypeFile, transfer_ownership), m_descriptor(fd),
|
|
||||||
m_stream(kInvalidStream), m_options(0), m_own_stream(false),
|
|
||||||
m_is_interactive(eLazyBoolCalculate),
|
|
||||||
m_is_real_terminal(eLazyBoolCalculate) {}
|
|
||||||
|
|
||||||
/// Destructor.
|
|
||||||
///
|
|
||||||
/// The destructor is virtual in case this class is subclassed.
|
|
||||||
~File() override;
|
|
||||||
|
|
||||||
bool IsValid() const override {
|
|
||||||
return DescriptorIsValid() || StreamIsValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Convert to pointer operator.
|
|
||||||
///
|
|
||||||
/// This allows code to check a File object to see if it contains anything
|
|
||||||
/// valid using code such as:
|
|
||||||
///
|
|
||||||
/// \code
|
|
||||||
/// File file(...);
|
|
||||||
/// if (file)
|
|
||||||
/// { ...
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// A pointer to this object if either the directory or filename
|
|
||||||
/// is valid, nullptr otherwise.
|
|
||||||
operator bool() const { return DescriptorIsValid() || StreamIsValid(); }
|
|
||||||
|
|
||||||
/// Logical NOT operator.
|
|
||||||
///
|
|
||||||
/// This allows code to check a File object to see if it is invalid using
|
|
||||||
/// code such as:
|
|
||||||
///
|
|
||||||
/// \code
|
|
||||||
/// File file(...);
|
|
||||||
/// if (!file)
|
|
||||||
/// { ...
|
|
||||||
/// \endcode
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// Returns \b true if the object has an empty directory and
|
|
||||||
/// filename, \b false otherwise.
|
|
||||||
bool operator!() const { return !DescriptorIsValid() && !StreamIsValid(); }
|
|
||||||
|
|
||||||
/// Get the file spec for this file.
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// A reference to the file specification object.
|
|
||||||
Status GetFileSpec(FileSpec &file_spec) const;
|
|
||||||
|
|
||||||
Status Close() override;
|
|
||||||
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
int GetDescriptor() const;
|
|
||||||
|
|
||||||
WaitableHandle GetWaitableHandle() override;
|
|
||||||
|
|
||||||
void SetDescriptor(int fd, bool transfer_ownership);
|
|
||||||
|
|
||||||
FILE *GetStream();
|
|
||||||
|
|
||||||
void SetStream(FILE *fh, bool transfer_ownership);
|
|
||||||
|
|
||||||
/// Read bytes from a file from the current file position.
|
|
||||||
///
|
///
|
||||||
/// NOTE: This function is NOT thread safe. Use the read function
|
/// NOTE: This function is NOT thread safe. Use the read function
|
||||||
/// that takes an "off_t &offset" to ensure correct operation in multi-
|
/// that takes an "off_t &offset" to ensure correct operation in multi-
|
||||||
/// threaded environments.
|
/// threaded environments.
|
||||||
///
|
///
|
||||||
/// \param[in] buf
|
/// \param[out] buf
|
||||||
/// A buffer where to put the bytes that are read.
|
|
||||||
///
|
///
|
||||||
/// \param[in,out] num_bytes
|
/// \param[in,out] num_bytes.
|
||||||
/// The number of bytes to read form the current file position
|
/// Pass in the size of buf. Read will pass out the number
|
||||||
/// which gets modified with the number of bytes that were read.
|
/// of bytes read. Zero bytes read with no error indicates
|
||||||
|
/// EOF.
|
||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// An error object that indicates success or the reason for
|
/// success, ENOTSUP, or another error.
|
||||||
/// failure.
|
|
||||||
Status Read(void *buf, size_t &num_bytes) override;
|
Status Read(void *buf, size_t &num_bytes) override;
|
||||||
|
|
||||||
/// Write bytes to a file at the current file position.
|
/// Write bytes from buf to a file at the current file position.
|
||||||
///
|
///
|
||||||
/// NOTE: This function is NOT thread safe. Use the write function
|
/// NOTE: This function is NOT thread safe. Use the write function
|
||||||
/// that takes an "off_t &offset" to ensure correct operation in multi-
|
/// that takes an "off_t &offset" to ensure correct operation in multi-
|
||||||
/// threaded environments.
|
/// threaded environments.
|
||||||
///
|
///
|
||||||
/// \param[in] buf
|
/// \param[in] buf
|
||||||
/// A buffer where to put the bytes that are read.
|
|
||||||
///
|
///
|
||||||
/// \param[in,out] num_bytes
|
/// \param[in,out] num_bytes
|
||||||
/// The number of bytes to write to the current file position
|
/// Pass in the size of buf. Write will pass out the number
|
||||||
/// which gets modified with the number of bytes that were
|
/// of bytes written. Write will attempt write the full number
|
||||||
/// written.
|
/// of bytes and will not return early except on error.
|
||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// An error object that indicates success or the reason for
|
/// success, ENOTSUP, or another error.
|
||||||
/// failure.
|
|
||||||
Status Write(const void *buf, size_t &num_bytes) override;
|
Status Write(const void *buf, size_t &num_bytes) override;
|
||||||
|
|
||||||
|
/// IsValid
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// true iff the file is valid.
|
||||||
|
bool IsValid() const override;
|
||||||
|
|
||||||
|
/// Flush any buffers and release any resources owned by the file.
|
||||||
|
/// After Close() the file will be invalid.
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// success or an error.
|
||||||
|
Status Close() override;
|
||||||
|
|
||||||
|
/// Get a handle that can be used for OS polling interfaces, such
|
||||||
|
/// as WaitForMultipleObjects, select, or epoll. This may return
|
||||||
|
/// IOObject::kInvalidHandleValue if none is available. This will
|
||||||
|
/// generally be the same as the file descriptor, this function
|
||||||
|
/// is not interchangeable with GetDescriptor(). A WaitableHandle
|
||||||
|
/// must only be used for polling, not actual I/O.
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// a valid handle or IOObject::kInvalidHandleValue
|
||||||
|
WaitableHandle GetWaitableHandle() override;
|
||||||
|
|
||||||
|
/// Get the file specification for this file, if possible.
|
||||||
|
///
|
||||||
|
/// \param[out] file_spec
|
||||||
|
/// the file specification.
|
||||||
|
/// \return
|
||||||
|
/// ENOTSUP, success, or another error.
|
||||||
|
virtual Status GetFileSpec(FileSpec &file_spec) const;
|
||||||
|
|
||||||
|
/// Get underlying OS file descriptor for this file, or kInvalidDescriptor.
|
||||||
|
/// If the descriptor is valid, then it may be used directly for I/O
|
||||||
|
/// However, the File may also perform it's own buffering, so avoid using
|
||||||
|
/// this if it is not necessary, or use Flush() appropriately.
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// a valid file descriptor for this file or kInvalidDescriptor
|
||||||
|
virtual int GetDescriptor() const;
|
||||||
|
|
||||||
|
/// Get the underlying libc stream for this file, or NULL.
|
||||||
|
///
|
||||||
|
/// Not all valid files will have a FILE* stream. This should only be
|
||||||
|
/// used if absolutely necessary, such as to interact with 3rd party
|
||||||
|
/// libraries that need FILE* streams.
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// a valid stream or NULL;
|
||||||
|
virtual FILE *GetStream();
|
||||||
|
|
||||||
/// Seek to an offset relative to the beginning of the file.
|
/// Seek to an offset relative to the beginning of the file.
|
||||||
///
|
///
|
||||||
/// NOTE: This function is NOT thread safe, other threads that
|
/// NOTE: This function is NOT thread safe, other threads that
|
||||||
@ -186,7 +173,7 @@ class File : public IOObject {
|
|||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// The resulting seek offset, or -1 on error.
|
/// The resulting seek offset, or -1 on error.
|
||||||
off_t SeekFromStart(off_t offset, Status *error_ptr = nullptr);
|
virtual off_t SeekFromStart(off_t offset, Status *error_ptr = nullptr);
|
||||||
|
|
||||||
/// Seek to an offset relative to the current file position.
|
/// Seek to an offset relative to the current file position.
|
||||||
///
|
///
|
||||||
@ -206,7 +193,7 @@ class File : public IOObject {
|
|||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// The resulting seek offset, or -1 on error.
|
/// The resulting seek offset, or -1 on error.
|
||||||
off_t SeekFromCurrent(off_t offset, Status *error_ptr = nullptr);
|
virtual off_t SeekFromCurrent(off_t offset, Status *error_ptr = nullptr);
|
||||||
|
|
||||||
/// Seek to an offset relative to the end of the file.
|
/// Seek to an offset relative to the end of the file.
|
||||||
///
|
///
|
||||||
@ -227,7 +214,7 @@ class File : public IOObject {
|
|||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// The resulting seek offset, or -1 on error.
|
/// The resulting seek offset, or -1 on error.
|
||||||
off_t SeekFromEnd(off_t offset, Status *error_ptr = nullptr);
|
virtual off_t SeekFromEnd(off_t offset, Status *error_ptr = nullptr);
|
||||||
|
|
||||||
/// Read bytes from a file from the specified file offset.
|
/// Read bytes from a file from the specified file offset.
|
||||||
///
|
///
|
||||||
@ -250,37 +237,7 @@ class File : public IOObject {
|
|||||||
/// \return
|
/// \return
|
||||||
/// An error object that indicates success or the reason for
|
/// An error object that indicates success or the reason for
|
||||||
/// failure.
|
/// failure.
|
||||||
Status Read(void *dst, size_t &num_bytes, off_t &offset);
|
virtual Status Read(void *dst, size_t &num_bytes, off_t &offset);
|
||||||
|
|
||||||
/// Read bytes from a file from the specified file offset.
|
|
||||||
///
|
|
||||||
/// NOTE: This function is thread safe in that clients manager their
|
|
||||||
/// own file position markers and reads on other threads won't mess up the
|
|
||||||
/// current read.
|
|
||||||
///
|
|
||||||
/// \param[in,out] num_bytes
|
|
||||||
/// The number of bytes to read form the current file position
|
|
||||||
/// which gets modified with the number of bytes that were read.
|
|
||||||
///
|
|
||||||
/// \param[in,out] offset
|
|
||||||
/// The offset within the file from which to read \a num_bytes
|
|
||||||
/// bytes. This offset gets incremented by the number of bytes
|
|
||||||
/// that were read.
|
|
||||||
///
|
|
||||||
/// \param[in] null_terminate
|
|
||||||
/// Ensure that the data that is read is terminated with a NULL
|
|
||||||
/// character so that the data can be used as a C string.
|
|
||||||
///
|
|
||||||
/// \param[out] data_buffer_sp
|
|
||||||
/// A data buffer to create and fill in that will contain any
|
|
||||||
/// data that is read from the file. This buffer will be reset
|
|
||||||
/// if an error occurs.
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// An error object that indicates success or the reason for
|
|
||||||
/// failure.
|
|
||||||
Status Read(size_t &num_bytes, off_t &offset, bool null_terminate,
|
|
||||||
lldb::DataBufferSP &data_buffer_sp);
|
|
||||||
|
|
||||||
/// Write bytes to a file at the specified file offset.
|
/// Write bytes to a file at the specified file offset.
|
||||||
///
|
///
|
||||||
@ -305,21 +262,67 @@ class File : public IOObject {
|
|||||||
/// \return
|
/// \return
|
||||||
/// An error object that indicates success or the reason for
|
/// An error object that indicates success or the reason for
|
||||||
/// failure.
|
/// failure.
|
||||||
Status Write(const void *src, size_t &num_bytes, off_t &offset);
|
virtual Status Write(const void *src, size_t &num_bytes, off_t &offset);
|
||||||
|
|
||||||
/// Flush the current stream
|
/// Flush the current stream
|
||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// An error object that indicates success or the reason for
|
/// An error object that indicates success or the reason for
|
||||||
/// failure.
|
/// failure.
|
||||||
Status Flush();
|
virtual Status Flush();
|
||||||
|
|
||||||
/// Sync to disk.
|
/// Sync to disk.
|
||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
/// An error object that indicates success or the reason for
|
/// An error object that indicates success or the reason for
|
||||||
/// failure.
|
/// failure.
|
||||||
Status Sync();
|
virtual Status Sync();
|
||||||
|
|
||||||
|
/// Output printf formatted output to the stream.
|
||||||
|
///
|
||||||
|
/// NOTE: this is not virtual, because it just calls the va_list
|
||||||
|
/// version of the function.
|
||||||
|
///
|
||||||
|
/// Print some formatted output to the stream.
|
||||||
|
///
|
||||||
|
/// \param[in] format
|
||||||
|
/// A printf style format string.
|
||||||
|
///
|
||||||
|
/// \param[in] ...
|
||||||
|
/// Variable arguments that are needed for the printf style
|
||||||
|
/// format string \a format.
|
||||||
|
size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||||
|
|
||||||
|
/// Output printf formatted output to the stream.
|
||||||
|
///
|
||||||
|
/// Print some formatted output to the stream.
|
||||||
|
///
|
||||||
|
/// \param[in] format
|
||||||
|
/// A printf style format string.
|
||||||
|
///
|
||||||
|
/// \param[in] args
|
||||||
|
/// Variable arguments that are needed for the printf style
|
||||||
|
/// format string \a format.
|
||||||
|
virtual size_t PrintfVarArg(const char *format, va_list args);
|
||||||
|
|
||||||
|
/// Return the OpenOptions for this file.
|
||||||
|
///
|
||||||
|
/// Some options like eOpenOptionDontFollowSymlinks only make
|
||||||
|
/// sense when a file is being opened (or not at all)
|
||||||
|
/// and may not be preserved for this method. But any valid
|
||||||
|
/// File should return either or both of eOpenOptionRead and
|
||||||
|
/// eOpenOptionWrite here.
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// OpenOptions flags for this file, or an error.
|
||||||
|
virtual llvm::Expected<OpenOptions> GetOptions() const;
|
||||||
|
|
||||||
|
llvm::Expected<const char *> GetOpenMode() const {
|
||||||
|
auto opts = GetOptions();
|
||||||
|
if (!opts)
|
||||||
|
return opts.takeError();
|
||||||
|
return GetStreamOpenModeFromOptions(opts.get());
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the permissions for a this file.
|
/// Get the permissions for a this file.
|
||||||
///
|
///
|
||||||
@ -346,47 +349,92 @@ class File : public IOObject {
|
|||||||
/// a non-zero width and height, false otherwise.
|
/// a non-zero width and height, false otherwise.
|
||||||
bool GetIsRealTerminal();
|
bool GetIsRealTerminal();
|
||||||
|
|
||||||
|
/// Return true if this file is a terminal which supports colors.
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// True iff this is a terminal and it supports colors.
|
||||||
bool GetIsTerminalWithColors();
|
bool GetIsTerminalWithColors();
|
||||||
|
|
||||||
/// Output printf formatted output to the stream.
|
operator bool() const { return IsValid(); };
|
||||||
///
|
|
||||||
/// Print some formatted output to the stream.
|
|
||||||
///
|
|
||||||
/// \param[in] format
|
|
||||||
/// A printf style format string.
|
|
||||||
///
|
|
||||||
/// \param[in] ...
|
|
||||||
/// Variable arguments that are needed for the printf style
|
|
||||||
/// format string \a format.
|
|
||||||
size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
|
|
||||||
|
|
||||||
size_t PrintfVarArg(const char *format, va_list args);
|
bool operator!() const { return !IsValid(); };
|
||||||
|
|
||||||
void SetOptions(uint32_t options) { m_options = options; }
|
static char ID;
|
||||||
|
virtual bool isA(const void *classID) const { return classID == &ID; }
|
||||||
static bool DescriptorIsValid(int descriptor) { return descriptor >= 0; };
|
static bool classof(const File *file) { return file->isA(&ID); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool DescriptorIsValid() const { return DescriptorIsValid(m_descriptor); }
|
|
||||||
|
|
||||||
bool StreamIsValid() const { return m_stream != kInvalidStream; }
|
|
||||||
|
|
||||||
void CalculateInteractiveAndTerminal();
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
int m_descriptor;
|
|
||||||
FILE *m_stream;
|
|
||||||
uint32_t m_options;
|
|
||||||
bool m_own_stream;
|
|
||||||
LazyBool m_is_interactive;
|
LazyBool m_is_interactive;
|
||||||
LazyBool m_is_real_terminal;
|
LazyBool m_is_real_terminal;
|
||||||
LazyBool m_supports_colors;
|
LazyBool m_supports_colors;
|
||||||
std::mutex offset_access_mutex;
|
|
||||||
|
void CalculateInteractiveAndTerminal();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(File);
|
DISALLOW_COPY_AND_ASSIGN(File);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NativeFile : public File {
|
||||||
|
public:
|
||||||
|
NativeFile()
|
||||||
|
: m_descriptor(kInvalidDescriptor), m_own_descriptor(false),
|
||||||
|
m_stream(kInvalidStream), m_options(), m_own_stream(false) {}
|
||||||
|
|
||||||
|
NativeFile(FILE *fh, bool transfer_ownership)
|
||||||
|
: m_descriptor(kInvalidDescriptor), m_own_descriptor(false), m_stream(fh),
|
||||||
|
m_options(), m_own_stream(transfer_ownership) {}
|
||||||
|
|
||||||
|
NativeFile(int fd, OpenOptions options, bool transfer_ownership)
|
||||||
|
: m_descriptor(fd), m_own_descriptor(transfer_ownership),
|
||||||
|
m_stream(kInvalidStream), m_options(options), m_own_stream(false) {}
|
||||||
|
|
||||||
|
~NativeFile() override { Close(); }
|
||||||
|
|
||||||
|
bool IsValid() const override {
|
||||||
|
return DescriptorIsValid() || StreamIsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
Status Read(void *buf, size_t &num_bytes) override;
|
||||||
|
Status Write(const void *buf, size_t &num_bytes) override;
|
||||||
|
Status Close() override;
|
||||||
|
WaitableHandle GetWaitableHandle() override;
|
||||||
|
Status GetFileSpec(FileSpec &file_spec) const override;
|
||||||
|
int GetDescriptor() const override;
|
||||||
|
FILE *GetStream() override;
|
||||||
|
off_t SeekFromStart(off_t offset, Status *error_ptr = nullptr) override;
|
||||||
|
off_t SeekFromCurrent(off_t offset, Status *error_ptr = nullptr) override;
|
||||||
|
off_t SeekFromEnd(off_t offset, Status *error_ptr = nullptr) override;
|
||||||
|
Status Read(void *dst, size_t &num_bytes, off_t &offset) override;
|
||||||
|
Status Write(const void *src, size_t &num_bytes, off_t &offset) override;
|
||||||
|
Status Flush() override;
|
||||||
|
Status Sync() override;
|
||||||
|
size_t PrintfVarArg(const char *format, va_list args) override;
|
||||||
|
llvm::Expected<OpenOptions> GetOptions() const override;
|
||||||
|
|
||||||
|
static char ID;
|
||||||
|
virtual bool isA(const void *classID) const override {
|
||||||
|
return classID == &ID || File::isA(classID);
|
||||||
|
}
|
||||||
|
static bool classof(const File *file) { return file->isA(&ID); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool DescriptorIsValid() const {
|
||||||
|
return File::DescriptorIsValid(m_descriptor);
|
||||||
|
}
|
||||||
|
bool StreamIsValid() const { return m_stream != kInvalidStream; }
|
||||||
|
|
||||||
|
// Member variables
|
||||||
|
int m_descriptor;
|
||||||
|
bool m_own_descriptor;
|
||||||
|
FILE *m_stream;
|
||||||
|
OpenOptions m_options;
|
||||||
|
bool m_own_stream;
|
||||||
|
std::mutex offset_access_mutex;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(NativeFile);
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace lldb_private
|
} // namespace lldb_private
|
||||||
|
|
||||||
#endif // liblldb_File_h_
|
#endif // liblldb_File_h_
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "lldb/lldb-forward.h"
|
#include "lldb/lldb-forward.h"
|
||||||
#include "lldb/lldb-types.h"
|
#include "lldb/lldb-types.h"
|
||||||
|
|
||||||
|
#include "lldb/Host/File.h"
|
||||||
#include "lldb/Utility/FileSpec.h"
|
#include "lldb/Utility/FileSpec.h"
|
||||||
#include "lldb/Utility/Status.h"
|
#include "lldb/Utility/Status.h"
|
||||||
|
|
||||||
@ -22,12 +23,12 @@ class FileCache {
|
|||||||
private:
|
private:
|
||||||
FileCache() {}
|
FileCache() {}
|
||||||
|
|
||||||
typedef std::map<lldb::user_id_t, lldb::FileSP> FDToFileMap;
|
typedef std::map<lldb::user_id_t, lldb::FileUP> FDToFileMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static FileCache &GetInstance();
|
static FileCache &GetInstance();
|
||||||
|
|
||||||
lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags,
|
lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
|
||||||
uint32_t mode, Status &error);
|
uint32_t mode, Status &error);
|
||||||
bool CloseFile(lldb::user_id_t fd, Status &error);
|
bool CloseFile(lldb::user_id_t fd, Status &error);
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
#include "lldb/Host/File.h"
|
#include "lldb/Host/File.h"
|
||||||
#include "lldb/Utility/DataBufferLLVM.h"
|
#include "lldb/Utility/DataBufferLLVM.h"
|
||||||
#include "lldb/Utility/FileCollector.h"
|
|
||||||
#include "lldb/Utility/FileSpec.h"
|
#include "lldb/Utility/FileSpec.h"
|
||||||
#include "lldb/Utility/Status.h"
|
#include "lldb/Utility/Status.h"
|
||||||
|
|
||||||
#include "llvm/ADT/Optional.h"
|
#include "llvm/ADT/Optional.h"
|
||||||
#include "llvm/Support/Chrono.h"
|
#include "llvm/Support/Chrono.h"
|
||||||
|
#include "llvm/Support/FileCollector.h"
|
||||||
#include "llvm/Support/VirtualFileSystem.h"
|
#include "llvm/Support/VirtualFileSystem.h"
|
||||||
|
|
||||||
#include "lldb/lldb-types.h"
|
#include "lldb/lldb-types.h"
|
||||||
@ -34,8 +34,8 @@ class FileSystem {
|
|||||||
FileSystem()
|
FileSystem()
|
||||||
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr),
|
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr),
|
||||||
m_mapped(false) {}
|
m_mapped(false) {}
|
||||||
FileSystem(FileCollector &collector)
|
FileSystem(std::shared_ptr<llvm::FileCollector> collector)
|
||||||
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(&collector),
|
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(collector),
|
||||||
m_mapped(false) {}
|
m_mapped(false) {}
|
||||||
FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
|
FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
|
||||||
bool mapped = false)
|
bool mapped = false)
|
||||||
@ -47,7 +47,7 @@ class FileSystem {
|
|||||||
static FileSystem &Instance();
|
static FileSystem &Instance();
|
||||||
|
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Initialize(FileCollector &collector);
|
static void Initialize(std::shared_ptr<llvm::FileCollector> collector);
|
||||||
static llvm::Error Initialize(const FileSpec &mapping);
|
static llvm::Error Initialize(const FileSpec &mapping);
|
||||||
static void Initialize(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs);
|
static void Initialize(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs);
|
||||||
static void Terminate();
|
static void Terminate();
|
||||||
@ -63,9 +63,10 @@ class FileSystem {
|
|||||||
/// Wraps ::open in a platform-independent way.
|
/// Wraps ::open in a platform-independent way.
|
||||||
int Open(const char *path, int flags, int mode);
|
int Open(const char *path, int flags, int mode);
|
||||||
|
|
||||||
Status Open(File &File, const FileSpec &file_spec, uint32_t options,
|
llvm::Expected<std::unique_ptr<File>>
|
||||||
uint32_t permissions = lldb::eFilePermissionsFileDefault,
|
Open(const FileSpec &file_spec, File::OpenOptions options,
|
||||||
bool should_close_fd = true);
|
uint32_t permissions = lldb::eFilePermissionsFileDefault,
|
||||||
|
bool should_close_fd = true);
|
||||||
|
|
||||||
/// Get a directory iterator.
|
/// Get a directory iterator.
|
||||||
/// \{
|
/// \{
|
||||||
@ -188,7 +189,7 @@ class FileSystem {
|
|||||||
private:
|
private:
|
||||||
static llvm::Optional<FileSystem> &InstanceImpl();
|
static llvm::Optional<FileSystem> &InstanceImpl();
|
||||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> m_fs;
|
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> m_fs;
|
||||||
FileCollector *m_collector;
|
std::shared_ptr<llvm::FileCollector> m_collector;
|
||||||
bool m_mapped;
|
bool m_mapped;
|
||||||
};
|
};
|
||||||
} // namespace lldb_private
|
} // namespace lldb_private
|
||||||
|
34
contrib/llvm-project/lldb/include/lldb/Host/LZMA.h
Normal file
34
contrib/llvm-project/lldb/include/lldb/Host/LZMA.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
//===-- LZMA.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 liblldb_Host_LZMA_h_
|
||||||
|
#define liblldb_Host_LZMA_h_
|
||||||
|
|
||||||
|
#include "llvm/ADT/ArrayRef.h"
|
||||||
|
|
||||||
|
namespace llvm {
|
||||||
|
class Error;
|
||||||
|
} // End of namespace llvm
|
||||||
|
|
||||||
|
namespace lldb_private {
|
||||||
|
|
||||||
|
namespace lzma {
|
||||||
|
|
||||||
|
bool isAvailable();
|
||||||
|
|
||||||
|
llvm::Expected<uint64_t>
|
||||||
|
getUncompressedSize(llvm::ArrayRef<uint8_t> InputBuffer);
|
||||||
|
|
||||||
|
llvm::Error uncompress(llvm::ArrayRef<uint8_t> InputBuffer,
|
||||||
|
llvm::SmallVectorImpl<uint8_t> &Uncompressed);
|
||||||
|
|
||||||
|
} // End of namespace lzma
|
||||||
|
|
||||||
|
} // End of namespace lldb_private
|
||||||
|
|
||||||
|
#endif // liblldb_Host_LZMA_h_
|
@ -31,7 +31,7 @@ class StringRef;
|
|||||||
|
|
||||||
namespace lldb_private {
|
namespace lldb_private {
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_WIN32)
|
||||||
typedef SOCKET NativeSocket;
|
typedef SOCKET NativeSocket;
|
||||||
#else
|
#else
|
||||||
typedef int NativeSocket;
|
typedef int NativeSocket;
|
||||||
@ -122,6 +122,7 @@ class Socket : public IOObject {
|
|||||||
SocketProtocol m_protocol;
|
SocketProtocol m_protocol;
|
||||||
NativeSocket m_socket;
|
NativeSocket m_socket;
|
||||||
bool m_child_processes_inherit;
|
bool m_child_processes_inherit;
|
||||||
|
bool m_should_close_fd;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace lldb_private
|
} // namespace lldb_private
|
||||||
|
@ -32,6 +32,14 @@ namespace lldb_private {
|
|||||||
class MemoryRegionInfo;
|
class MemoryRegionInfo;
|
||||||
class ResumeActionList;
|
class ResumeActionList;
|
||||||
|
|
||||||
|
struct SVR4LibraryInfo {
|
||||||
|
std::string name;
|
||||||
|
lldb::addr_t link_map;
|
||||||
|
lldb::addr_t base_addr;
|
||||||
|
lldb::addr_t ld_addr;
|
||||||
|
lldb::addr_t next;
|
||||||
|
};
|
||||||
|
|
||||||
// NativeProcessProtocol
|
// NativeProcessProtocol
|
||||||
class NativeProcessProtocol {
|
class NativeProcessProtocol {
|
||||||
public:
|
public:
|
||||||
@ -76,6 +84,31 @@ class NativeProcessProtocol {
|
|||||||
Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
|
Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
|
||||||
size_t &bytes_read);
|
size_t &bytes_read);
|
||||||
|
|
||||||
|
/// Reads a null terminated string from memory.
|
||||||
|
///
|
||||||
|
/// Reads up to \p max_size bytes of memory until it finds a '\0'.
|
||||||
|
/// If a '\0' is not found then it reads max_size-1 bytes as a string and a
|
||||||
|
/// '\0' is added as the last character of the \p buffer.
|
||||||
|
///
|
||||||
|
/// \param[in] addr
|
||||||
|
/// The address in memory to read from.
|
||||||
|
///
|
||||||
|
/// \param[in] buffer
|
||||||
|
/// An allocated buffer with at least \p max_size size.
|
||||||
|
///
|
||||||
|
/// \param[in] max_size
|
||||||
|
/// The maximum number of bytes to read from memory until it reads the
|
||||||
|
/// string.
|
||||||
|
///
|
||||||
|
/// \param[out] total_bytes_read
|
||||||
|
/// The number of bytes read from memory into \p buffer.
|
||||||
|
///
|
||||||
|
/// \return
|
||||||
|
/// Returns a StringRef backed up by the \p buffer passed in.
|
||||||
|
llvm::Expected<llvm::StringRef>
|
||||||
|
ReadCStringFromMemory(lldb::addr_t addr, char *buffer, size_t max_size,
|
||||||
|
size_t &total_bytes_read);
|
||||||
|
|
||||||
virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size,
|
virtual Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size,
|
||||||
size_t &bytes_written) = 0;
|
size_t &bytes_written) = 0;
|
||||||
|
|
||||||
@ -86,6 +119,12 @@ class NativeProcessProtocol {
|
|||||||
|
|
||||||
virtual lldb::addr_t GetSharedLibraryInfoAddress() = 0;
|
virtual lldb::addr_t GetSharedLibraryInfoAddress() = 0;
|
||||||
|
|
||||||
|
virtual llvm::Expected<std::vector<SVR4LibraryInfo>>
|
||||||
|
GetLoadedSVR4Libraries() {
|
||||||
|
return llvm::createStringError(llvm::inconvertibleErrorCode(),
|
||||||
|
"Not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool IsAlive() const;
|
virtual bool IsAlive() const;
|
||||||
|
|
||||||
virtual size_t UpdateThreads() = 0;
|
virtual size_t UpdateThreads() = 0;
|
||||||
@ -391,6 +430,8 @@ class NativeProcessProtocol {
|
|||||||
NativeProcessProtocol(lldb::pid_t pid, int terminal_fd,
|
NativeProcessProtocol(lldb::pid_t pid, int terminal_fd,
|
||||||
NativeDelegate &delegate);
|
NativeDelegate &delegate);
|
||||||
|
|
||||||
|
void SetID(lldb::pid_t pid) { m_pid = pid; }
|
||||||
|
|
||||||
// interface for state handling
|
// interface for state handling
|
||||||
void SetState(lldb::StateType state, bool notify_delegates = true);
|
void SetState(lldb::StateType state, bool notify_delegates = true);
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@ class CommandAlias : public CommandObject {
|
|||||||
|
|
||||||
bool WantsCompletion() override;
|
bool WantsCompletion() override;
|
||||||
|
|
||||||
int HandleCompletion(CompletionRequest &request) override;
|
void HandleCompletion(CompletionRequest &request) override;
|
||||||
|
|
||||||
int HandleArgumentCompletion(
|
void
|
||||||
CompletionRequest &request,
|
HandleArgumentCompletion(CompletionRequest &request,
|
||||||
OptionElementVector &opt_element_vector) override;
|
OptionElementVector &opt_element_vector) override;
|
||||||
|
|
||||||
Options *GetOptions() override;
|
Options *GetOptions() override;
|
||||||
|
|
||||||
|
@ -26,10 +26,10 @@ class CommandCompletions {
|
|||||||
// This is the command completion callback that is used to complete the
|
// This is the command completion callback that is used to complete the
|
||||||
// argument of the option it is bound to (in the OptionDefinition table
|
// argument of the option it is bound to (in the OptionDefinition table
|
||||||
// below). Return the total number of matches.
|
// below). Return the total number of matches.
|
||||||
typedef int (*CompletionCallback)(CommandInterpreter &interpreter,
|
typedef void (*CompletionCallback)(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request,
|
CompletionRequest &request,
|
||||||
// A search filter to limit the search...
|
// A search filter to limit the search...
|
||||||
lldb_private::SearchFilter *searcher);
|
lldb_private::SearchFilter *searcher);
|
||||||
enum CommonCompletionTypes {
|
enum CommonCompletionTypes {
|
||||||
eNoCompletion = 0u,
|
eNoCompletion = 0u,
|
||||||
eSourceFileCompletion = (1u << 0),
|
eSourceFileCompletion = (1u << 0),
|
||||||
@ -57,43 +57,43 @@ class CommandCompletions {
|
|||||||
lldb_private::CompletionRequest &request, SearchFilter *searcher);
|
lldb_private::CompletionRequest &request, SearchFilter *searcher);
|
||||||
|
|
||||||
// These are the generic completer functions:
|
// These are the generic completer functions:
|
||||||
static int DiskFiles(CommandInterpreter &interpreter,
|
static void DiskFiles(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request, SearchFilter *searcher);
|
CompletionRequest &request, SearchFilter *searcher);
|
||||||
|
|
||||||
static int DiskFiles(const llvm::Twine &partial_file_name,
|
static void DiskFiles(const llvm::Twine &partial_file_name,
|
||||||
StringList &matches, TildeExpressionResolver &Resolver);
|
StringList &matches, TildeExpressionResolver &Resolver);
|
||||||
|
|
||||||
static int DiskDirectories(CommandInterpreter &interpreter,
|
static void DiskDirectories(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request,
|
CompletionRequest &request,
|
||||||
SearchFilter *searcher);
|
SearchFilter *searcher);
|
||||||
|
|
||||||
static int DiskDirectories(const llvm::Twine &partial_file_name,
|
static void DiskDirectories(const llvm::Twine &partial_file_name,
|
||||||
StringList &matches,
|
StringList &matches,
|
||||||
TildeExpressionResolver &Resolver);
|
TildeExpressionResolver &Resolver);
|
||||||
|
|
||||||
static int SourceFiles(CommandInterpreter &interpreter,
|
static void SourceFiles(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request, SearchFilter *searcher);
|
|
||||||
|
|
||||||
static int Modules(CommandInterpreter &interpreter,
|
|
||||||
CompletionRequest &request, SearchFilter *searcher);
|
|
||||||
|
|
||||||
static int Symbols(CommandInterpreter &interpreter,
|
|
||||||
CompletionRequest &request, SearchFilter *searcher);
|
|
||||||
|
|
||||||
static int SettingsNames(CommandInterpreter &interpreter,
|
|
||||||
CompletionRequest &request, SearchFilter *searcher);
|
|
||||||
|
|
||||||
static int PlatformPluginNames(CommandInterpreter &interpreter,
|
|
||||||
CompletionRequest &request,
|
|
||||||
SearchFilter *searcher);
|
|
||||||
|
|
||||||
static int ArchitectureNames(CommandInterpreter &interpreter,
|
|
||||||
CompletionRequest &request,
|
|
||||||
SearchFilter *searcher);
|
|
||||||
|
|
||||||
static int VariablePath(CommandInterpreter &interpreter,
|
|
||||||
CompletionRequest &request, SearchFilter *searcher);
|
CompletionRequest &request, SearchFilter *searcher);
|
||||||
|
|
||||||
|
static void Modules(CommandInterpreter &interpreter,
|
||||||
|
CompletionRequest &request, SearchFilter *searcher);
|
||||||
|
|
||||||
|
static void Symbols(CommandInterpreter &interpreter,
|
||||||
|
CompletionRequest &request, SearchFilter *searcher);
|
||||||
|
|
||||||
|
static void SettingsNames(CommandInterpreter &interpreter,
|
||||||
|
CompletionRequest &request, SearchFilter *searcher);
|
||||||
|
|
||||||
|
static void PlatformPluginNames(CommandInterpreter &interpreter,
|
||||||
|
CompletionRequest &request,
|
||||||
|
SearchFilter *searcher);
|
||||||
|
|
||||||
|
static void ArchitectureNames(CommandInterpreter &interpreter,
|
||||||
|
CompletionRequest &request,
|
||||||
|
SearchFilter *searcher);
|
||||||
|
|
||||||
|
static void VariablePath(CommandInterpreter &interpreter,
|
||||||
|
CompletionRequest &request, SearchFilter *searcher);
|
||||||
|
|
||||||
// The Completer class is a convenient base class for building searchers that
|
// The Completer class is a convenient base class for building searchers that
|
||||||
// go along with the SearchFilter passed to the standard Completer functions.
|
// go along with the SearchFilter passed to the standard Completer functions.
|
||||||
class Completer : public Searcher {
|
class Completer : public Searcher {
|
||||||
@ -103,11 +103,11 @@ class CommandCompletions {
|
|||||||
~Completer() override;
|
~Completer() override;
|
||||||
|
|
||||||
CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context,
|
CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context,
|
||||||
Address *addr, bool complete) override = 0;
|
Address *addr) override = 0;
|
||||||
|
|
||||||
lldb::SearchDepth GetDepth() override = 0;
|
lldb::SearchDepth GetDepth() override = 0;
|
||||||
|
|
||||||
virtual size_t DoCompletion(SearchFilter *filter) = 0;
|
virtual void DoCompletion(SearchFilter *filter) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CommandInterpreter &m_interpreter;
|
CommandInterpreter &m_interpreter;
|
||||||
@ -127,10 +127,9 @@ class CommandCompletions {
|
|||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context,
|
SymbolContext &context,
|
||||||
Address *addr,
|
Address *addr) override;
|
||||||
bool complete) override;
|
|
||||||
|
|
||||||
size_t DoCompletion(SearchFilter *filter) override;
|
void DoCompletion(SearchFilter *filter) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_include_support_files;
|
bool m_include_support_files;
|
||||||
@ -151,10 +150,9 @@ class CommandCompletions {
|
|||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context,
|
SymbolContext &context,
|
||||||
Address *addr,
|
Address *addr) override;
|
||||||
bool complete) override;
|
|
||||||
|
|
||||||
size_t DoCompletion(SearchFilter *filter) override;
|
void DoCompletion(SearchFilter *filter) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char *m_file_name;
|
const char *m_file_name;
|
||||||
@ -173,20 +171,11 @@ class CommandCompletions {
|
|||||||
|
|
||||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||||
SymbolContext &context,
|
SymbolContext &context,
|
||||||
Address *addr,
|
Address *addr) override;
|
||||||
bool complete) override;
|
|
||||||
|
|
||||||
size_t DoCompletion(SearchFilter *filter) override;
|
void DoCompletion(SearchFilter *filter) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// struct NameCmp {
|
|
||||||
// bool operator() (const ConstString& lhs, const ConstString&
|
|
||||||
// rhs) const
|
|
||||||
// {
|
|
||||||
// return lhs < rhs;
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
RegularExpression m_regex;
|
RegularExpression m_regex;
|
||||||
typedef std::set<ConstString> collection;
|
typedef std::set<ConstString> collection;
|
||||||
collection m_match_set;
|
collection m_match_set;
|
||||||
|
@ -308,31 +308,12 @@ class CommandInterpreter : public Broadcaster,
|
|||||||
|
|
||||||
CommandObject *GetCommandObjectForCommand(llvm::StringRef &command_line);
|
CommandObject *GetCommandObjectForCommand(llvm::StringRef &command_line);
|
||||||
|
|
||||||
// This handles command line completion. You are given a pointer to the
|
// This handles command line completion.
|
||||||
// command string buffer, to the current cursor, and to the end of the string
|
void HandleCompletion(CompletionRequest &request);
|
||||||
// (in case it is not NULL terminated). You also passed in an StringList
|
|
||||||
// object to fill with the returns. The first element of the array will be
|
|
||||||
// filled with the string that you would need to insert at the cursor point
|
|
||||||
// to complete the cursor point to the longest common matching prefix. If you
|
|
||||||
// want to limit the number of elements returned, set max_return_elements to
|
|
||||||
// the number of elements you want returned. Otherwise set
|
|
||||||
// max_return_elements to -1. If you want to start some way into the match
|
|
||||||
// list, then set match_start_point to the desired start point. Returns: -1
|
|
||||||
// if the completion character should be inserted -2 if the entire command
|
|
||||||
// line should be deleted and replaced with matches.GetStringAtIndex(0)
|
|
||||||
// INT_MAX if the number of matches is > max_return_elements, but it is
|
|
||||||
// expensive to compute. Otherwise, returns the number of matches.
|
|
||||||
//
|
|
||||||
// FIXME: Only max_return_elements == -1 is supported at present.
|
|
||||||
int HandleCompletion(const char *current_line, const char *cursor,
|
|
||||||
const char *last_char, int match_start_point,
|
|
||||||
int max_return_elements, StringList &matches,
|
|
||||||
StringList &descriptions);
|
|
||||||
|
|
||||||
// This version just returns matches, and doesn't compute the substring. It
|
// This version just returns matches, and doesn't compute the substring. It
|
||||||
// is here so the Help command can call it for the first argument. It uses
|
// is here so the Help command can call it for the first argument.
|
||||||
// a CompletionRequest for simplicity reasons.
|
void HandleCompletionMatches(CompletionRequest &request);
|
||||||
int HandleCompletionMatches(CompletionRequest &request);
|
|
||||||
|
|
||||||
int GetCommandNamesMatchingPartialString(const char *cmd_cstr,
|
int GetCommandNamesMatchingPartialString(const char *cmd_cstr,
|
||||||
bool include_aliases,
|
bool include_aliases,
|
||||||
@ -519,7 +500,9 @@ class CommandInterpreter : public Broadcaster,
|
|||||||
|
|
||||||
bool IOHandlerInterrupt(IOHandler &io_handler) override;
|
bool IOHandlerInterrupt(IOHandler &io_handler) override;
|
||||||
|
|
||||||
size_t GetProcessOutput();
|
void GetProcessOutput();
|
||||||
|
|
||||||
|
bool DidProcessStopAbnormally() const;
|
||||||
|
|
||||||
void SetSynchronous(bool value);
|
void SetSynchronous(bool value);
|
||||||
|
|
||||||
|
@ -228,36 +228,18 @@ class CommandObject {
|
|||||||
///
|
///
|
||||||
/// \param[in/out] request
|
/// \param[in/out] request
|
||||||
/// The completion request that needs to be answered.
|
/// The completion request that needs to be answered.
|
||||||
///
|
virtual void HandleCompletion(CompletionRequest &request);
|
||||||
/// FIXME: This is the wrong return value, since we also need to make a
|
|
||||||
/// distinction between
|
|
||||||
/// total number of matches, and the window the user wants returned.
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// \btrue if we were in an option, \bfalse otherwise.
|
|
||||||
virtual int HandleCompletion(CompletionRequest &request);
|
|
||||||
|
|
||||||
/// The input array contains a parsed version of the line. The insertion
|
/// The input array contains a parsed version of the line.
|
||||||
/// point is given by cursor_index (the index in input of the word containing
|
///
|
||||||
/// the cursor) and cursor_char_position (the position of the cursor in that
|
|
||||||
/// word.)
|
|
||||||
/// We've constructed the map of options and their arguments as well if that
|
/// We've constructed the map of options and their arguments as well if that
|
||||||
/// is helpful for the completion.
|
/// is helpful for the completion.
|
||||||
///
|
///
|
||||||
/// \param[in/out] request
|
/// \param[in/out] request
|
||||||
/// The completion request that needs to be answered.
|
/// The completion request that needs to be answered.
|
||||||
///
|
virtual void
|
||||||
/// FIXME: This is the wrong return value, since we also need to make a
|
|
||||||
/// distinction between
|
|
||||||
/// total number of matches, and the window the user wants returned.
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// The number of completions.
|
|
||||||
virtual int
|
|
||||||
HandleArgumentCompletion(CompletionRequest &request,
|
HandleArgumentCompletion(CompletionRequest &request,
|
||||||
OptionElementVector &opt_element_vector) {
|
OptionElementVector &opt_element_vector) {}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HelpTextContainsWord(llvm::StringRef search_word,
|
bool HelpTextContainsWord(llvm::StringRef search_word,
|
||||||
bool search_short_help = true,
|
bool search_short_help = true,
|
||||||
@ -348,8 +330,9 @@ class CommandObject {
|
|||||||
// This is for use in the command interpreter, when you either want the
|
// This is for use in the command interpreter, when you either want the
|
||||||
// selected target, or if no target is present you want to prime the dummy
|
// selected target, or if no target is present you want to prime the dummy
|
||||||
// target with entities that will be copied over to new targets.
|
// target with entities that will be copied over to new targets.
|
||||||
Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
|
Target &GetSelectedOrDummyTarget(bool prefer_dummy = false);
|
||||||
Target *GetDummyTarget();
|
Target &GetSelectedTarget();
|
||||||
|
Target &GetDummyTarget();
|
||||||
|
|
||||||
// If a command needs to use the "current" thread, use this call. Command
|
// If a command needs to use the "current" thread, use this call. Command
|
||||||
// objects will have an ExecutionContext to use, and that may or may not have
|
// objects will have an ExecutionContext to use, and that may or may not have
|
||||||
|
@ -50,7 +50,7 @@ class CommandObjectMultiword : public CommandObject {
|
|||||||
|
|
||||||
bool WantsRawCommandString() override { return false; }
|
bool WantsRawCommandString() override { return false; }
|
||||||
|
|
||||||
int HandleCompletion(CompletionRequest &request) override;
|
void HandleCompletion(CompletionRequest &request) override;
|
||||||
|
|
||||||
const char *GetRepeatCommand(Args ¤t_command_args,
|
const char *GetRepeatCommand(Args ¤t_command_args,
|
||||||
uint32_t index) override;
|
uint32_t index) override;
|
||||||
@ -112,11 +112,11 @@ class CommandObjectProxy : public CommandObject {
|
|||||||
|
|
||||||
Options *GetOptions() override;
|
Options *GetOptions() override;
|
||||||
|
|
||||||
int HandleCompletion(CompletionRequest &request) override;
|
void HandleCompletion(CompletionRequest &request) override;
|
||||||
|
|
||||||
int HandleArgumentCompletion(
|
void
|
||||||
CompletionRequest &request,
|
HandleArgumentCompletion(CompletionRequest &request,
|
||||||
OptionElementVector &opt_element_vector) override;
|
OptionElementVector &opt_element_vector) override;
|
||||||
|
|
||||||
const char *GetRepeatCommand(Args ¤t_command_args,
|
const char *GetRepeatCommand(Args ¤t_command_args,
|
||||||
uint32_t index) override;
|
uint32_t index) override;
|
||||||
|
@ -34,7 +34,7 @@ class CommandObjectRegexCommand : public CommandObjectRaw {
|
|||||||
|
|
||||||
bool HasRegexEntries() const { return !m_entries.empty(); }
|
bool HasRegexEntries() const { return !m_entries.empty(); }
|
||||||
|
|
||||||
int HandleCompletion(CompletionRequest &request) override;
|
void HandleCompletion(CompletionRequest &request) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
|
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
|
||||||
|
@ -62,13 +62,13 @@ class CommandReturnObject {
|
|||||||
return m_err_stream;
|
return m_err_stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetImmediateOutputFile(FILE *fh, bool transfer_fh_ownership = false) {
|
void SetImmediateOutputFile(lldb::FileSP file_sp) {
|
||||||
lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
|
lldb::StreamSP stream_sp(new StreamFile(file_sp));
|
||||||
m_out_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
|
m_out_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetImmediateErrorFile(FILE *fh, bool transfer_fh_ownership = false) {
|
void SetImmediateErrorFile(lldb::FileSP file_sp) {
|
||||||
lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
|
lldb::StreamSP stream_sp(new StreamFile(file_sp));
|
||||||
m_err_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
|
m_err_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,14 +144,6 @@ class CommandReturnObject {
|
|||||||
|
|
||||||
void SetInteractive(bool b);
|
void SetInteractive(bool b);
|
||||||
|
|
||||||
bool GetAbnormalStopWasExpected() const {
|
|
||||||
return m_abnormal_stop_was_expected;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetAbnormalStopWasExpected(bool signal_was_expected) {
|
|
||||||
m_abnormal_stop_was_expected = signal_was_expected;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum { eStreamStringIndex = 0, eImmediateStreamIndex = 1 };
|
enum { eStreamStringIndex = 0, eImmediateStreamIndex = 1 };
|
||||||
|
|
||||||
@ -162,14 +154,6 @@ class CommandReturnObject {
|
|||||||
bool m_did_change_process_state;
|
bool m_did_change_process_state;
|
||||||
bool m_interactive; // If true, then the input handle from the debugger will
|
bool m_interactive; // If true, then the input handle from the debugger will
|
||||||
// be hooked up
|
// be hooked up
|
||||||
bool m_abnormal_stop_was_expected; // This is to support
|
|
||||||
// eHandleCommandFlagStopOnCrash vrs.
|
|
||||||
// attach.
|
|
||||||
// The attach command often ends up with the process stopped due to a signal.
|
|
||||||
// Normally that would mean stop on crash should halt batch execution, but we
|
|
||||||
// obviously don't want that for attach. Using this flag, the attach command
|
|
||||||
// (and anything else for which this is relevant) can say that the signal is
|
|
||||||
// expected, and batch command execution can continue.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace lldb_private
|
} // namespace lldb_private
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
//===-- OptionGroupPythonClassWithDict.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 liblldb_OptionGroupPythonClassWithDict_h_
|
||||||
|
#define liblldb_OptionGroupPythonClassWithDict_h_
|
||||||
|
|
||||||
|
#include "lldb/lldb-types.h"
|
||||||
|
#include "lldb/Interpreter/Options.h"
|
||||||
|
#include "lldb/Utility/StructuredData.h"
|
||||||
|
|
||||||
|
namespace lldb_private {
|
||||||
|
|
||||||
|
// Use this Option group if you have a python class that implements some
|
||||||
|
// Python extension point, and you pass a SBStructuredData to the class
|
||||||
|
// __init__ method.
|
||||||
|
// class_option specifies the class name
|
||||||
|
// the key and value options are read in in pairs, and a
|
||||||
|
// StructuredData::Dictionary is constructed with those pairs.
|
||||||
|
class OptionGroupPythonClassWithDict : public OptionGroup {
|
||||||
|
public:
|
||||||
|
OptionGroupPythonClassWithDict(const char *class_use,
|
||||||
|
int class_option = 'C',
|
||||||
|
int key_option = 'k',
|
||||||
|
int value_option = 'v',
|
||||||
|
const char *class_long_option = "python-class",
|
||||||
|
const char *key_long_option = "python-class-key",
|
||||||
|
const char *value_long_option = "python-class-value",
|
||||||
|
bool required = false);
|
||||||
|
|
||||||
|
~OptionGroupPythonClassWithDict() override;
|
||||||
|
|
||||||
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
|
||||||
|
return llvm::ArrayRef<OptionDefinition>(m_option_definition);
|
||||||
|
}
|
||||||
|
|
||||||
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
|
||||||
|
ExecutionContext *execution_context) override;
|
||||||
|
Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
|
||||||
|
|
||||||
|
void OptionParsingStarting(ExecutionContext *execution_context) override;
|
||||||
|
Status OptionParsingFinished(ExecutionContext *execution_context) override;
|
||||||
|
|
||||||
|
const StructuredData::DictionarySP GetStructuredData() {
|
||||||
|
return m_dict_sp;
|
||||||
|
}
|
||||||
|
const std::string &GetClassName() {
|
||||||
|
return m_class_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::string m_class_name;
|
||||||
|
std::string m_current_key;
|
||||||
|
StructuredData::DictionarySP m_dict_sp;
|
||||||
|
std::string m_class_usage_text, m_key_usage_text, m_value_usage_text;
|
||||||
|
OptionDefinition m_option_definition[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace lldb_private
|
||||||
|
|
||||||
|
#endif // liblldb_OptionGroupPythonClassWithDict_h_
|
@ -93,8 +93,8 @@ class OptionValue {
|
|||||||
|
|
||||||
virtual lldb::OptionValueSP DeepCopy() const = 0;
|
virtual lldb::OptionValueSP DeepCopy() const = 0;
|
||||||
|
|
||||||
virtual size_t AutoComplete(CommandInterpreter &interpreter,
|
virtual void AutoComplete(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request);
|
CompletionRequest &request);
|
||||||
|
|
||||||
// Subclasses can override these functions
|
// Subclasses can override these functions
|
||||||
virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
|
virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
|
||||||
|
@ -55,8 +55,8 @@ class OptionValueArch : public OptionValue {
|
|||||||
|
|
||||||
lldb::OptionValueSP DeepCopy() const override;
|
lldb::OptionValueSP DeepCopy() const override;
|
||||||
|
|
||||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
void AutoComplete(CommandInterpreter &interpreter,
|
||||||
lldb_private::CompletionRequest &request) override;
|
lldb_private::CompletionRequest &request) override;
|
||||||
|
|
||||||
// Subclass specific functions
|
// Subclass specific functions
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ class OptionValueBoolean : public OptionValue {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
void AutoComplete(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request) override;
|
CompletionRequest &request) override;
|
||||||
|
|
||||||
// Subclass specific functions
|
// Subclass specific functions
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ class OptionValueEnumeration : public OptionValue {
|
|||||||
|
|
||||||
lldb::OptionValueSP DeepCopy() const override;
|
lldb::OptionValueSP DeepCopy() const override;
|
||||||
|
|
||||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
void AutoComplete(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request) override;
|
CompletionRequest &request) override;
|
||||||
|
|
||||||
// Subclass specific functions
|
// Subclass specific functions
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ class OptionValueFileSpec : public OptionValue {
|
|||||||
|
|
||||||
lldb::OptionValueSP DeepCopy() const override;
|
lldb::OptionValueSP DeepCopy() const override;
|
||||||
|
|
||||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
void AutoComplete(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request) override;
|
CompletionRequest &request) override;
|
||||||
|
|
||||||
// Subclass specific functions
|
// Subclass specific functions
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ class OptionValueFormatEntity : public OptionValue {
|
|||||||
|
|
||||||
lldb::OptionValueSP DeepCopy() const override;
|
lldb::OptionValueSP DeepCopy() const override;
|
||||||
|
|
||||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
void AutoComplete(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request) override;
|
CompletionRequest &request) override;
|
||||||
|
|
||||||
// Subclass specific functions
|
// Subclass specific functions
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class OptionValueRegex : public OptionValue {
|
|||||||
VarSetOperationType = eVarSetOperationAssign) = delete;
|
VarSetOperationType = eVarSetOperationAssign) = delete;
|
||||||
|
|
||||||
bool Clear() override {
|
bool Clear() override {
|
||||||
m_regex.Clear();
|
m_regex = RegularExpression();
|
||||||
m_value_was_set = false;
|
m_value_was_set = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -50,9 +50,9 @@ class OptionValueRegex : public OptionValue {
|
|||||||
|
|
||||||
void SetCurrentValue(const char *value) {
|
void SetCurrentValue(const char *value) {
|
||||||
if (value && value[0])
|
if (value && value[0])
|
||||||
m_regex.Compile(llvm::StringRef(value));
|
m_regex = RegularExpression(llvm::StringRef(value));
|
||||||
else
|
else
|
||||||
m_regex.Clear();
|
m_regex = RegularExpression();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsValid() const { return m_regex.IsValid(); }
|
bool IsValid() const { return m_regex.IsValid(); }
|
||||||
|
@ -52,8 +52,8 @@ class OptionValueUUID : public OptionValue {
|
|||||||
|
|
||||||
void SetCurrentValue(const UUID &value) { m_uuid = value; }
|
void SetCurrentValue(const UUID &value) { m_uuid = value; }
|
||||||
|
|
||||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
void AutoComplete(CommandInterpreter &interpreter,
|
||||||
CompletionRequest &request) override;
|
CompletionRequest &request) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UUID m_uuid;
|
UUID m_uuid;
|
||||||
|
@ -187,14 +187,7 @@ class Options {
|
|||||||
///
|
///
|
||||||
/// \param[in] interpreter
|
/// \param[in] interpreter
|
||||||
/// The command interpreter doing the completion.
|
/// The command interpreter doing the completion.
|
||||||
///
|
virtual void
|
||||||
/// FIXME: This is the wrong return value, since we also need to
|
|
||||||
/// make a distinction between total number of matches, and the window the
|
|
||||||
/// user wants returned.
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// \btrue if we were in an option, \bfalse otherwise.
|
|
||||||
virtual bool
|
|
||||||
HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request,
|
HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request,
|
||||||
OptionElementVector &opt_element_vector,
|
OptionElementVector &opt_element_vector,
|
||||||
int opt_element_index,
|
int opt_element_index,
|
||||||
|
@ -65,6 +65,9 @@ class ScriptInterpreter : public PluginInterface {
|
|||||||
|
|
||||||
bool GetSetLLDBGlobals() const { return m_set_lldb_globals; }
|
bool GetSetLLDBGlobals() const { return m_set_lldb_globals; }
|
||||||
|
|
||||||
|
// If this is true then any exceptions raised by the script will be
|
||||||
|
// cleared with PyErr_Clear(). If false then they will be left for
|
||||||
|
// the caller to clean up
|
||||||
bool GetMaskoutErrors() const { return m_maskout_errors; }
|
bool GetMaskoutErrors() const { return m_maskout_errors; }
|
||||||
|
|
||||||
ExecuteScriptOptions &SetEnableIO(bool enable) {
|
ExecuteScriptOptions &SetEnableIO(bool enable) {
|
||||||
@ -208,6 +211,8 @@ class ScriptInterpreter : public PluginInterface {
|
|||||||
|
|
||||||
virtual StructuredData::ObjectSP
|
virtual StructuredData::ObjectSP
|
||||||
CreateScriptedThreadPlan(const char *class_name,
|
CreateScriptedThreadPlan(const char *class_name,
|
||||||
|
StructuredDataImpl *args_data,
|
||||||
|
std::string &error_str,
|
||||||
lldb::ThreadPlanSP thread_plan_sp) {
|
lldb::ThreadPlanSP thread_plan_sp) {
|
||||||
return StructuredData::ObjectSP();
|
return StructuredData::ObjectSP();
|
||||||
}
|
}
|
||||||
@ -463,8 +468,6 @@ class ScriptInterpreter : public PluginInterface {
|
|||||||
|
|
||||||
static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string);
|
static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string);
|
||||||
|
|
||||||
virtual void ResetOutputFileHandle(FILE *new_fh) {} // By default, do nothing.
|
|
||||||
|
|
||||||
lldb::ScriptLanguage GetLanguage() { return m_script_lang; }
|
lldb::ScriptLanguage GetLanguage() { return m_script_lang; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
//===-- CallFrameInfo.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 liblldb_CallFrameInfo_h_
|
||||||
|
#define liblldb_CallFrameInfo_h_
|
||||||
|
|
||||||
|
#include "lldb/Core/Address.h"
|
||||||
|
|
||||||
|
namespace lldb_private {
|
||||||
|
|
||||||
|
class CallFrameInfo {
|
||||||
|
public:
|
||||||
|
virtual ~CallFrameInfo() = default;
|
||||||
|
|
||||||
|
virtual bool GetAddressRange(Address addr, AddressRange &range) = 0;
|
||||||
|
|
||||||
|
virtual bool GetUnwindPlan(const Address &addr, UnwindPlan &unwind_plan) = 0;
|
||||||
|
virtual bool GetUnwindPlan(const AddressRange &range, UnwindPlan &unwind_plan) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace lldb_private
|
||||||
|
|
||||||
|
#endif // liblldb_CallFrameInfo_h_
|
@ -26,8 +26,8 @@
|
|||||||
#include "llvm/ADT/APSInt.h"
|
#include "llvm/ADT/APSInt.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
|
|
||||||
#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
|
|
||||||
#include "lldb/Core/ClangForward.h"
|
#include "lldb/Core/ClangForward.h"
|
||||||
|
#include "lldb/Expression/ExpressionVariable.h"
|
||||||
#include "lldb/Symbol/CompilerType.h"
|
#include "lldb/Symbol/CompilerType.h"
|
||||||
#include "lldb/Symbol/TypeSystem.h"
|
#include "lldb/Symbol/TypeSystem.h"
|
||||||
#include "lldb/Utility/ConstString.h"
|
#include "lldb/Utility/ConstString.h"
|
||||||
@ -54,7 +54,14 @@ class ClangASTContext : public TypeSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Constructors and Destructors
|
// Constructors and Destructors
|
||||||
ClangASTContext(const char *triple = nullptr);
|
explicit ClangASTContext(llvm::StringRef triple = "");
|
||||||
|
explicit ClangASTContext(ArchSpec arch);
|
||||||
|
|
||||||
|
/// Constructs a ClangASTContext that uses an existing ASTContext internally.
|
||||||
|
/// Useful when having an existing ASTContext created by Clang.
|
||||||
|
///
|
||||||
|
/// \param existing_ctxt An existing ASTContext.
|
||||||
|
explicit ClangASTContext(clang::ASTContext &existing_ctxt);
|
||||||
|
|
||||||
~ClangASTContext() override;
|
~ClangASTContext() override;
|
||||||
|
|
||||||
@ -70,9 +77,8 @@ class ClangASTContext : public TypeSystem {
|
|||||||
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
|
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
|
||||||
Module *module, Target *target);
|
Module *module, Target *target);
|
||||||
|
|
||||||
static void EnumerateSupportedLanguages(
|
static LanguageSet GetSupportedLanguagesForTypes();
|
||||||
std::set<lldb::LanguageType> &languages_for_types,
|
static LanguageSet GetSupportedLanguagesForExpressions();
|
||||||
std::set<lldb::LanguageType> &languages_for_expressions);
|
|
||||||
|
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
|
|
||||||
@ -82,8 +88,6 @@ class ClangASTContext : public TypeSystem {
|
|||||||
|
|
||||||
clang::ASTContext *getASTContext();
|
clang::ASTContext *getASTContext();
|
||||||
|
|
||||||
void setASTContext(clang::ASTContext *ast_ctx);
|
|
||||||
|
|
||||||
clang::Builtin::Context *getBuiltinContext();
|
clang::Builtin::Context *getBuiltinContext();
|
||||||
|
|
||||||
clang::IdentifierTable *getIdentifierTable();
|
clang::IdentifierTable *getIdentifierTable();
|
||||||
@ -109,21 +113,11 @@ class ClangASTContext : public TypeSystem {
|
|||||||
void setSema(clang::Sema *s);
|
void setSema(clang::Sema *s);
|
||||||
clang::Sema *getSema() { return m_sema; }
|
clang::Sema *getSema() { return m_sema; }
|
||||||
|
|
||||||
void Clear();
|
|
||||||
|
|
||||||
const char *GetTargetTriple();
|
const char *GetTargetTriple();
|
||||||
|
|
||||||
void SetTargetTriple(const char *target_triple);
|
|
||||||
|
|
||||||
void SetArchitecture(const ArchSpec &arch);
|
|
||||||
|
|
||||||
bool HasExternalSource();
|
|
||||||
|
|
||||||
void SetExternalSource(
|
void SetExternalSource(
|
||||||
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
|
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
|
||||||
|
|
||||||
void RemoveExternalSource();
|
|
||||||
|
|
||||||
bool GetCompleteDecl(clang::Decl *decl) {
|
bool GetCompleteDecl(clang::Decl *decl) {
|
||||||
return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
|
return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
|
||||||
}
|
}
|
||||||
@ -231,7 +225,8 @@ class ClangASTContext : public TypeSystem {
|
|||||||
if (const RecordDeclType *record_decl =
|
if (const RecordDeclType *record_decl =
|
||||||
llvm::dyn_cast<RecordDeclType>(named_decl))
|
llvm::dyn_cast<RecordDeclType>(named_decl))
|
||||||
compiler_type.SetCompilerType(
|
compiler_type.SetCompilerType(
|
||||||
ast, clang::QualType(record_decl->getTypeForDecl(), 0));
|
this, clang::QualType(record_decl->getTypeForDecl(), 0)
|
||||||
|
.getAsOpaquePtr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -251,7 +246,7 @@ class ClangASTContext : public TypeSystem {
|
|||||||
&type_fields,
|
&type_fields,
|
||||||
bool packed = false);
|
bool packed = false);
|
||||||
|
|
||||||
static bool IsOperator(const char *name,
|
static bool IsOperator(llvm::StringRef name,
|
||||||
clang::OverloadedOperatorKind &op_kind);
|
clang::OverloadedOperatorKind &op_kind);
|
||||||
|
|
||||||
// Structure, Unions, Classes
|
// Structure, Unions, Classes
|
||||||
@ -397,7 +392,8 @@ class ClangASTContext : public TypeSystem {
|
|||||||
clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx,
|
clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx,
|
||||||
const char *name,
|
const char *name,
|
||||||
const CompilerType ¶m_type,
|
const CompilerType ¶m_type,
|
||||||
int storage);
|
int storage,
|
||||||
|
bool add_decl=false);
|
||||||
|
|
||||||
void SetFunctionParameters(clang::FunctionDecl *function_decl,
|
void SetFunctionParameters(clang::FunctionDecl *function_decl,
|
||||||
clang::ParmVarDecl **params, unsigned num_params);
|
clang::ParmVarDecl **params, unsigned num_params);
|
||||||
@ -468,6 +464,8 @@ class ClangASTContext : public TypeSystem {
|
|||||||
CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
|
CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
|
||||||
size_t arg_idx) override;
|
size_t arg_idx) override;
|
||||||
|
|
||||||
|
CompilerType GetTypeForDecl(void *opaque_decl) override;
|
||||||
|
|
||||||
// CompilerDeclContext override functions
|
// CompilerDeclContext override functions
|
||||||
|
|
||||||
std::vector<CompilerDecl>
|
std::vector<CompilerDecl>
|
||||||
@ -609,9 +607,6 @@ class ClangASTContext : public TypeSystem {
|
|||||||
static bool GetCXXClassName(const CompilerType &type,
|
static bool GetCXXClassName(const CompilerType &type,
|
||||||
std::string &class_name);
|
std::string &class_name);
|
||||||
|
|
||||||
static bool GetObjCClassName(const CompilerType &type,
|
|
||||||
std::string &class_name);
|
|
||||||
|
|
||||||
// Type Completion
|
// Type Completion
|
||||||
|
|
||||||
bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
|
bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
|
||||||
@ -695,6 +690,8 @@ class ClangASTContext : public TypeSystem {
|
|||||||
|
|
||||||
// Exploring the type
|
// Exploring the type
|
||||||
|
|
||||||
|
const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) override;
|
||||||
|
|
||||||
llvm::Optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
|
llvm::Optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
|
||||||
ExecutionContextScope *exe_scope) {
|
ExecutionContextScope *exe_scope) {
|
||||||
if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
|
if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
|
||||||
@ -711,7 +708,9 @@ class ClangASTContext : public TypeSystem {
|
|||||||
|
|
||||||
lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
|
lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
|
||||||
|
|
||||||
size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
|
llvm::Optional<size_t>
|
||||||
|
GetTypeBitAlign(lldb::opaque_compiler_type_t type,
|
||||||
|
ExecutionContextScope *exe_scope) override;
|
||||||
|
|
||||||
uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
|
uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
|
||||||
bool omit_empty_base_classes,
|
bool omit_empty_base_classes,
|
||||||
@ -859,7 +858,6 @@ class ClangASTContext : public TypeSystem {
|
|||||||
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type,
|
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type,
|
||||||
bool has_extern);
|
bool has_extern);
|
||||||
|
|
||||||
static bool GetHasExternalStorage(const CompilerType &type);
|
|
||||||
// Tag Declarations
|
// Tag Declarations
|
||||||
static bool StartTagDeclarationDefinition(const CompilerType &type);
|
static bool StartTagDeclarationDefinition(const CompilerType &type);
|
||||||
|
|
||||||
@ -882,12 +880,6 @@ class ClangASTContext : public TypeSystem {
|
|||||||
static CompilerType CreateMemberPointerType(const CompilerType &type,
|
static CompilerType CreateMemberPointerType(const CompilerType &type,
|
||||||
const CompilerType &pointee_type);
|
const CompilerType &pointee_type);
|
||||||
|
|
||||||
// Converts "s" to a floating point value and place resulting floating point
|
|
||||||
// bytes in the "dst" buffer.
|
|
||||||
size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
|
|
||||||
const char *s, uint8_t *dst,
|
|
||||||
size_t dst_size) override;
|
|
||||||
|
|
||||||
// Dumping types
|
// Dumping types
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
/// Convenience LLVM-style dump method for use in the debugger only.
|
/// Convenience LLVM-style dump method for use in the debugger only.
|
||||||
@ -898,6 +890,14 @@ class ClangASTContext : public TypeSystem {
|
|||||||
|
|
||||||
void Dump(Stream &s);
|
void Dump(Stream &s);
|
||||||
|
|
||||||
|
/// Dump clang AST types from the symbol file.
|
||||||
|
///
|
||||||
|
/// \param[in] s
|
||||||
|
/// A stream to send the dumped AST node(s) to
|
||||||
|
/// \param[in] symbol_name
|
||||||
|
/// The name of the symbol to dump, if it is empty dump all the symbols
|
||||||
|
void DumpFromSymbolFile(Stream &s, llvm::StringRef symbol_name);
|
||||||
|
|
||||||
void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
|
void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
|
||||||
Stream *s, lldb::Format format, const DataExtractor &data,
|
Stream *s, lldb::Format format, const DataExtractor &data,
|
||||||
lldb::offset_t data_offset, size_t data_byte_size,
|
lldb::offset_t data_offset, size_t data_byte_size,
|
||||||
@ -981,45 +981,47 @@ class ClangASTContext : public TypeSystem {
|
|||||||
GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type);
|
GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type);
|
||||||
|
|
||||||
// Classes that inherit from ClangASTContext can see and modify these
|
// Classes that inherit from ClangASTContext can see and modify these
|
||||||
// clang-format off
|
std::string m_target_triple;
|
||||||
std::string m_target_triple;
|
std::unique_ptr<clang::ASTContext> m_ast_up;
|
||||||
std::unique_ptr<clang::ASTContext> m_ast_up;
|
std::unique_ptr<clang::LangOptions> m_language_options_up;
|
||||||
std::unique_ptr<clang::LangOptions> m_language_options_up;
|
std::unique_ptr<clang::FileManager> m_file_manager_up;
|
||||||
std::unique_ptr<clang::FileManager> m_file_manager_up;
|
std::unique_ptr<clang::SourceManager> m_source_manager_up;
|
||||||
std::unique_ptr<clang::SourceManager> m_source_manager_up;
|
std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
|
||||||
std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
|
std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
|
||||||
std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
|
std::shared_ptr<clang::TargetOptions> m_target_options_rp;
|
||||||
std::shared_ptr<clang::TargetOptions> m_target_options_rp;
|
std::unique_ptr<clang::TargetInfo> m_target_info_up;
|
||||||
std::unique_ptr<clang::TargetInfo> m_target_info_up;
|
std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
|
||||||
std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
|
std::unique_ptr<clang::SelectorTable> m_selector_table_up;
|
||||||
std::unique_ptr<clang::SelectorTable> m_selector_table_up;
|
std::unique_ptr<clang::Builtin::Context> m_builtins_up;
|
||||||
std::unique_ptr<clang::Builtin::Context> m_builtins_up;
|
std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
|
||||||
std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
|
|
||||||
#ifdef LLDB_ENABLE_ALL
|
#ifdef LLDB_ENABLE_ALL
|
||||||
std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
|
std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
|
||||||
#endif // LLDB_ENABLE_ALL
|
#endif // LLDB_ENABLE_ALL
|
||||||
std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
|
std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
|
||||||
std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
|
std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
|
||||||
CompleteTagDeclCallback m_callback_tag_decl;
|
CompleteTagDeclCallback m_callback_tag_decl = nullptr;
|
||||||
CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
|
CompleteObjCInterfaceDeclCallback m_callback_objc_decl = nullptr;
|
||||||
void * m_callback_baton;
|
void *m_callback_baton = nullptr;
|
||||||
clang::ExternalASTMerger::OriginMap m_origins;
|
clang::ExternalASTMerger::OriginMap m_origins;
|
||||||
uint32_t m_pointer_byte_size;
|
uint32_t m_pointer_byte_size = 0;
|
||||||
bool m_ast_owned;
|
bool m_ast_owned = false;
|
||||||
/// The sema associated that is currently used to build this ASTContext.
|
/// The sema associated that is currently used to build this ASTContext.
|
||||||
/// May be null if we are already done parsing this ASTContext or the
|
/// May be null if we are already done parsing this ASTContext or the
|
||||||
/// ASTContext wasn't created by parsing source code.
|
/// ASTContext wasn't created by parsing source code.
|
||||||
clang::Sema * m_sema = nullptr;
|
clang::Sema *m_sema = nullptr;
|
||||||
// clang-format on
|
|
||||||
private:
|
private:
|
||||||
// For ClangASTContext only
|
// For ClangASTContext only
|
||||||
ClangASTContext(const ClangASTContext &);
|
ClangASTContext(const ClangASTContext &);
|
||||||
const ClangASTContext &operator=(const ClangASTContext &);
|
const ClangASTContext &operator=(const ClangASTContext &);
|
||||||
|
/// Creates the internal ASTContext.
|
||||||
|
void CreateASTContext();
|
||||||
|
void SetTargetTriple(llvm::StringRef target_triple);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClangASTContextForExpressions : public ClangASTContext {
|
class ClangASTContextForExpressions : public ClangASTContext {
|
||||||
public:
|
public:
|
||||||
ClangASTContextForExpressions(Target &target);
|
ClangASTContextForExpressions(Target &target, ArchSpec arch);
|
||||||
|
|
||||||
~ClangASTContextForExpressions() override = default;
|
~ClangASTContextForExpressions() override = default;
|
||||||
|
|
||||||
@ -1047,13 +1049,9 @@ class ClangASTContextForExpressions : public ClangASTContext {
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
lldb::TargetWP m_target_wp;
|
lldb::TargetWP m_target_wp;
|
||||||
lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
|
std::unique_ptr<PersistentExpressionState>
|
||||||
///persistent
|
m_persistent_variables; // These are the persistent variables associated
|
||||||
///variables
|
// with this process for the expression parser
|
||||||
///associated with
|
|
||||||
///this process for
|
|
||||||
///the expression
|
|
||||||
///parser.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace lldb_private
|
} // namespace lldb_private
|
||||||
|
@ -210,7 +210,7 @@ class ClangASTImporter {
|
|||||||
void ForgetDestination(clang::ASTContext *dst_ctx);
|
void ForgetDestination(clang::ASTContext *dst_ctx);
|
||||||
void ForgetSource(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
|
void ForgetSource(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
|
||||||
|
|
||||||
private:
|
public:
|
||||||
struct DeclOrigin {
|
struct DeclOrigin {
|
||||||
DeclOrigin() : ctx(nullptr), decl(nullptr) {}
|
DeclOrigin() : ctx(nullptr), decl(nullptr) {}
|
||||||
|
|
||||||
@ -235,24 +235,32 @@ class ClangASTImporter {
|
|||||||
|
|
||||||
typedef std::map<const clang::Decl *, DeclOrigin> OriginMap;
|
typedef std::map<const clang::Decl *, DeclOrigin> OriginMap;
|
||||||
|
|
||||||
|
/// Listener interface used by the ASTImporterDelegate to inform other code
|
||||||
|
/// about decls that have been imported the first time.
|
||||||
|
struct NewDeclListener {
|
||||||
|
virtual ~NewDeclListener() = default;
|
||||||
|
/// A decl has been imported for the first time.
|
||||||
|
virtual void NewDeclImported(clang::Decl *from, clang::Decl *to) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
/// ASTImporter that intercepts and records the import process of the
|
/// ASTImporter that intercepts and records the import process of the
|
||||||
/// underlying ASTImporter.
|
/// underlying ASTImporter.
|
||||||
///
|
///
|
||||||
/// This class updates the map from declarations to their original
|
/// This class updates the map from declarations to their original
|
||||||
/// declarations and can record and complete declarations that have been
|
/// declarations and can record declarations that have been imported in a
|
||||||
/// imported in a certain interval.
|
/// certain interval.
|
||||||
///
|
///
|
||||||
/// When intercepting a declaration import, the ASTImporterDelegate uses the
|
/// When intercepting a declaration import, the ASTImporterDelegate uses the
|
||||||
/// CxxModuleHandler to replace any missing or malformed declarations with
|
/// CxxModuleHandler to replace any missing or malformed declarations with
|
||||||
/// their counterpart from a C++ module.
|
/// their counterpart from a C++ module.
|
||||||
class ASTImporterDelegate : public clang::ASTImporter {
|
struct ASTImporterDelegate : public clang::ASTImporter {
|
||||||
public:
|
|
||||||
ASTImporterDelegate(ClangASTImporter &master, clang::ASTContext *target_ctx,
|
ASTImporterDelegate(ClangASTImporter &master, clang::ASTContext *target_ctx,
|
||||||
clang::ASTContext *source_ctx)
|
clang::ASTContext *source_ctx)
|
||||||
: clang::ASTImporter(*target_ctx, master.m_file_manager, *source_ctx,
|
: clang::ASTImporter(*target_ctx, master.m_file_manager, *source_ctx,
|
||||||
master.m_file_manager, true /*minimal*/),
|
master.m_file_manager, true /*minimal*/),
|
||||||
m_decls_to_deport(nullptr), m_decls_already_deported(nullptr),
|
m_master(master), m_source_ctx(source_ctx) {
|
||||||
m_master(master), m_source_ctx(source_ctx) {}
|
setODRHandling(clang::ASTImporter::ODRHandlingType::Liberal);
|
||||||
|
}
|
||||||
|
|
||||||
/// Scope guard that attaches a CxxModuleHandler to an ASTImporterDelegate
|
/// Scope guard that attaches a CxxModuleHandler to an ASTImporterDelegate
|
||||||
/// and deattaches it at the end of the scope. Supports being used multiple
|
/// and deattaches it at the end of the scope. Supports being used multiple
|
||||||
@ -285,43 +293,32 @@ class ClangASTImporter {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
|
||||||
llvm::Expected<clang::Decl *> ImportImpl(clang::Decl *From) override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
// A call to "InitDeportWorkQueues" puts the delegate into deport mode.
|
|
||||||
// In deport mode, every copied Decl that could require completion is
|
|
||||||
// recorded and placed into the decls_to_deport set.
|
|
||||||
//
|
|
||||||
// A call to "ExecuteDeportWorkQueues" completes all the Decls that
|
|
||||||
// are in decls_to_deport, adding any Decls it sees along the way that it
|
|
||||||
// hasn't already deported. It proceeds until decls_to_deport is empty.
|
|
||||||
//
|
|
||||||
// These calls must be paired. Leaving a delegate in deport mode or trying
|
|
||||||
// to start deport delegate with a new pair of queues will result in an
|
|
||||||
// assertion failure.
|
|
||||||
|
|
||||||
void
|
|
||||||
InitDeportWorkQueues(std::set<clang::NamedDecl *> *decls_to_deport,
|
|
||||||
std::set<clang::NamedDecl *> *decls_already_deported);
|
|
||||||
void ExecuteDeportWorkQueues();
|
|
||||||
|
|
||||||
void ImportDefinitionTo(clang::Decl *to, clang::Decl *from);
|
void ImportDefinitionTo(clang::Decl *to, clang::Decl *from);
|
||||||
|
|
||||||
void Imported(clang::Decl *from, clang::Decl *to) override;
|
void Imported(clang::Decl *from, clang::Decl *to) override;
|
||||||
|
|
||||||
clang::Decl *GetOriginalDecl(clang::Decl *To) override;
|
clang::Decl *GetOriginalDecl(clang::Decl *To) override;
|
||||||
|
|
||||||
|
void SetImportListener(NewDeclListener *listener) {
|
||||||
|
assert(m_new_decl_listener == nullptr && "Already attached a listener?");
|
||||||
|
m_new_decl_listener = listener;
|
||||||
|
}
|
||||||
|
void RemoveImportListener() { m_new_decl_listener = nullptr; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
llvm::Expected<clang::Decl *> ImportImpl(clang::Decl *From) override;
|
||||||
|
|
||||||
|
private:
|
||||||
/// Decls we should ignore when mapping decls back to their original
|
/// Decls we should ignore when mapping decls back to their original
|
||||||
/// ASTContext. Used by the CxxModuleHandler to mark declarations that
|
/// ASTContext. Used by the CxxModuleHandler to mark declarations that
|
||||||
/// were created from the 'std' C++ module to prevent that the Importer
|
/// were created from the 'std' C++ module to prevent that the Importer
|
||||||
/// tries to sync them with the broken equivalent in the debug info AST.
|
/// tries to sync them with the broken equivalent in the debug info AST.
|
||||||
std::set<clang::Decl *> m_decls_to_ignore;
|
std::set<clang::Decl *> m_decls_to_ignore;
|
||||||
std::set<clang::NamedDecl *> *m_decls_to_deport;
|
|
||||||
std::set<clang::NamedDecl *> *m_decls_already_deported;
|
|
||||||
ClangASTImporter &m_master;
|
ClangASTImporter &m_master;
|
||||||
clang::ASTContext *m_source_ctx;
|
clang::ASTContext *m_source_ctx;
|
||||||
CxxModuleHandler *m_std_handler = nullptr;
|
CxxModuleHandler *m_std_handler = nullptr;
|
||||||
|
/// The currently attached listener.
|
||||||
|
NewDeclListener *m_new_decl_listener = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<ASTImporterDelegate> ImporterDelegateSP;
|
typedef std::shared_ptr<ASTImporterDelegate> ImporterDelegateSP;
|
||||||
@ -387,6 +384,7 @@ class ClangASTImporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
DeclOrigin GetDeclOrigin(const clang::Decl *decl);
|
DeclOrigin GetDeclOrigin(const clang::Decl *decl);
|
||||||
|
|
||||||
clang::FileManager m_file_manager;
|
clang::FileManager m_file_manager;
|
||||||
|
@ -225,6 +225,14 @@ class CompileUnit : public std::enable_shared_from_this<CompileUnit>,
|
|||||||
|
|
||||||
DebugMacros *GetDebugMacros();
|
DebugMacros *GetDebugMacros();
|
||||||
|
|
||||||
|
/// Apply a lambda to each external lldb::Module referenced by this
|
||||||
|
/// compilation unit. Recursively also descends into the referenced external
|
||||||
|
/// modules of any encountered compilation unit.
|
||||||
|
///
|
||||||
|
/// \param[in] lambda
|
||||||
|
/// The lambda that should be applied to every module.
|
||||||
|
void ForEachExternalModule(llvm::function_ref<void(lldb::ModuleSP)> f);
|
||||||
|
|
||||||
/// Get the compile unit's support file list.
|
/// Get the compile unit's support file list.
|
||||||
///
|
///
|
||||||
/// The support file list is used by the line table, and any objects that
|
/// The support file list is used by the line table, and any objects that
|
||||||
@ -298,6 +306,8 @@ class CompileUnit : public std::enable_shared_from_this<CompileUnit>,
|
|||||||
/// A line table object pointer that this object now owns.
|
/// A line table object pointer that this object now owns.
|
||||||
void SetLineTable(LineTable *line_table);
|
void SetLineTable(LineTable *line_table);
|
||||||
|
|
||||||
|
void SetSupportFiles(const FileSpecList &support_files);
|
||||||
|
|
||||||
void SetDebugMacros(const DebugMacrosSP &debug_macros);
|
void SetDebugMacros(const DebugMacrosSP &debug_macros);
|
||||||
|
|
||||||
/// Set accessor for the variable list.
|
/// Set accessor for the variable list.
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "lldb/Core/ClangForward.h"
|
|
||||||
#include "lldb/lldb-private.h"
|
#include "lldb/lldb-private.h"
|
||||||
#include "llvm/ADT/APSInt.h"
|
#include "llvm/ADT/APSInt.h"
|
||||||
|
|
||||||
@ -32,7 +31,6 @@ class CompilerType {
|
|||||||
public:
|
public:
|
||||||
// Constructors and Destructors
|
// Constructors and Destructors
|
||||||
CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
|
CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
|
||||||
CompilerType(clang::ASTContext *ast_context, clang::QualType qual_type);
|
|
||||||
|
|
||||||
CompilerType(const CompilerType &rhs)
|
CompilerType(const CompilerType &rhs)
|
||||||
: m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}
|
: m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}
|
||||||
@ -169,8 +167,6 @@ class CompilerType {
|
|||||||
void SetCompilerType(TypeSystem *type_system,
|
void SetCompilerType(TypeSystem *type_system,
|
||||||
lldb::opaque_compiler_type_t type);
|
lldb::opaque_compiler_type_t type);
|
||||||
|
|
||||||
void SetCompilerType(clang::ASTContext *ast, clang::QualType qual_type);
|
|
||||||
|
|
||||||
unsigned GetTypeQualifiers() const;
|
unsigned GetTypeQualifiers() const;
|
||||||
|
|
||||||
// Creating related types
|
// Creating related types
|
||||||
@ -257,7 +253,7 @@ class CompilerType {
|
|||||||
|
|
||||||
lldb::Format GetFormat() const;
|
lldb::Format GetFormat() const;
|
||||||
|
|
||||||
size_t GetTypeBitAlign() const;
|
llvm::Optional<size_t> GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
|
||||||
|
|
||||||
uint32_t GetNumChildren(bool omit_empty_base_classes,
|
uint32_t GetNumChildren(bool omit_empty_base_classes,
|
||||||
const ExecutionContext *exe_ctx) const;
|
const ExecutionContext *exe_ctx) const;
|
||||||
@ -336,13 +332,6 @@ class CompilerType {
|
|||||||
|
|
||||||
bool IsMeaninglessWithoutDynamicResolution() const;
|
bool IsMeaninglessWithoutDynamicResolution() const;
|
||||||
|
|
||||||
// Pointers & References
|
|
||||||
|
|
||||||
// Converts "s" to a floating point value and place resulting floating point
|
|
||||||
// bytes in the "dst" buffer.
|
|
||||||
size_t ConvertStringToFloatValue(const char *s, uint8_t *dst,
|
|
||||||
size_t dst_size) const;
|
|
||||||
|
|
||||||
// Dumping types
|
// Dumping types
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -9,11 +9,8 @@
|
|||||||
#ifndef liblldb_DeclVendor_h_
|
#ifndef liblldb_DeclVendor_h_
|
||||||
#define liblldb_DeclVendor_h_
|
#define liblldb_DeclVendor_h_
|
||||||
|
|
||||||
#include "lldb/Core/ClangForward.h"
|
|
||||||
#include "lldb/lldb-defines.h"
|
#include "lldb/lldb-defines.h"
|
||||||
|
|
||||||
#include "clang/AST/ExternalASTMerger.h"
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace lldb_private {
|
namespace lldb_private {
|
||||||
@ -22,11 +19,19 @@ namespace lldb_private {
|
|||||||
// declarations that are not necessarily backed by a specific symbol file.
|
// declarations that are not necessarily backed by a specific symbol file.
|
||||||
class DeclVendor {
|
class DeclVendor {
|
||||||
public:
|
public:
|
||||||
|
enum DeclVendorKind {
|
||||||
|
eClangDeclVendor,
|
||||||
|
eClangModuleDeclVendor,
|
||||||
|
eAppleObjCDeclVendor,
|
||||||
|
eLastClangDeclVendor,
|
||||||
|
};
|
||||||
// Constructors and Destructors
|
// Constructors and Destructors
|
||||||
DeclVendor() {}
|
DeclVendor(DeclVendorKind kind) : m_kind(kind) {}
|
||||||
|
|
||||||
virtual ~DeclVendor() {}
|
virtual ~DeclVendor() {}
|
||||||
|
|
||||||
|
DeclVendorKind GetKind() const { return m_kind; }
|
||||||
|
|
||||||
/// Look up the set of Decls that the DeclVendor currently knows about
|
/// Look up the set of Decls that the DeclVendor currently knows about
|
||||||
/// matching a given name.
|
/// matching a given name.
|
||||||
///
|
///
|
||||||
@ -45,7 +50,7 @@ class DeclVendor {
|
|||||||
/// max_matches.
|
/// max_matches.
|
||||||
virtual uint32_t FindDecls(ConstString name, bool append,
|
virtual uint32_t FindDecls(ConstString name, bool append,
|
||||||
uint32_t max_matches,
|
uint32_t max_matches,
|
||||||
std::vector<clang::NamedDecl *> &decls) = 0;
|
std::vector<CompilerDecl> &decls) = 0;
|
||||||
|
|
||||||
/// Look up the types that the DeclVendor currently knows about matching a
|
/// Look up the types that the DeclVendor currently knows about matching a
|
||||||
/// given name.
|
/// given name.
|
||||||
@ -60,16 +65,11 @@ class DeclVendor {
|
|||||||
/// The vector of CompilerTypes that was found.
|
/// The vector of CompilerTypes that was found.
|
||||||
std::vector<CompilerType> FindTypes(ConstString name, uint32_t max_matches);
|
std::vector<CompilerType> FindTypes(ConstString name, uint32_t max_matches);
|
||||||
|
|
||||||
/// Interface for ExternalASTMerger. Returns an ImporterSource
|
|
||||||
/// allowing type completion.
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// An ImporterSource for this DeclVendor.
|
|
||||||
virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// For DeclVendor only
|
// For DeclVendor only
|
||||||
DISALLOW_COPY_AND_ASSIGN(DeclVendor);
|
DISALLOW_COPY_AND_ASSIGN(DeclVendor);
|
||||||
|
|
||||||
|
const DeclVendorKind m_kind;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace lldb_private
|
} // namespace lldb_private
|
||||||
|
@ -76,6 +76,11 @@ class FuncUnwinders {
|
|||||||
|
|
||||||
lldb::UnwindPlanSP GetAssemblyUnwindPlan(Target &target, Thread &thread);
|
lldb::UnwindPlanSP GetAssemblyUnwindPlan(Target &target, Thread &thread);
|
||||||
|
|
||||||
|
lldb::UnwindPlanSP GetObjectFileUnwindPlan(Target &target);
|
||||||
|
|
||||||
|
lldb::UnwindPlanSP GetObjectFileAugmentedUnwindPlan(Target &target,
|
||||||
|
Thread &thread);
|
||||||
|
|
||||||
lldb::UnwindPlanSP GetEHFrameUnwindPlan(Target &target);
|
lldb::UnwindPlanSP GetEHFrameUnwindPlan(Target &target);
|
||||||
|
|
||||||
lldb::UnwindPlanSP GetEHFrameAugmentedUnwindPlan(Target &target,
|
lldb::UnwindPlanSP GetEHFrameAugmentedUnwindPlan(Target &target,
|
||||||
@ -113,10 +118,12 @@ class FuncUnwinders {
|
|||||||
std::recursive_mutex m_mutex;
|
std::recursive_mutex m_mutex;
|
||||||
|
|
||||||
lldb::UnwindPlanSP m_unwind_plan_assembly_sp;
|
lldb::UnwindPlanSP m_unwind_plan_assembly_sp;
|
||||||
|
lldb::UnwindPlanSP m_unwind_plan_object_file_sp;
|
||||||
lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp;
|
lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp;
|
||||||
lldb::UnwindPlanSP m_unwind_plan_debug_frame_sp;
|
lldb::UnwindPlanSP m_unwind_plan_debug_frame_sp;
|
||||||
|
|
||||||
// augmented by assembly inspection so it's valid everywhere
|
// augmented by assembly inspection so it's valid everywhere
|
||||||
|
lldb::UnwindPlanSP m_unwind_plan_object_file_augmented_sp;
|
||||||
lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp;
|
lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp;
|
||||||
lldb::UnwindPlanSP m_unwind_plan_debug_frame_augmented_sp;
|
lldb::UnwindPlanSP m_unwind_plan_debug_frame_augmented_sp;
|
||||||
|
|
||||||
@ -130,7 +137,9 @@ class FuncUnwinders {
|
|||||||
// Fetching the UnwindPlans can be expensive - if we've already attempted to
|
// Fetching the UnwindPlans can be expensive - if we've already attempted to
|
||||||
// get one & failed, don't try again.
|
// get one & failed, don't try again.
|
||||||
bool m_tried_unwind_plan_assembly : 1, m_tried_unwind_plan_eh_frame : 1,
|
bool m_tried_unwind_plan_assembly : 1, m_tried_unwind_plan_eh_frame : 1,
|
||||||
|
m_tried_unwind_plan_object_file : 1,
|
||||||
m_tried_unwind_plan_debug_frame : 1,
|
m_tried_unwind_plan_debug_frame : 1,
|
||||||
|
m_tried_unwind_plan_object_file_augmented : 1,
|
||||||
m_tried_unwind_plan_eh_frame_augmented : 1,
|
m_tried_unwind_plan_eh_frame_augmented : 1,
|
||||||
m_tried_unwind_plan_debug_frame_augmented : 1,
|
m_tried_unwind_plan_debug_frame_augmented : 1,
|
||||||
m_tried_unwind_plan_compact_unwind : 1,
|
m_tried_unwind_plan_compact_unwind : 1,
|
||||||
|
@ -140,7 +140,7 @@ class InlineFunctionInfo : public FunctionInfo {
|
|||||||
/// \param[in] call_decl_ptr
|
/// \param[in] call_decl_ptr
|
||||||
/// Optional calling location declaration information that
|
/// Optional calling location declaration information that
|
||||||
/// describes from where this inlined function was called.
|
/// describes from where this inlined function was called.
|
||||||
InlineFunctionInfo(const char *name, const char *mangled,
|
InlineFunctionInfo(const char *name, llvm::StringRef mangled,
|
||||||
const Declaration *decl_ptr,
|
const Declaration *decl_ptr,
|
||||||
const Declaration *call_decl_ptr);
|
const Declaration *call_decl_ptr);
|
||||||
|
|
||||||
@ -246,10 +246,22 @@ class InlineFunctionInfo : public FunctionInfo {
|
|||||||
|
|
||||||
class Function;
|
class Function;
|
||||||
|
|
||||||
|
/// \class CallSiteParameter Function.h "lldb/Symbol/Function.h"
|
||||||
|
///
|
||||||
|
/// Represent the locations of a parameter at a call site, both in the caller
|
||||||
|
/// and in the callee.
|
||||||
|
struct CallSiteParameter {
|
||||||
|
DWARFExpression LocationInCallee;
|
||||||
|
DWARFExpression LocationInCaller;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// A vector of \c CallSiteParameter.
|
||||||
|
using CallSiteParameterArray = llvm::SmallVector<CallSiteParameter, 0>;
|
||||||
|
|
||||||
/// \class CallEdge Function.h "lldb/Symbol/Function.h"
|
/// \class CallEdge Function.h "lldb/Symbol/Function.h"
|
||||||
///
|
///
|
||||||
/// Represent a call made within a Function. This can be used to find a path
|
/// Represent a call made within a Function. This can be used to find a path
|
||||||
/// in the call graph between two functions.
|
/// in the call graph between two functions, or to evaluate DW_OP_entry_value.
|
||||||
class CallEdge {
|
class CallEdge {
|
||||||
public:
|
public:
|
||||||
/// Construct a call edge using a symbol name to identify the calling
|
/// Construct a call edge using a symbol name to identify the calling
|
||||||
@ -259,7 +271,8 @@ class CallEdge {
|
|||||||
/// TODO: A symbol name may not be globally unique. To disambiguate ODR
|
/// TODO: A symbol name may not be globally unique. To disambiguate ODR
|
||||||
/// conflicts, it's necessary to determine the \c Target a call edge is
|
/// conflicts, it's necessary to determine the \c Target a call edge is
|
||||||
/// associated with before resolving it.
|
/// associated with before resolving it.
|
||||||
CallEdge(const char *symbol_name, lldb::addr_t return_pc);
|
CallEdge(const char *symbol_name, lldb::addr_t return_pc,
|
||||||
|
CallSiteParameterArray parameters);
|
||||||
|
|
||||||
CallEdge(CallEdge &&) = default;
|
CallEdge(CallEdge &&) = default;
|
||||||
CallEdge &operator=(CallEdge &&) = default;
|
CallEdge &operator=(CallEdge &&) = default;
|
||||||
@ -279,6 +292,9 @@ class CallEdge {
|
|||||||
/// offset.
|
/// offset.
|
||||||
lldb::addr_t GetUnresolvedReturnPCAddress() const { return return_pc; }
|
lldb::addr_t GetUnresolvedReturnPCAddress() const { return return_pc; }
|
||||||
|
|
||||||
|
/// Get the call site parameters available at this call edge.
|
||||||
|
llvm::ArrayRef<CallSiteParameter> GetCallSiteParameters() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ParseSymbolFileAndResolve(ModuleList &images);
|
void ParseSymbolFileAndResolve(ModuleList &images);
|
||||||
|
|
||||||
@ -294,6 +310,8 @@ class CallEdge {
|
|||||||
/// gives the return PC for the call.
|
/// gives the return PC for the call.
|
||||||
lldb::addr_t return_pc;
|
lldb::addr_t return_pc;
|
||||||
|
|
||||||
|
CallSiteParameterArray parameters;
|
||||||
|
|
||||||
/// Whether or not an attempt was made to find the callee's definition.
|
/// Whether or not an attempt was made to find the callee's definition.
|
||||||
bool resolved;
|
bool resolved;
|
||||||
|
|
||||||
@ -402,6 +420,11 @@ class Function : public UserID, public SymbolContextScope {
|
|||||||
/// return None.
|
/// return None.
|
||||||
llvm::MutableArrayRef<CallEdge> GetTailCallingEdges();
|
llvm::MutableArrayRef<CallEdge> GetTailCallingEdges();
|
||||||
|
|
||||||
|
/// Get the outgoing call edge from this function which has the given return
|
||||||
|
/// address \p return_pc, or return nullptr. Note that this will not return a
|
||||||
|
/// tail-calling edge.
|
||||||
|
CallEdge *GetCallEdgeForReturnAddress(lldb::addr_t return_pc, Target &target);
|
||||||
|
|
||||||
/// Get accessor for the block list.
|
/// Get accessor for the block list.
|
||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
@ -564,6 +587,8 @@ class Function : public UserID, public SymbolContextScope {
|
|||||||
uint32_t
|
uint32_t
|
||||||
m_prologue_byte_size; ///< Compute the prologue size once and cache it
|
m_prologue_byte_size; ///< Compute the prologue size once and cache it
|
||||||
|
|
||||||
|
// TODO: Use a layer of indirection to point to call edges, to save space
|
||||||
|
// when call info hasn't been parsed.
|
||||||
bool m_call_edges_resolved = false; ///< Whether call site info has been
|
bool m_call_edges_resolved = false; ///< Whether call site info has been
|
||||||
/// parsed.
|
/// parsed.
|
||||||
std::vector<CallEdge> m_call_edges; ///< Outgoing call edges.
|
std::vector<CallEdge> m_call_edges; ///< Outgoing call edges.
|
||||||
|
@ -63,16 +63,22 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
|
|||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
eTypeInvalid = 0,
|
eTypeInvalid = 0,
|
||||||
eTypeCoreFile, /// A core file that has a checkpoint of a program's
|
/// A core file that has a checkpoint of a program's execution state.
|
||||||
/// execution state
|
eTypeCoreFile,
|
||||||
eTypeExecutable, /// A normal executable
|
/// A normal executable.
|
||||||
eTypeDebugInfo, /// An object file that contains only debug information
|
eTypeExecutable,
|
||||||
eTypeDynamicLinker, /// The platform's dynamic linker executable
|
/// An object file that contains only debug information.
|
||||||
eTypeObjectFile, /// An intermediate object file
|
eTypeDebugInfo,
|
||||||
eTypeSharedLibrary, /// A shared library that can be used during execution
|
/// The platform's dynamic linker executable.
|
||||||
eTypeStubLibrary, /// A library that can be linked against but not used for
|
eTypeDynamicLinker,
|
||||||
/// execution
|
/// An intermediate object file.
|
||||||
eTypeJIT, /// JIT code that has symbols, sections and possibly debug info
|
eTypeObjectFile,
|
||||||
|
/// A shared library that can be used during execution.
|
||||||
|
eTypeSharedLibrary,
|
||||||
|
/// A library that can be linked against but not used for execution.
|
||||||
|
eTypeStubLibrary,
|
||||||
|
/// JIT code that has symbols, sections and possibly debug info.
|
||||||
|
eTypeJIT,
|
||||||
eTypeUnknown
|
eTypeUnknown
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -201,9 +207,13 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
|
|||||||
/// \b false otherwise and \a archive_file and \a archive_object
|
/// \b false otherwise and \a archive_file and \a archive_object
|
||||||
/// are guaranteed to be remain unchanged.
|
/// are guaranteed to be remain unchanged.
|
||||||
static bool SplitArchivePathWithObject(
|
static bool SplitArchivePathWithObject(
|
||||||
const char *path_with_object, lldb_private::FileSpec &archive_file,
|
llvm::StringRef path_with_object, lldb_private::FileSpec &archive_file,
|
||||||
lldb_private::ConstString &archive_object, bool must_exist);
|
lldb_private::ConstString &archive_object, bool must_exist);
|
||||||
|
|
||||||
|
// LLVM RTTI support
|
||||||
|
static char ID;
|
||||||
|
virtual bool isA(const void *ClassID) const { return ClassID == &ID; }
|
||||||
|
|
||||||
/// Gets the address size in bytes for the current object file.
|
/// Gets the address size in bytes for the current object file.
|
||||||
///
|
///
|
||||||
/// \return
|
/// \return
|
||||||
@ -366,17 +376,6 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
|
|||||||
/// returned.
|
/// returned.
|
||||||
virtual UUID GetUUID() = 0;
|
virtual UUID GetUUID() = 0;
|
||||||
|
|
||||||
/// Gets the symbol file spec list for this object file.
|
|
||||||
///
|
|
||||||
/// If the object file format contains a debug symbol file link, the values
|
|
||||||
/// will be returned in the FileSpecList.
|
|
||||||
///
|
|
||||||
/// \return
|
|
||||||
/// Returns filespeclist.
|
|
||||||
virtual lldb_private::FileSpecList GetDebugSymbolFilePaths() {
|
|
||||||
return FileSpecList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Gets the file spec list of libraries re-exported by this object file.
|
/// Gets the file spec list of libraries re-exported by this object file.
|
||||||
///
|
///
|
||||||
/// If the object file format has the notion of one library re-exporting the
|
/// If the object file format has the notion of one library re-exporting the
|
||||||
@ -657,6 +656,9 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
|
|||||||
/// \return
|
/// \return
|
||||||
virtual std::vector<LoadableData> GetLoadableData(Target &target);
|
virtual std::vector<LoadableData> GetLoadableData(Target &target);
|
||||||
|
|
||||||
|
/// Creates a plugin-specific call frame info
|
||||||
|
virtual std::unique_ptr<CallFrameInfo> CreateCallFrameInfo();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Member variables.
|
// Member variables.
|
||||||
FileSpec m_file;
|
FileSpec m_file;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/Support/Allocator.h"
|
#include "llvm/Support/Allocator.h"
|
||||||
#include "llvm/Support/Casting.h"
|
#include "llvm/Support/Casting.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace lldb_private {
|
namespace lldb_private {
|
||||||
|
|
||||||
@ -211,7 +212,10 @@ inline T *MakeNode(llvm::BumpPtrAllocator &alloc, Args &&... args) {
|
|||||||
|
|
||||||
/// Parse the given postfix expression. The parsed nodes are placed into the
|
/// Parse the given postfix expression. The parsed nodes are placed into the
|
||||||
/// provided allocator.
|
/// provided allocator.
|
||||||
Node *Parse(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc);
|
Node *ParseOneExpression(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc);
|
||||||
|
|
||||||
|
std::vector<std::pair<llvm::StringRef, Node *>>
|
||||||
|
ParseFPOProgram(llvm::StringRef prog, llvm::BumpPtrAllocator &alloc);
|
||||||
|
|
||||||
/// Serialize the given expression tree as DWARF. The result is written into the
|
/// Serialize the given expression tree as DWARF. The result is written into the
|
||||||
/// given stream. The AST should not contain any SymbolNodes. If the expression
|
/// given stream. The AST should not contain any SymbolNodes. If the expression
|
||||||
|
@ -24,9 +24,8 @@ class Symbol : public SymbolContextScope {
|
|||||||
// drastically different meanings and sorting requirements.
|
// drastically different meanings and sorting requirements.
|
||||||
Symbol();
|
Symbol();
|
||||||
|
|
||||||
Symbol(uint32_t symID, const char *name, bool name_is_mangled,
|
Symbol(uint32_t symID, llvm::StringRef name, lldb::SymbolType type,
|
||||||
lldb::SymbolType type, bool external, bool is_debug,
|
bool external, bool is_debug, bool is_trampoline, bool is_artificial,
|
||||||
bool is_trampoline, bool is_artificial,
|
|
||||||
const lldb::SectionSP §ion_sp, lldb::addr_t value,
|
const lldb::SectionSP §ion_sp, lldb::addr_t value,
|
||||||
lldb::addr_t size, bool size_is_valid,
|
lldb::addr_t size, bool size_is_valid,
|
||||||
bool contains_linker_annotations, uint32_t flags);
|
bool contains_linker_annotations, uint32_t flags);
|
||||||
|
@ -470,6 +470,8 @@ class SymbolContextList {
|
|||||||
/// Returns the number of symbol context objects in the list.
|
/// Returns the number of symbol context objects in the list.
|
||||||
uint32_t GetSize() const;
|
uint32_t GetSize() const;
|
||||||
|
|
||||||
|
bool IsEmpty() const;
|
||||||
|
|
||||||
uint32_t NumLineEntriesWithLine(uint32_t line) const;
|
uint32_t NumLineEntriesWithLine(uint32_t line) const;
|
||||||
|
|
||||||
void GetDescription(Stream *s, lldb::DescriptionLevel level,
|
void GetDescription(Stream *s, lldb::DescriptionLevel level,
|
||||||
|
@ -16,9 +16,11 @@
|
|||||||
#include "lldb/Symbol/Function.h"
|
#include "lldb/Symbol/Function.h"
|
||||||
#include "lldb/Symbol/SourceModule.h"
|
#include "lldb/Symbol/SourceModule.h"
|
||||||
#include "lldb/Symbol/Type.h"
|
#include "lldb/Symbol/Type.h"
|
||||||
|
#include "lldb/Symbol/TypeList.h"
|
||||||
|
#include "lldb/Symbol/TypeSystem.h"
|
||||||
#include "lldb/lldb-private.h"
|
#include "lldb/lldb-private.h"
|
||||||
|
|
||||||
#include "llvm/ADT/DenseSet.h"
|
#include "llvm/ADT/DenseSet.h"
|
||||||
|
#include "llvm/Support/Errc.h"
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
@ -49,11 +51,12 @@ class SymbolFile : public PluginInterface {
|
|||||||
kAllAbilities = ((1u << 7) - 1u)
|
kAllAbilities = ((1u << 7) - 1u)
|
||||||
};
|
};
|
||||||
|
|
||||||
static SymbolFile *FindPlugin(ObjectFile *obj_file);
|
static SymbolFile *FindPlugin(lldb::ObjectFileSP objfile_sp);
|
||||||
|
|
||||||
// Constructors and Destructors
|
// Constructors and Destructors
|
||||||
SymbolFile(ObjectFile *obj_file)
|
SymbolFile(lldb::ObjectFileSP objfile_sp)
|
||||||
: m_obj_file(obj_file), m_abilities(0), m_calculated_abilities(false) {}
|
: m_objfile_sp(std::move(objfile_sp)), m_abilities(0),
|
||||||
|
m_calculated_abilities(false) {}
|
||||||
|
|
||||||
~SymbolFile() override {}
|
~SymbolFile() override {}
|
||||||
|
|
||||||
@ -110,13 +113,18 @@ class SymbolFile : public PluginInterface {
|
|||||||
|
|
||||||
// Compile Unit function calls
|
// Compile Unit function calls
|
||||||
// Approach 1 - iterator
|
// Approach 1 - iterator
|
||||||
virtual uint32_t GetNumCompileUnits() = 0;
|
uint32_t GetNumCompileUnits();
|
||||||
virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0;
|
lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx);
|
||||||
|
|
||||||
|
Symtab *GetSymtab();
|
||||||
|
|
||||||
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0;
|
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0;
|
||||||
virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0;
|
virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0;
|
||||||
virtual bool ParseLineTable(CompileUnit &comp_unit) = 0;
|
virtual bool ParseLineTable(CompileUnit &comp_unit) = 0;
|
||||||
virtual bool ParseDebugMacros(CompileUnit &comp_unit) = 0;
|
virtual bool ParseDebugMacros(CompileUnit &comp_unit) = 0;
|
||||||
|
virtual void
|
||||||
|
ForEachExternalModule(CompileUnit &comp_unit,
|
||||||
|
llvm::function_ref<void(lldb::ModuleSP)> f) {}
|
||||||
virtual bool ParseSupportFiles(CompileUnit &comp_unit,
|
virtual bool ParseSupportFiles(CompileUnit &comp_unit,
|
||||||
FileSpecList &support_files) = 0;
|
FileSpecList &support_files) = 0;
|
||||||
virtual size_t ParseTypes(CompileUnit &comp_unit) = 0;
|
virtual size_t ParseTypes(CompileUnit &comp_unit) = 0;
|
||||||
@ -165,43 +173,41 @@ class SymbolFile : public PluginInterface {
|
|||||||
SymbolContextList &sc_list);
|
SymbolContextList &sc_list);
|
||||||
|
|
||||||
virtual void DumpClangAST(Stream &s) {}
|
virtual void DumpClangAST(Stream &s) {}
|
||||||
virtual uint32_t
|
virtual void
|
||||||
FindGlobalVariables(ConstString name,
|
FindGlobalVariables(ConstString name,
|
||||||
const CompilerDeclContext *parent_decl_ctx,
|
const CompilerDeclContext *parent_decl_ctx,
|
||||||
uint32_t max_matches, VariableList &variables);
|
uint32_t max_matches, VariableList &variables);
|
||||||
virtual uint32_t FindGlobalVariables(const RegularExpression ®ex,
|
virtual void FindGlobalVariables(const RegularExpression ®ex,
|
||||||
uint32_t max_matches,
|
uint32_t max_matches,
|
||||||
VariableList &variables);
|
VariableList &variables);
|
||||||
virtual uint32_t FindFunctions(ConstString name,
|
virtual void FindFunctions(ConstString name,
|
||||||
const CompilerDeclContext *parent_decl_ctx,
|
const CompilerDeclContext *parent_decl_ctx,
|
||||||
lldb::FunctionNameType name_type_mask,
|
lldb::FunctionNameType name_type_mask,
|
||||||
bool include_inlines, bool append,
|
bool include_inlines, SymbolContextList &sc_list);
|
||||||
SymbolContextList &sc_list);
|
virtual void FindFunctions(const RegularExpression ®ex,
|
||||||
virtual uint32_t FindFunctions(const RegularExpression ®ex,
|
bool include_inlines, SymbolContextList &sc_list);
|
||||||
bool include_inlines, bool append,
|
virtual void
|
||||||
SymbolContextList &sc_list);
|
|
||||||
virtual uint32_t
|
|
||||||
FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
|
FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
|
||||||
bool append, uint32_t max_matches,
|
uint32_t max_matches,
|
||||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
||||||
TypeMap &types);
|
TypeMap &types);
|
||||||
virtual size_t FindTypes(const std::vector<CompilerContext> &context,
|
|
||||||
bool append, TypeMap &types);
|
/// Find types specified by a CompilerContextPattern.
|
||||||
|
/// \param languages Only return results in these languages.
|
||||||
|
virtual void FindTypes(llvm::ArrayRef<CompilerContext> pattern,
|
||||||
|
LanguageSet languages, TypeMap &types);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
GetMangledNamesForFunction(const std::string &scope_qualified_name,
|
GetMangledNamesForFunction(const std::string &scope_qualified_name,
|
||||||
std::vector<ConstString> &mangled_names);
|
std::vector<ConstString> &mangled_names);
|
||||||
// virtual uint32_t FindTypes (const SymbolContext& sc, const
|
|
||||||
// RegularExpression& regex, bool append, uint32_t max_matches, TypeList&
|
virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope,
|
||||||
// types) = 0;
|
lldb::TypeClass type_mask,
|
||||||
virtual TypeList *GetTypeList();
|
lldb_private::TypeList &type_list) = 0;
|
||||||
virtual size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
|
|
||||||
lldb::TypeClass type_mask,
|
|
||||||
lldb_private::TypeList &type_list) = 0;
|
|
||||||
|
|
||||||
virtual void PreloadSymbols();
|
virtual void PreloadSymbols();
|
||||||
|
|
||||||
virtual lldb_private::TypeSystem *
|
virtual llvm::Expected<lldb_private::TypeSystem &>
|
||||||
GetTypeSystemForLanguage(lldb::LanguageType language);
|
GetTypeSystemForLanguage(lldb::LanguageType language);
|
||||||
|
|
||||||
virtual CompilerDeclContext
|
virtual CompilerDeclContext
|
||||||
@ -210,8 +216,9 @@ class SymbolFile : public PluginInterface {
|
|||||||
return CompilerDeclContext();
|
return CompilerDeclContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectFile *GetObjectFile() { return m_obj_file; }
|
ObjectFile *GetObjectFile() { return m_objfile_sp.get(); }
|
||||||
const ObjectFile *GetObjectFile() const { return m_obj_file; }
|
const ObjectFile *GetObjectFile() const { return m_objfile_sp.get(); }
|
||||||
|
ObjectFile *GetMainObjectFile();
|
||||||
|
|
||||||
virtual std::vector<CallEdge> ParseCallEdgesInFunction(UserID func_id) {
|
virtual std::vector<CallEdge> ParseCallEdgesInFunction(UserID func_id) {
|
||||||
return {};
|
return {};
|
||||||
@ -221,7 +228,7 @@ class SymbolFile : public PluginInterface {
|
|||||||
|
|
||||||
/// Notify the SymbolFile that the file addresses in the Sections
|
/// Notify the SymbolFile that the file addresses in the Sections
|
||||||
/// for this module have been changed.
|
/// for this module have been changed.
|
||||||
virtual void SectionFileAddressesChanged() {}
|
virtual void SectionFileAddressesChanged();
|
||||||
|
|
||||||
struct RegisterInfoResolver {
|
struct RegisterInfoResolver {
|
||||||
virtual ~RegisterInfoResolver(); // anchor
|
virtual ~RegisterInfoResolver(); // anchor
|
||||||
@ -235,12 +242,30 @@ class SymbolFile : public PluginInterface {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Dump(Stream &s) {}
|
/// Return the number of stack bytes taken up by the parameters to this
|
||||||
|
/// function.
|
||||||
|
virtual llvm::Expected<lldb::addr_t> GetParameterStackSize(Symbol &symbol) {
|
||||||
|
return llvm::createStringError(make_error_code(llvm::errc::not_supported),
|
||||||
|
"Operation not supported.");
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Dump(Stream &s);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AssertModuleLock();
|
void AssertModuleLock();
|
||||||
|
virtual uint32_t CalculateNumCompileUnits() = 0;
|
||||||
|
virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t idx) = 0;
|
||||||
|
virtual TypeList &GetTypeList() { return m_type_list; }
|
||||||
|
|
||||||
ObjectFile *m_obj_file; // The object file that symbols can be extracted from.
|
void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp);
|
||||||
|
|
||||||
|
lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
|
||||||
|
// case it isn't the same as the module
|
||||||
|
// object file (debug symbols in a separate
|
||||||
|
// file)
|
||||||
|
llvm::Optional<std::vector<lldb::CompUnitSP>> m_compile_units;
|
||||||
|
TypeList m_type_list;
|
||||||
|
Symtab *m_symtab = nullptr;
|
||||||
uint32_t m_abilities;
|
uint32_t m_abilities;
|
||||||
bool m_calculated_abilities;
|
bool m_calculated_abilities;
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
#include "lldb/Core/ModuleChild.h"
|
#include "lldb/Core/ModuleChild.h"
|
||||||
#include "lldb/Core/PluginInterface.h"
|
#include "lldb/Core/PluginInterface.h"
|
||||||
#include "lldb/Symbol/SourceModule.h"
|
#include "lldb/Symbol/SourceModule.h"
|
||||||
#include "lldb/Symbol/TypeList.h"
|
|
||||||
#include "lldb/Symbol/TypeMap.h"
|
#include "lldb/Symbol/TypeMap.h"
|
||||||
#include "lldb/lldb-private.h"
|
#include "lldb/lldb-private.h"
|
||||||
#include "llvm/ADT/DenseSet.h"
|
#include "llvm/ADT/DenseSet.h"
|
||||||
@ -40,123 +39,16 @@ class SymbolVendor : public ModuleChild, public PluginInterface {
|
|||||||
|
|
||||||
void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
|
void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
|
||||||
|
|
||||||
virtual void Dump(Stream *s);
|
|
||||||
|
|
||||||
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit);
|
|
||||||
|
|
||||||
virtual size_t ParseFunctions(CompileUnit &comp_unit);
|
|
||||||
|
|
||||||
virtual bool ParseLineTable(CompileUnit &comp_unit);
|
|
||||||
|
|
||||||
virtual bool ParseDebugMacros(CompileUnit &comp_unit);
|
|
||||||
|
|
||||||
virtual bool ParseSupportFiles(CompileUnit &comp_unit,
|
|
||||||
FileSpecList &support_files);
|
|
||||||
|
|
||||||
virtual bool ParseIsOptimized(CompileUnit &comp_unit);
|
|
||||||
|
|
||||||
virtual size_t ParseTypes(CompileUnit &comp_unit);
|
|
||||||
|
|
||||||
virtual bool
|
|
||||||
ParseImportedModules(const SymbolContext &sc,
|
|
||||||
std::vector<SourceModule> &imported_modules);
|
|
||||||
|
|
||||||
virtual size_t ParseBlocksRecursive(Function &func);
|
|
||||||
|
|
||||||
virtual size_t ParseVariablesForContext(const SymbolContext &sc);
|
|
||||||
|
|
||||||
virtual Type *ResolveTypeUID(lldb::user_id_t type_uid);
|
|
||||||
|
|
||||||
virtual uint32_t ResolveSymbolContext(const Address &so_addr,
|
|
||||||
lldb::SymbolContextItem resolve_scope,
|
|
||||||
SymbolContext &sc);
|
|
||||||
|
|
||||||
virtual uint32_t ResolveSymbolContext(const FileSpec &file_spec,
|
|
||||||
uint32_t line, bool check_inlines,
|
|
||||||
lldb::SymbolContextItem resolve_scope,
|
|
||||||
SymbolContextList &sc_list);
|
|
||||||
|
|
||||||
virtual size_t FindGlobalVariables(ConstString name,
|
|
||||||
const CompilerDeclContext *parent_decl_ctx,
|
|
||||||
size_t max_matches,
|
|
||||||
VariableList &variables);
|
|
||||||
|
|
||||||
virtual size_t FindGlobalVariables(const RegularExpression ®ex,
|
|
||||||
size_t max_matches,
|
|
||||||
VariableList &variables);
|
|
||||||
|
|
||||||
virtual size_t FindFunctions(ConstString name,
|
|
||||||
const CompilerDeclContext *parent_decl_ctx,
|
|
||||||
lldb::FunctionNameType name_type_mask,
|
|
||||||
bool include_inlines, bool append,
|
|
||||||
SymbolContextList &sc_list);
|
|
||||||
|
|
||||||
virtual size_t FindFunctions(const RegularExpression ®ex,
|
|
||||||
bool include_inlines, bool append,
|
|
||||||
SymbolContextList &sc_list);
|
|
||||||
|
|
||||||
virtual size_t
|
|
||||||
FindTypes(ConstString name, const CompilerDeclContext *parent_decl_ctx,
|
|
||||||
bool append, size_t max_matches,
|
|
||||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
|
||||||
TypeMap &types);
|
|
||||||
|
|
||||||
virtual size_t FindTypes(const std::vector<CompilerContext> &context,
|
|
||||||
bool append, TypeMap &types);
|
|
||||||
|
|
||||||
virtual CompilerDeclContext
|
|
||||||
FindNamespace(ConstString name,
|
|
||||||
const CompilerDeclContext *parent_decl_ctx);
|
|
||||||
|
|
||||||
virtual size_t GetNumCompileUnits();
|
|
||||||
|
|
||||||
virtual bool SetCompileUnitAtIndex(size_t cu_idx,
|
|
||||||
const lldb::CompUnitSP &cu_sp);
|
|
||||||
|
|
||||||
virtual lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
|
|
||||||
|
|
||||||
TypeList &GetTypeList() { return m_type_list; }
|
|
||||||
|
|
||||||
const TypeList &GetTypeList() const { return m_type_list; }
|
|
||||||
|
|
||||||
virtual size_t GetTypes(SymbolContextScope *sc_scope,
|
|
||||||
lldb::TypeClass type_mask, TypeList &type_list);
|
|
||||||
|
|
||||||
SymbolFile *GetSymbolFile() { return m_sym_file_up.get(); }
|
SymbolFile *GetSymbolFile() { return m_sym_file_up.get(); }
|
||||||
|
|
||||||
FileSpec GetMainFileSpec() const;
|
|
||||||
|
|
||||||
// Get module unified section list symbol table.
|
|
||||||
virtual Symtab *GetSymtab();
|
|
||||||
|
|
||||||
// Clear module unified section list symbol table.
|
|
||||||
virtual void ClearSymtab();
|
|
||||||
|
|
||||||
/// Notify the SymbolVendor that the file addresses in the Sections
|
|
||||||
/// for this module have been changed.
|
|
||||||
virtual void SectionFileAddressesChanged();
|
|
||||||
|
|
||||||
// PluginInterface protocol
|
// PluginInterface protocol
|
||||||
ConstString GetPluginName() override;
|
ConstString GetPluginName() override;
|
||||||
|
|
||||||
uint32_t GetPluginVersion() override;
|
uint32_t GetPluginVersion() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Classes that inherit from SymbolVendor can see and modify these
|
|
||||||
typedef std::vector<lldb::CompUnitSP> CompileUnits;
|
|
||||||
typedef CompileUnits::iterator CompileUnitIter;
|
|
||||||
typedef CompileUnits::const_iterator CompileUnitConstIter;
|
|
||||||
|
|
||||||
TypeList m_type_list; // Uniqued types for all parsers owned by this module
|
|
||||||
CompileUnits m_compile_units; // The current compile units
|
|
||||||
lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
|
|
||||||
// case it isn't the same as the module
|
|
||||||
// object file (debug symbols in a separate
|
|
||||||
// file)
|
|
||||||
std::unique_ptr<SymbolFile> m_sym_file_up; // A single symbol file. Subclasses
|
std::unique_ptr<SymbolFile> m_sym_file_up; // A single symbol file. Subclasses
|
||||||
// can add more of these if needed.
|
// can add more of these if needed.
|
||||||
Symtab *m_symtab; // Save a symtab once to not pass it through `AddSymbols` of
|
|
||||||
// the symbol file each time when it is needed
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// For SymbolVendor only
|
// For SymbolVendor only
|
||||||
|
@ -92,15 +92,15 @@ class Symtab {
|
|||||||
const RegularExpression ®ex, lldb::SymbolType symbol_type,
|
const RegularExpression ®ex, lldb::SymbolType symbol_type,
|
||||||
Debug symbol_debug_type, Visibility symbol_visibility,
|
Debug symbol_debug_type, Visibility symbol_visibility,
|
||||||
std::vector<uint32_t> &indexes);
|
std::vector<uint32_t> &indexes);
|
||||||
size_t FindAllSymbolsWithNameAndType(ConstString name,
|
void FindAllSymbolsWithNameAndType(ConstString name,
|
||||||
lldb::SymbolType symbol_type,
|
lldb::SymbolType symbol_type,
|
||||||
std::vector<uint32_t> &symbol_indexes);
|
std::vector<uint32_t> &symbol_indexes);
|
||||||
size_t FindAllSymbolsWithNameAndType(ConstString name,
|
void FindAllSymbolsWithNameAndType(ConstString name,
|
||||||
lldb::SymbolType symbol_type,
|
lldb::SymbolType symbol_type,
|
||||||
Debug symbol_debug_type,
|
Debug symbol_debug_type,
|
||||||
Visibility symbol_visibility,
|
Visibility symbol_visibility,
|
||||||
std::vector<uint32_t> &symbol_indexes);
|
std::vector<uint32_t> &symbol_indexes);
|
||||||
size_t FindAllSymbolsMatchingRexExAndType(
|
void FindAllSymbolsMatchingRexExAndType(
|
||||||
const RegularExpression ®ex, lldb::SymbolType symbol_type,
|
const RegularExpression ®ex, lldb::SymbolType symbol_type,
|
||||||
Debug symbol_debug_type, Visibility symbol_visibility,
|
Debug symbol_debug_type, Visibility symbol_visibility,
|
||||||
std::vector<uint32_t> &symbol_indexes);
|
std::vector<uint32_t> &symbol_indexes);
|
||||||
@ -112,8 +112,8 @@ class Symtab {
|
|||||||
Symbol *FindSymbolContainingFileAddress(lldb::addr_t file_addr);
|
Symbol *FindSymbolContainingFileAddress(lldb::addr_t file_addr);
|
||||||
void ForEachSymbolContainingFileAddress(
|
void ForEachSymbolContainingFileAddress(
|
||||||
lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback);
|
lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback);
|
||||||
size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
|
void FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
|
||||||
SymbolContextList &sc_list);
|
SymbolContextList &sc_list);
|
||||||
void CalculateSymbolSizes();
|
void CalculateSymbolSizes();
|
||||||
|
|
||||||
void SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
|
void SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#ifndef liblldb_Type_h_
|
#ifndef liblldb_Type_h_
|
||||||
#define liblldb_Type_h_
|
#define liblldb_Type_h_
|
||||||
|
|
||||||
#include "lldb/Core/ClangForward.h"
|
|
||||||
#include "lldb/Symbol/CompilerDecl.h"
|
#include "lldb/Symbol/CompilerDecl.h"
|
||||||
#include "lldb/Symbol/CompilerType.h"
|
#include "lldb/Symbol/CompilerType.h"
|
||||||
#include "lldb/Symbol/Declaration.h"
|
#include "lldb/Symbol/Declaration.h"
|
||||||
@ -22,22 +21,28 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
namespace lldb_private {
|
namespace lldb_private {
|
||||||
// CompilerContext allows an array of these items to be passed to perform
|
|
||||||
// detailed lookups in SymbolVendor and SymbolFile functions.
|
/// CompilerContext allows an array of these items to be passed to perform
|
||||||
|
/// detailed lookups in SymbolVendor and SymbolFile functions.
|
||||||
struct CompilerContext {
|
struct CompilerContext {
|
||||||
CompilerContext(CompilerContextKind t, ConstString n)
|
CompilerContext(CompilerContextKind t, ConstString n) : kind(t), name(n) {}
|
||||||
: type(t), name(n) {}
|
|
||||||
|
|
||||||
bool operator==(const CompilerContext &rhs) const {
|
bool operator==(const CompilerContext &rhs) const {
|
||||||
return type == rhs.type && name == rhs.name;
|
return kind == rhs.kind && name == rhs.name;
|
||||||
}
|
}
|
||||||
|
bool operator!=(const CompilerContext &rhs) const { return !(*this == rhs); }
|
||||||
|
|
||||||
void Dump() const;
|
void Dump() const;
|
||||||
|
|
||||||
CompilerContextKind type;
|
CompilerContextKind kind;
|
||||||
ConstString name;
|
ConstString name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Match \p context_chain against \p pattern, which may contain "Any"
|
||||||
|
/// kinds. The \p context_chain should *not* contain any "Any" kinds.
|
||||||
|
bool contextMatches(llvm::ArrayRef<CompilerContext> context_chain,
|
||||||
|
llvm::ArrayRef<CompilerContext> pattern);
|
||||||
|
|
||||||
class SymbolFileType : public std::enable_shared_from_this<SymbolFileType>,
|
class SymbolFileType : public std::enable_shared_from_this<SymbolFileType>,
|
||||||
public UserID {
|
public UserID {
|
||||||
public:
|
public:
|
||||||
@ -117,8 +122,6 @@ class Type : public std::enable_shared_from_this<Type>, public UserID {
|
|||||||
SymbolFile *GetSymbolFile() { return m_symbol_file; }
|
SymbolFile *GetSymbolFile() { return m_symbol_file; }
|
||||||
const SymbolFile *GetSymbolFile() const { return m_symbol_file; }
|
const SymbolFile *GetSymbolFile() const { return m_symbol_file; }
|
||||||
|
|
||||||
TypeList *GetTypeList();
|
|
||||||
|
|
||||||
ConstString GetName();
|
ConstString GetName();
|
||||||
|
|
||||||
llvm::Optional<uint64_t> GetByteSize();
|
llvm::Optional<uint64_t> GetByteSize();
|
||||||
|
@ -28,15 +28,14 @@ class TypeList {
|
|||||||
|
|
||||||
void Dump(Stream *s, bool show_context);
|
void Dump(Stream *s, bool show_context);
|
||||||
|
|
||||||
// lldb::TypeSP
|
|
||||||
// FindType(lldb::user_id_t uid);
|
|
||||||
|
|
||||||
TypeList FindTypes(ConstString name);
|
TypeList FindTypes(ConstString name);
|
||||||
|
|
||||||
void Insert(const lldb::TypeSP &type);
|
void Insert(const lldb::TypeSP &type);
|
||||||
|
|
||||||
uint32_t GetSize() const;
|
uint32_t GetSize() const;
|
||||||
|
|
||||||
|
bool Empty() const { return !GetSize(); }
|
||||||
|
|
||||||
lldb::TypeSP GetTypeAtIndex(uint32_t idx);
|
lldb::TypeSP GetTypeAtIndex(uint32_t idx);
|
||||||
|
|
||||||
typedef std::vector<lldb::TypeSP> collection;
|
typedef std::vector<lldb::TypeSP> collection;
|
||||||
|
@ -14,8 +14,11 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "llvm/ADT/APFloat.h"
|
||||||
#include "llvm/ADT/APSInt.h"
|
#include "llvm/ADT/APSInt.h"
|
||||||
|
#include "llvm/ADT/SmallBitVector.h"
|
||||||
#include "llvm/Support/Casting.h"
|
#include "llvm/Support/Casting.h"
|
||||||
|
#include "llvm/Support/Error.h"
|
||||||
|
|
||||||
#include "lldb/Core/PluginInterface.h"
|
#include "lldb/Core/PluginInterface.h"
|
||||||
#include "lldb/Expression/Expression.h"
|
#include "lldb/Expression/Expression.h"
|
||||||
@ -29,7 +32,24 @@ class PDBASTParser;
|
|||||||
|
|
||||||
namespace lldb_private {
|
namespace lldb_private {
|
||||||
|
|
||||||
// Interface for representing the Type Systems in different languages.
|
/// A SmallBitVector that represents a set of source languages (\p
|
||||||
|
/// lldb::LanguageType). Each lldb::LanguageType is represented by
|
||||||
|
/// the bit with the position of its enumerator. The largest
|
||||||
|
/// LanguageType is < 64, so this is space-efficient and on 64-bit
|
||||||
|
/// architectures a LanguageSet can be completely stack-allocated.
|
||||||
|
struct LanguageSet {
|
||||||
|
llvm::SmallBitVector bitvector;
|
||||||
|
LanguageSet();
|
||||||
|
|
||||||
|
/// If the set contains a single language only, return it.
|
||||||
|
llvm::Optional<lldb::LanguageType> GetSingularLanguage();
|
||||||
|
void Insert(lldb::LanguageType language);
|
||||||
|
bool Empty() const;
|
||||||
|
size_t Size() const;
|
||||||
|
bool operator[](unsigned i) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Interface for representing the Type Systems in different languages.
|
||||||
class TypeSystem : public PluginInterface {
|
class TypeSystem : public PluginInterface {
|
||||||
public:
|
public:
|
||||||
// Intrusive type system that allows us to use llvm casting.
|
// Intrusive type system that allows us to use llvm casting.
|
||||||
@ -107,6 +127,8 @@ class TypeSystem : public PluginInterface {
|
|||||||
virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
|
virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
|
||||||
size_t arg_idx);
|
size_t arg_idx);
|
||||||
|
|
||||||
|
virtual CompilerType GetTypeForDecl(void *opaque_decl) = 0;
|
||||||
|
|
||||||
// CompilerDeclContext functions
|
// CompilerDeclContext functions
|
||||||
|
|
||||||
virtual std::vector<CompilerDecl>
|
virtual std::vector<CompilerDecl>
|
||||||
@ -255,6 +277,8 @@ class TypeSystem : public PluginInterface {
|
|||||||
|
|
||||||
// Exploring the type
|
// Exploring the type
|
||||||
|
|
||||||
|
virtual const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) = 0;
|
||||||
|
|
||||||
virtual llvm::Optional<uint64_t>
|
virtual llvm::Optional<uint64_t>
|
||||||
GetBitSize(lldb::opaque_compiler_type_t type,
|
GetBitSize(lldb::opaque_compiler_type_t type,
|
||||||
ExecutionContextScope *exe_scope) = 0;
|
ExecutionContextScope *exe_scope) = 0;
|
||||||
@ -375,12 +399,6 @@ class TypeSystem : public PluginInterface {
|
|||||||
lldb::offset_t data_offset,
|
lldb::offset_t data_offset,
|
||||||
size_t data_byte_size) = 0;
|
size_t data_byte_size) = 0;
|
||||||
|
|
||||||
// Converts "s" to a floating point value and place resulting floating point
|
|
||||||
// bytes in the "dst" buffer.
|
|
||||||
virtual size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
|
|
||||||
const char *s, uint8_t *dst,
|
|
||||||
size_t dst_size) = 0;
|
|
||||||
|
|
||||||
// TODO: Determine if these methods should move to ClangASTContext.
|
// TODO: Determine if these methods should move to ClangASTContext.
|
||||||
|
|
||||||
virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
|
virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
|
||||||
@ -391,7 +409,9 @@ class TypeSystem : public PluginInterface {
|
|||||||
virtual bool IsCStringType(lldb::opaque_compiler_type_t type,
|
virtual bool IsCStringType(lldb::opaque_compiler_type_t type,
|
||||||
uint32_t &length) = 0;
|
uint32_t &length) = 0;
|
||||||
|
|
||||||
virtual size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) = 0;
|
virtual llvm::Optional<size_t>
|
||||||
|
GetTypeBitAlign(lldb::opaque_compiler_type_t type,
|
||||||
|
ExecutionContextScope *exe_scope) = 0;
|
||||||
|
|
||||||
virtual CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) = 0;
|
virtual CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) = 0;
|
||||||
|
|
||||||
@ -491,18 +511,15 @@ class TypeSystemMap {
|
|||||||
// callback to keep iterating, false to stop iterating.
|
// callback to keep iterating, false to stop iterating.
|
||||||
void ForEach(std::function<bool(TypeSystem *)> const &callback);
|
void ForEach(std::function<bool(TypeSystem *)> const &callback);
|
||||||
|
|
||||||
TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
|
llvm::Expected<TypeSystem &>
|
||||||
Module *module, bool can_create);
|
GetTypeSystemForLanguage(lldb::LanguageType language, Module *module,
|
||||||
|
bool can_create);
|
||||||
|
|
||||||
TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
|
llvm::Expected<TypeSystem &>
|
||||||
Target *target, bool can_create);
|
GetTypeSystemForLanguage(lldb::LanguageType language, Target *target,
|
||||||
|
bool can_create);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// This function does not take the map mutex, and should only be called from
|
|
||||||
// functions that do take the mutex.
|
|
||||||
void AddToMap(lldb::LanguageType language,
|
|
||||||
lldb::TypeSystemSP const &type_system_sp);
|
|
||||||
|
|
||||||
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> collection;
|
typedef std::map<lldb::LanguageType, lldb::TypeSystemSP> collection;
|
||||||
mutable std::mutex m_mutex; ///< A mutex to keep this object happy in
|
mutable std::mutex m_mutex; ///< A mutex to keep this object happy in
|
||||||
///multi-threaded environments.
|
///multi-threaded environments.
|
||||||
|
@ -201,7 +201,8 @@ class UnwindPlan {
|
|||||||
unspecified, // not specified
|
unspecified, // not specified
|
||||||
isRegisterPlusOffset, // FA = register + offset
|
isRegisterPlusOffset, // FA = register + offset
|
||||||
isRegisterDereferenced, // FA = [reg]
|
isRegisterDereferenced, // FA = [reg]
|
||||||
isDWARFExpression // FA = eval(dwarf_expr)
|
isDWARFExpression, // FA = eval(dwarf_expr)
|
||||||
|
isRaSearch, // FA = SP + offset + ???
|
||||||
};
|
};
|
||||||
|
|
||||||
FAValue() : m_type(unspecified), m_value() {}
|
FAValue() : m_type(unspecified), m_value() {}
|
||||||
@ -214,6 +215,11 @@ class UnwindPlan {
|
|||||||
|
|
||||||
bool IsUnspecified() const { return m_type == unspecified; }
|
bool IsUnspecified() const { return m_type == unspecified; }
|
||||||
|
|
||||||
|
void SetRaSearch(int32_t offset) {
|
||||||
|
m_type = isRaSearch;
|
||||||
|
m_value.ra_search_offset = offset;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsRegisterPlusOffset() const {
|
bool IsRegisterPlusOffset() const {
|
||||||
return m_type == isRegisterPlusOffset;
|
return m_type == isRegisterPlusOffset;
|
||||||
}
|
}
|
||||||
@ -250,9 +256,14 @@ class UnwindPlan {
|
|||||||
ValueType GetValueType() const { return m_type; }
|
ValueType GetValueType() const { return m_type; }
|
||||||
|
|
||||||
int32_t GetOffset() const {
|
int32_t GetOffset() const {
|
||||||
if (m_type == isRegisterPlusOffset)
|
switch (m_type) {
|
||||||
return m_value.reg.offset;
|
case isRegisterPlusOffset:
|
||||||
return 0;
|
return m_value.reg.offset;
|
||||||
|
case isRaSearch:
|
||||||
|
return m_value.ra_search_offset;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IncOffset(int32_t delta) {
|
void IncOffset(int32_t delta) {
|
||||||
@ -304,6 +315,8 @@ class UnwindPlan {
|
|||||||
const uint8_t *opcodes;
|
const uint8_t *opcodes;
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
} expr;
|
} expr;
|
||||||
|
// For m_type == isRaSearch
|
||||||
|
int32_t ra_search_offset;
|
||||||
} m_value;
|
} m_value;
|
||||||
}; // class FAValue
|
}; // class FAValue
|
||||||
|
|
||||||
@ -370,6 +383,7 @@ class UnwindPlan {
|
|||||||
m_return_addr_register(LLDB_INVALID_REGNUM), m_source_name(),
|
m_return_addr_register(LLDB_INVALID_REGNUM), m_source_name(),
|
||||||
m_plan_is_sourced_from_compiler(eLazyBoolCalculate),
|
m_plan_is_sourced_from_compiler(eLazyBoolCalculate),
|
||||||
m_plan_is_valid_at_all_instruction_locations(eLazyBoolCalculate),
|
m_plan_is_valid_at_all_instruction_locations(eLazyBoolCalculate),
|
||||||
|
m_plan_is_for_signal_trap(eLazyBoolCalculate),
|
||||||
m_lsda_address(), m_personality_func_addr() {}
|
m_lsda_address(), m_personality_func_addr() {}
|
||||||
|
|
||||||
// Performs a deep copy of the plan, including all the rows (expensive).
|
// Performs a deep copy of the plan, including all the rows (expensive).
|
||||||
@ -463,6 +477,17 @@ class UnwindPlan {
|
|||||||
m_plan_is_valid_at_all_instruction_locations = valid_at_all_insn;
|
m_plan_is_valid_at_all_instruction_locations = valid_at_all_insn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Is this UnwindPlan for a signal trap frame? If so, then its saved pc
|
||||||
|
// may have been set manually by the signal dispatch code and therefore
|
||||||
|
// not follow a call to the child frame.
|
||||||
|
lldb_private::LazyBool GetUnwindPlanForSignalTrap() const {
|
||||||
|
return m_plan_is_for_signal_trap;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetUnwindPlanForSignalTrap(lldb_private::LazyBool is_for_signal_trap) {
|
||||||
|
m_plan_is_for_signal_trap = is_for_signal_trap;
|
||||||
|
}
|
||||||
|
|
||||||
int GetRowCount() const;
|
int GetRowCount() const;
|
||||||
|
|
||||||
void Clear() {
|
void Clear() {
|
||||||
@ -472,6 +497,7 @@ class UnwindPlan {
|
|||||||
m_source_name.Clear();
|
m_source_name.Clear();
|
||||||
m_plan_is_sourced_from_compiler = eLazyBoolCalculate;
|
m_plan_is_sourced_from_compiler = eLazyBoolCalculate;
|
||||||
m_plan_is_valid_at_all_instruction_locations = eLazyBoolCalculate;
|
m_plan_is_valid_at_all_instruction_locations = eLazyBoolCalculate;
|
||||||
|
m_plan_is_for_signal_trap = eLazyBoolCalculate;
|
||||||
m_lsda_address.Clear();
|
m_lsda_address.Clear();
|
||||||
m_personality_func_addr.Clear();
|
m_personality_func_addr.Clear();
|
||||||
}
|
}
|
||||||
@ -502,6 +528,7 @@ class UnwindPlan {
|
|||||||
m_source_name; // for logging, where this UnwindPlan originated from
|
m_source_name; // for logging, where this UnwindPlan originated from
|
||||||
lldb_private::LazyBool m_plan_is_sourced_from_compiler;
|
lldb_private::LazyBool m_plan_is_sourced_from_compiler;
|
||||||
lldb_private::LazyBool m_plan_is_valid_at_all_instruction_locations;
|
lldb_private::LazyBool m_plan_is_valid_at_all_instruction_locations;
|
||||||
|
lldb_private::LazyBool m_plan_is_for_signal_trap;
|
||||||
|
|
||||||
Address m_lsda_address; // Where the language specific data area exists in the
|
Address m_lsda_address; // Where the language specific data area exists in the
|
||||||
// module - used
|
// module - used
|
||||||
|
@ -27,6 +27,8 @@ class UnwindTable {
|
|||||||
|
|
||||||
~UnwindTable();
|
~UnwindTable();
|
||||||
|
|
||||||
|
lldb_private::CallFrameInfo *GetObjectFileUnwindInfo();
|
||||||
|
|
||||||
lldb_private::DWARFCallFrameInfo *GetEHFrameInfo();
|
lldb_private::DWARFCallFrameInfo *GetEHFrameInfo();
|
||||||
lldb_private::DWARFCallFrameInfo *GetDebugFrameInfo();
|
lldb_private::DWARFCallFrameInfo *GetDebugFrameInfo();
|
||||||
|
|
||||||
@ -71,6 +73,7 @@ class UnwindTable {
|
|||||||
bool m_initialized; // delay some initialization until ObjectFile is set up
|
bool m_initialized; // delay some initialization until ObjectFile is set up
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
|
|
||||||
|
std::unique_ptr<CallFrameInfo> m_object_file_unwind_up;
|
||||||
std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up;
|
std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up;
|
||||||
std::unique_ptr<DWARFCallFrameInfo> m_debug_frame_up;
|
std::unique_ptr<DWARFCallFrameInfo> m_debug_frame_up;
|
||||||
std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up;
|
std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up;
|
||||||
|
@ -26,15 +26,14 @@ class Variable : public UserID, public std::enable_shared_from_this<Variable> {
|
|||||||
public:
|
public:
|
||||||
typedef RangeVector<lldb::addr_t, lldb::addr_t> RangeList;
|
typedef RangeVector<lldb::addr_t, lldb::addr_t> RangeList;
|
||||||
|
|
||||||
// Constructors and Destructors
|
/// Constructors and Destructors.
|
||||||
Variable(lldb::user_id_t uid, const char *name,
|
///
|
||||||
const char
|
/// \param mangled The mangled or fully qualified name of the variable.
|
||||||
*mangled, // The mangled or fully qualified name of the variable.
|
Variable(lldb::user_id_t uid, const char *name, const char *mangled,
|
||||||
const lldb::SymbolFileTypeSP &symfile_type_sp,
|
const lldb::SymbolFileTypeSP &symfile_type_sp, lldb::ValueType scope,
|
||||||
lldb::ValueType scope, SymbolContextScope *owner_scope,
|
SymbolContextScope *owner_scope, const RangeList &scope_range,
|
||||||
const RangeList &scope_range, Declaration *decl,
|
Declaration *decl, const DWARFExpression &location, bool external,
|
||||||
const DWARFExpression &location, bool external, bool artificial,
|
bool artificial, bool static_member = false);
|
||||||
bool static_member = false);
|
|
||||||
|
|
||||||
virtual ~Variable();
|
virtual ~Variable();
|
||||||
|
|
||||||
@ -50,11 +49,11 @@ class Variable : public UserID, public std::enable_shared_from_this<Variable> {
|
|||||||
|
|
||||||
SymbolContextScope *GetSymbolContextScope() const { return m_owner_scope; }
|
SymbolContextScope *GetSymbolContextScope() const { return m_owner_scope; }
|
||||||
|
|
||||||
// Since a variable can have a basename "i" and also a mangled named
|
/// Since a variable can have a basename "i" and also a mangled named
|
||||||
// "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
|
/// "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
|
||||||
// namespace)::i", this function will allow a generic match function that can
|
/// namespace)::i", this function will allow a generic match function that can
|
||||||
// be called by commands and expression parsers to make sure we match
|
/// be called by commands and expression parsers to make sure we match
|
||||||
// anything we come across.
|
/// anything we come across.
|
||||||
bool NameMatches(ConstString name) const;
|
bool NameMatches(ConstString name) const;
|
||||||
|
|
||||||
bool NameMatches(const RegularExpression ®ex) const;
|
bool NameMatches(const RegularExpression ®ex) const;
|
||||||
@ -99,34 +98,42 @@ class Variable : public UserID, public std::enable_shared_from_this<Variable> {
|
|||||||
GetVariableCallback callback, void *baton, VariableList &variable_list,
|
GetVariableCallback callback, void *baton, VariableList &variable_list,
|
||||||
ValueObjectList &valobj_list);
|
ValueObjectList &valobj_list);
|
||||||
|
|
||||||
static size_t AutoComplete(const ExecutionContext &exe_ctx,
|
static void AutoComplete(const ExecutionContext &exe_ctx,
|
||||||
CompletionRequest &request);
|
CompletionRequest &request);
|
||||||
|
|
||||||
CompilerDeclContext GetDeclContext();
|
CompilerDeclContext GetDeclContext();
|
||||||
|
|
||||||
CompilerDecl GetDecl();
|
CompilerDecl GetDecl();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ConstString m_name; // The basename of the variable (no namespaces)
|
/// The basename of the variable (no namespaces).
|
||||||
Mangled m_mangled; // The mangled name of the variable
|
ConstString m_name;
|
||||||
lldb::SymbolFileTypeSP m_symfile_type_sp; // The type pointer of the variable
|
/// The mangled name of the variable.
|
||||||
// (int, struct, class, etc)
|
Mangled m_mangled;
|
||||||
lldb::ValueType m_scope; // global, parameter, local
|
/// The type pointer of the variable (int, struct, class, etc)
|
||||||
SymbolContextScope
|
/// global, parameter, local.
|
||||||
*m_owner_scope; // The symbol file scope that this variable was defined in
|
lldb::SymbolFileTypeSP m_symfile_type_sp;
|
||||||
RangeList m_scope_range; // The list of ranges inside the owner's scope where
|
lldb::ValueType m_scope;
|
||||||
// this variable is valid
|
/// The symbol file scope that this variable was defined in
|
||||||
Declaration m_declaration; // Declaration location for this item.
|
SymbolContextScope *m_owner_scope;
|
||||||
DWARFExpression m_location; // The location of this variable that can be fed
|
/// The list of ranges inside the owner's scope where this variable
|
||||||
// to DWARFExpression::Evaluate()
|
/// is valid.
|
||||||
uint8_t m_external : 1, // Visible outside the containing compile unit?
|
RangeList m_scope_range;
|
||||||
m_artificial : 1, // Non-zero if the variable is not explicitly declared
|
/// Declaration location for this item.
|
||||||
// in source
|
Declaration m_declaration;
|
||||||
m_loc_is_const_data : 1, // The m_location expression contains the
|
/// The location of this variable that can be fed to
|
||||||
// constant variable value data, not a DWARF
|
/// DWARFExpression::Evaluate().
|
||||||
// location
|
DWARFExpression m_location;
|
||||||
m_static_member : 1; // Non-zero if variable is static member of a class
|
/// Visible outside the containing compile unit?
|
||||||
// or struct.
|
unsigned m_external : 1;
|
||||||
|
/// Non-zero if the variable is not explicitly declared in source.
|
||||||
|
unsigned m_artificial : 1;
|
||||||
|
/// The m_location expression contains the constant variable value
|
||||||
|
/// data, not a DWARF location.
|
||||||
|
unsigned m_loc_is_const_data : 1;
|
||||||
|
/// Non-zero if variable is static member of a class or struct.
|
||||||
|
unsigned m_static_member : 1;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Variable(const Variable &rhs) = delete;
|
Variable(const Variable &rhs) = delete;
|
||||||
Variable &operator=(const Variable &rhs) = delete;
|
Variable &operator=(const Variable &rhs) = delete;
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
//===-- VerifyDecl.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_VariableList_h_
|
|
||||||
#define lldb_VariableList_h_
|
|
||||||
|
|
||||||
#include "lldb/Core/ClangForward.h"
|
|
||||||
|
|
||||||
namespace lldb_private {
|
|
||||||
void VerifyDecl(clang::Decl *decl);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -15,8 +15,8 @@
|
|||||||
#include "lldb/lldb-private.h"
|
#include "lldb/lldb-private.h"
|
||||||
|
|
||||||
#include "llvm/ADT/ArrayRef.h"
|
#include "llvm/ADT/ArrayRef.h"
|
||||||
|
#include "llvm/MC/MCRegisterInfo.h"
|
||||||
|
|
||||||
// forward define the llvm::Type class
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
class Type;
|
class Type;
|
||||||
}
|
}
|
||||||
@ -124,6 +124,8 @@ class ABI : public PluginInterface {
|
|||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
llvm::MCRegisterInfo &GetMCRegisterInfo() { return *m_mc_register_info_up; }
|
||||||
|
|
||||||
virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0;
|
virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0;
|
||||||
|
|
||||||
bool GetRegisterInfoByName(ConstString name, RegisterInfo &info);
|
bool GetRegisterInfoByName(ConstString name, RegisterInfo &info);
|
||||||
@ -136,13 +138,19 @@ class ABI : public PluginInterface {
|
|||||||
static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch);
|
static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Classes that inherit from ABI can see and modify these
|
ABI(lldb::ProcessSP process_sp, std::unique_ptr<llvm::MCRegisterInfo> info_up)
|
||||||
ABI(lldb::ProcessSP process_sp) {
|
: m_process_wp(process_sp), m_mc_register_info_up(std::move(info_up)) {
|
||||||
if (process_sp.get())
|
assert(m_mc_register_info_up && "ABI must have MCRegisterInfo");
|
||||||
m_process_wp = process_sp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Utility function to construct a MCRegisterInfo using the ArchSpec triple.
|
||||||
|
/// Plugins wishing to customize the construction can construct the
|
||||||
|
/// MCRegisterInfo themselves.
|
||||||
|
static std::unique_ptr<llvm::MCRegisterInfo>
|
||||||
|
MakeMCRegisterInfo(const ArchSpec &arch);
|
||||||
|
|
||||||
lldb::ProcessWP m_process_wp;
|
lldb::ProcessWP m_process_wp;
|
||||||
|
std::unique_ptr<llvm::MCRegisterInfo> m_mc_register_info_up;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISALLOW_COPY_AND_ASSIGN(ABI);
|
DISALLOW_COPY_AND_ASSIGN(ABI);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user