22#include "llvm/BinaryFormat/Dwarf.h"
23#include "llvm/Support/Threading.h"
32#define LLDB_PROPERTIES_language
33#include "TargetProperties.inc"
36#define LLDB_PROPERTIES_language
37#include "TargetPropertiesEnum.inc"
46 static constexpr llvm::StringLiteral g_setting_name(
"language");
47 return g_setting_name;
56 const uint32_t idx = ePropertyEnableFilterForLineBreakpoints;
57 return GetPropertyAtIndexAs<bool>(
58 idx, g_language_properties[idx].default_uint_value != 0);
63 static llvm::once_flag g_initialize;
65 llvm::call_once(g_initialize, [] {
73 static std::mutex *g_mutex =
nullptr;
74 static llvm::once_flag g_initialize;
76 llvm::call_once(g_initialize, [] {
77 g_mutex =
new std::mutex();
87 auto iter = map.find(language), end = map.end();
89 return iter->second.get();
94 for (uint32_t idx = 0;
98 language_ptr = create_callback(language);
101 map[language] = std::unique_ptr<Language>(language_ptr);
122 llvm::StringRef file_path) {
134 static llvm::once_flag g_initialize;
135 llvm::call_once(g_initialize, [] {
145 std::vector<Language *> loaded_plugins;
149 for (
const auto &entry : map) {
151 loaded_plugins.push_back(entry.second.get());
155 for (
auto *lang : loaded_plugins) {
178std::vector<FormattersMatchCandidate>
233 {
"<invalid language>",
259 if (
string.equals_insensitive(L.name))
274 llvm::StringRef prefix,
275 llvm::StringRef suffix) {
279 if (supported[lang.type])
280 s << prefix << lang.name << suffix;
285 const char *suffix) {
416 std::set<lldb::LanguageType> supported_languages;
421 return supported_languages;
454 size_t old_size = results.size();
456 if (this->
Find_Impl(exe_scope, key, results))
457 return results.size() - old_size;
470 images.FindTypes(
nullptr, query, type_results);
473 CompilerType compiler_type(match->GetFullCompilerType());
474 compiler_type = AdjustForInclusion(compiler_type);
477 std::unique_ptr<Language::TypeScavenger::Result> scavengeresult(
478 new Result(compiler_type));
479 results.insert(std::move(scavengeresult));
488std::pair<llvm::StringRef, llvm::StringRef>
490 return std::pair<llvm::StringRef, llvm::StringRef>();
528 s.
Printf(
"Exception breakpoint (catch: %s throw: %s)",
529 catch_on ?
"on" :
"off", throw_on ?
"on" :
"off");
533 return llvm::StringSwitch<std::optional<bool>>(str)
534 .Case(
"true", {
true})
535 .Case(
"false", {
false})
547 llvm::dwarf::toDW_LNAME((llvm::dwarf::SourceLanguage)language_type);
551 version = lname->second;
555 if (
auto lang = llvm::dwarf::toDW_LANG((llvm::dwarf::SourceLanguageName)name,
565 return llvm::dwarf::LanguageDescription(
566 (llvm::dwarf::SourceLanguageName)name);
571 return name == llvm::dwarf::DW_LNAME_ObjC;
575 return name == llvm::dwarf::DW_LNAME_C_plus_plus;
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.
static llvm::StringRef GetSettingName()
bool GetEnableFilterForLineBreakpoints() const
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::optional< bool > GetBooleanFromString(llvm::StringRef str) const
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()
static LanguageProperties & GetGlobalLanguageProperties()
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()
lldb::OptionValuePropertiesSP m_collection_sp
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.
TypeIterable Types() const
A class that contains all state required for type lookups.
This class tracks the state and results of a TypeQuery.
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).
lldb::LanguageType AsLanguageType() const
llvm::StringRef GetDescription() const