LLDB mainline
|
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/DumpRegisterValue.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/DataFormatters/FormatClasses.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/Expression/ExpressionVariable.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/ExecutionContextScope.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/AnsiTerminal.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/CompletionRequest.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/Status.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/StringList.h"
#include "lldb/Utility/StructuredData.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-forward.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Regex.h"
#include "llvm/TargetParser/Triple.h"
#include <cctype>
#include <cinttypes>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <memory>
#include <type_traits>
#include <utility>
Go to the source code of this file.
Namespaces | |
namespace | lldb_private |
A class that represents a running process on the host machine. | |
Macros | |
#define | _TO_STR2(_val) #_val |
#define | _TO_STR(_val) _TO_STR2(_val) |
#define | ENUM_TO_CSTR(eee) |
Typedefs | |
using | Definition = lldb_private::FormatEntity::Entry::Definition |
using | Entry = FormatEntity::Entry |
using | EntryType = FormatEntity::Entry::Type |
Enumerations | |
enum | FileKind { FileError = 0 , Basename , Dirname , Fullpath } |
Functions | |
template<typename T > | |
static bool | RunScriptFormatKeyword (Stream &s, const SymbolContext *sc, const ExecutionContext *exe_ctx, T t, const char *script_function_name) |
static bool | DumpAddressAndContent (Stream &s, const SymbolContext *sc, const ExecutionContext *exe_ctx, const Address &addr, bool print_file_addr_or_load_addr) |
static bool | DumpAddressOffsetFromFunction (Stream &s, const SymbolContext *sc, const ExecutionContext *exe_ctx, const Address &format_addr, bool concrete_only, bool no_padding, bool print_zero_offsets) |
static bool | ScanBracketedRange (llvm::StringRef subpath, size_t &close_bracket_index, const char *&var_name_final_if_array_range, int64_t &index_lower, int64_t &index_higher) |
static bool | DumpFile (Stream &s, const FileSpec &file, FileKind file_kind) |
static bool | DumpRegister (Stream &s, StackFrame *frame, RegisterKind reg_kind, uint32_t reg_num, Format format) |
static ValueObjectSP | ExpandIndexedExpression (ValueObject *valobj, size_t index, bool deref_pointer) |
static char | ConvertValueObjectStyleToChar (ValueObject::ValueObjectRepresentationStyle style) |
static bool | DumpValueWithLLVMFormat (Stream &s, llvm::StringRef options, ValueObject &valobj) |
static bool | DumpValue (Stream &s, const SymbolContext *sc, const ExecutionContext *exe_ctx, const FormatEntity::Entry &entry, ValueObject *valobj) |
static bool | DumpRegister (Stream &s, StackFrame *frame, const char *reg_name, Format format) |
static bool | FormatThreadExtendedInfoRecurse (const FormatEntity::Entry &entry, const StructuredData::ObjectSP &thread_info_dictionary, const SymbolContext *sc, const ExecutionContext *exe_ctx, Stream &s) |
static bool | IsToken (const char *var_name_begin, const char *var) |
static std::pair< char const *, char const * > | ParseBaseName (char const *full_name) |
Parses the basename out of a demangled function name that may include function arguments. | |
static void | PrettyPrintFunctionNameWithArgs (Stream &out_stream, char const *full_name, ExecutionContextScope *exe_scope, VariableList const &args) |
Writes out the function name in 'full_name' to 'out_stream' but replaces each argument type with the variable name and the corresponding pretty-printed value. | |
static void | FormatInlinedBlock (Stream &out_stream, Block *block) |
static bool | DumpCommaSeparatedChildEntryNames (Stream &s, const Definition *parent) |
static Status | ParseEntry (const llvm::StringRef &format_str, const Definition *parent, FormatEntity::Entry &entry) |
static const Definition * | FindEntry (const llvm::StringRef &format_str, const Definition *parent, llvm::StringRef &remainder) |
static Status | ParseInternal (llvm::StringRef &format, Entry &parent_entry, uint32_t depth) |
static std::string | MakeMatch (const llvm::StringRef &prefix, const char *suffix) |
static void | AddMatches (const Definition *def, const llvm::StringRef &prefix, const llvm::StringRef &match_prefix, StringList &matches) |
Variables | |
constexpr Definition | g_string_entry [] |
constexpr Definition | g_addr_entries [] |
constexpr Definition | g_file_child_entries [] |
constexpr Definition | g_frame_child_entries [] |
constexpr Definition | g_function_child_entries [] |
constexpr Definition | g_line_child_entries [] |
constexpr Definition | g_module_child_entries [] |
constexpr Definition | g_process_child_entries [] |
constexpr Definition | g_svar_child_entries [] |
constexpr Definition | g_var_child_entries [] |
constexpr Definition | g_thread_child_entries [] |
constexpr Definition | g_target_child_entries [] |
constexpr Definition | g_ansi_fg_entries [] |
constexpr Definition | g_ansi_bg_entries [] |
constexpr Definition | g_ansi_entries [] |
constexpr Definition | g_script_child_entries [] |
constexpr Definition | g_top_level_entries [] |
constexpr Definition | g_root |
static llvm::Regex | LLVMFormatPattern {"x[-+]?\\d*|n|d", llvm::Regex::IgnoreCase} |
Options supported by format_provider<T> for integral arithmetic types. | |
#define _TO_STR | ( | _val | ) | _TO_STR2(_val) |
Definition at line 168 of file FormatEntity.cpp.
#define _TO_STR2 | ( | _val | ) | #_val |
Definition at line 167 of file FormatEntity.cpp.
#define ENUM_TO_CSTR | ( | eee | ) |
Definition at line 290 of file FormatEntity.cpp.
Definition at line 82 of file FormatEntity.cpp.
using Entry = FormatEntity::Entry |
Definition at line 83 of file FormatEntity.cpp.
using EntryType = FormatEntity::Entry::Type |
Definition at line 84 of file FormatEntity.cpp.
enum FileKind |
Enumerator | |
---|---|
FileError | |
Basename | |
Dirname | |
Fullpath |
Definition at line 86 of file FormatEntity.cpp.
|
static |
Definition at line 2375 of file FormatEntity.cpp.
References lldb_private::StringList::AppendString(), lldb_private::FormatEntity::Entry::Definition::children, MakeMatch(), lldb_private::FormatEntity::Entry::Definition::name, and lldb_private::FormatEntity::Entry::Definition::num_children.
Referenced by lldb_private::FormatEntity::AutoComplete().
|
static |
Definition at line 639 of file FormatEntity.cpp.
References lldb_private::ValueObject::eValueObjectRepresentationStyleChildrenCount, lldb_private::ValueObject::eValueObjectRepresentationStyleExpressionPath, lldb_private::ValueObject::eValueObjectRepresentationStyleLanguageSpecific, lldb_private::ValueObject::eValueObjectRepresentationStyleLocation, lldb_private::ValueObject::eValueObjectRepresentationStyleName, lldb_private::ValueObject::eValueObjectRepresentationStyleSummary, lldb_private::ValueObject::eValueObjectRepresentationStyleType, and lldb_private::ValueObject::eValueObjectRepresentationStyleValue.
Referenced by DumpValue().
|
static |
Definition at line 408 of file FormatEntity.cpp.
References lldb_private::Address::Dump(), lldb_private::Address::DumpStyleLoadAddress, lldb_private::Address::DumpStyleModuleWithFileAddress, lldb_private::ArchSpec::GetAddressByteSize(), lldb_private::Target::GetArchitecture(), lldb_private::ExecutionContext::GetBestExecutionContextScope(), lldb_private::Address::GetFileAddress(), lldb_private::Address::GetLoadAddress(), lldb_private::Target::GetSectionLoadList(), lldb_private::Target::GetTargetFromContexts(), lldb_private::SectionLoadList::IsEmpty(), LLDB_INVALID_ADDRESS, and lldb_private::Stream::Printf().
Referenced by lldb_private::FormatEntity::Format().
|
static |
Definition at line 440 of file FormatEntity.cpp.
References lldb_private::SymbolContext::block, lldb_private::SymbolContext::function, lldb_private::Function::GetAddressRange(), lldb_private::Symbol::GetAddressRef(), lldb_private::AddressRange::GetBaseAddress(), lldb_private::Block::GetContainingInlinedBlock(), lldb_private::Address::GetFileAddress(), lldb_private::Address::GetLoadAddress(), lldb_private::Block::GetRangeContainingAddress(), lldb_private::Address::GetSection(), lldb_private::Target::GetTargetFromContexts(), lldb_private::Address::IsValid(), lldb_private::Stream::Printf(), lldb_private::SymbolContext::symbol, and lldb_private::Symbol::ValueIsAddress().
Referenced by lldb_private::FormatEntity::Format().
|
static |
Definition at line 1905 of file FormatEntity.cpp.
References lldb_private::FormatEntity::Entry::Definition::children, lldb_private::FormatEntity::Entry::Definition::name, lldb_private::FormatEntity::Entry::Definition::num_children, lldb_private::Stream::Printf(), and lldb_private::Stream::PutCString().
Referenced by ParseEntry().
Definition at line 559 of file FormatEntity.cpp.
References lldb_private::FileSpec::GetDirectory(), and lldb_private::FileSpec::GetFilename().
Referenced by lldb_private::FormatEntity::Format().
|
static |
Definition at line 1013 of file FormatEntity.cpp.
References lldb_private::DumpRegisterValue(), lldb_private::StackFrame::GetRegisterContext(), lldb_private::RegisterContext::GetRegisterInfoByName(), and lldb_private::RegisterContext::ReadRegister().
|
static |
Definition at line 588 of file FormatEntity.cpp.
References lldb_private::RegisterContext::ConvertRegisterKindToRegisterNumber(), lldb_private::DumpRegisterValue(), lldb_private::StackFrame::GetRegisterContext(), lldb_private::RegisterContext::GetRegisterInfoAtIndex(), LLDB_INVALID_REGNUM, and lldb_private::RegisterContext::ReadRegister().
Referenced by lldb_private::FormatEntity::Format().
|
static |
Definition at line 693 of file FormatEntity.cpp.
References lldb_private::ConstString::AsCString(), ConvertValueObjectStyleToChar(), lldb_private::DataFormatters, lldb_private::FormatEntity::Entry::deref, lldb_private::ValueObject::Dereference(), lldb_private::ValueObject::GetValueForExpressionPathOptions::DoAllowBitfieldSyntax(), lldb_private::ValueObject::GetValueForExpressionPathOptions::DoAllowFragileIVar(), lldb_private::ValueObject::GetValueForExpressionPathOptions::DontCheckDotVsArrowSyntax(), lldb_private::ValueObject::DumpPrintableRepresentation(), DumpValueWithLLVMFormat(), lldb_private::ValueObject::eDisable, lldb_private::ValueObject::eExpressionPathAftermathDereference, lldb_private::ValueObject::eExpressionPathAftermathNothing, lldb_private::ValueObject::eExpressionPathEndResultTypeBoundedRange, lldb_private::ValueObject::eExpressionPathEndResultTypePlain, lldb_private::ValueObject::eExpressionPathEndResultTypeUnboundedRange, lldb_private::ValueObject::eExpressionPathScanEndReasonEndOfString, lldb::eFormatDefault, lldb::eFormatInvalid, lldb::eFormatterMatchExact, error(), lldb_private::ValueObject::eValueObjectRepresentationStyleSummary, lldb_private::ValueObject::eValueObjectRepresentationStyleValue, ExpandIndexedExpression(), lldb_private::FormatEntity::Entry::fmt, lldb_private::FormatEntity::FormatStringRef(), lldb_private::ValueObject::GetBitfieldBitSize(), lldb_private::ValueObject::GetCompilerType(), lldb_private::ConstString::GetCString(), lldb_private::ValueObject::GetDynamicValueType(), lldb_private::FormatManager::GetFormatAsCString(), lldb_private::FormatManager::GetFormatAsFormatChar(), lldb_private::ValueObject::GetLocationAsCString(), lldb_private::GetLog(), lldb_private::ValueObject::GetNumChildrenIgnoringErrors(), lldb_private::ValueObject::GetQualifiedRepresentationIfAvailable(), lldb_private::StreamString::GetString(), lldb_private::DataVisualization::GetSummaryForType(), lldb_private::ValueObject::GetSyntheticValue(), lldb_private::ValueObject::GetTargetSP(), lldb_private::ValueObject::GetTypeInfo(), lldb_private::CompilerType::GetTypeInfo(), lldb_private::ValueObject::GetTypeName(), lldb_private::ValueObject::GetValueForExpressionPath(), lldb_private::ValueObject::HasSpecialPrintableRepresentation(), lldb_private::CompilerType::IsAggregateType(), lldb_private::ValueObject::IsBitfield(), lldb_private::ValueObject::IsSynthetic(), LLDB_LOG, LLDB_LOGF, lldb_private::FormatEntity::Entry::number, lldb_private::Stream::Printf(), lldb_private::FormatEntity::Entry::printf_format, lldb_private::Stream::PutChar(), lldb_private::Stream::PutCString(), RunScriptFormatKeyword(), ScanBracketedRange(), lldb_private::FormatEntity::Entry::ScriptVariable, lldb_private::FormatEntity::Entry::ScriptVariableSynthetic, lldb_private::ValueObject::GetValueForExpressionPathOptions::SetSyntheticChildrenTraversal(), lldb_private::FormatEntity::Entry::string, lldb_private::FormatEntity::Entry::type, lldb_private::FormatEntity::Entry::Variable, and lldb_private::FormatEntity::Entry::VariableSynthetic.
Referenced by lldb_private::FormatEntity::Format().
|
static |
Definition at line 666 of file FormatEntity.cpp.
References lldb_private::ValueObject::GetTypeInfo(), lldb_private::ValueObject::GetValueAsSigned(), lldb_private::ValueObject::GetValueAsUnsigned(), integer, LLVMFormatPattern, and lldb_private::Stream::Write().
Referenced by DumpValue().
|
static |
Definition at line 612 of file FormatEntity.cpp.
References lldb_private::DataFormatters, lldb_private::ValueObject::eExpressionPathAftermathDereference, lldb_private::ValueObject::eExpressionPathAftermathNothing, lldb_private::GetLog(), lldb_private::ValueObject::GetValueForExpressionPath(), LLDB_LOG, and LLDB_LOGF.
Referenced by DumpValue().
|
static |
Definition at line 2003 of file FormatEntity.cpp.
References lldb_private::FormatEntity::Entry::Definition::children, error(), FindEntry(), lldb_private::FormatEntity::Entry::Definition::name, and lldb_private::FormatEntity::Entry::Definition::num_children.
Referenced by lldb_private::FormatEntity::AutoComplete(), and FindEntry().
Definition at line 1138 of file FormatEntity.cpp.
References lldb_private::Block::GetContainingInlinedBlock(), lldb_private::Block::GetInlinedFunctionInfo(), and lldb_private::Stream::PutCString().
Referenced by lldb_private::FormatEntity::Format().
|
static |
Definition at line 1032 of file FormatEntity.cpp.
References lldb::eStructuredDataTypeArray, lldb::eStructuredDataTypeDictionary, lldb::eStructuredDataTypeFloat, lldb::eStructuredDataTypeInteger, lldb::eStructuredDataTypeString, lldb_private::Stream::Format(), lldb_private::Stream::Printf(), lldb_private::FormatEntity::Entry::printf_format, and lldb_private::FormatEntity::Entry::string.
Referenced by lldb_private::FormatEntity::Format().
|
inlinestatic |
Definition at line 1069 of file FormatEntity.cpp.
Referenced by ParseBaseName().
|
static |
Definition at line 2368 of file FormatEntity.cpp.
Referenced by AddMatches(), and lldb_private::FormatEntity::AutoComplete().
|
static |
Parses the basename out of a demangled function name that may include function arguments.
Supports template functions.
Returns pointers to the opening and closing parenthesis of full_name
. Can return nullptr for either parenthesis if none is exists.
Definition at line 1081 of file FormatEntity.cpp.
References IsToken().
Referenced by PrettyPrintFunctionNameWithArgs().
|
static |
Definition at line 1919 of file FormatEntity.cpp.
References lldb_private::FormatEntity::Entry::Definition::children, lldb_private::FormatEntity::Entry::Definition::data, DumpCommaSeparatedChildEntryNames(), error(), lldb_private::FormatEntity::Entry::EscapeCode, lldb_private::StreamString::GetData(), lldb_private::FormatEntity::Entry::Invalid, lldb_private::FormatEntity::Entry::Definition::keep_separator, lldb_private::FormatEntity::Entry::Definition::name, lldb_private::FormatEntity::Entry::Definition::num_children, lldb_private::FormatEntity::Entry::number, lldb_private::FormatEntity::Entry::ParentNumber, lldb_private::FormatEntity::Entry::ParentString, ParseEntry(), lldb_private::Stream::Printf(), lldb_private::FormatEntity::Entry::Root, lldb_private::FormatEntity::Entry::Definition::string, lldb_private::FormatEntity::Entry::string, lldb_private::FormatEntity::Entry::Definition::type, and lldb_private::FormatEntity::Entry::type.
Referenced by ParseEntry(), and ParseInternal().
|
static |
Definition at line 2033 of file FormatEntity.cpp.
References lldb_private::FormatEntity::Entry::AppendChar(), lldb_private::FormatEntity::Entry::AppendEntry(), lldb_private::FormatEntity::Entry::AppendText(), lldb_private::FormatEntity::Entry::deref, error(), lldb_private::ValueObject::eValueObjectRepresentationStyleChildrenCount, lldb_private::ValueObject::eValueObjectRepresentationStyleExpressionPath, lldb_private::ValueObject::eValueObjectRepresentationStyleLanguageSpecific, lldb_private::ValueObject::eValueObjectRepresentationStyleLocation, lldb_private::ValueObject::eValueObjectRepresentationStyleName, lldb_private::ValueObject::eValueObjectRepresentationStyleSummary, lldb_private::ValueObject::eValueObjectRepresentationStyleType, lldb_private::ValueObject::eValueObjectRepresentationStyleValue, lldb_private::FormatEntity::ExtractVariableInfo(), lldb_private::FormatEntity::Entry::fmt, g_root, lldb_private::FormatManager::GetFormatFromCString(), LLVMFormatPattern, lldb_private::FormatEntity::Entry::number, ParseEntry(), ParseInternal(), lldb_private::FormatEntity::Entry::printf_format, lldb_private::FormatEntity::Entry::Scope, lldb_private::FormatEntity::Entry::string, lldb_private::FormatEntity::Entry::ThreadID, lldb_private::FormatEntity::Entry::ThreadProtocolID, lldb_private::FormatEntity::Entry::type, lldb_private::FormatEntity::Entry::Variable, and lldb_private::FormatEntity::Entry::VariableSynthetic.
Referenced by lldb_private::FormatEntity::Parse(), and ParseInternal().
|
static |
Writes out the function name in 'full_name' to 'out_stream' but replaces each argument type with the variable name and the corresponding pretty-printed value.
Definition at line 1118 of file FormatEntity.cpp.
References ParseBaseName(), lldb_private::FormatEntity::PrettyPrintFunctionArguments(), lldb_private::Stream::PutChar(), lldb_private::Stream::PutCString(), and lldb_private::Stream::Write().
Referenced by lldb_private::FormatEntity::Format(), and lldb_private::CPlusPlusLanguage::GetFunctionDisplayName().
|
static |
Definition at line 383 of file FormatEntity.cpp.
References error(), lldb_private::Target::GetDebugger(), lldb_private::Debugger::GetScriptInterpreter(), lldb_private::Target::GetTargetFromContexts(), lldb_private::Stream::Printf(), and lldb_private::ScriptInterpreter::RunScriptFormatKeyword().
Referenced by DumpValue(), and lldb_private::FormatEntity::Format().
|
static |
Definition at line 501 of file FormatEntity.cpp.
References lldb_private::DataFormatters, lldb_private::GetLog(), and LLDB_LOGF.
Referenced by DumpValue().
|
constexpr |
Definition at line 91 of file FormatEntity.cpp.
|
constexpr |
Definition at line 186 of file FormatEntity.cpp.
|
constexpr |
Definition at line 202 of file FormatEntity.cpp.
|
constexpr |
Definition at line 170 of file FormatEntity.cpp.
|
constexpr |
Definition at line 95 of file FormatEntity.cpp.
|
constexpr |
Definition at line 100 of file FormatEntity.cpp.
|
constexpr |
Definition at line 112 of file FormatEntity.cpp.
|
constexpr |
Definition at line 127 of file FormatEntity.cpp.
|
constexpr |
Definition at line 136 of file FormatEntity.cpp.
|
constexpr |
Definition at line 139 of file FormatEntity.cpp.
|
constexpr |
Definition at line 262 of file FormatEntity.cpp.
Referenced by lldb_private::FormatEntity::AutoComplete(), and ParseInternal().
|
constexpr |
Definition at line 223 of file FormatEntity.cpp.
|
constexpr |
Definition at line 88 of file FormatEntity.cpp.
|
constexpr |
Definition at line 145 of file FormatEntity.cpp.
|
constexpr |
Definition at line 164 of file FormatEntity.cpp.
|
constexpr |
Definition at line 151 of file FormatEntity.cpp.
|
constexpr |
Definition at line 232 of file FormatEntity.cpp.
|
constexpr |
Definition at line 148 of file FormatEntity.cpp.
|
static |
Options supported by format_provider<T> for integral arithmetic types.
See table in FormatProviders.h.
Definition at line 664 of file FormatEntity.cpp.
Referenced by DumpValueWithLLVMFormat(), and ParseInternal().