Vendor import of stripped lldb trunk r375505, the last commit before the
upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/lldb/trunk@375505
This commit is contained in:
parent
fdb00c4408
commit
ead246455a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/lldb/dist/; revision=353952 svn path=/vendor/lldb/lldb-r375505/; revision=353953; tag=vendor/lldb/lldb-trunk-r375505
@ -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
|
||||
be especially helpful for users coming from gdb.
|
||||
.Sh BUGS
|
||||
To report bugs, please visit http://llvm.org/bugs/
|
||||
To report bugs, please visit https://bugs.llvm.org/
|
||||
.Sh AUTHOR
|
||||
Maintained by the LLDB Team, http://lldb.llvm.org/
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "lldb/API/SBAttachInfo.h"
|
||||
#include "lldb/API/SBBlock.h"
|
||||
#include "lldb/API/SBBreakpoint.h"
|
||||
#include "lldb/API/SBBreakpointName.h"
|
||||
#include "lldb/API/SBBreakpointLocation.h"
|
||||
#include "lldb/API/SBBreakpointName.h"
|
||||
#include "lldb/API/SBBroadcaster.h"
|
||||
#include "lldb/API/SBCommandInterpreter.h"
|
||||
#include "lldb/API/SBCommandReturnObject.h"
|
||||
@ -28,6 +28,7 @@
|
||||
#include "lldb/API/SBEvent.h"
|
||||
#include "lldb/API/SBExecutionContext.h"
|
||||
#include "lldb/API/SBExpressionOptions.h"
|
||||
#include "lldb/API/SBFile.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
#include "lldb/API/SBFileSpecList.h"
|
||||
#include "lldb/API/SBFrame.h"
|
||||
|
@ -15,23 +15,27 @@
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb_private {
|
||||
class SBCommandReturnObjectImpl;
|
||||
}
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class LLDB_API SBCommandReturnObject {
|
||||
public:
|
||||
SBCommandReturnObject();
|
||||
|
||||
SBCommandReturnObject(lldb_private::CommandReturnObject &ref);
|
||||
|
||||
// rvalue ctor+assignment are incompatible with Reproducers.
|
||||
|
||||
SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs);
|
||||
|
||||
~SBCommandReturnObject();
|
||||
|
||||
const lldb::SBCommandReturnObject &
|
||||
lldb::SBCommandReturnObject &
|
||||
operator=(const lldb::SBCommandReturnObject &rhs);
|
||||
|
||||
SBCommandReturnObject(lldb_private::CommandReturnObject *ptr);
|
||||
|
||||
lldb_private::CommandReturnObject *Release();
|
||||
|
||||
explicit operator bool() const;
|
||||
|
||||
bool IsValid() const;
|
||||
@ -40,13 +44,21 @@ class LLDB_API SBCommandReturnObject {
|
||||
|
||||
const char *GetError();
|
||||
|
||||
size_t PutOutput(FILE *fh);
|
||||
size_t PutOutput(FILE *fh); // DEPRECATED
|
||||
|
||||
size_t PutOutput(SBFile file);
|
||||
|
||||
size_t PutOutput(FileSP file);
|
||||
|
||||
size_t GetOutputSize();
|
||||
|
||||
size_t GetErrorSize();
|
||||
|
||||
size_t PutError(FILE *fh);
|
||||
size_t PutError(FILE *fh); // DEPRECATED
|
||||
|
||||
size_t PutError(SBFile file);
|
||||
|
||||
size_t PutError(FileSP file);
|
||||
|
||||
void Clear();
|
||||
|
||||
@ -64,14 +76,21 @@ class LLDB_API SBCommandReturnObject {
|
||||
|
||||
bool GetDescription(lldb::SBStream &description);
|
||||
|
||||
// deprecated, these two functions do not take ownership of file handle
|
||||
void SetImmediateOutputFile(FILE *fh);
|
||||
void SetImmediateOutputFile(FILE *fh); // DEPRECATED
|
||||
|
||||
void SetImmediateErrorFile(FILE *fh);
|
||||
void SetImmediateErrorFile(FILE *fh); // DEPRECATED
|
||||
|
||||
void SetImmediateOutputFile(FILE *fh, bool transfer_ownership);
|
||||
void SetImmediateOutputFile(FILE *fh, bool transfer_ownership); // DEPRECATED
|
||||
|
||||
void SetImmediateErrorFile(FILE *fh, bool transfer_ownership);
|
||||
void SetImmediateErrorFile(FILE *fh, bool transfer_ownership); // DEPRECATED
|
||||
|
||||
void SetImmediateOutputFile(SBFile file);
|
||||
|
||||
void SetImmediateErrorFile(SBFile file);
|
||||
|
||||
void SetImmediateOutputFile(FileSP file);
|
||||
|
||||
void SetImmediateErrorFile(FileSP file);
|
||||
|
||||
void PutCString(const char *string, int len = -1);
|
||||
|
||||
@ -86,6 +105,9 @@ class LLDB_API SBCommandReturnObject {
|
||||
|
||||
void SetError(const char *error_cstr);
|
||||
|
||||
// ref() is internal for LLDB only.
|
||||
lldb_private::CommandReturnObject &ref() const;
|
||||
|
||||
protected:
|
||||
friend class SBCommandInterpreter;
|
||||
friend class SBOptions;
|
||||
@ -96,12 +118,8 @@ class LLDB_API SBCommandReturnObject {
|
||||
|
||||
lldb_private::CommandReturnObject &operator*() const;
|
||||
|
||||
lldb_private::CommandReturnObject &ref() const;
|
||||
|
||||
void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr);
|
||||
|
||||
private:
|
||||
std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_up;
|
||||
std::unique_ptr<lldb_private::SBCommandReturnObjectImpl> m_opaque_up;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
@ -88,6 +88,24 @@ class LLDB_API SBDebugger {
|
||||
|
||||
FILE *GetErrorFileHandle();
|
||||
|
||||
SBError SetInputFile(SBFile file);
|
||||
|
||||
SBError SetOutputFile(SBFile file);
|
||||
|
||||
SBError SetErrorFile(SBFile file);
|
||||
|
||||
SBError SetInputFile(FileSP file);
|
||||
|
||||
SBError SetOutputFile(FileSP file);
|
||||
|
||||
SBError SetErrorFile(FileSP file);
|
||||
|
||||
SBFile GetInputFile();
|
||||
|
||||
SBFile GetOutputFile();
|
||||
|
||||
SBFile GetErrorFile();
|
||||
|
||||
void SaveInputTerminalState();
|
||||
|
||||
void RestoreInputTerminalState();
|
||||
@ -99,7 +117,14 @@ class LLDB_API SBDebugger {
|
||||
lldb::SBListener GetListener();
|
||||
|
||||
void HandleProcessEvent(const lldb::SBProcess &process,
|
||||
const lldb::SBEvent &event, FILE *out, FILE *err);
|
||||
const lldb::SBEvent &event, FILE *out,
|
||||
FILE *err); // DEPRECATED
|
||||
|
||||
void HandleProcessEvent(const lldb::SBProcess &process,
|
||||
const lldb::SBEvent &event, SBFile out, SBFile err);
|
||||
|
||||
void HandleProcessEvent(const lldb::SBProcess &process,
|
||||
const lldb::SBEvent &event, FileSP out, FileSP err);
|
||||
|
||||
lldb::SBTarget CreateTarget(const char *filename, const char *target_triple,
|
||||
const char *platform_name,
|
||||
|
@ -41,6 +41,7 @@ class LLDB_API SBEvent;
|
||||
class LLDB_API SBEventList;
|
||||
class LLDB_API SBExecutionContext;
|
||||
class LLDB_API SBExpressionOptions;
|
||||
class LLDB_API SBFile;
|
||||
class LLDB_API SBFileSpec;
|
||||
class LLDB_API SBFileSpecList;
|
||||
class LLDB_API SBFrame;
|
||||
|
@ -70,6 +70,7 @@ class LLDB_API SBError {
|
||||
friend class SBTrace;
|
||||
friend class SBValue;
|
||||
friend class SBWatchpoint;
|
||||
friend class SBFile;
|
||||
|
||||
lldb_private::Status *get();
|
||||
|
||||
|
47
include/lldb/API/SBFile.h
Normal file
47
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(SBFile out);
|
||||
|
||||
void Print(FileSP out);
|
||||
|
||||
bool GetDescription(lldb::SBStream &description);
|
||||
|
||||
bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options);
|
||||
|
@ -46,6 +46,10 @@ class LLDB_API SBInstructionList {
|
||||
|
||||
void Print(FILE *out);
|
||||
|
||||
void Print(SBFile out);
|
||||
|
||||
void Print(FileSP out);
|
||||
|
||||
bool GetDescription(lldb::SBStream &description);
|
||||
|
||||
bool DumpEmulationForAllInstructions(const char *triple);
|
||||
@ -56,6 +60,8 @@ class LLDB_API SBInstructionList {
|
||||
friend class SBTarget;
|
||||
|
||||
void SetDisassembler(const lldb::DisassemblerSP &opaque_sp);
|
||||
bool GetDescription(lldb_private::Stream &description);
|
||||
|
||||
|
||||
private:
|
||||
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, SBFile file) const;
|
||||
|
||||
void ReportEventState(const lldb::SBEvent &event, FileSP file) const;
|
||||
|
||||
void AppendEventStateReport(const lldb::SBEvent &event,
|
||||
lldb::SBCommandReturnObject &result);
|
||||
|
||||
|
@ -39,6 +39,10 @@ class LLDB_API SBStream {
|
||||
|
||||
void RedirectToFile(const char *path, bool append);
|
||||
|
||||
void RedirectToFile(lldb::SBFile file);
|
||||
|
||||
void RedirectToFile(lldb::FileSP file);
|
||||
|
||||
void RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership);
|
||||
|
||||
void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership);
|
||||
|
@ -91,6 +91,8 @@ class SBStructuredData {
|
||||
friend class SBTraceOptions;
|
||||
friend class SBDebugger;
|
||||
friend class SBTarget;
|
||||
friend class SBThread;
|
||||
friend class SBThreadPlan;
|
||||
|
||||
StructuredDataImplUP m_impl_up;
|
||||
};
|
||||
|
@ -122,6 +122,10 @@ class LLDB_API SBThread {
|
||||
SBError StepUsingScriptedThreadPlan(const char *script_class_name,
|
||||
bool resume_immediately);
|
||||
|
||||
SBError StepUsingScriptedThreadPlan(const char *script_class_name,
|
||||
lldb::SBStructuredData &args_data,
|
||||
bool resume_immediately);
|
||||
|
||||
SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line);
|
||||
|
||||
void RunToAddress(lldb::addr_t addr);
|
||||
|
@ -28,6 +28,9 @@ class LLDB_API SBThreadPlan {
|
||||
|
||||
SBThreadPlan(lldb::SBThread &thread, const char *class_name);
|
||||
|
||||
SBThreadPlan(lldb::SBThread &thread, const char *class_name,
|
||||
lldb::SBStructuredData &args_data);
|
||||
|
||||
~SBThreadPlan();
|
||||
|
||||
explicit operator bool() const;
|
||||
@ -100,6 +103,9 @@ class LLDB_API SBThreadPlan {
|
||||
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name);
|
||||
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
|
||||
SBError &error);
|
||||
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
|
||||
lldb::SBStructuredData &args_data,
|
||||
SBError &error);
|
||||
|
||||
private:
|
||||
friend class SBBreakpoint;
|
||||
|
@ -67,7 +67,7 @@ class BreakpointLocation
|
||||
|
||||
// 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);
|
||||
|
||||
/// Check the Enable/Disable state.
|
||||
|
@ -107,6 +107,12 @@ friend class Breakpoint;
|
||||
/// \param[in] ignore
|
||||
/// 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,
|
||||
int32_t ignore = 0, bool one_shot = false,
|
||||
bool auto_continue = false);
|
||||
@ -319,7 +325,10 @@ friend class Breakpoint;
|
||||
|
||||
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;
|
||||
|
||||
/// This is the default empty callback.
|
||||
@ -367,22 +376,32 @@ friend class Breakpoint;
|
||||
void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up);
|
||||
|
||||
private:
|
||||
// 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
|
||||
/// For BreakpointOptions only
|
||||
|
||||
/// 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_callback_is_synchronous;
|
||||
bool m_enabled;
|
||||
/// If set, the breakpoint delete itself after being hit once.
|
||||
bool m_one_shot;
|
||||
uint32_t m_ignore_count; // Number of times to ignore this breakpoint
|
||||
std::unique_ptr<ThreadSpec>
|
||||
m_thread_spec_up; // Thread for which this breakpoint will take
|
||||
std::string m_condition_text; // The condition to test.
|
||||
size_t m_condition_text_hash; // Its hash, so that locations know when the
|
||||
// condition is updated.
|
||||
bool m_auto_continue; // If set, auto-continue from breakpoint.
|
||||
Flags m_set_flags; // Which options are set at this level. Drawn
|
||||
// from BreakpointOptions::SetOptionsFlags.
|
||||
/// Number of times to ignore this breakpoint.
|
||||
uint32_t m_ignore_count;
|
||||
/// Thread for which this breakpoint will stop.
|
||||
std::unique_ptr<ThreadSpec> m_thread_spec_up;
|
||||
/// The condition to test.
|
||||
std::string m_condition_text;
|
||||
/// Its hash, so that locations know when the condition is updated.
|
||||
size_t m_condition_text_hash;
|
||||
/// 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
|
||||
|
@ -41,8 +41,8 @@ class BreakpointResolverAddress : public BreakpointResolver {
|
||||
ModuleList &modules) override;
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
SymbolContext &context,
|
||||
Address *addr) override;
|
||||
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
|
@ -35,8 +35,8 @@ class BreakpointResolverFileLine : public BreakpointResolver {
|
||||
~BreakpointResolverFileLine() override;
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
SymbolContext &context,
|
||||
Address *addr) override;
|
||||
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace lldb_private {
|
||||
class BreakpointResolverFileRegex : public BreakpointResolver {
|
||||
public:
|
||||
BreakpointResolverFileRegex(
|
||||
Breakpoint *bkpt, RegularExpression ®ex,
|
||||
Breakpoint *bkpt, RegularExpression regex,
|
||||
const std::unordered_set<std::string> &func_name_set, bool exact_match);
|
||||
|
||||
static BreakpointResolver *
|
||||
@ -37,8 +37,8 @@ class BreakpointResolverFileRegex : public BreakpointResolver {
|
||||
~BreakpointResolverFileRegex() override;
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
SymbolContext &context,
|
||||
Address *addr) override;
|
||||
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
|
@ -44,7 +44,7 @@ class BreakpointResolverName : public BreakpointResolver {
|
||||
|
||||
// Creates a function breakpoint by regular expression. Takes over control
|
||||
// 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,
|
||||
bool skip_prologue);
|
||||
|
||||
@ -58,8 +58,8 @@ class BreakpointResolverName : public BreakpointResolver {
|
||||
~BreakpointResolverName() override;
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
SymbolContext &context,
|
||||
Address *addr) override;
|
||||
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
|
@ -26,8 +26,7 @@ class BreakpointResolverScripted : public BreakpointResolver {
|
||||
BreakpointResolverScripted(Breakpoint *bkpt,
|
||||
const llvm::StringRef class_name,
|
||||
lldb::SearchDepth depth,
|
||||
StructuredDataImpl *args_data,
|
||||
ScriptInterpreter &script_interp);
|
||||
StructuredDataImpl *args_data);
|
||||
|
||||
~BreakpointResolverScripted() override;
|
||||
|
||||
@ -39,8 +38,8 @@ class BreakpointResolverScripted : public BreakpointResolver {
|
||||
StructuredData::ObjectSP SerializeToStructuredData() override;
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
SymbolContext &context,
|
||||
Address *addr) override;
|
||||
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
|
@ -338,6 +338,23 @@ class Address {
|
||||
bool ResolveAddressUsingFileSections(lldb::addr_t addr,
|
||||
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.
|
||||
///
|
||||
/// The address will attempt to find a loaded section within \a target that
|
||||
|
@ -34,8 +34,8 @@ class AddressResolverFileLine : public AddressResolver {
|
||||
~AddressResolverFileLine() override;
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
SymbolContext &context,
|
||||
Address *addr) override;
|
||||
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
|
@ -31,7 +31,7 @@ class AddressResolverName : public AddressResolver {
|
||||
|
||||
// Creates a function breakpoint by regular expression. Takes over control
|
||||
// of the lifespan of func_regex.
|
||||
AddressResolverName(RegularExpression &func_regex);
|
||||
AddressResolverName(RegularExpression func_regex);
|
||||
|
||||
AddressResolverName(const char *class_name, const char *method,
|
||||
AddressResolver::MatchType type);
|
||||
@ -39,8 +39,8 @@ class AddressResolverName : public AddressResolver {
|
||||
~AddressResolverName() override;
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
SymbolContext &context,
|
||||
Address *addr) override;
|
||||
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "lldb/Core/FormatEntity.h"
|
||||
#include "lldb/Core/IOHandler.h"
|
||||
#include "lldb/Core/SourceManager.h"
|
||||
#include "lldb/Core/StreamFile.h"
|
||||
#include "lldb/Core/UserSettingsController.h"
|
||||
#include "lldb/Host/HostThread.h"
|
||||
#include "lldb/Host/Terminal.h"
|
||||
@ -113,20 +114,29 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
||||
|
||||
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();
|
||||
|
||||
void SetInputFileHandle(FILE *fh, bool tranfer_ownership,
|
||||
repro::DataRecorder *recorder = nullptr);
|
||||
void SetInputFile(lldb::FileSP file, 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();
|
||||
|
||||
@ -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
|
||||
// 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 &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
|
||||
// target with entities that will be copied over to new targets.
|
||||
Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
|
||||
Target *GetDummyTarget();
|
||||
Target *GetDummyTarget() { return m_dummy_target_sp.get(); }
|
||||
|
||||
lldb::BroadcasterManagerSP GetBroadcasterManager() {
|
||||
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);
|
||||
|
||||
size_t GetProcessSTDOUT(Process *process, Stream *stream);
|
||||
|
||||
size_t GetProcessSTDERR(Process *process, Stream *stream);
|
||||
// Ensures two threads don't attempt to flush process output in parallel.
|
||||
std::mutex m_output_flush_mutex;
|
||||
void FlushProcessOutput(Process &process, bool flush_stdout,
|
||||
bool flush_stderr);
|
||||
|
||||
SourceManager::SourceFileCache &GetSourceFileCache() {
|
||||
return m_source_file_cache;
|
||||
@ -355,9 +366,10 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
||||
|
||||
void InstanceInitialize();
|
||||
|
||||
lldb::StreamFileSP m_input_file_sp;
|
||||
lldb::StreamFileSP m_output_file_sp;
|
||||
lldb::StreamFileSP m_error_file_sp;
|
||||
// these should never be NULL
|
||||
lldb::FileSP m_input_file_sp;
|
||||
lldb::StreamFileSP m_output_stream_sp;
|
||||
lldb::StreamFileSP m_error_stream_sp;
|
||||
|
||||
/// Used for shadowing the input file when capturing a reproducer.
|
||||
repro::DataRecorder *m_input_recorder;
|
||||
@ -399,6 +411,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
||||
Broadcaster m_sync_broadcaster;
|
||||
lldb::ListenerSP m_forward_listener_sp;
|
||||
llvm::once_flag m_clear_once;
|
||||
lldb::TargetSP m_dummy_target_sp;
|
||||
|
||||
// Events for m_sync_broadcaster
|
||||
enum {
|
||||
|
@ -37,8 +37,8 @@ class FileLineResolver : public Searcher {
|
||||
~FileLineResolver() override;
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
SymbolContext &context,
|
||||
Address *addr) override;
|
||||
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
|
@ -25,6 +25,9 @@ class Stream;
|
||||
/// A class that contains a mutable list of FileSpec objects.
|
||||
class FileSpecList {
|
||||
public:
|
||||
typedef std::vector<FileSpec> collection;
|
||||
typedef collection::const_iterator const_iterator;
|
||||
|
||||
/// Default constructor.
|
||||
///
|
||||
/// Initialize this object with an empty file list.
|
||||
@ -76,6 +79,15 @@ class FileSpecList {
|
||||
/// \b true if the file was appended, \b false otherwise.
|
||||
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.
|
||||
void Clear();
|
||||
|
||||
@ -182,9 +194,10 @@ class FileSpecList {
|
||||
static size_t GetFilesMatchingPartialPath(const char *path, bool dir_okay,
|
||||
FileSpecList &matches);
|
||||
|
||||
const_iterator begin() const { return m_files.begin(); }
|
||||
const_iterator end() const { return m_files.end(); }
|
||||
|
||||
protected:
|
||||
typedef std::vector<FileSpec>
|
||||
collection; ///< The collection type for the file list.
|
||||
collection m_files; ///< A collection of FileSpec objects.
|
||||
};
|
||||
|
||||
|
@ -199,7 +199,7 @@ class FormatEntity {
|
||||
llvm::StringRef &variable_name,
|
||||
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.
|
||||
//
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define liblldb_IOHandler_h_
|
||||
|
||||
#include "lldb/Core/ValueObjectList.h"
|
||||
#include "lldb/Utility/CompletionRequest.h"
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/Flags.h"
|
||||
#include "lldb/Utility/Predicate.h"
|
||||
@ -57,8 +58,7 @@ class IOHandler {
|
||||
IOHandler(Debugger &debugger, IOHandler::Type type);
|
||||
|
||||
IOHandler(Debugger &debugger, IOHandler::Type type,
|
||||
const lldb::StreamFileSP &input_sp,
|
||||
const lldb::StreamFileSP &output_sp,
|
||||
const lldb::FileSP &input_sp, const lldb::StreamFileSP &output_sp,
|
||||
const lldb::StreamFileSP &error_sp, uint32_t flags,
|
||||
repro::DataRecorder *data_recorder);
|
||||
|
||||
@ -122,11 +122,11 @@ class IOHandler {
|
||||
|
||||
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; }
|
||||
|
||||
@ -164,7 +164,7 @@ class IOHandler {
|
||||
|
||||
protected:
|
||||
Debugger &m_debugger;
|
||||
lldb::StreamFileSP m_input_sp;
|
||||
lldb::FileSP m_input_sp;
|
||||
lldb::StreamFileSP m_output_sp;
|
||||
lldb::StreamFileSP m_error_sp;
|
||||
repro::DataRecorder *m_data_recorder;
|
||||
@ -198,10 +198,8 @@ class IOHandlerDelegate {
|
||||
|
||||
virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
|
||||
|
||||
virtual int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
|
||||
const char *cursor, const char *last_char,
|
||||
int skip_first_n_matches, int max_matches,
|
||||
StringList &matches, StringList &descriptions);
|
||||
virtual void IOHandlerComplete(IOHandler &io_handler,
|
||||
CompletionRequest &request);
|
||||
|
||||
virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
|
||||
|
||||
@ -334,7 +332,7 @@ class IOHandlerEditline : public IOHandler {
|
||||
repro::DataRecorder *data_recorder);
|
||||
|
||||
IOHandlerEditline(Debugger &debugger, IOHandler::Type type,
|
||||
const lldb::StreamFileSP &input_sp,
|
||||
const lldb::FileSP &input_sp,
|
||||
const lldb::StreamFileSP &output_sp,
|
||||
const lldb::StreamFileSP &error_sp, uint32_t flags,
|
||||
const char *editline_name, // Used for saving history files
|
||||
@ -350,7 +348,7 @@ class IOHandlerEditline : public IOHandler {
|
||||
const char *, bool, bool, uint32_t,
|
||||
IOHandlerDelegate &) = delete;
|
||||
|
||||
IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::StreamFileSP &,
|
||||
IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::FileSP &,
|
||||
const lldb::StreamFileSP &, const lldb::StreamFileSP &,
|
||||
uint32_t, const char *, const char *, const char *, bool,
|
||||
bool, uint32_t, IOHandlerDelegate &) = delete;
|
||||
@ -415,11 +413,7 @@ class IOHandlerEditline : public IOHandler {
|
||||
static int FixIndentationCallback(Editline *editline, const StringList &lines,
|
||||
int cursor_position, void *baton);
|
||||
|
||||
static int AutoCompleteCallback(const char *current_line, const char *cursor,
|
||||
const char *last_char,
|
||||
int skip_first_n_matches, int max_matches,
|
||||
StringList &matches, StringList &descriptions,
|
||||
void *baton);
|
||||
static void AutoCompleteCallback(CompletionRequest &request, void *baton);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@ -437,6 +431,7 @@ class IOHandlerEditline : public IOHandler {
|
||||
bool m_interrupt_exits;
|
||||
bool m_editing; // Set to true when fetching a line manually (not using
|
||||
// libedit)
|
||||
std::string m_line_buffer;
|
||||
};
|
||||
|
||||
// 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; }
|
||||
|
||||
int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
|
||||
const char *cursor, const char *last_char,
|
||||
int skip_first_n_matches, int max_matches,
|
||||
StringList &matches, StringList &descriptions) override;
|
||||
void IOHandlerComplete(IOHandler &io_handler,
|
||||
CompletionRequest &request) override;
|
||||
|
||||
void IOHandlerInputComplete(IOHandler &io_handler,
|
||||
std::string &data) override;
|
||||
|
@ -84,9 +84,6 @@ class LoadedModuleInfoList {
|
||||
}
|
||||
|
||||
bool operator==(LoadedModuleInfo const &rhs) const {
|
||||
if (e_num != rhs.e_num)
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < e_num; ++i) {
|
||||
if (m_has[i] != rhs.m_has[i])
|
||||
return false;
|
||||
|
@ -49,21 +49,7 @@ class Mangled {
|
||||
/// Default constructor.
|
||||
///
|
||||
/// Initialize with both mangled and demangled names empty.
|
||||
Mangled();
|
||||
|
||||
/// 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);
|
||||
Mangled() = default;
|
||||
|
||||
/// Construct with name.
|
||||
///
|
||||
@ -76,12 +62,6 @@ class Mangled {
|
||||
|
||||
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.
|
||||
///
|
||||
/// This allows code to check a Mangled object to see if it contains a valid
|
||||
|
@ -49,7 +49,6 @@ class Symbol;
|
||||
class SymbolContext;
|
||||
class SymbolContextList;
|
||||
class SymbolFile;
|
||||
class SymbolVendor;
|
||||
class Symtab;
|
||||
class Target;
|
||||
class TypeList;
|
||||
@ -67,8 +66,8 @@ class VariableList;
|
||||
/// accessors are called. For example the object file (ObjectFile)
|
||||
/// representation will only be parsed if the object file is requested using
|
||||
/// the Module::GetObjectFile() is called. The debug symbols will only be
|
||||
/// parsed if the symbol vendor (SymbolVendor) is requested using the
|
||||
/// Module::GetSymbolVendor() is called.
|
||||
/// parsed if the symbol file (SymbolFile) is requested using the
|
||||
/// Module::GetSymbolFile() method.
|
||||
///
|
||||
/// The module will parse more detailed information as more queries are made.
|
||||
class Module : public std::enable_shared_from_this<Module>,
|
||||
@ -247,13 +246,13 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
ConstString name,
|
||||
lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
|
||||
|
||||
size_t FindSymbolsWithNameAndType(ConstString name,
|
||||
lldb::SymbolType symbol_type,
|
||||
SymbolContextList &sc_list);
|
||||
void FindSymbolsWithNameAndType(ConstString name,
|
||||
lldb::SymbolType symbol_type,
|
||||
SymbolContextList &sc_list);
|
||||
|
||||
size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
|
||||
lldb::SymbolType symbol_type,
|
||||
SymbolContextList &sc_list);
|
||||
void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
|
||||
lldb::SymbolType symbol_type,
|
||||
SymbolContextList &sc_list);
|
||||
|
||||
/// 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
|
||||
/// A list to append any matching symbol contexts to.
|
||||
///
|
||||
/// \return
|
||||
/// 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);
|
||||
void FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
|
||||
SymbolContextList &sc_list);
|
||||
|
||||
/// Find compile units by partial or full path.
|
||||
///
|
||||
@ -281,19 +277,10 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// \param[in] path
|
||||
/// 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
|
||||
/// A symbol context list that gets filled in with all of the
|
||||
/// matches.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a sc_list.
|
||||
size_t FindCompileUnits(const FileSpec &path, bool append,
|
||||
SymbolContextList &sc_list);
|
||||
void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list);
|
||||
|
||||
/// 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.
|
||||
/// 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
|
||||
/// A symbol context list that gets filled in with all of the
|
||||
/// matches.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a sc_list.
|
||||
size_t FindFunctions(ConstString name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
lldb::FunctionNameType name_type_mask, bool symbols_ok,
|
||||
bool inlines_ok, bool append,
|
||||
SymbolContextList &sc_list);
|
||||
void FindFunctions(ConstString name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
lldb::FunctionNameType name_type_mask, bool symbols_ok,
|
||||
bool inlines_ok, SymbolContextList &sc_list);
|
||||
|
||||
/// Find functions by name.
|
||||
///
|
||||
@ -345,12 +324,8 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// \param[out] sc_list
|
||||
/// A symbol context list that gets filled in with all of the
|
||||
/// matches.
|
||||
///
|
||||
/// \return
|
||||
/// 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);
|
||||
void FindFunctions(const RegularExpression ®ex, bool symbols_ok,
|
||||
bool inlines_ok, SymbolContextList &sc_list);
|
||||
|
||||
/// Find addresses by file/line
|
||||
///
|
||||
@ -395,11 +370,9 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// \param[in] variable_list
|
||||
/// A list of variables that gets the matches appended to.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a variable_list.
|
||||
size_t FindGlobalVariables(ConstString name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
size_t max_matches, VariableList &variable_list);
|
||||
void FindGlobalVariables(ConstString name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
size_t max_matches, VariableList &variable_list);
|
||||
|
||||
/// 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
|
||||
/// A list of variables that gets the matches appended to.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a variable_list.
|
||||
size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
|
||||
VariableList &variable_list);
|
||||
void FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
|
||||
VariableList &variable_list);
|
||||
|
||||
/// Find types by name.
|
||||
///
|
||||
/// Type lookups in modules go through the SymbolVendor (which will use one
|
||||
/// or more SymbolFile subclasses). The SymbolFile needs to be able to
|
||||
/// lookup types by basename and not the fully qualified typename. This
|
||||
/// allows the type accelerator tables to stay small, even with heavily
|
||||
/// Type lookups in modules go through the SymbolFile. The SymbolFile needs to
|
||||
/// be able to lookup types by basename and not the fully qualified typename.
|
||||
/// This allows the type accelerator tables to stay small, even with heavily
|
||||
/// templatized C++. The type search will then narrow down the search
|
||||
/// 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
|
||||
@ -449,13 +419,19 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// \param[out] type_list
|
||||
/// A type list gets populated with any matches.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a type_list.
|
||||
size_t
|
||||
void
|
||||
FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
|
||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
||||
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,
|
||||
ConstString type_name, bool exact_match);
|
||||
|
||||
@ -473,11 +449,9 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// \param[out] type_list
|
||||
/// A type list gets populated with any matches.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a type_list.
|
||||
size_t FindTypesInNamespace(ConstString type_name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
size_t max_matches, TypeList &type_list);
|
||||
void FindTypesInNamespace(ConstString type_name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
size_t max_matches, TypeList &type_list);
|
||||
|
||||
/// 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,
|
||||
lldb::addr_t header_addr, Status &error,
|
||||
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
|
||||
/// A valid type list pointer, or nullptr if there is no valid
|
||||
/// symbol vendor for this module.
|
||||
TypeList *GetTypeList();
|
||||
/// If the symbol file has already been loaded, this function returns it. All
|
||||
/// arguments are ignored. If the symbol file has not been located yet, and
|
||||
/// the can_create argument is false, the function returns nullptr. If
|
||||
/// 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.
|
||||
///
|
||||
@ -819,7 +785,8 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
|
||||
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
|
||||
// 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.
|
||||
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.
|
||||
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(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"
|
||||
/// A class that encapsulates name lookup information.
|
||||
///
|
||||
/// Users can type a wide variety of partial names when setting breakpoints
|
||||
/// by name or when looking for functions by name. SymbolVendor and
|
||||
/// SymbolFile objects are only required to implement name lookup for
|
||||
/// function basenames and for fully mangled names. This means if the user
|
||||
/// types in a partial name, we must reduce this to a name lookup that will
|
||||
/// work with all SymbolFile objects. So we might reduce a name lookup to
|
||||
/// look for a basename, and then prune out any results that don't match.
|
||||
/// by name or when looking for functions by name. The SymbolFile object is
|
||||
/// only required to implement name lookup for function basenames and for
|
||||
/// fully mangled names. This means if the user types in a partial name, we
|
||||
/// must reduce this to a name lookup that will work with all SymbolFile
|
||||
/// objects. So we might reduce a name lookup to look for a basename, and then
|
||||
/// prune out any results that don't match.
|
||||
///
|
||||
/// 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
|
||||
@ -1012,7 +982,7 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// ObjectFile instances for the debug info
|
||||
|
||||
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};
|
||||
mutable bool m_file_has_changed : 1,
|
||||
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:
|
||||
Module(); // Only used internally by CreateJITModule ()
|
||||
|
||||
size_t FindTypes_Impl(
|
||||
void FindTypes_Impl(
|
||||
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,
|
||||
TypeMap &types);
|
||||
|
||||
|
@ -247,35 +247,24 @@ class ModuleList {
|
||||
/// \param[in] path
|
||||
/// 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
|
||||
/// A symbol context list that gets filled in with all of the
|
||||
/// matches.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a sc_list.
|
||||
size_t FindCompileUnits(const FileSpec &path, bool append,
|
||||
SymbolContextList &sc_list) const;
|
||||
void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list) const;
|
||||
|
||||
/// \see Module::FindFunctions ()
|
||||
size_t FindFunctions(ConstString name,
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
bool include_symbols, bool include_inlines, bool append,
|
||||
SymbolContextList &sc_list) const;
|
||||
void FindFunctions(ConstString name, lldb::FunctionNameType name_type_mask,
|
||||
bool include_symbols, bool include_inlines,
|
||||
SymbolContextList &sc_list) const;
|
||||
|
||||
/// \see Module::FindFunctionSymbols ()
|
||||
size_t FindFunctionSymbols(ConstString name,
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
SymbolContextList &sc_list);
|
||||
void FindFunctionSymbols(ConstString name,
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
SymbolContextList &sc_list);
|
||||
|
||||
/// \see Module::FindFunctions ()
|
||||
size_t FindFunctions(const RegularExpression &name, bool include_symbols,
|
||||
bool include_inlines, bool append,
|
||||
SymbolContextList &sc_list);
|
||||
void FindFunctions(const RegularExpression &name, bool include_symbols,
|
||||
bool include_inlines, SymbolContextList &sc_list);
|
||||
|
||||
/// Find global and static variables by name.
|
||||
///
|
||||
@ -289,11 +278,8 @@ class ModuleList {
|
||||
///
|
||||
/// \param[in] variable_list
|
||||
/// A list of variables that gets the matches appended to.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a variable_list.
|
||||
size_t FindGlobalVariables(ConstString name, size_t max_matches,
|
||||
VariableList &variable_list) const;
|
||||
void FindGlobalVariables(ConstString name, size_t max_matches,
|
||||
VariableList &variable_list) const;
|
||||
|
||||
/// Find global and static variables by regular expression.
|
||||
///
|
||||
@ -306,11 +292,8 @@ class ModuleList {
|
||||
///
|
||||
/// \param[in] variable_list
|
||||
/// A list of variables that gets the matches appended to.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a variable_list.
|
||||
size_t FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
|
||||
VariableList &variable_list) const;
|
||||
void FindGlobalVariables(const RegularExpression ®ex, size_t max_matches,
|
||||
VariableList &variable_list) const;
|
||||
|
||||
/// Finds the first module whose file specification matches \a file_spec.
|
||||
///
|
||||
@ -337,11 +320,8 @@ class ModuleList {
|
||||
/// \param[out] matching_module_list
|
||||
/// A module list that gets filled in with any modules that
|
||||
/// match the search criteria.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matching modules found by the search.
|
||||
size_t FindModules(const ModuleSpec &module_spec,
|
||||
ModuleList &matching_module_list) const;
|
||||
void FindModules(const ModuleSpec &module_spec,
|
||||
ModuleList &matching_module_list) const;
|
||||
|
||||
lldb::ModuleSP FindModule(const Module *module_ptr) const;
|
||||
|
||||
@ -354,15 +334,13 @@ class ModuleList {
|
||||
|
||||
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const;
|
||||
|
||||
size_t FindSymbolsWithNameAndType(ConstString name,
|
||||
lldb::SymbolType symbol_type,
|
||||
SymbolContextList &sc_list,
|
||||
bool append = false) const;
|
||||
void FindSymbolsWithNameAndType(ConstString name,
|
||||
lldb::SymbolType symbol_type,
|
||||
SymbolContextList &sc_list) const;
|
||||
|
||||
size_t FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
|
||||
lldb::SymbolType symbol_type,
|
||||
SymbolContextList &sc_list,
|
||||
bool append = false) const;
|
||||
void FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
|
||||
lldb::SymbolType symbol_type,
|
||||
SymbolContextList &sc_list) const;
|
||||
|
||||
/// Find types by name.
|
||||
///
|
||||
@ -393,12 +371,10 @@ class ModuleList {
|
||||
/// \param[out] type_list
|
||||
/// A type list gets populated with any matches.
|
||||
///
|
||||
/// \return
|
||||
/// The number of matches added to \a type_list.
|
||||
size_t FindTypes(Module *search_first, ConstString name,
|
||||
bool name_is_fully_qualified, size_t max_matches,
|
||||
llvm::DenseSet<SymbolFile *> &searched_symbol_files,
|
||||
TypeList &types) const;
|
||||
void FindTypes(Module *search_first, ConstString name,
|
||||
bool name_is_fully_qualified, size_t max_matches,
|
||||
llvm::DenseSet<SymbolFile *> &searched_symbol_files,
|
||||
TypeList &types) const;
|
||||
|
||||
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
|
||||
|
||||
@ -476,6 +452,7 @@ class ModuleList {
|
||||
/// \return
|
||||
/// The number of modules in the module list.
|
||||
size_t GetSize() const;
|
||||
bool IsEmpty() const { return !GetSize(); }
|
||||
|
||||
bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors,
|
||||
Stream *feedback_stream = nullptr,
|
||||
@ -494,8 +471,8 @@ class ModuleList {
|
||||
|
||||
static bool RemoveSharedModule(lldb::ModuleSP &module_sp);
|
||||
|
||||
static size_t FindSharedModules(const ModuleSpec &module_spec,
|
||||
ModuleList &matching_module_list);
|
||||
static void FindSharedModules(const ModuleSpec &module_spec,
|
||||
ModuleList &matching_module_list);
|
||||
|
||||
static size_t RemoveOrphanSharedModules(bool mandatory);
|
||||
|
||||
|
@ -380,8 +380,8 @@ class ModuleSpecList {
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t FindMatchingModuleSpecs(const ModuleSpec &module_spec,
|
||||
ModuleSpecList &matching_list) const {
|
||||
void FindMatchingModuleSpecs(const ModuleSpec &module_spec,
|
||||
ModuleSpecList &matching_list) const {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
bool exact_arch_match = true;
|
||||
const size_t initial_match_count = matching_list.GetSize();
|
||||
@ -400,7 +400,6 @@ class ModuleSpecList {
|
||||
matching_list.Append(spec);
|
||||
}
|
||||
}
|
||||
return matching_list.GetSize() - initial_match_count;
|
||||
}
|
||||
|
||||
void Dump(Stream &strm) {
|
||||
|
@ -10,6 +10,8 @@
|
||||
#define liblldb_PluginManager_h_
|
||||
|
||||
#include "lldb/Core/Architecture.h"
|
||||
#include "lldb/Symbol/TypeSystem.h"
|
||||
#include "lldb/Utility/CompletionRequest.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
@ -228,8 +230,8 @@ class PluginManager {
|
||||
|
||||
static const char *GetPlatformPluginDescriptionAtIndex(uint32_t idx);
|
||||
|
||||
static size_t AutoCompletePlatformName(llvm::StringRef partial_name,
|
||||
StringList &matches);
|
||||
static void AutoCompletePlatformName(llvm::StringRef partial_name,
|
||||
CompletionRequest &request);
|
||||
// Process
|
||||
static bool
|
||||
RegisterPlugin(ConstString name, const char *description,
|
||||
@ -383,10 +385,10 @@ class PluginManager {
|
||||
GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
|
||||
|
||||
// TypeSystem
|
||||
static bool RegisterPlugin(
|
||||
ConstString name, const char *description,
|
||||
TypeSystemCreateInstance create_callback,
|
||||
TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
|
||||
static bool RegisterPlugin(ConstString name, const char *description,
|
||||
TypeSystemCreateInstance create_callback,
|
||||
LanguageSet supported_languages_for_types,
|
||||
LanguageSet supported_languages_for_expressions);
|
||||
|
||||
static bool UnregisterPlugin(TypeSystemCreateInstance create_callback);
|
||||
|
||||
@ -396,18 +398,14 @@ class PluginManager {
|
||||
static TypeSystemCreateInstance
|
||||
GetTypeSystemCreateCallbackForPluginName(ConstString name);
|
||||
|
||||
static TypeSystemEnumerateSupportedLanguages
|
||||
GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
|
||||
static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes();
|
||||
|
||||
static TypeSystemEnumerateSupportedLanguages
|
||||
GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
|
||||
ConstString name);
|
||||
static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions();
|
||||
|
||||
// REPL
|
||||
static bool
|
||||
RegisterPlugin(ConstString name, const char *description,
|
||||
REPLCreateInstance create_callback,
|
||||
REPLEnumerateSupportedLanguages enumerate_languages_callback);
|
||||
static bool RegisterPlugin(ConstString name, const char *description,
|
||||
REPLCreateInstance create_callback,
|
||||
LanguageSet supported_languages);
|
||||
|
||||
static bool UnregisterPlugin(REPLCreateInstance create_callback);
|
||||
|
||||
@ -416,12 +414,7 @@ class PluginManager {
|
||||
static REPLCreateInstance
|
||||
GetREPLCreateCallbackForPluginName(ConstString name);
|
||||
|
||||
static REPLEnumerateSupportedLanguages
|
||||
GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
|
||||
|
||||
static REPLEnumerateSupportedLanguages
|
||||
GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName(
|
||||
ConstString name);
|
||||
static LanguageSet GetREPLAllTypeSystemSupportedLanguages();
|
||||
|
||||
// Some plug-ins might register a DebuggerInitializeCallback callback when
|
||||
// registering the plug-in. After a new Debugger instance is created, this
|
||||
@ -439,32 +432,28 @@ class PluginManager {
|
||||
ConstString description, bool is_global_property);
|
||||
|
||||
static lldb::OptionValuePropertiesSP
|
||||
GetSettingForPlatformPlugin(Debugger &debugger,
|
||||
ConstString setting_name);
|
||||
GetSettingForPlatformPlugin(Debugger &debugger, ConstString setting_name);
|
||||
|
||||
static bool CreateSettingForPlatformPlugin(
|
||||
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
||||
ConstString description, bool is_global_property);
|
||||
|
||||
static lldb::OptionValuePropertiesSP
|
||||
GetSettingForProcessPlugin(Debugger &debugger,
|
||||
ConstString setting_name);
|
||||
GetSettingForProcessPlugin(Debugger &debugger, ConstString setting_name);
|
||||
|
||||
static bool CreateSettingForProcessPlugin(
|
||||
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
||||
ConstString description, bool is_global_property);
|
||||
|
||||
static lldb::OptionValuePropertiesSP
|
||||
GetSettingForSymbolFilePlugin(Debugger &debugger,
|
||||
ConstString setting_name);
|
||||
GetSettingForSymbolFilePlugin(Debugger &debugger, ConstString setting_name);
|
||||
|
||||
static bool CreateSettingForSymbolFilePlugin(
|
||||
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
||||
ConstString description, bool is_global_property);
|
||||
|
||||
static lldb::OptionValuePropertiesSP
|
||||
GetSettingForJITLoaderPlugin(Debugger &debugger,
|
||||
ConstString setting_name);
|
||||
GetSettingForJITLoaderPlugin(Debugger &debugger, ConstString setting_name);
|
||||
|
||||
static bool CreateSettingForJITLoaderPlugin(
|
||||
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
|
||||
|
49
include/lldb/Core/PropertiesBase.td
Normal file
49
include/lldb/Core/PropertiesBase.td
Normal file
@ -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 CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool complete) = 0;
|
||||
SymbolContext &context,
|
||||
Address *addr) = 0;
|
||||
|
||||
virtual lldb::SearchDepth GetDepth() = 0;
|
||||
|
||||
|
@ -43,9 +43,8 @@ class SectionList {
|
||||
const_iterator begin() { return m_sections.begin(); }
|
||||
const_iterator end() { return m_sections.end(); }
|
||||
|
||||
SectionList();
|
||||
|
||||
~SectionList();
|
||||
/// Create an empty list.
|
||||
SectionList() = default;
|
||||
|
||||
SectionList &operator=(const SectionList &rhs);
|
||||
|
||||
|
@ -30,23 +30,27 @@ class StreamFile : public Stream {
|
||||
|
||||
StreamFile(const char *path);
|
||||
|
||||
StreamFile(const char *path, uint32_t options,
|
||||
StreamFile(const char *path, File::OpenOptions options,
|
||||
uint32_t permissions = lldb::eFilePermissionsFileDefault);
|
||||
|
||||
StreamFile(FILE *fh, bool transfer_ownership);
|
||||
|
||||
StreamFile(std::shared_ptr<File> file) : m_file_sp(file) { assert(file); };
|
||||
|
||||
~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;
|
||||
|
||||
|
||||
protected:
|
||||
// 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;
|
||||
|
||||
private:
|
||||
|
@ -54,7 +54,8 @@ class StructuredDataImpl {
|
||||
return error;
|
||||
}
|
||||
|
||||
m_data_sp->Dump(stream);
|
||||
llvm::json::OStream s(stream.AsRawOstream());
|
||||
m_data_sp->Serialize(s);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,6 @@ class Value {
|
||||
uint64_t GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx);
|
||||
|
||||
Status GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
|
||||
uint32_t data_offset,
|
||||
Module *module); // Can be nullptr
|
||||
|
||||
static const char *GetValueTypeAsCString(ValueType context_type);
|
||||
|
@ -22,7 +22,7 @@ typedef uint32_t dw_uleb128_t;
|
||||
typedef int32_t dw_sleb128_t;
|
||||
typedef uint16_t dw_attr_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
|
||||
// any addresses in the compile units that get
|
||||
// parsed
|
||||
|
@ -47,7 +47,7 @@ static inline ConstString GetValidTypeName_Impl(ConstString type) {
|
||||
return type;
|
||||
|
||||
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("enum ");
|
||||
@ -65,9 +65,9 @@ template <typename KeyType, typename ValueType> class FormattersContainer;
|
||||
template <typename KeyType, typename ValueType> class FormatMap {
|
||||
public:
|
||||
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 std::function<bool(KeyType, const ValueSP &)> ForEachCallback;
|
||||
typedef std::function<bool(const KeyType &, const ValueSP &)> ForEachCallback;
|
||||
|
||||
FormatMap(IFormatChangeListener *lst)
|
||||
: m_map(), m_map_mutex(), listener(lst) {}
|
||||
@ -79,20 +79,22 @@ template <typename KeyType, typename ValueType> class FormatMap {
|
||||
entry->GetRevision() = 0;
|
||||
|
||||
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)
|
||||
listener->Changed();
|
||||
}
|
||||
|
||||
bool Delete(KeyType name) {
|
||||
bool Delete(const KeyType &name) {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.find(name);
|
||||
if (iter == m_map.end())
|
||||
return false;
|
||||
m_map.erase(name);
|
||||
if (listener)
|
||||
listener->Changed();
|
||||
return true;
|
||||
for (MapIterator iter = m_map.begin(); iter != m_map.end(); ++iter)
|
||||
if (iter->first == name) {
|
||||
m_map.erase(iter);
|
||||
if (listener)
|
||||
listener->Changed();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
@ -102,22 +104,22 @@ template <typename KeyType, typename ValueType> class FormatMap {
|
||||
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);
|
||||
MapIterator iter = m_map.find(name);
|
||||
if (iter == m_map.end())
|
||||
return false;
|
||||
entry = iter->second;
|
||||
return true;
|
||||
for (const auto &pos : m_map)
|
||||
if (pos.first == name) {
|
||||
entry = pos.second;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ForEach(ForEachCallback callback) {
|
||||
if (callback) {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator pos, end = m_map.end();
|
||||
for (pos = m_map.begin(); pos != end; pos++) {
|
||||
KeyType type = pos->first;
|
||||
if (!callback(type, pos->second))
|
||||
for (const auto &pos : m_map) {
|
||||
const KeyType &type = pos.first;
|
||||
if (!callback(type, pos.second))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -127,28 +129,17 @@ template <typename KeyType, typename ValueType> class FormatMap {
|
||||
|
||||
ValueSP GetValueAtIndex(size_t index) {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.begin();
|
||||
MapIterator end = m_map.end();
|
||||
while (index > 0) {
|
||||
iter++;
|
||||
index--;
|
||||
if (end == iter)
|
||||
return ValueSP();
|
||||
}
|
||||
return iter->second;
|
||||
if (index >= m_map.size())
|
||||
return ValueSP();
|
||||
return m_map[index].second;
|
||||
}
|
||||
|
||||
// If caller holds the mutex we could return a reference without copy ctor.
|
||||
KeyType GetKeyAtIndex(size_t index) {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
|
||||
MapIterator iter = m_map.begin();
|
||||
MapIterator end = m_map.end();
|
||||
while (index > 0) {
|
||||
iter++;
|
||||
index--;
|
||||
if (end == iter)
|
||||
return KeyType();
|
||||
}
|
||||
return iter->first;
|
||||
if (index >= m_map.size())
|
||||
return {};
|
||||
return m_map[index].first;
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -171,8 +162,8 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
||||
public:
|
||||
typedef typename BackEndType::MapType MapType;
|
||||
typedef typename MapType::iterator MapIterator;
|
||||
typedef typename MapType::key_type MapKeyType;
|
||||
typedef typename MapType::mapped_type MapValueType;
|
||||
typedef KeyType MapKeyType;
|
||||
typedef std::shared_ptr<ValueType> MapValueType;
|
||||
typedef typename BackEndType::ForEachCallback ForEachCallback;
|
||||
typedef typename std::shared_ptr<FormattersContainer<KeyType, ValueType>>
|
||||
SharedPointer;
|
||||
@ -182,8 +173,8 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
||||
FormattersContainer(std::string name, IFormatChangeListener *lst)
|
||||
: m_format_map(lst), m_name(name) {}
|
||||
|
||||
void Add(const MapKeyType &type, const MapValueType &entry) {
|
||||
Add_Impl(type, entry, static_cast<KeyType *>(nullptr));
|
||||
void Add(MapKeyType type, const MapValueType &entry) {
|
||||
Add_Impl(std::move(type), entry, static_cast<KeyType *>(nullptr));
|
||||
}
|
||||
|
||||
bool Delete(ConstString type) {
|
||||
@ -233,9 +224,9 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(FormattersContainer);
|
||||
|
||||
void Add_Impl(const MapKeyType &type, const MapValueType &entry,
|
||||
lldb::RegularExpressionSP *dummy) {
|
||||
m_format_map.Add(type, entry);
|
||||
void Add_Impl(MapKeyType type, const MapValueType &entry,
|
||||
RegularExpression *dummy) {
|
||||
m_format_map.Add(std::move(type), 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);
|
||||
}
|
||||
|
||||
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());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++) {
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (type.GetStringRef() == regex->GetText()) {
|
||||
const RegularExpression ®ex = pos->first;
|
||||
if (type.GetStringRef() == regex.GetText()) {
|
||||
m_format_map.map().erase(pos);
|
||||
if (m_format_map.listener)
|
||||
m_format_map.listener->Changed();
|
||||
@ -282,24 +273,23 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
||||
}
|
||||
|
||||
lldb::TypeNameSpecifierImplSP
|
||||
GetTypeNameSpecifierAtIndex_Impl(size_t index,
|
||||
lldb::RegularExpressionSP *dummy) {
|
||||
lldb::RegularExpressionSP regex = m_format_map.GetKeyAtIndex(index);
|
||||
if (regex.get() == nullptr)
|
||||
GetTypeNameSpecifierAtIndex_Impl(size_t index, RegularExpression *dummy) {
|
||||
RegularExpression regex = m_format_map.GetKeyAtIndex(index);
|
||||
if (regex == RegularExpression())
|
||||
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,
|
||||
lldb::RegularExpressionSP *dummy) {
|
||||
RegularExpression *dummy) {
|
||||
llvm::StringRef key_str = key.GetStringRef();
|
||||
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++) {
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (regex->Execute(key_str)) {
|
||||
value = pos->second;
|
||||
// Patterns are matched in reverse-chronological order.
|
||||
for (const auto &pos : llvm::reverse(m_format_map.map())) {
|
||||
const RegularExpression ®ex = pos.first;
|
||||
if (regex.Execute(key_str)) {
|
||||
value = pos.second;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -307,13 +297,12 @@ template <typename KeyType, typename ValueType> class FormattersContainer {
|
||||
}
|
||||
|
||||
bool GetExact_Impl(ConstString key, MapValueType &value,
|
||||
lldb::RegularExpressionSP *dummy) {
|
||||
RegularExpression *dummy) {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
|
||||
MapIterator pos, end = m_format_map.map().end();
|
||||
for (pos = m_format_map.map().begin(); pos != end; pos++) {
|
||||
lldb::RegularExpressionSP regex = pos->first;
|
||||
if (regex->GetText() == key.GetStringRef()) {
|
||||
value = pos->second;
|
||||
for (const auto &pos : m_format_map.map()) {
|
||||
const RegularExpression ®ex = pos.first;
|
||||
if (regex.GetText() == key.GetStringRef()) {
|
||||
value = pos.second;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -24,238 +24,121 @@ class StringPrinter {
|
||||
|
||||
enum class GetPrintableElementType { ASCII, UTF8 };
|
||||
|
||||
class ReadStringAndDumpToStreamOptions {
|
||||
class DumpToStreamOptions {
|
||||
public:
|
||||
ReadStringAndDumpToStreamOptions()
|
||||
: 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) {}
|
||||
DumpToStreamOptions() = default;
|
||||
|
||||
ReadStringAndDumpToStreamOptions(ValueObject &valobj);
|
||||
|
||||
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;
|
||||
}
|
||||
void SetStream(Stream *s) { m_stream = s; }
|
||||
|
||||
Stream *GetStream() const { return m_stream; }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetPrefixToken(const std::string &p) {
|
||||
m_prefix_token = p;
|
||||
return *this;
|
||||
}
|
||||
void SetPrefixToken(const std::string &p) { m_prefix_token = p; }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetPrefixToken(std::nullptr_t) {
|
||||
m_prefix_token.clear();
|
||||
return *this;
|
||||
}
|
||||
void SetPrefixToken(std::nullptr_t) { m_prefix_token.clear(); }
|
||||
|
||||
const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetSuffixToken(const std::string &p) {
|
||||
m_suffix_token = p;
|
||||
return *this;
|
||||
}
|
||||
void SetSuffixToken(const std::string &p) { m_suffix_token = p; }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetSuffixToken(std::nullptr_t) {
|
||||
m_suffix_token.clear();
|
||||
return *this;
|
||||
}
|
||||
void SetSuffixToken(std::nullptr_t) { m_suffix_token.clear(); }
|
||||
|
||||
const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetQuote(char q) {
|
||||
m_quote = q;
|
||||
return *this;
|
||||
}
|
||||
void SetQuote(char q) { m_quote = q; }
|
||||
|
||||
char GetQuote() const { return m_quote; }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetSourceSize(uint32_t s) {
|
||||
m_source_size = s;
|
||||
return *this;
|
||||
}
|
||||
void SetSourceSize(uint32_t s) { m_source_size = s; }
|
||||
|
||||
uint32_t GetSourceSize() const { return m_source_size; }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetNeedsZeroTermination(bool z) {
|
||||
m_needs_zero_termination = z;
|
||||
return *this;
|
||||
}
|
||||
void SetNeedsZeroTermination(bool z) { m_needs_zero_termination = z; }
|
||||
|
||||
bool GetNeedsZeroTermination() const { return m_needs_zero_termination; }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetBinaryZeroIsTerminator(bool e) {
|
||||
m_zero_is_terminator = e;
|
||||
return *this;
|
||||
}
|
||||
void SetBinaryZeroIsTerminator(bool e) { m_zero_is_terminator = e; }
|
||||
|
||||
bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetEscapeNonPrintables(bool e) {
|
||||
m_escape_non_printables = e;
|
||||
return *this;
|
||||
}
|
||||
void SetEscapeNonPrintables(bool e) { m_escape_non_printables = e; }
|
||||
|
||||
bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetIgnoreMaxLength(bool e) {
|
||||
m_ignore_max_length = e;
|
||||
return *this;
|
||||
}
|
||||
void SetIgnoreMaxLength(bool e) { m_ignore_max_length = e; }
|
||||
|
||||
bool GetIgnoreMaxLength() const { return m_ignore_max_length; }
|
||||
|
||||
ReadStringAndDumpToStreamOptions &SetLanguage(lldb::LanguageType l) {
|
||||
m_language_type = l;
|
||||
return *this;
|
||||
}
|
||||
void SetLanguage(lldb::LanguageType l) { m_language_type = l; }
|
||||
|
||||
lldb::LanguageType GetLanguage() const
|
||||
|
||||
{
|
||||
return m_language_type;
|
||||
}
|
||||
lldb::LanguageType GetLanguage() const { return m_language_type; }
|
||||
|
||||
private:
|
||||
uint64_t m_location;
|
||||
lldb::ProcessSP m_process_sp;
|
||||
Stream *m_stream;
|
||||
/// The used output stream.
|
||||
Stream *m_stream = nullptr;
|
||||
/// String that should be printed before the heading quote character.
|
||||
std::string m_prefix_token;
|
||||
/// String that should be printed after the trailing quote character.
|
||||
std::string m_suffix_token;
|
||||
char m_quote;
|
||||
uint32_t m_source_size;
|
||||
bool m_needs_zero_termination;
|
||||
bool m_escape_non_printables;
|
||||
bool m_ignore_max_length;
|
||||
bool m_zero_is_terminator;
|
||||
lldb::LanguageType m_language_type;
|
||||
/// The quote character that should surround the string.
|
||||
char m_quote = '"';
|
||||
/// The length of the memory region that should be dumped in bytes.
|
||||
uint32_t m_source_size = 0;
|
||||
bool m_needs_zero_termination = true;
|
||||
/// True iff non-printable characters should be escaped when dumping
|
||||
/// 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:
|
||||
ReadBufferAndDumpToStreamOptions()
|
||||
: m_data(), m_stream(nullptr), m_prefix_token(), m_suffix_token(),
|
||||
m_quote('"'), m_source_size(0), m_escape_non_printables(true),
|
||||
m_zero_is_terminator(true), m_is_truncated(false),
|
||||
m_language_type(lldb::eLanguageTypeUnknown) {}
|
||||
ReadStringAndDumpToStreamOptions() = default;
|
||||
|
||||
ReadStringAndDumpToStreamOptions(ValueObject &valobj);
|
||||
|
||||
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(
|
||||
const ReadStringAndDumpToStreamOptions &options);
|
||||
|
||||
ReadBufferAndDumpToStreamOptions &SetData(DataExtractor d) {
|
||||
m_data = d;
|
||||
return *this;
|
||||
}
|
||||
void SetData(DataExtractor d) { m_data = d; }
|
||||
|
||||
lldb_private::DataExtractor GetData() const { return m_data; }
|
||||
|
||||
ReadBufferAndDumpToStreamOptions &SetStream(Stream *s) {
|
||||
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;
|
||||
}
|
||||
void SetIsTruncated(bool t) { m_is_truncated = t; }
|
||||
|
||||
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:
|
||||
DataExtractor m_data;
|
||||
Stream *m_stream;
|
||||
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;
|
||||
bool m_is_truncated = false;
|
||||
};
|
||||
|
||||
// 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 {
|
||||
public:
|
||||
typedef FormattersContainer<ConstString, FormatterImpl> ExactMatchContainer;
|
||||
typedef FormattersContainer<lldb::RegularExpressionSP, FormatterImpl>
|
||||
typedef FormattersContainer<RegularExpression, FormatterImpl>
|
||||
RegexMatchContainer;
|
||||
|
||||
typedef typename ExactMatchContainer::MapType ExactMatchMap;
|
||||
|
@ -50,15 +50,8 @@ class DWARFExpression {
|
||||
/// \param[in] data
|
||||
/// A data extractor configured to read the DWARF location expression's
|
||||
/// 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,
|
||||
const DWARFUnit *dwarf_cu, lldb::offset_t data_offset,
|
||||
lldb::offset_t data_length);
|
||||
const DWARFUnit *dwarf_cu);
|
||||
|
||||
/// Destructor
|
||||
virtual ~DWARFExpression();
|
||||
@ -211,12 +204,6 @@ class DWARFExpression {
|
||||
/// in the case where an expression needs to be evaluated while building
|
||||
/// 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
|
||||
/// The call-frame-info style register kind.
|
||||
///
|
||||
@ -236,8 +223,7 @@ class DWARFExpression {
|
||||
/// details of the failure are provided through it.
|
||||
static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
|
||||
lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
|
||||
const DWARFUnit *dwarf_cu, const lldb::offset_t offset,
|
||||
const lldb::offset_t length,
|
||||
const DWARFUnit *dwarf_cu,
|
||||
const lldb::RegisterKind reg_set,
|
||||
const Value *initial_value_ptr,
|
||||
const Value *object_address_ptr, Value &result,
|
||||
@ -252,10 +238,6 @@ class DWARFExpression {
|
||||
lldb::addr_t loclist_base_load_addr,
|
||||
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,
|
||||
int address_size, int dwarf_ref_size,
|
||||
bool location_expression);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <string>
|
||||
@ -23,7 +24,6 @@ enum DiagnosticOrigin {
|
||||
eDiagnosticOriginUnknown = 0,
|
||||
eDiagnosticOriginLLDB,
|
||||
eDiagnosticOriginClang,
|
||||
eDiagnosticOriginGo,
|
||||
eDiagnosticOriginSwift,
|
||||
eDiagnosticOriginLLVM
|
||||
};
|
||||
@ -47,7 +47,6 @@ class Diagnostic {
|
||||
switch (kind) {
|
||||
case eDiagnosticOriginUnknown:
|
||||
case eDiagnosticOriginLLDB:
|
||||
case eDiagnosticOriginGo:
|
||||
case eDiagnosticOriginLLVM:
|
||||
return true;
|
||||
case eDiagnosticOriginClang:
|
||||
@ -89,7 +88,7 @@ class Diagnostic {
|
||||
uint32_t m_compiler_id; // Compiler-specific diagnostic ID
|
||||
};
|
||||
|
||||
typedef std::vector<Diagnostic *> DiagnosticList;
|
||||
typedef std::vector<std::unique_ptr<Diagnostic>> DiagnosticList;
|
||||
|
||||
class DiagnosticManager {
|
||||
public:
|
||||
@ -98,45 +97,33 @@ class DiagnosticManager {
|
||||
m_fixed_expression.clear();
|
||||
}
|
||||
|
||||
// The diagnostic manager holds a list of diagnostics, which are owned by the
|
||||
// manager.
|
||||
const DiagnosticList &Diagnostics() { return m_diagnostics; }
|
||||
|
||||
~DiagnosticManager() {
|
||||
for (Diagnostic *diag : m_diagnostics) {
|
||||
delete diag;
|
||||
}
|
||||
}
|
||||
|
||||
bool HasFixIts() {
|
||||
for (Diagnostic *diag : m_diagnostics) {
|
||||
if (diag->HasFixIts())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
bool HasFixIts() const {
|
||||
return llvm::any_of(m_diagnostics,
|
||||
[](const std::unique_ptr<Diagnostic> &diag) {
|
||||
return diag->HasFixIts();
|
||||
});
|
||||
}
|
||||
|
||||
void AddDiagnostic(llvm::StringRef message, DiagnosticSeverity severity,
|
||||
DiagnosticOrigin origin,
|
||||
uint32_t compiler_id = LLDB_INVALID_COMPILER_ID) {
|
||||
m_diagnostics.push_back(
|
||||
new Diagnostic(message, severity, origin, compiler_id));
|
||||
m_diagnostics.emplace_back(
|
||||
std::make_unique<Diagnostic>(message, severity, origin, compiler_id));
|
||||
}
|
||||
|
||||
void AddDiagnostic(Diagnostic *diagnostic) {
|
||||
m_diagnostics.push_back(diagnostic);
|
||||
void AddDiagnostic(std::unique_ptr<Diagnostic> diagnostic) {
|
||||
m_diagnostics.push_back(std::move(diagnostic));
|
||||
}
|
||||
|
||||
void CopyDiagnostics(DiagnosticManager &otherDiagnostics);
|
||||
|
||||
size_t Printf(DiagnosticSeverity severity, const char *format, ...)
|
||||
__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) {
|
||||
if (!m_diagnostics.empty()) {
|
||||
if (!m_diagnostics.empty())
|
||||
m_diagnostics.back()->AppendMessage(str);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns a string containing errors in this format:
|
||||
@ -153,7 +140,6 @@ class DiagnosticManager {
|
||||
// Moves fixed_expression to the internal storage.
|
||||
void SetFixedExpression(std::string fixed_expression) {
|
||||
m_fixed_expression = std::move(fixed_expression);
|
||||
fixed_expression.clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -17,20 +17,27 @@
|
||||
namespace lldb_private {
|
||||
|
||||
class ExpressionSourceCode {
|
||||
protected:
|
||||
enum Wrapping : bool {
|
||||
Wrap = true,
|
||||
NoWrap = false,
|
||||
};
|
||||
|
||||
public:
|
||||
bool NeedsWrapping() const { return m_wrap; }
|
||||
bool NeedsWrapping() const { return m_wrap == Wrap; }
|
||||
|
||||
const char *GetName() const { return m_name.c_str(); }
|
||||
|
||||
protected:
|
||||
ExpressionSourceCode(const char *name, const char *prefix, const char *body,
|
||||
bool wrap)
|
||||
: m_name(name), m_prefix(prefix), m_body(body), m_wrap(wrap) {}
|
||||
ExpressionSourceCode(llvm::StringRef name, llvm::StringRef prefix,
|
||||
llvm::StringRef body, Wrapping wrap)
|
||||
: m_name(name.str()), m_prefix(prefix.str()), m_body(body.str()),
|
||||
m_wrap(wrap) {}
|
||||
|
||||
std::string m_name;
|
||||
std::string m_prefix;
|
||||
std::string m_body;
|
||||
bool m_wrap;
|
||||
Wrapping m_wrap;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
@ -103,22 +103,6 @@ class LLVMUserExpression : public UserExpression {
|
||||
/// when running the
|
||||
/// expression.
|
||||
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
|
||||
///variables.
|
||||
|
||||
|
@ -115,8 +115,6 @@ class Materializer {
|
||||
void SetOffset(uint32_t offset) { m_offset = offset; }
|
||||
|
||||
protected:
|
||||
void SetSizeAndAlignmentFromType(CompilerType &type);
|
||||
|
||||
uint32_t m_alignment;
|
||||
uint32_t m_size;
|
||||
uint32_t m_offset;
|
||||
|
@ -103,10 +103,8 @@ class REPL : public IOHandlerDelegate {
|
||||
void IOHandlerInputComplete(IOHandler &io_handler,
|
||||
std::string &line) override;
|
||||
|
||||
int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
|
||||
const char *cursor, const char *last_char,
|
||||
int skip_first_n_matches, int max_matches,
|
||||
StringList &matches, StringList &descriptions) override;
|
||||
void IOHandlerComplete(IOHandler &io_handler,
|
||||
CompletionRequest &request) override;
|
||||
|
||||
protected:
|
||||
static int CalculateActualIndentation(const StringList &lines);
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}"
|
||||
|
||||
#cmakedefine01 HAVE_SYS_TYPES_H
|
||||
|
||||
#cmakedefine01 HAVE_SYS_EVENT_H
|
||||
|
||||
#cmakedefine01 HAVE_PPOLL
|
||||
@ -33,4 +35,6 @@
|
||||
#cmakedefine HAVE_LIBCOMPRESSION
|
||||
#endif
|
||||
|
||||
#cmakedefine01 LLDB_ENABLE_LZMA
|
||||
|
||||
#endif // #ifndef LLDB_HOST_CONFIG_H
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/Host/ConnectionFileDescriptor.h"
|
||||
#include "lldb/Utility/CompletionRequest.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Predicate.h"
|
||||
|
||||
@ -97,11 +98,7 @@ typedef int (*FixIndentationCallbackType)(Editline *editline,
|
||||
const StringList &lines,
|
||||
int cursor_position, void *baton);
|
||||
|
||||
typedef int (*CompleteCallbackType)(const char *current_line,
|
||||
const char *cursor, const char *last_char,
|
||||
int skip_first_n_matches, int max_matches,
|
||||
StringList &matches,
|
||||
StringList &descriptions, void *baton);
|
||||
typedef void (*CompleteCallbackType)(CompletionRequest &request, void *baton);
|
||||
|
||||
/// Status used to decide when and how to start editing another line in
|
||||
/// multi-line sessions
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "lldb/Utility/IOObject.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "llvm/ADT/BitmaskEnum.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <stdarg.h>
|
||||
@ -21,11 +22,15 @@
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
|
||||
|
||||
/// \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
|
||||
/// functionality.
|
||||
/// Files will often be NativeFiles, which provides a wrapper
|
||||
/// 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 {
|
||||
public:
|
||||
static int kInvalidDescriptor;
|
||||
@ -33,7 +38,12 @@ class File : public IOObject {
|
||||
|
||||
// NB this enum is used in the lldb platform gdb-remote packet
|
||||
// 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
|
||||
eOpenOptionWrite = (1u << 1), // Open file for writing
|
||||
eOpenOptionAppend =
|
||||
@ -45,129 +55,106 @@ class File : public IOObject {
|
||||
(1u << 6), // Can create file only if it doesn't already exist
|
||||
eOpenOptionDontFollowSymlinks = (1u << 7),
|
||||
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()
|
||||
: IOObject(eFDTypeFile, false), m_descriptor(kInvalidDescriptor),
|
||||
m_stream(kInvalidStream), m_options(0), m_own_stream(false),
|
||||
m_is_interactive(eLazyBoolCalculate),
|
||||
: IOObject(eFDTypeFile), m_is_interactive(eLazyBoolCalculate),
|
||||
m_is_real_terminal(eLazyBoolCalculate),
|
||||
m_supports_colors(eLazyBoolCalculate) {}
|
||||
m_supports_colors(eLazyBoolCalculate){};
|
||||
|
||||
File(FILE *fh, bool transfer_ownership)
|
||||
: 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.
|
||||
/// Read bytes from a file from the current file position into buf.
|
||||
///
|
||||
/// NOTE: This function is NOT thread safe. Use the read function
|
||||
/// that takes an "off_t &offset" to ensure correct operation in multi-
|
||||
/// threaded environments.
|
||||
///
|
||||
/// \param[in] buf
|
||||
/// A buffer where to put the bytes that are read.
|
||||
/// \param[out] buf
|
||||
///
|
||||
/// \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] num_bytes.
|
||||
/// Pass in the size of buf. Read will pass out the number
|
||||
/// of bytes read. Zero bytes read with no error indicates
|
||||
/// EOF.
|
||||
///
|
||||
/// \return
|
||||
/// An error object that indicates success or the reason for
|
||||
/// failure.
|
||||
/// success, ENOTSUP, or another error.
|
||||
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
|
||||
/// that takes an "off_t &offset" to ensure correct operation in multi-
|
||||
/// threaded environments.
|
||||
///
|
||||
/// \param[in] buf
|
||||
/// A buffer where to put the bytes that are read.
|
||||
///
|
||||
/// \param[in,out] num_bytes
|
||||
/// The number of bytes to write to the current file position
|
||||
/// which gets modified with the number of bytes that were
|
||||
/// written.
|
||||
/// Pass in the size of buf. Write will pass out the number
|
||||
/// of bytes written. Write will attempt write the full number
|
||||
/// of bytes and will not return early except on error.
|
||||
///
|
||||
/// \return
|
||||
/// An error object that indicates success or the reason for
|
||||
/// failure.
|
||||
/// success, ENOTSUP, or another error.
|
||||
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.
|
||||
///
|
||||
/// NOTE: This function is NOT thread safe, other threads that
|
||||
@ -186,7 +173,7 @@ class File : public IOObject {
|
||||
///
|
||||
/// \return
|
||||
/// 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.
|
||||
///
|
||||
@ -206,7 +193,7 @@ class File : public IOObject {
|
||||
///
|
||||
/// \return
|
||||
/// 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.
|
||||
///
|
||||
@ -227,7 +214,7 @@ class File : public IOObject {
|
||||
///
|
||||
/// \return
|
||||
/// 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.
|
||||
///
|
||||
@ -250,37 +237,7 @@ class File : public IOObject {
|
||||
/// \return
|
||||
/// An error object that indicates success or the reason for
|
||||
/// failure.
|
||||
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);
|
||||
virtual Status Read(void *dst, size_t &num_bytes, off_t &offset);
|
||||
|
||||
/// Write bytes to a file at the specified file offset.
|
||||
///
|
||||
@ -305,21 +262,67 @@ class File : public IOObject {
|
||||
/// \return
|
||||
/// An error object that indicates success or the reason for
|
||||
/// 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
|
||||
///
|
||||
/// \return
|
||||
/// An error object that indicates success or the reason for
|
||||
/// failure.
|
||||
Status Flush();
|
||||
virtual Status Flush();
|
||||
|
||||
/// Sync to disk.
|
||||
///
|
||||
/// \return
|
||||
/// An error object that indicates success or the reason for
|
||||
/// 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.
|
||||
///
|
||||
@ -346,47 +349,92 @@ class File : public IOObject {
|
||||
/// a non-zero width and height, false otherwise.
|
||||
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();
|
||||
|
||||
/// Output printf formatted output to the stream.
|
||||
///
|
||||
/// 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)));
|
||||
operator bool() const { return IsValid(); };
|
||||
|
||||
size_t PrintfVarArg(const char *format, va_list args);
|
||||
bool operator!() const { return !IsValid(); };
|
||||
|
||||
void SetOptions(uint32_t options) { m_options = options; }
|
||||
|
||||
static bool DescriptorIsValid(int descriptor) { return descriptor >= 0; };
|
||||
static char ID;
|
||||
virtual bool isA(const void *classID) const { return classID == &ID; }
|
||||
static bool classof(const File *file) { return file->isA(&ID); }
|
||||
|
||||
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_real_terminal;
|
||||
LazyBool m_supports_colors;
|
||||
std::mutex offset_access_mutex;
|
||||
|
||||
void CalculateInteractiveAndTerminal();
|
||||
|
||||
private:
|
||||
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
|
||||
|
||||
#endif // liblldb_File_h_
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include "lldb/Host/File.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
|
||||
@ -22,12 +23,12 @@ class FileCache {
|
||||
private:
|
||||
FileCache() {}
|
||||
|
||||
typedef std::map<lldb::user_id_t, lldb::FileSP> FDToFileMap;
|
||||
typedef std::map<lldb::user_id_t, lldb::FileUP> FDToFileMap;
|
||||
|
||||
public:
|
||||
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);
|
||||
bool CloseFile(lldb::user_id_t fd, Status &error);
|
||||
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
#include "lldb/Host/File.h"
|
||||
#include "lldb/Utility/DataBufferLLVM.h"
|
||||
#include "lldb/Utility/FileCollector.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Support/Chrono.h"
|
||||
#include "llvm/Support/FileCollector.h"
|
||||
#include "llvm/Support/VirtualFileSystem.h"
|
||||
|
||||
#include "lldb/lldb-types.h"
|
||||
@ -34,8 +34,8 @@ class FileSystem {
|
||||
FileSystem()
|
||||
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr),
|
||||
m_mapped(false) {}
|
||||
FileSystem(FileCollector &collector)
|
||||
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(&collector),
|
||||
FileSystem(std::shared_ptr<llvm::FileCollector> collector)
|
||||
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(collector),
|
||||
m_mapped(false) {}
|
||||
FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
|
||||
bool mapped = false)
|
||||
@ -47,7 +47,7 @@ class FileSystem {
|
||||
static FileSystem &Instance();
|
||||
|
||||
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 void Initialize(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs);
|
||||
static void Terminate();
|
||||
@ -63,9 +63,10 @@ class FileSystem {
|
||||
/// Wraps ::open in a platform-independent way.
|
||||
int Open(const char *path, int flags, int mode);
|
||||
|
||||
Status Open(File &File, const FileSpec &file_spec, uint32_t options,
|
||||
uint32_t permissions = lldb::eFilePermissionsFileDefault,
|
||||
bool should_close_fd = true);
|
||||
llvm::Expected<std::unique_ptr<File>>
|
||||
Open(const FileSpec &file_spec, File::OpenOptions options,
|
||||
uint32_t permissions = lldb::eFilePermissionsFileDefault,
|
||||
bool should_close_fd = true);
|
||||
|
||||
/// Get a directory iterator.
|
||||
/// \{
|
||||
@ -188,7 +189,7 @@ class FileSystem {
|
||||
private:
|
||||
static llvm::Optional<FileSystem> &InstanceImpl();
|
||||
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> m_fs;
|
||||
FileCollector *m_collector;
|
||||
std::shared_ptr<llvm::FileCollector> m_collector;
|
||||
bool m_mapped;
|
||||
};
|
||||
} // namespace lldb_private
|
||||
|
34
include/lldb/Host/LZMA.h
Normal file
34
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 {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
typedef SOCKET NativeSocket;
|
||||
#else
|
||||
typedef int NativeSocket;
|
||||
@ -122,6 +122,7 @@ class Socket : public IOObject {
|
||||
SocketProtocol m_protocol;
|
||||
NativeSocket m_socket;
|
||||
bool m_child_processes_inherit;
|
||||
bool m_should_close_fd;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
@ -32,6 +32,14 @@ namespace lldb_private {
|
||||
class MemoryRegionInfo;
|
||||
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
|
||||
class NativeProcessProtocol {
|
||||
public:
|
||||
@ -76,6 +84,31 @@ class NativeProcessProtocol {
|
||||
Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size,
|
||||
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,
|
||||
size_t &bytes_written) = 0;
|
||||
|
||||
@ -86,6 +119,12 @@ class NativeProcessProtocol {
|
||||
|
||||
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 size_t UpdateThreads() = 0;
|
||||
@ -391,6 +430,8 @@ class NativeProcessProtocol {
|
||||
NativeProcessProtocol(lldb::pid_t pid, int terminal_fd,
|
||||
NativeDelegate &delegate);
|
||||
|
||||
void SetID(lldb::pid_t pid) { m_pid = pid; }
|
||||
|
||||
// interface for state handling
|
||||
void SetState(lldb::StateType state, bool notify_delegates = true);
|
||||
|
||||
|
@ -36,11 +36,11 @@ class CommandAlias : public CommandObject {
|
||||
|
||||
bool WantsCompletion() override;
|
||||
|
||||
int HandleCompletion(CompletionRequest &request) override;
|
||||
void HandleCompletion(CompletionRequest &request) override;
|
||||
|
||||
int HandleArgumentCompletion(
|
||||
CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override;
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override;
|
||||
|
||||
Options *GetOptions() override;
|
||||
|
||||
|
@ -26,10 +26,10 @@ class CommandCompletions {
|
||||
// This is the command completion callback that is used to complete the
|
||||
// argument of the option it is bound to (in the OptionDefinition table
|
||||
// below). Return the total number of matches.
|
||||
typedef int (*CompletionCallback)(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request,
|
||||
// A search filter to limit the search...
|
||||
lldb_private::SearchFilter *searcher);
|
||||
typedef void (*CompletionCallback)(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request,
|
||||
// A search filter to limit the search...
|
||||
lldb_private::SearchFilter *searcher);
|
||||
enum CommonCompletionTypes {
|
||||
eNoCompletion = 0u,
|
||||
eSourceFileCompletion = (1u << 0),
|
||||
@ -57,43 +57,43 @@ class CommandCompletions {
|
||||
lldb_private::CompletionRequest &request, SearchFilter *searcher);
|
||||
|
||||
// These are the generic completer functions:
|
||||
static int DiskFiles(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request, SearchFilter *searcher);
|
||||
static void DiskFiles(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request, SearchFilter *searcher);
|
||||
|
||||
static int DiskFiles(const llvm::Twine &partial_file_name,
|
||||
StringList &matches, TildeExpressionResolver &Resolver);
|
||||
static void DiskFiles(const llvm::Twine &partial_file_name,
|
||||
StringList &matches, TildeExpressionResolver &Resolver);
|
||||
|
||||
static int DiskDirectories(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request,
|
||||
SearchFilter *searcher);
|
||||
static void DiskDirectories(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request,
|
||||
SearchFilter *searcher);
|
||||
|
||||
static int DiskDirectories(const llvm::Twine &partial_file_name,
|
||||
StringList &matches,
|
||||
TildeExpressionResolver &Resolver);
|
||||
static void DiskDirectories(const llvm::Twine &partial_file_name,
|
||||
StringList &matches,
|
||||
TildeExpressionResolver &Resolver);
|
||||
|
||||
static int 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,
|
||||
static void SourceFiles(CommandInterpreter &interpreter,
|
||||
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
|
||||
// go along with the SearchFilter passed to the standard Completer functions.
|
||||
class Completer : public Searcher {
|
||||
@ -103,11 +103,11 @@ class CommandCompletions {
|
||||
~Completer() override;
|
||||
|
||||
CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context,
|
||||
Address *addr, bool complete) override = 0;
|
||||
Address *addr) override = 0;
|
||||
|
||||
lldb::SearchDepth GetDepth() override = 0;
|
||||
|
||||
virtual size_t DoCompletion(SearchFilter *filter) = 0;
|
||||
virtual void DoCompletion(SearchFilter *filter) = 0;
|
||||
|
||||
protected:
|
||||
CommandInterpreter &m_interpreter;
|
||||
@ -127,10 +127,9 @@ class CommandCompletions {
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool complete) override;
|
||||
Address *addr) override;
|
||||
|
||||
size_t DoCompletion(SearchFilter *filter) override;
|
||||
void DoCompletion(SearchFilter *filter) override;
|
||||
|
||||
private:
|
||||
bool m_include_support_files;
|
||||
@ -151,10 +150,9 @@ class CommandCompletions {
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool complete) override;
|
||||
Address *addr) override;
|
||||
|
||||
size_t DoCompletion(SearchFilter *filter) override;
|
||||
void DoCompletion(SearchFilter *filter) override;
|
||||
|
||||
private:
|
||||
const char *m_file_name;
|
||||
@ -173,20 +171,11 @@ class CommandCompletions {
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool complete) override;
|
||||
Address *addr) override;
|
||||
|
||||
size_t DoCompletion(SearchFilter *filter) override;
|
||||
void DoCompletion(SearchFilter *filter) override;
|
||||
|
||||
private:
|
||||
// struct NameCmp {
|
||||
// bool operator() (const ConstString& lhs, const ConstString&
|
||||
// rhs) const
|
||||
// {
|
||||
// return lhs < rhs;
|
||||
// }
|
||||
// };
|
||||
|
||||
RegularExpression m_regex;
|
||||
typedef std::set<ConstString> collection;
|
||||
collection m_match_set;
|
||||
|
@ -308,31 +308,12 @@ class CommandInterpreter : public Broadcaster,
|
||||
|
||||
CommandObject *GetCommandObjectForCommand(llvm::StringRef &command_line);
|
||||
|
||||
// This handles command line completion. You are given a pointer to the
|
||||
// command string buffer, to the current cursor, and to the end of the string
|
||||
// (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 handles command line completion.
|
||||
void HandleCompletion(CompletionRequest &request);
|
||||
|
||||
// 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
|
||||
// a CompletionRequest for simplicity reasons.
|
||||
int HandleCompletionMatches(CompletionRequest &request);
|
||||
// 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.
|
||||
void HandleCompletionMatches(CompletionRequest &request);
|
||||
|
||||
int GetCommandNamesMatchingPartialString(const char *cmd_cstr,
|
||||
bool include_aliases,
|
||||
@ -519,7 +500,9 @@ class CommandInterpreter : public Broadcaster,
|
||||
|
||||
bool IOHandlerInterrupt(IOHandler &io_handler) override;
|
||||
|
||||
size_t GetProcessOutput();
|
||||
void GetProcessOutput();
|
||||
|
||||
bool DidProcessStopAbnormally() const;
|
||||
|
||||
void SetSynchronous(bool value);
|
||||
|
||||
|
@ -228,36 +228,18 @@ class CommandObject {
|
||||
///
|
||||
/// \param[in/out] request
|
||||
/// The completion request that needs to be answered.
|
||||
///
|
||||
/// 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);
|
||||
virtual void HandleCompletion(CompletionRequest &request);
|
||||
|
||||
/// The input array contains a parsed version of the line. The insertion
|
||||
/// 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.)
|
||||
/// The input array contains a parsed version of the line.
|
||||
///
|
||||
/// We've constructed the map of options and their arguments as well if that
|
||||
/// is helpful for the completion.
|
||||
///
|
||||
/// \param[in/out] request
|
||||
/// The completion request that needs to be answered.
|
||||
///
|
||||
/// 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
|
||||
virtual void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) {
|
||||
return 0;
|
||||
}
|
||||
OptionElementVector &opt_element_vector) {}
|
||||
|
||||
bool HelpTextContainsWord(llvm::StringRef search_word,
|
||||
bool search_short_help = true,
|
||||
@ -348,8 +330,9 @@ class CommandObject {
|
||||
// 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
|
||||
// target with entities that will be copied over to new targets.
|
||||
Target *GetSelectedOrDummyTarget(bool prefer_dummy = false);
|
||||
Target *GetDummyTarget();
|
||||
Target &GetSelectedOrDummyTarget(bool prefer_dummy = false);
|
||||
Target &GetSelectedTarget();
|
||||
Target &GetDummyTarget();
|
||||
|
||||
// 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
|
||||
|
@ -50,7 +50,7 @@ class CommandObjectMultiword : public CommandObject {
|
||||
|
||||
bool WantsRawCommandString() override { return false; }
|
||||
|
||||
int HandleCompletion(CompletionRequest &request) override;
|
||||
void HandleCompletion(CompletionRequest &request) override;
|
||||
|
||||
const char *GetRepeatCommand(Args ¤t_command_args,
|
||||
uint32_t index) override;
|
||||
@ -112,11 +112,11 @@ class CommandObjectProxy : public CommandObject {
|
||||
|
||||
Options *GetOptions() override;
|
||||
|
||||
int HandleCompletion(CompletionRequest &request) override;
|
||||
void HandleCompletion(CompletionRequest &request) override;
|
||||
|
||||
int HandleArgumentCompletion(
|
||||
CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override;
|
||||
void
|
||||
HandleArgumentCompletion(CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector) override;
|
||||
|
||||
const char *GetRepeatCommand(Args ¤t_command_args,
|
||||
uint32_t index) override;
|
||||
|
@ -34,7 +34,7 @@ class CommandObjectRegexCommand : public CommandObjectRaw {
|
||||
|
||||
bool HasRegexEntries() const { return !m_entries.empty(); }
|
||||
|
||||
int HandleCompletion(CompletionRequest &request) override;
|
||||
void HandleCompletion(CompletionRequest &request) override;
|
||||
|
||||
protected:
|
||||
bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
|
||||
|
@ -62,13 +62,13 @@ class CommandReturnObject {
|
||||
return m_err_stream;
|
||||
}
|
||||
|
||||
void SetImmediateOutputFile(FILE *fh, bool transfer_fh_ownership = false) {
|
||||
lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
|
||||
void SetImmediateOutputFile(lldb::FileSP file_sp) {
|
||||
lldb::StreamSP stream_sp(new StreamFile(file_sp));
|
||||
m_out_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
|
||||
}
|
||||
|
||||
void SetImmediateErrorFile(FILE *fh, bool transfer_fh_ownership = false) {
|
||||
lldb::StreamSP stream_sp(new StreamFile(fh, transfer_fh_ownership));
|
||||
void SetImmediateErrorFile(lldb::FileSP file_sp) {
|
||||
lldb::StreamSP stream_sp(new StreamFile(file_sp));
|
||||
m_err_stream.SetStreamAtIndex(eImmediateStreamIndex, stream_sp);
|
||||
}
|
||||
|
||||
@ -144,14 +144,6 @@ class CommandReturnObject {
|
||||
|
||||
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:
|
||||
enum { eStreamStringIndex = 0, eImmediateStreamIndex = 1 };
|
||||
|
||||
@ -162,14 +154,6 @@ class CommandReturnObject {
|
||||
bool m_did_change_process_state;
|
||||
bool m_interactive; // If true, then the input handle from the debugger will
|
||||
// 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
|
||||
|
65
include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
Normal file
65
include/lldb/Interpreter/OptionGroupPythonClassWithDict.h
Normal file
@ -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 size_t AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request);
|
||||
virtual void AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request);
|
||||
|
||||
// Subclasses can override these functions
|
||||
virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
|
||||
|
@ -55,8 +55,8 @@ class OptionValueArch : public OptionValue {
|
||||
|
||||
lldb::OptionValueSP DeepCopy() const override;
|
||||
|
||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
||||
lldb_private::CompletionRequest &request) override;
|
||||
void AutoComplete(CommandInterpreter &interpreter,
|
||||
lldb_private::CompletionRequest &request) override;
|
||||
|
||||
// Subclass specific functions
|
||||
|
||||
|
@ -43,8 +43,8 @@ class OptionValueBoolean : public OptionValue {
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
void AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
|
||||
// Subclass specific functions
|
||||
|
||||
|
@ -55,8 +55,8 @@ class OptionValueEnumeration : public OptionValue {
|
||||
|
||||
lldb::OptionValueSP DeepCopy() const override;
|
||||
|
||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
void AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
|
||||
// Subclass specific functions
|
||||
|
||||
|
@ -51,8 +51,8 @@ class OptionValueFileSpec : public OptionValue {
|
||||
|
||||
lldb::OptionValueSP DeepCopy() const override;
|
||||
|
||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
void AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
|
||||
// Subclass specific functions
|
||||
|
||||
|
@ -38,8 +38,8 @@ class OptionValueFormatEntity : public OptionValue {
|
||||
|
||||
lldb::OptionValueSP DeepCopy() const override;
|
||||
|
||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
void AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
|
||||
// Subclass specific functions
|
||||
|
||||
|
@ -36,7 +36,7 @@ class OptionValueRegex : public OptionValue {
|
||||
VarSetOperationType = eVarSetOperationAssign) = delete;
|
||||
|
||||
bool Clear() override {
|
||||
m_regex.Clear();
|
||||
m_regex = RegularExpression();
|
||||
m_value_was_set = false;
|
||||
return true;
|
||||
}
|
||||
@ -50,9 +50,9 @@ class OptionValueRegex : public OptionValue {
|
||||
|
||||
void SetCurrentValue(const char *value) {
|
||||
if (value && value[0])
|
||||
m_regex.Compile(llvm::StringRef(value));
|
||||
m_regex = RegularExpression(llvm::StringRef(value));
|
||||
else
|
||||
m_regex.Clear();
|
||||
m_regex = RegularExpression();
|
||||
}
|
||||
|
||||
bool IsValid() const { return m_regex.IsValid(); }
|
||||
|
@ -52,8 +52,8 @@ class OptionValueUUID : public OptionValue {
|
||||
|
||||
void SetCurrentValue(const UUID &value) { m_uuid = value; }
|
||||
|
||||
size_t AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
void AutoComplete(CommandInterpreter &interpreter,
|
||||
CompletionRequest &request) override;
|
||||
|
||||
protected:
|
||||
UUID m_uuid;
|
||||
|
@ -187,14 +187,7 @@ class Options {
|
||||
///
|
||||
/// \param[in] interpreter
|
||||
/// The command interpreter doing the completion.
|
||||
///
|
||||
/// 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
|
||||
virtual void
|
||||
HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request,
|
||||
OptionElementVector &opt_element_vector,
|
||||
int opt_element_index,
|
||||
|
@ -65,6 +65,9 @@ class ScriptInterpreter : public PluginInterface {
|
||||
|
||||
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; }
|
||||
|
||||
ExecuteScriptOptions &SetEnableIO(bool enable) {
|
||||
@ -208,6 +211,8 @@ class ScriptInterpreter : public PluginInterface {
|
||||
|
||||
virtual StructuredData::ObjectSP
|
||||
CreateScriptedThreadPlan(const char *class_name,
|
||||
StructuredDataImpl *args_data,
|
||||
std::string &error_str,
|
||||
lldb::ThreadPlanSP thread_plan_sp) {
|
||||
return StructuredData::ObjectSP();
|
||||
}
|
||||
@ -463,8 +468,6 @@ class ScriptInterpreter : public PluginInterface {
|
||||
|
||||
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; }
|
||||
|
||||
protected:
|
||||
|
28
include/lldb/Symbol/CallFrameInfo.h
Normal file
28
include/lldb/Symbol/CallFrameInfo.h
Normal file
@ -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/SmallVector.h"
|
||||
|
||||
#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
|
||||
#include "lldb/Core/ClangForward.h"
|
||||
#include "lldb/Expression/ExpressionVariable.h"
|
||||
#include "lldb/Symbol/CompilerType.h"
|
||||
#include "lldb/Symbol/TypeSystem.h"
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
@ -52,7 +52,14 @@ class ClangASTContext : public TypeSystem {
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
@ -68,9 +75,8 @@ class ClangASTContext : public TypeSystem {
|
||||
static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
|
||||
Module *module, Target *target);
|
||||
|
||||
static void EnumerateSupportedLanguages(
|
||||
std::set<lldb::LanguageType> &languages_for_types,
|
||||
std::set<lldb::LanguageType> &languages_for_expressions);
|
||||
static LanguageSet GetSupportedLanguagesForTypes();
|
||||
static LanguageSet GetSupportedLanguagesForExpressions();
|
||||
|
||||
static void Initialize();
|
||||
|
||||
@ -80,8 +86,6 @@ class ClangASTContext : public TypeSystem {
|
||||
|
||||
clang::ASTContext *getASTContext();
|
||||
|
||||
void setASTContext(clang::ASTContext *ast_ctx);
|
||||
|
||||
clang::Builtin::Context *getBuiltinContext();
|
||||
|
||||
clang::IdentifierTable *getIdentifierTable();
|
||||
@ -107,21 +111,11 @@ class ClangASTContext : public TypeSystem {
|
||||
void setSema(clang::Sema *s);
|
||||
clang::Sema *getSema() { return m_sema; }
|
||||
|
||||
void Clear();
|
||||
|
||||
const char *GetTargetTriple();
|
||||
|
||||
void SetTargetTriple(const char *target_triple);
|
||||
|
||||
void SetArchitecture(const ArchSpec &arch);
|
||||
|
||||
bool HasExternalSource();
|
||||
|
||||
void SetExternalSource(
|
||||
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up);
|
||||
|
||||
void RemoveExternalSource();
|
||||
|
||||
bool GetCompleteDecl(clang::Decl *decl) {
|
||||
return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
|
||||
}
|
||||
@ -229,7 +223,8 @@ class ClangASTContext : public TypeSystem {
|
||||
if (const RecordDeclType *record_decl =
|
||||
llvm::dyn_cast<RecordDeclType>(named_decl))
|
||||
compiler_type.SetCompilerType(
|
||||
ast, clang::QualType(record_decl->getTypeForDecl(), 0));
|
||||
this, clang::QualType(record_decl->getTypeForDecl(), 0)
|
||||
.getAsOpaquePtr());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -249,7 +244,7 @@ class ClangASTContext : public TypeSystem {
|
||||
&type_fields,
|
||||
bool packed = false);
|
||||
|
||||
static bool IsOperator(const char *name,
|
||||
static bool IsOperator(llvm::StringRef name,
|
||||
clang::OverloadedOperatorKind &op_kind);
|
||||
|
||||
// Structure, Unions, Classes
|
||||
@ -395,7 +390,8 @@ class ClangASTContext : public TypeSystem {
|
||||
clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx,
|
||||
const char *name,
|
||||
const CompilerType ¶m_type,
|
||||
int storage);
|
||||
int storage,
|
||||
bool add_decl=false);
|
||||
|
||||
void SetFunctionParameters(clang::FunctionDecl *function_decl,
|
||||
clang::ParmVarDecl **params, unsigned num_params);
|
||||
@ -464,6 +460,8 @@ class ClangASTContext : public TypeSystem {
|
||||
CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
|
||||
size_t arg_idx) override;
|
||||
|
||||
CompilerType GetTypeForDecl(void *opaque_decl) override;
|
||||
|
||||
// CompilerDeclContext override functions
|
||||
|
||||
std::vector<CompilerDecl>
|
||||
@ -605,9 +603,6 @@ class ClangASTContext : public TypeSystem {
|
||||
static bool GetCXXClassName(const CompilerType &type,
|
||||
std::string &class_name);
|
||||
|
||||
static bool GetObjCClassName(const CompilerType &type,
|
||||
std::string &class_name);
|
||||
|
||||
// Type Completion
|
||||
|
||||
bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
|
||||
@ -691,6 +686,8 @@ class ClangASTContext : public TypeSystem {
|
||||
|
||||
// Exploring the type
|
||||
|
||||
const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) override;
|
||||
|
||||
llvm::Optional<uint64_t> GetByteSize(lldb::opaque_compiler_type_t type,
|
||||
ExecutionContextScope *exe_scope) {
|
||||
if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
|
||||
@ -707,7 +704,9 @@ class ClangASTContext : public TypeSystem {
|
||||
|
||||
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,
|
||||
bool omit_empty_base_classes,
|
||||
@ -855,7 +854,6 @@ class ClangASTContext : public TypeSystem {
|
||||
static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type,
|
||||
bool has_extern);
|
||||
|
||||
static bool GetHasExternalStorage(const CompilerType &type);
|
||||
// Tag Declarations
|
||||
static bool StartTagDeclarationDefinition(const CompilerType &type);
|
||||
|
||||
@ -878,12 +876,6 @@ class ClangASTContext : public TypeSystem {
|
||||
static CompilerType CreateMemberPointerType(const CompilerType &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
|
||||
#ifndef NDEBUG
|
||||
/// Convenience LLVM-style dump method for use in the debugger only.
|
||||
@ -894,6 +886,14 @@ class ClangASTContext : public TypeSystem {
|
||||
|
||||
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,
|
||||
Stream *s, lldb::Format format, const DataExtractor &data,
|
||||
lldb::offset_t data_offset, size_t data_byte_size,
|
||||
@ -977,43 +977,45 @@ class ClangASTContext : public TypeSystem {
|
||||
GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type);
|
||||
|
||||
// Classes that inherit from ClangASTContext can see and modify these
|
||||
// clang-format off
|
||||
std::string m_target_triple;
|
||||
std::unique_ptr<clang::ASTContext> m_ast_up;
|
||||
std::unique_ptr<clang::LangOptions> m_language_options_up;
|
||||
std::unique_ptr<clang::FileManager> m_file_manager_up;
|
||||
std::unique_ptr<clang::SourceManager> m_source_manager_up;
|
||||
std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
|
||||
std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
|
||||
std::shared_ptr<clang::TargetOptions> m_target_options_rp;
|
||||
std::unique_ptr<clang::TargetInfo> m_target_info_up;
|
||||
std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
|
||||
std::unique_ptr<clang::SelectorTable> m_selector_table_up;
|
||||
std::unique_ptr<clang::Builtin::Context> m_builtins_up;
|
||||
std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
|
||||
std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
|
||||
std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
|
||||
std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
|
||||
CompleteTagDeclCallback m_callback_tag_decl;
|
||||
CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
|
||||
void * m_callback_baton;
|
||||
clang::ExternalASTMerger::OriginMap m_origins;
|
||||
uint32_t m_pointer_byte_size;
|
||||
bool m_ast_owned;
|
||||
/// The sema associated that is currently used to build this ASTContext.
|
||||
/// May be null if we are already done parsing this ASTContext or the
|
||||
/// ASTContext wasn't created by parsing source code.
|
||||
clang::Sema * m_sema = nullptr;
|
||||
// clang-format on
|
||||
std::string m_target_triple;
|
||||
std::unique_ptr<clang::ASTContext> m_ast_up;
|
||||
std::unique_ptr<clang::LangOptions> m_language_options_up;
|
||||
std::unique_ptr<clang::FileManager> m_file_manager_up;
|
||||
std::unique_ptr<clang::SourceManager> m_source_manager_up;
|
||||
std::unique_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_up;
|
||||
std::unique_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_up;
|
||||
std::shared_ptr<clang::TargetOptions> m_target_options_rp;
|
||||
std::unique_ptr<clang::TargetInfo> m_target_info_up;
|
||||
std::unique_ptr<clang::IdentifierTable> m_identifier_table_up;
|
||||
std::unique_ptr<clang::SelectorTable> m_selector_table_up;
|
||||
std::unique_ptr<clang::Builtin::Context> m_builtins_up;
|
||||
std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
|
||||
std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
|
||||
std::unique_ptr<ClangASTSource> m_scratch_ast_source_up;
|
||||
std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
|
||||
CompleteTagDeclCallback m_callback_tag_decl = nullptr;
|
||||
CompleteObjCInterfaceDeclCallback m_callback_objc_decl = nullptr;
|
||||
void *m_callback_baton = nullptr;
|
||||
clang::ExternalASTMerger::OriginMap m_origins;
|
||||
uint32_t m_pointer_byte_size = 0;
|
||||
bool m_ast_owned = false;
|
||||
/// The sema associated that is currently used to build this ASTContext.
|
||||
/// May be null if we are already done parsing this ASTContext or the
|
||||
/// ASTContext wasn't created by parsing source code.
|
||||
clang::Sema *m_sema = nullptr;
|
||||
|
||||
private:
|
||||
// For ClangASTContext only
|
||||
ClangASTContext(const ClangASTContext &);
|
||||
const ClangASTContext &operator=(const ClangASTContext &);
|
||||
/// Creates the internal ASTContext.
|
||||
void CreateASTContext();
|
||||
void SetTargetTriple(llvm::StringRef target_triple);
|
||||
};
|
||||
|
||||
class ClangASTContextForExpressions : public ClangASTContext {
|
||||
public:
|
||||
ClangASTContextForExpressions(Target &target);
|
||||
ClangASTContextForExpressions(Target &target, ArchSpec arch);
|
||||
|
||||
~ClangASTContextForExpressions() override = default;
|
||||
|
||||
@ -1041,13 +1043,9 @@ class ClangASTContextForExpressions : public ClangASTContext {
|
||||
}
|
||||
private:
|
||||
lldb::TargetWP m_target_wp;
|
||||
lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
|
||||
///persistent
|
||||
///variables
|
||||
///associated with
|
||||
///this process for
|
||||
///the expression
|
||||
///parser.
|
||||
std::unique_ptr<PersistentExpressionState>
|
||||
m_persistent_variables; // These are the persistent variables associated
|
||||
// with this process for the expression parser
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
@ -210,7 +210,7 @@ class ClangASTImporter {
|
||||
void ForgetDestination(clang::ASTContext *dst_ctx);
|
||||
void ForgetSource(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
|
||||
|
||||
private:
|
||||
public:
|
||||
struct DeclOrigin {
|
||||
DeclOrigin() : ctx(nullptr), decl(nullptr) {}
|
||||
|
||||
@ -235,24 +235,32 @@ class ClangASTImporter {
|
||||
|
||||
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
|
||||
/// underlying ASTImporter.
|
||||
///
|
||||
/// This class updates the map from declarations to their original
|
||||
/// declarations and can record and complete declarations that have been
|
||||
/// imported in a certain interval.
|
||||
/// declarations and can record declarations that have been imported in a
|
||||
/// certain interval.
|
||||
///
|
||||
/// When intercepting a declaration import, the ASTImporterDelegate uses the
|
||||
/// CxxModuleHandler to replace any missing or malformed declarations with
|
||||
/// their counterpart from a C++ module.
|
||||
class ASTImporterDelegate : public clang::ASTImporter {
|
||||
public:
|
||||
struct ASTImporterDelegate : public clang::ASTImporter {
|
||||
ASTImporterDelegate(ClangASTImporter &master, clang::ASTContext *target_ctx,
|
||||
clang::ASTContext *source_ctx)
|
||||
: clang::ASTImporter(*target_ctx, master.m_file_manager, *source_ctx,
|
||||
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
|
||||
/// 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 Imported(clang::Decl *from, 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
|
||||
/// ASTContext. Used by the CxxModuleHandler to mark declarations that
|
||||
/// 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.
|
||||
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;
|
||||
clang::ASTContext *m_source_ctx;
|
||||
CxxModuleHandler *m_std_handler = nullptr;
|
||||
/// The currently attached listener.
|
||||
NewDeclListener *m_new_decl_listener = nullptr;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<ASTImporterDelegate> ImporterDelegateSP;
|
||||
@ -387,6 +384,7 @@ class ClangASTImporter {
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
DeclOrigin GetDeclOrigin(const clang::Decl *decl);
|
||||
|
||||
clang::FileManager m_file_manager;
|
||||
|
@ -225,6 +225,14 @@ class CompileUnit : public std::enable_shared_from_this<CompileUnit>,
|
||||
|
||||
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.
|
||||
///
|
||||
/// 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.
|
||||
void SetLineTable(LineTable *line_table);
|
||||
|
||||
void SetSupportFiles(const FileSpecList &support_files);
|
||||
|
||||
void SetDebugMacros(const DebugMacrosSP &debug_macros);
|
||||
|
||||
/// Set accessor for the variable list.
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/Core/ClangForward.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "llvm/ADT/APSInt.h"
|
||||
|
||||
@ -32,7 +31,6 @@ class CompilerType {
|
||||
public:
|
||||
// Constructors and Destructors
|
||||
CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
|
||||
CompilerType(clang::ASTContext *ast_context, clang::QualType qual_type);
|
||||
|
||||
CompilerType(const CompilerType &rhs)
|
||||
: m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}
|
||||
@ -169,8 +167,6 @@ class CompilerType {
|
||||
void SetCompilerType(TypeSystem *type_system,
|
||||
lldb::opaque_compiler_type_t type);
|
||||
|
||||
void SetCompilerType(clang::ASTContext *ast, clang::QualType qual_type);
|
||||
|
||||
unsigned GetTypeQualifiers() const;
|
||||
|
||||
// Creating related types
|
||||
@ -257,7 +253,7 @@ class CompilerType {
|
||||
|
||||
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,
|
||||
const ExecutionContext *exe_ctx) const;
|
||||
@ -336,13 +332,6 @@ class CompilerType {
|
||||
|
||||
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
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -9,11 +9,8 @@
|
||||
#ifndef liblldb_DeclVendor_h_
|
||||
#define liblldb_DeclVendor_h_
|
||||
|
||||
#include "lldb/Core/ClangForward.h"
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
#include "clang/AST/ExternalASTMerger.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace lldb_private {
|
||||
@ -22,11 +19,19 @@ namespace lldb_private {
|
||||
// declarations that are not necessarily backed by a specific symbol file.
|
||||
class DeclVendor {
|
||||
public:
|
||||
enum DeclVendorKind {
|
||||
eClangDeclVendor,
|
||||
eClangModuleDeclVendor,
|
||||
eAppleObjCDeclVendor,
|
||||
eLastClangDeclVendor,
|
||||
};
|
||||
// Constructors and Destructors
|
||||
DeclVendor() {}
|
||||
DeclVendor(DeclVendorKind kind) : m_kind(kind) {}
|
||||
|
||||
virtual ~DeclVendor() {}
|
||||
|
||||
DeclVendorKind GetKind() const { return m_kind; }
|
||||
|
||||
/// Look up the set of Decls that the DeclVendor currently knows about
|
||||
/// matching a given name.
|
||||
///
|
||||
@ -45,7 +50,7 @@ class DeclVendor {
|
||||
/// max_matches.
|
||||
virtual uint32_t FindDecls(ConstString name, bool append,
|
||||
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
|
||||
/// given name.
|
||||
@ -60,16 +65,11 @@ class DeclVendor {
|
||||
/// The vector of CompilerTypes that was found.
|
||||
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:
|
||||
// For DeclVendor only
|
||||
DISALLOW_COPY_AND_ASSIGN(DeclVendor);
|
||||
|
||||
const DeclVendorKind m_kind;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
@ -76,6 +76,11 @@ class FuncUnwinders {
|
||||
|
||||
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 GetEHFrameAugmentedUnwindPlan(Target &target,
|
||||
@ -113,10 +118,12 @@ class FuncUnwinders {
|
||||
std::recursive_mutex m_mutex;
|
||||
|
||||
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_debug_frame_sp;
|
||||
|
||||
// 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_debug_frame_augmented_sp;
|
||||
|
||||
@ -130,7 +137,9 @@ class FuncUnwinders {
|
||||
// Fetching the UnwindPlans can be expensive - if we've already attempted to
|
||||
// get one & failed, don't try again.
|
||||
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_object_file_augmented : 1,
|
||||
m_tried_unwind_plan_eh_frame_augmented : 1,
|
||||
m_tried_unwind_plan_debug_frame_augmented : 1,
|
||||
m_tried_unwind_plan_compact_unwind : 1,
|
||||
|
@ -140,7 +140,7 @@ class InlineFunctionInfo : public FunctionInfo {
|
||||
/// \param[in] call_decl_ptr
|
||||
/// Optional calling location declaration information that
|
||||
/// 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 *call_decl_ptr);
|
||||
|
||||
@ -246,10 +246,22 @@ class InlineFunctionInfo : public FunctionInfo {
|
||||
|
||||
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"
|
||||
///
|
||||
/// 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 {
|
||||
public:
|
||||
/// 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
|
||||
/// conflicts, it's necessary to determine the \c Target a call edge is
|
||||
/// 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 &operator=(CallEdge &&) = default;
|
||||
@ -279,6 +292,9 @@ class CallEdge {
|
||||
/// offset.
|
||||
lldb::addr_t GetUnresolvedReturnPCAddress() const { return return_pc; }
|
||||
|
||||
/// Get the call site parameters available at this call edge.
|
||||
llvm::ArrayRef<CallSiteParameter> GetCallSiteParameters() const;
|
||||
|
||||
private:
|
||||
void ParseSymbolFileAndResolve(ModuleList &images);
|
||||
|
||||
@ -294,6 +310,8 @@ class CallEdge {
|
||||
/// gives the return PC for the call.
|
||||
lldb::addr_t return_pc;
|
||||
|
||||
CallSiteParameterArray parameters;
|
||||
|
||||
/// Whether or not an attempt was made to find the callee's definition.
|
||||
bool resolved;
|
||||
|
||||
@ -402,6 +420,11 @@ class Function : public UserID, public SymbolContextScope {
|
||||
/// return None.
|
||||
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.
|
||||
///
|
||||
/// \return
|
||||
@ -564,6 +587,8 @@ class Function : public UserID, public SymbolContextScope {
|
||||
uint32_t
|
||||
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
|
||||
/// parsed.
|
||||
std::vector<CallEdge> m_call_edges; ///< Outgoing call edges.
|
||||
|
@ -63,16 +63,22 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
|
||||
public:
|
||||
enum Type {
|
||||
eTypeInvalid = 0,
|
||||
eTypeCoreFile, /// A core file that has a checkpoint of a program's
|
||||
/// execution state
|
||||
eTypeExecutable, /// A normal executable
|
||||
eTypeDebugInfo, /// An object file that contains only debug information
|
||||
eTypeDynamicLinker, /// The platform's dynamic linker executable
|
||||
eTypeObjectFile, /// An intermediate object file
|
||||
eTypeSharedLibrary, /// A shared library that can be used during execution
|
||||
eTypeStubLibrary, /// A library that can be linked against but not used for
|
||||
/// execution
|
||||
eTypeJIT, /// JIT code that has symbols, sections and possibly debug info
|
||||
/// A core file that has a checkpoint of a program's execution state.
|
||||
eTypeCoreFile,
|
||||
/// A normal executable.
|
||||
eTypeExecutable,
|
||||
/// An object file that contains only debug information.
|
||||
eTypeDebugInfo,
|
||||
/// The platform's dynamic linker executable.
|
||||
eTypeDynamicLinker,
|
||||
/// An intermediate object file.
|
||||
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
|
||||
};
|
||||
|
||||
@ -201,9 +207,13 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
|
||||
/// \b false otherwise and \a archive_file and \a archive_object
|
||||
/// are guaranteed to be remain unchanged.
|
||||
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);
|
||||
|
||||
// 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.
|
||||
///
|
||||
/// \return
|
||||
@ -366,17 +376,6 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
|
||||
/// returned.
|
||||
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.
|
||||
///
|
||||
/// 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
|
||||
virtual std::vector<LoadableData> GetLoadableData(Target &target);
|
||||
|
||||
/// Creates a plugin-specific call frame info
|
||||
virtual std::unique_ptr<CallFrameInfo> CreateCallFrameInfo();
|
||||
|
||||
protected:
|
||||
// Member variables.
|
||||
FileSpec m_file;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include <vector>
|
||||
|
||||
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
|
||||
/// 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
|
||||
/// 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.
|
||||
Symbol();
|
||||
|
||||
Symbol(uint32_t symID, const char *name, bool name_is_mangled,
|
||||
lldb::SymbolType type, bool external, bool is_debug,
|
||||
bool is_trampoline, bool is_artificial,
|
||||
Symbol(uint32_t symID, llvm::StringRef name, lldb::SymbolType type,
|
||||
bool external, bool is_debug, bool is_trampoline, bool is_artificial,
|
||||
const lldb::SectionSP §ion_sp, lldb::addr_t value,
|
||||
lldb::addr_t size, bool size_is_valid,
|
||||
bool contains_linker_annotations, uint32_t flags);
|
||||
|
@ -470,6 +470,8 @@ class SymbolContextList {
|
||||
/// Returns the number of symbol context objects in the list.
|
||||
uint32_t GetSize() const;
|
||||
|
||||
bool IsEmpty() const;
|
||||
|
||||
uint32_t NumLineEntriesWithLine(uint32_t line) const;
|
||||
|
||||
void GetDescription(Stream *s, lldb::DescriptionLevel level,
|
||||
|
@ -16,9 +16,11 @@
|
||||
#include "lldb/Symbol/Function.h"
|
||||
#include "lldb/Symbol/SourceModule.h"
|
||||
#include "lldb/Symbol/Type.h"
|
||||
#include "lldb/Symbol/TypeList.h"
|
||||
#include "lldb/Symbol/TypeSystem.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/Support/Errc.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
@ -49,11 +51,12 @@ class SymbolFile : public PluginInterface {
|
||||
kAllAbilities = ((1u << 7) - 1u)
|
||||
};
|
||||
|
||||
static SymbolFile *FindPlugin(ObjectFile *obj_file);
|
||||
static SymbolFile *FindPlugin(lldb::ObjectFileSP objfile_sp);
|
||||
|
||||
// Constructors and Destructors
|
||||
SymbolFile(ObjectFile *obj_file)
|
||||
: m_obj_file(obj_file), m_abilities(0), m_calculated_abilities(false) {}
|
||||
SymbolFile(lldb::ObjectFileSP objfile_sp)
|
||||
: m_objfile_sp(std::move(objfile_sp)), m_abilities(0),
|
||||
m_calculated_abilities(false) {}
|
||||
|
||||
~SymbolFile() override {}
|
||||
|
||||
@ -110,13 +113,18 @@ class SymbolFile : public PluginInterface {
|
||||
|
||||
// Compile Unit function calls
|
||||
// Approach 1 - iterator
|
||||
virtual uint32_t GetNumCompileUnits() = 0;
|
||||
virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0;
|
||||
uint32_t GetNumCompileUnits();
|
||||
lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx);
|
||||
|
||||
Symtab *GetSymtab();
|
||||
|
||||
virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0;
|
||||
virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0;
|
||||
virtual bool ParseLineTable(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,
|
||||
FileSpecList &support_files) = 0;
|
||||
virtual size_t ParseTypes(CompileUnit &comp_unit) = 0;
|
||||
@ -165,43 +173,41 @@ class SymbolFile : public PluginInterface {
|
||||
SymbolContextList &sc_list);
|
||||
|
||||
virtual void DumpClangAST(Stream &s) {}
|
||||
virtual uint32_t
|
||||
virtual void
|
||||
FindGlobalVariables(ConstString name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
uint32_t max_matches, VariableList &variables);
|
||||
virtual uint32_t FindGlobalVariables(const RegularExpression ®ex,
|
||||
uint32_t max_matches,
|
||||
VariableList &variables);
|
||||
virtual uint32_t FindFunctions(ConstString name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
bool include_inlines, bool append,
|
||||
SymbolContextList &sc_list);
|
||||
virtual uint32_t FindFunctions(const RegularExpression ®ex,
|
||||
bool include_inlines, bool append,
|
||||
SymbolContextList &sc_list);
|
||||
virtual uint32_t
|
||||
virtual void FindGlobalVariables(const RegularExpression ®ex,
|
||||
uint32_t max_matches,
|
||||
VariableList &variables);
|
||||
virtual void FindFunctions(ConstString name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
bool include_inlines, SymbolContextList &sc_list);
|
||||
virtual void FindFunctions(const RegularExpression ®ex,
|
||||
bool include_inlines, SymbolContextList &sc_list);
|
||||
virtual void
|
||||
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,
|
||||
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
|
||||
GetMangledNamesForFunction(const std::string &scope_qualified_name,
|
||||
std::vector<ConstString> &mangled_names);
|
||||
// virtual uint32_t FindTypes (const SymbolContext& sc, const
|
||||
// RegularExpression& regex, bool append, uint32_t max_matches, TypeList&
|
||||
// types) = 0;
|
||||
virtual TypeList *GetTypeList();
|
||||
virtual size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
|
||||
lldb::TypeClass type_mask,
|
||||
lldb_private::TypeList &type_list) = 0;
|
||||
|
||||
virtual void GetTypes(lldb_private::SymbolContextScope *sc_scope,
|
||||
lldb::TypeClass type_mask,
|
||||
lldb_private::TypeList &type_list) = 0;
|
||||
|
||||
virtual void PreloadSymbols();
|
||||
|
||||
virtual lldb_private::TypeSystem *
|
||||
virtual llvm::Expected<lldb_private::TypeSystem &>
|
||||
GetTypeSystemForLanguage(lldb::LanguageType language);
|
||||
|
||||
virtual CompilerDeclContext
|
||||
@ -210,8 +216,9 @@ class SymbolFile : public PluginInterface {
|
||||
return CompilerDeclContext();
|
||||
}
|
||||
|
||||
ObjectFile *GetObjectFile() { return m_obj_file; }
|
||||
const ObjectFile *GetObjectFile() const { return m_obj_file; }
|
||||
ObjectFile *GetObjectFile() { return m_objfile_sp.get(); }
|
||||
const ObjectFile *GetObjectFile() const { return m_objfile_sp.get(); }
|
||||
ObjectFile *GetMainObjectFile();
|
||||
|
||||
virtual std::vector<CallEdge> ParseCallEdgesInFunction(UserID func_id) {
|
||||
return {};
|
||||
@ -221,7 +228,7 @@ class SymbolFile : public PluginInterface {
|
||||
|
||||
/// Notify the SymbolFile that the file addresses in the Sections
|
||||
/// for this module have been changed.
|
||||
virtual void SectionFileAddressesChanged() {}
|
||||
virtual void SectionFileAddressesChanged();
|
||||
|
||||
struct RegisterInfoResolver {
|
||||
virtual ~RegisterInfoResolver(); // anchor
|
||||
@ -235,12 +242,30 @@ class SymbolFile : public PluginInterface {
|
||||
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:
|
||||
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;
|
||||
bool m_calculated_abilities;
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "lldb/Core/ModuleChild.h"
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
#include "lldb/Symbol/SourceModule.h"
|
||||
#include "lldb/Symbol/TypeList.h"
|
||||
#include "lldb/Symbol/TypeMap.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
@ -40,123 +39,16 @@ class SymbolVendor : public ModuleChild, public PluginInterface {
|
||||
|
||||
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(); }
|
||||
|
||||
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
|
||||
ConstString GetPluginName() override;
|
||||
|
||||
uint32_t GetPluginVersion() override;
|
||||
|
||||
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
|
||||
// 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:
|
||||
// For SymbolVendor only
|
||||
|
@ -92,15 +92,15 @@ class Symtab {
|
||||
const RegularExpression ®ex, lldb::SymbolType symbol_type,
|
||||
Debug symbol_debug_type, Visibility symbol_visibility,
|
||||
std::vector<uint32_t> &indexes);
|
||||
size_t FindAllSymbolsWithNameAndType(ConstString name,
|
||||
lldb::SymbolType symbol_type,
|
||||
std::vector<uint32_t> &symbol_indexes);
|
||||
size_t FindAllSymbolsWithNameAndType(ConstString name,
|
||||
lldb::SymbolType symbol_type,
|
||||
Debug symbol_debug_type,
|
||||
Visibility symbol_visibility,
|
||||
std::vector<uint32_t> &symbol_indexes);
|
||||
size_t FindAllSymbolsMatchingRexExAndType(
|
||||
void FindAllSymbolsWithNameAndType(ConstString name,
|
||||
lldb::SymbolType symbol_type,
|
||||
std::vector<uint32_t> &symbol_indexes);
|
||||
void FindAllSymbolsWithNameAndType(ConstString name,
|
||||
lldb::SymbolType symbol_type,
|
||||
Debug symbol_debug_type,
|
||||
Visibility symbol_visibility,
|
||||
std::vector<uint32_t> &symbol_indexes);
|
||||
void FindAllSymbolsMatchingRexExAndType(
|
||||
const RegularExpression ®ex, lldb::SymbolType symbol_type,
|
||||
Debug symbol_debug_type, Visibility symbol_visibility,
|
||||
std::vector<uint32_t> &symbol_indexes);
|
||||
@ -112,8 +112,8 @@ class Symtab {
|
||||
Symbol *FindSymbolContainingFileAddress(lldb::addr_t file_addr);
|
||||
void ForEachSymbolContainingFileAddress(
|
||||
lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback);
|
||||
size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
|
||||
SymbolContextList &sc_list);
|
||||
void FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
|
||||
SymbolContextList &sc_list);
|
||||
void CalculateSymbolSizes();
|
||||
|
||||
void SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
|
||||
|
@ -9,7 +9,6 @@
|
||||
#ifndef liblldb_Type_h_
|
||||
#define liblldb_Type_h_
|
||||
|
||||
#include "lldb/Core/ClangForward.h"
|
||||
#include "lldb/Symbol/CompilerDecl.h"
|
||||
#include "lldb/Symbol/CompilerType.h"
|
||||
#include "lldb/Symbol/Declaration.h"
|
||||
@ -22,22 +21,28 @@
|
||||
#include <set>
|
||||
|
||||
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 {
|
||||
CompilerContext(CompilerContextKind t, ConstString n)
|
||||
: type(t), name(n) {}
|
||||
CompilerContext(CompilerContextKind t, ConstString n) : kind(t), name(n) {}
|
||||
|
||||
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;
|
||||
|
||||
CompilerContextKind type;
|
||||
CompilerContextKind kind;
|
||||
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>,
|
||||
public UserID {
|
||||
public:
|
||||
@ -117,8 +122,6 @@ class Type : public std::enable_shared_from_this<Type>, public UserID {
|
||||
SymbolFile *GetSymbolFile() { return m_symbol_file; }
|
||||
const SymbolFile *GetSymbolFile() const { return m_symbol_file; }
|
||||
|
||||
TypeList *GetTypeList();
|
||||
|
||||
ConstString GetName();
|
||||
|
||||
llvm::Optional<uint64_t> GetByteSize();
|
||||
|
@ -28,15 +28,14 @@ class TypeList {
|
||||
|
||||
void Dump(Stream *s, bool show_context);
|
||||
|
||||
// lldb::TypeSP
|
||||
// FindType(lldb::user_id_t uid);
|
||||
|
||||
TypeList FindTypes(ConstString name);
|
||||
|
||||
void Insert(const lldb::TypeSP &type);
|
||||
|
||||
uint32_t GetSize() const;
|
||||
|
||||
bool Empty() const { return !GetSize(); }
|
||||
|
||||
lldb::TypeSP GetTypeAtIndex(uint32_t idx);
|
||||
|
||||
typedef std::vector<lldb::TypeSP> collection;
|
||||
|
@ -14,8 +14,11 @@
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
#include "llvm/ADT/APSInt.h"
|
||||
#include "llvm/ADT/SmallBitVector.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
#include "lldb/Expression/Expression.h"
|
||||
@ -29,7 +32,24 @@ class PDBASTParser;
|
||||
|
||||
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 {
|
||||
public:
|
||||
// Intrusive type system that allows us to use llvm casting.
|
||||
@ -107,6 +127,8 @@ class TypeSystem : public PluginInterface {
|
||||
virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
|
||||
size_t arg_idx);
|
||||
|
||||
virtual CompilerType GetTypeForDecl(void *opaque_decl) = 0;
|
||||
|
||||
// CompilerDeclContext functions
|
||||
|
||||
virtual std::vector<CompilerDecl>
|
||||
@ -255,6 +277,8 @@ class TypeSystem : public PluginInterface {
|
||||
|
||||
// Exploring the type
|
||||
|
||||
virtual const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) = 0;
|
||||
|
||||
virtual llvm::Optional<uint64_t>
|
||||
GetBitSize(lldb::opaque_compiler_type_t type,
|
||||
ExecutionContextScope *exe_scope) = 0;
|
||||
@ -375,12 +399,6 @@ class TypeSystem : public PluginInterface {
|
||||
lldb::offset_t data_offset,
|
||||
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.
|
||||
|
||||
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,
|
||||
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;
|
||||
|
||||
@ -491,18 +511,15 @@ class TypeSystemMap {
|
||||
// callback to keep iterating, false to stop iterating.
|
||||
void ForEach(std::function<bool(TypeSystem *)> const &callback);
|
||||
|
||||
TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
|
||||
Module *module, bool can_create);
|
||||
llvm::Expected<TypeSystem &>
|
||||
GetTypeSystemForLanguage(lldb::LanguageType language, Module *module,
|
||||
bool can_create);
|
||||
|
||||
TypeSystem *GetTypeSystemForLanguage(lldb::LanguageType language,
|
||||
Target *target, bool can_create);
|
||||
llvm::Expected<TypeSystem &>
|
||||
GetTypeSystemForLanguage(lldb::LanguageType language, Target *target,
|
||||
bool can_create);
|
||||
|
||||
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;
|
||||
mutable std::mutex m_mutex; ///< A mutex to keep this object happy in
|
||||
///multi-threaded environments.
|
||||
|
@ -201,7 +201,8 @@ class UnwindPlan {
|
||||
unspecified, // not specified
|
||||
isRegisterPlusOffset, // FA = register + offset
|
||||
isRegisterDereferenced, // FA = [reg]
|
||||
isDWARFExpression // FA = eval(dwarf_expr)
|
||||
isDWARFExpression, // FA = eval(dwarf_expr)
|
||||
isRaSearch, // FA = SP + offset + ???
|
||||
};
|
||||
|
||||
FAValue() : m_type(unspecified), m_value() {}
|
||||
@ -214,6 +215,11 @@ class UnwindPlan {
|
||||
|
||||
bool IsUnspecified() const { return m_type == unspecified; }
|
||||
|
||||
void SetRaSearch(int32_t offset) {
|
||||
m_type = isRaSearch;
|
||||
m_value.ra_search_offset = offset;
|
||||
}
|
||||
|
||||
bool IsRegisterPlusOffset() const {
|
||||
return m_type == isRegisterPlusOffset;
|
||||
}
|
||||
@ -250,9 +256,14 @@ class UnwindPlan {
|
||||
ValueType GetValueType() const { return m_type; }
|
||||
|
||||
int32_t GetOffset() const {
|
||||
if (m_type == isRegisterPlusOffset)
|
||||
return m_value.reg.offset;
|
||||
return 0;
|
||||
switch (m_type) {
|
||||
case isRegisterPlusOffset:
|
||||
return m_value.reg.offset;
|
||||
case isRaSearch:
|
||||
return m_value.ra_search_offset;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void IncOffset(int32_t delta) {
|
||||
@ -304,6 +315,8 @@ class UnwindPlan {
|
||||
const uint8_t *opcodes;
|
||||
uint16_t length;
|
||||
} expr;
|
||||
// For m_type == isRaSearch
|
||||
int32_t ra_search_offset;
|
||||
} m_value;
|
||||
}; // class FAValue
|
||||
|
||||
@ -370,6 +383,7 @@ class UnwindPlan {
|
||||
m_return_addr_register(LLDB_INVALID_REGNUM), m_source_name(),
|
||||
m_plan_is_sourced_from_compiler(eLazyBoolCalculate),
|
||||
m_plan_is_valid_at_all_instruction_locations(eLazyBoolCalculate),
|
||||
m_plan_is_for_signal_trap(eLazyBoolCalculate),
|
||||
m_lsda_address(), m_personality_func_addr() {}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
void Clear() {
|
||||
@ -472,6 +497,7 @@ class UnwindPlan {
|
||||
m_source_name.Clear();
|
||||
m_plan_is_sourced_from_compiler = eLazyBoolCalculate;
|
||||
m_plan_is_valid_at_all_instruction_locations = eLazyBoolCalculate;
|
||||
m_plan_is_for_signal_trap = eLazyBoolCalculate;
|
||||
m_lsda_address.Clear();
|
||||
m_personality_func_addr.Clear();
|
||||
}
|
||||
@ -502,6 +528,7 @@ class UnwindPlan {
|
||||
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_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
|
||||
// module - used
|
||||
|
@ -27,6 +27,8 @@ class UnwindTable {
|
||||
|
||||
~UnwindTable();
|
||||
|
||||
lldb_private::CallFrameInfo *GetObjectFileUnwindInfo();
|
||||
|
||||
lldb_private::DWARFCallFrameInfo *GetEHFrameInfo();
|
||||
lldb_private::DWARFCallFrameInfo *GetDebugFrameInfo();
|
||||
|
||||
@ -71,6 +73,7 @@ class UnwindTable {
|
||||
bool m_initialized; // delay some initialization until ObjectFile is set up
|
||||
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_debug_frame_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:
|
||||
typedef RangeVector<lldb::addr_t, lldb::addr_t> RangeList;
|
||||
|
||||
// Constructors and Destructors
|
||||
Variable(lldb::user_id_t uid, const char *name,
|
||||
const char
|
||||
*mangled, // The mangled or fully qualified name of the variable.
|
||||
const lldb::SymbolFileTypeSP &symfile_type_sp,
|
||||
lldb::ValueType scope, SymbolContextScope *owner_scope,
|
||||
const RangeList &scope_range, Declaration *decl,
|
||||
const DWARFExpression &location, bool external, bool artificial,
|
||||
bool static_member = false);
|
||||
/// Constructors and Destructors.
|
||||
///
|
||||
/// \param 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, lldb::ValueType scope,
|
||||
SymbolContextScope *owner_scope, const RangeList &scope_range,
|
||||
Declaration *decl, const DWARFExpression &location, bool external,
|
||||
bool artificial, bool static_member = false);
|
||||
|
||||
virtual ~Variable();
|
||||
|
||||
@ -50,11 +49,11 @@ class Variable : public UserID, public std::enable_shared_from_this<Variable> {
|
||||
|
||||
SymbolContextScope *GetSymbolContextScope() const { return m_owner_scope; }
|
||||
|
||||
// Since a variable can have a basename "i" and also a mangled named
|
||||
// "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
|
||||
// namespace)::i", this function will allow a generic match function that can
|
||||
// be called by commands and expression parsers to make sure we match
|
||||
// anything we come across.
|
||||
/// Since a variable can have a basename "i" and also a mangled named
|
||||
/// "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous
|
||||
/// namespace)::i", this function will allow a generic match function that can
|
||||
/// be called by commands and expression parsers to make sure we match
|
||||
/// anything we come across.
|
||||
bool NameMatches(ConstString name) 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,
|
||||
ValueObjectList &valobj_list);
|
||||
|
||||
static size_t AutoComplete(const ExecutionContext &exe_ctx,
|
||||
CompletionRequest &request);
|
||||
static void AutoComplete(const ExecutionContext &exe_ctx,
|
||||
CompletionRequest &request);
|
||||
|
||||
CompilerDeclContext GetDeclContext();
|
||||
|
||||
CompilerDecl GetDecl();
|
||||
|
||||
protected:
|
||||
ConstString m_name; // The basename of the variable (no namespaces)
|
||||
Mangled m_mangled; // The mangled name of the variable
|
||||
lldb::SymbolFileTypeSP m_symfile_type_sp; // The type pointer of the variable
|
||||
// (int, struct, class, etc)
|
||||
lldb::ValueType m_scope; // global, parameter, local
|
||||
SymbolContextScope
|
||||
*m_owner_scope; // The symbol file scope that this variable was defined in
|
||||
RangeList m_scope_range; // The list of ranges inside the owner's scope where
|
||||
// this variable is valid
|
||||
Declaration m_declaration; // Declaration location for this item.
|
||||
DWARFExpression m_location; // The location of this variable that can be fed
|
||||
// to DWARFExpression::Evaluate()
|
||||
uint8_t m_external : 1, // Visible outside the containing compile unit?
|
||||
m_artificial : 1, // Non-zero if the variable is not explicitly declared
|
||||
// in source
|
||||
m_loc_is_const_data : 1, // The m_location expression contains the
|
||||
// constant variable value data, not a DWARF
|
||||
// location
|
||||
m_static_member : 1; // Non-zero if variable is static member of a class
|
||||
// or struct.
|
||||
/// The basename of the variable (no namespaces).
|
||||
ConstString m_name;
|
||||
/// The mangled name of the variable.
|
||||
Mangled m_mangled;
|
||||
/// The type pointer of the variable (int, struct, class, etc)
|
||||
/// global, parameter, local.
|
||||
lldb::SymbolFileTypeSP m_symfile_type_sp;
|
||||
lldb::ValueType m_scope;
|
||||
/// The symbol file scope that this variable was defined in
|
||||
SymbolContextScope *m_owner_scope;
|
||||
/// The list of ranges inside the owner's scope where this variable
|
||||
/// is valid.
|
||||
RangeList m_scope_range;
|
||||
/// Declaration location for this item.
|
||||
Declaration m_declaration;
|
||||
/// The location of this variable that can be fed to
|
||||
/// DWARFExpression::Evaluate().
|
||||
DWARFExpression m_location;
|
||||
/// Visible outside the containing compile unit?
|
||||
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:
|
||||
Variable(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 "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/MC/MCRegisterInfo.h"
|
||||
|
||||
// forward define the llvm::Type class
|
||||
namespace llvm {
|
||||
class Type;
|
||||
}
|
||||
@ -124,6 +124,8 @@ class ABI : public PluginInterface {
|
||||
return pc;
|
||||
}
|
||||
|
||||
llvm::MCRegisterInfo &GetMCRegisterInfo() { return *m_mc_register_info_up; }
|
||||
|
||||
virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0;
|
||||
|
||||
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);
|
||||
|
||||
protected:
|
||||
// Classes that inherit from ABI can see and modify these
|
||||
ABI(lldb::ProcessSP process_sp) {
|
||||
if (process_sp.get())
|
||||
m_process_wp = process_sp;
|
||||
ABI(lldb::ProcessSP process_sp, std::unique_ptr<llvm::MCRegisterInfo> info_up)
|
||||
: m_process_wp(process_sp), m_mc_register_info_up(std::move(info_up)) {
|
||||
assert(m_mc_register_info_up && "ABI must have MCRegisterInfo");
|
||||
}
|
||||
|
||||
/// 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;
|
||||
std::unique_ptr<llvm::MCRegisterInfo> m_mc_register_info_up;
|
||||
|
||||
private:
|
||||
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