21#include "llvm/Support/Threading.h"
32 static llvm::once_flag g_initialize;
34 llvm::call_once(g_initialize, [] {
42 static std::mutex *g_mutex =
nullptr;
43 static llvm::once_flag g_initialize;
45 llvm::call_once(g_initialize, [] {
46 g_mutex =
new std::mutex();
56 auto iter = map.find(language), end = map.end();
58 return iter->second.get();
63 for (uint32_t idx = 0;
67 language_ptr = create_callback(language);
70 map[language] = std::unique_ptr<Language>(language_ptr);
91 llvm::StringRef file_path) {
103 static llvm::once_flag g_initialize;
104 llvm::call_once(g_initialize, [] {
114 std::vector<Language *> loaded_plugins;
118 for (
const auto &entry : map) {
120 loaded_plugins.push_back(entry.second.get());
124 for (
auto *lang : loaded_plugins) {
147std::vector<FormattersMatchCandidate>
202 {
"<invalid language>",
228 if (
string.equals_insensitive(L.name))
243 llvm::StringRef prefix,
244 llvm::StringRef suffix) {
248 if (supported[lang.type])
249 s << prefix << lang.name << suffix;
254 const char *suffix) {
385 std::set<lldb::LanguageType> supported_languages;
390 return supported_languages;
423 size_t old_size = results.size();
425 if (this->
Find_Impl(exe_scope, key, results))
426 return results.size() - old_size;
438 llvm::DenseSet<SymbolFile *> searched_sym_files;
442 for (
const auto &match : matches.
Types()) {
444 CompilerType compiler_type(match->GetFullCompilerType());
445 compiler_type = AdjustForInclusion(compiler_type);
448 std::unique_ptr<Language::TypeScavenger::Result> scavengeresult(
449 new Result(compiler_type));
450 results.insert(std::move(scavengeresult));
459std::pair<llvm::StringRef, llvm::StringRef>
461 return std::pair<llvm::StringRef, llvm::StringRef>();
499 s.
Printf(
"Exception breakpoint (catch: %s throw: %s)",
500 catch_on ?
"on" :
"off", throw_on ?
"on" :
"off");
static llvm::raw_ostream & error(Stream &strm)
struct language_name_pair language_names[]
std::map< lldb::LanguageType, LanguageUP > LanguagesMap
static LanguagesMap & GetLanguagesMap()
static uint32_t num_languages
static std::mutex & GetLanguagesMutex()
std::unique_ptr< Language > LanguageUP
Generic representation of a type in a programming language.
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
std::function< bool(ConstString, ConstString, const DumpValueObjectOptions &, Stream &)> DeclPrintingHelper
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
virtual lldb::TargetSP CalculateTarget()=0
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A class that describes a function.
bool Find_Impl(ExecutionContextScope *exe_scope, const char *key, ResultSet &results) override
std::set< std::unique_ptr< Result > > ResultSet
virtual bool Find_Impl(ExecutionContextScope *exe_scope, const char *key, ResultSet &results)=0
size_t Find(ExecutionContextScope *exe_scope, const char *key, ResultSet &results, bool append=true)
virtual bool IsSourceFile(llvm::StringRef file_path) const =0
static void PrintSupportedLanguagesForExpressions(Stream &s, llvm::StringRef prefix, llvm::StringRef suffix)
Prints to the specified stream 's' each language type that the current target supports for expression...
static LanguageSet GetLanguagesSupportingREPLs()
static LanguageSet GetLanguagesSupportingTypeSystems()
virtual std::vector< FormattersMatchCandidate > GetPossibleFormattersMatches(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
FunctionNameRepresentation
virtual lldb::TypeCategoryImplSP GetFormatters()
static Language * FindPlugin(lldb::LanguageType language)
static const char * GetNameForLanguageType(lldb::LanguageType language)
virtual DumpValueObjectOptions::DeclPrintingHelper GetDeclPrintingHelper()
virtual LazyBool IsLogicalTrue(ValueObject &valobj, Status &error)
virtual const char * GetLanguageSpecificTypeLookupHelp()
virtual std::pair< llvm::StringRef, llvm::StringRef > GetFormatterPrefixSuffix(llvm::StringRef type_hint)
An individual data formatter may apply to several types and cross language boundaries.
static bool LanguageIsC(lldb::LanguageType language)
virtual lldb::LanguageType GetLanguageType() const =0
virtual HardcodedFormatters::HardcodedSummaryFinder GetHardcodedSummaries()
static void GetDefaultExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s)
virtual bool DemangledNameContainsPath(llvm::StringRef path, ConstString demangled) const
static bool LanguageIsCPlusPlus(lldb::LanguageType language)
static lldb::LanguageType GetPrimaryLanguage(lldb::LanguageType language)
static bool LanguageIsPascal(lldb::LanguageType language)
virtual bool IsNilReference(ValueObject &valobj)
static void ForAllLanguages(std::function< bool(lldb::LanguageType)> callback)
virtual bool IsUninitializedReference(ValueObject &valobj)
virtual bool GetFunctionDisplayName(const SymbolContext *sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s)
static void PrintAllLanguages(Stream &s, const char *prefix, const char *suffix)
virtual HardcodedFormatters::HardcodedSyntheticFinder GetHardcodedSynthetics()
virtual std::unique_ptr< TypeScavenger > GetTypeScavenger()
static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions()
virtual bool IsTopLevelFunction(Function &function)
virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s)
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
static void ForEach(std::function< bool(Language *)> callback)
static bool LanguageIsCFamily(lldb::LanguageType language)
Equivalent to LanguageIsC||LanguageIsObjC||LanguageIsCPlusPlus.
static std::set< lldb::LanguageType > GetSupportedLanguages()
virtual HardcodedFormatters::HardcodedFormatFinder GetHardcodedFormats()
static bool LanguageIsObjC(lldb::LanguageType language)
static LanguageSet GetAllTypeSystemSupportedLanguagesForExpressions()
static LanguageSet GetREPLAllTypeSystemSupportedLanguages()
static LanguageCreateInstance GetLanguageCreateCallbackAtIndex(uint32_t idx)
static LanguageSet GetAllTypeSystemSupportedLanguagesForTypes()
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Defines a symbol context baton that can be handed other debug core functions.
const ModuleList & GetImages() const
Get accessor for the images for this process.
TypeList FindTypes(ConstString name)
A class that represents a running process on the host machine.
Language *(* LanguageCreateInstance)(lldb::LanguageType language)
LanguageType
Programming language type.
@ eLanguageTypeC_plus_plus_20
ISO C++:2020.
@ eLanguageTypeC_plus_plus_14
ISO C++:2014.
@ eLanguageTypeHaskell
Haskell.
@ eLanguageTypeRenderScript
@ eLanguageTypePLI
ANSI PL/I:1976.
@ eLanguageTypeC11
ISO C:2011.
@ eLanguageTypeFortran08
ISO Fortran 2008.
@ eLanguageTypeC99
ISO C:1999.
@ eLanguageTypePascal83
ISO Pascal:1983.
@ eLanguageTypeModula3
Modula 3.
@ eLanguageTypeModula2
ISO Modula-2:1996.
@ eLanguageTypeOCaml
OCaml.
@ eLanguageTypeMipsAssembler
Mips_Assembler.
@ eLanguageTypeC_plus_plus_03
ISO C++:2003.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeFortran95
ISO Fortran 95.
@ eLanguageTypeC_plus_plus_17
ISO C++:2017.
@ eLanguageTypeObjC_plus_plus
Objective-C++.
@ eLanguageTypeC_plus_plus_11
ISO C++:2011.
@ eLanguageTypeSwift
Swift.
@ eLanguageTypeC89
ISO C:1989.
@ eLanguageTypeAda83
ISO Ada:1983.
@ eLanguageTypeJulia
Julia.
@ eLanguageTypeFortran77
ISO Fortran 77.
@ eLanguageTypeCobol85
ISO Cobol:1985.
@ eLanguageTypeUPC
Unified Parallel C.
@ eLanguageTypeC
Non-standardized C, such as K&R.
@ eLanguageTypeAda95
ISO Ada:1995.
@ eLanguageTypeCobol74
ISO Cobol:1974.
@ eLanguageTypePython
Python.
@ eLanguageTypeOpenCL
OpenCL.
@ eLanguageTypeFortran90
ISO Fortran 90.
@ eLanguageTypeObjC
Objective-C.
@ eLanguageTypeC_plus_plus
ISO C++:1998.
@ eLanguageTypeDylan
Dylan.
@ eLanguageTypeFortran03
ISO Fortran 2003.
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
A SmallBitVector that represents a set of source languages (lldb::LanguageType).