31using namespace llvm::dwarf;
49 if (sc_parent_tag == DW_TAG_compile_unit ||
50 sc_parent_tag == DW_TAG_partial_unit) {
52 }
else if (!sc.
function && sc_parent_die) {
53 symbol_context_scope =
55 if (symbol_context_scope ==
nullptr)
58 symbol_context_scope = sc.
module_sp.get();
61 if (symbol_context_scope !=
nullptr)
62 type_sp->SetSymbolContextScope(symbol_context_scope);
74 if (die.Tag() != DW_TAG_formal_parameter ||
75 die.GetAttributeValueAsUnsigned(DW_AT_artificial, 0))
79 Type *type = die.ResolveTypeUID(param_type_die);
83 param_names.emplace_back(die.GetName());
86 assert(param_names.size() == param_types.size());
94 *type_is_new_ptr =
false;
102 dwarf->GetObjectFile()->GetModule()->LogMessage(
104 "DWARFASTParserFortran::ParseTypeFromDWARF (die = 0x%8.8x) %s name"
115 return type_ptr->shared_from_this();
121 *type_is_new_ptr =
true;
124 const char *type_name_cstr =
nullptr;
130 llvm::dwarf::TypeKind encoding =
static_cast<llvm::dwarf::TypeKind
>(0x00);
133 case DW_TAG_base_type: {
136 uint64_t bit_size = 0;
137 for (
size_t idx = 0; idx < attributes.
Size(); idx++) {
144 if (type_name_cstr && type_name_cstr[0] !=
'\0')
145 type_name.
SetString(llvm::StringRef(type_name_cstr).upper());
151 encoding =
static_cast<llvm::dwarf::TypeKind
>(form_value.
Unsigned());
153 case DW_AT_byte_size:
154 bit_size = form_value.
Unsigned() * 8;
165 compiler_type =
m_ast.CreateBaseType(encoding, bit_size, type_name);
167 dwarf->MakeType(die.
GetID(), type_name, llvm::divideCeil(bit_size, 8),
172 case DW_TAG_subprogram:
173 case DW_TAG_subroutine_type: {
177 size_t num_attr = attributes.
Size();
179 for (
size_t i = 0; i < num_attr; ++i) {
184 const char *type_name_cstr = form_value.
AsCString();
185 if (type_name_cstr && type_name_cstr[0] !=
'\0')
188 type_name.
SetCString(
"UNKNOWN_FORTRAN_FUNCTION");
195 return_type = resolved_type->GetForwardCompilerType();
204 llvm::SmallVector<CompilerType, 4> param_types;
205 llvm::SmallVector<llvm::StringRef, 4> param_names;
208 compiler_type =
m_ast.CreateFortranFunction(type_name, param_types,
209 param_names, return_type);
211 type_sp =
dwarf->MakeType(die.
GetID(), type_name, 0,
nullptr,
219 dwarf->GetObjectFile()->GetModule()->LogMessage(
220 log,
"[{0:x16}]: unhandled type tag {1:x4} ({2})", die.
GetOffset(),
228 dwarf->GetDIEToType()[die.
GetDIE()] = type_sp.get();
237 if (die.
Tag() != DW_TAG_subprogram && die.
Tag() != DW_TAG_subroutine_type)
240 llvm::DWARFAddressRangesVector unused_func_ranges;
241 const char *name =
nullptr;
242 const char *mangled =
nullptr;
243 std::optional<int> decl_file = 0;
244 std::optional<int> decl_line = 0;
245 std::optional<int> decl_column = 0;
246 std::optional<int> call_file = 0;
247 std::optional<int> call_line = 0;
248 std::optional<int> call_column = 0;
251 decl_line, decl_column, call_file, call_line,
252 call_column, &frame_base))
271 Address func_addr = ranges[0].GetBaseAddress();
273 func_sp = std::make_shared<Function>(&comp_unit,
275 func_user_id, func_name, func_type,
276 std::move(func_addr), std::move(ranges));
278 if (func_sp.get() ==
nullptr)
282 func_sp->GetFrameBaseExpression() = frame_base;
285 return func_sp.get();
This file defines the DWARF AST parser for the Fortran language.
#define DIE_IS_BEING_PARSED
bool CompleteTypeFromDWARF(const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::Type *type, const lldb_private::CompilerType &compiler_type) override
void ParseFunctionParameters(const lldb_private::plugin::dwarf::DWARFDIE &function_die, llvm::SmallVectorImpl< lldb_private::CompilerType > ¶m_types, llvm::SmallVectorImpl< llvm::StringRef > ¶m_names)
lldb_private::Function * ParseFunctionFromDWARF(lldb_private::CompileUnit &comp_unit, const lldb_private::plugin::dwarf::DWARFDIE &die, lldb_private::AddressRanges ranges) override
DWARFASTParserFortran(lldb_private::TypeSystemFortran &m_ast)
lldb_private::TypeSystemFortran & m_ast
~DWARFASTParserFortran() override
lldb::TypeSP UpdateSymbolContextScopeForType(const lldb_private::SymbolContext &sc, const lldb_private::plugin::dwarf::DWARFDIE &die, lldb::TypeSP type_sp)
If type_sp is valid, calculate and set its symbol context scope, and update the type list for its bac...
lldb::TypeSP ParseTypeFromDWARF(const lldb_private::SymbolContext &sc, const lldb_private::plugin::dwarf::DWARFDIE &die, bool *type_is_new_ptr) override
A section + offset based address class.
Block * FindBlockByID(lldb::user_id_t block_id)
A class that describes a compilation unit.
void AddFunction(lldb::FunctionSP &function_sp)
Add a function to this compile unit.
Generic representation of a type in a programming language.
A uniqued constant string class.
void SetCString(const char *cstr)
Set the C string value.
void SetString(llvm::StringRef s)
"lldb/Expression/DWARFExpressionList.h" Encapsulates a range map from file address range to a single ...
bool IsValid() const
Return true if the location expression contains data.
A class that describes the declaration location of a lldb object.
A class that describes a function.
Block & GetBlock(bool can_create)
Get accessor for the block list.
A class that handles mangled names.
void SetDemangledName(ConstString name)
void SetMangledName(ConstString name)
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
lldb::ModuleSP module_sp
The Module for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
CompilerType GetForwardCompilerType()
@ eEncodingIsUID
This type is the type whose UID is m_encoding_uid.
DWARFASTParser(Kind kind)
dw_attr_t AttributeAtIndex(uint32_t i) const
bool ExtractFormValueAtIndex(uint32_t i, DWARFFormValue &form_value) const
DWARFAttributes GetAttributes(Recurse recurse=Recurse::yes) const
SymbolFileDWARF * GetDWARF() const
dw_offset_t GetOffset() const
lldb::user_id_t GetID() const
void GetName(Stream &s) const
bool GetDIENamesAndRanges(const char *&name, const char *&mangled, llvm::DWARFAddressRangesVector &ranges, std::optional< int > &decl_file, std::optional< int > &decl_line, std::optional< int > &decl_column, std::optional< int > &call_file, std::optional< int > &call_line, std::optional< int > &call_column, DWARFExpressionList *frame_base) const
DWARFDIE GetDIE(dw_offset_t die_offset) const
llvm::iterator_range< child_iterator > children() const
The range of all the children of this DIE.
DWARFDIE GetAttributeValueAsReferenceDIE(const dw_attr_t attr) const
Type * ResolveType(const DWARFDIE &die, bool assert_not_being_parsed=true, bool resolve_function_context=false)
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die)
llvm::dwarf::Tag dw_tag_t
llvm::StringRef DW_TAG_value_to_name(dw_tag_t tag)
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::Function > FunctionSP
std::shared_ptr< lldb_private::Type > TypeSP