diff options
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF')
15 files changed, 897 insertions, 1024 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index d9636aef5de..21c795ed7e6 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -106,9 +106,9 @@ struct BitfieldInfo { bool NextBitfieldOffsetIsValid(const uint64_t next_bit_offset) const { if (IsValid()) { - // This bitfield info is valid, so any subsequent bitfields - // must not overlap and must be at a higher bit offset than - // any previous bitfield + size. + // This bitfield info is valid, so any subsequent bitfields must not + // overlap and must be at a higher bit offset than any previous bitfield + // + size. return (bit_size + bit_offset) <= next_bit_offset; } else { // If the this BitfieldInfo is not valid, then any offset isOK @@ -152,8 +152,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWO(const DWARFDIE &die, Log *log) { if (!isClangModuleFwdDecl(die)) return TypeSP(); - // Since this this type is defined in one of the Clang modules - // imported by this symbol file, search all of them. + // Since this this type is defined in one of the Clang modules imported by + // this symbol file, search all of them. auto *SymFile = die.GetCU()->GetSymbolFileDWARF(); for (const auto &NameModule : SymFile->getExternalTypeModules()) { if (!NameModule.second) @@ -168,9 +168,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWO(const DWARFDIE &die, Log *log) { if (num_dwo_types != 1) return TypeSP(); - // We found a real definition for this type in the Clang module, so - // lets use it and cache the fact that we found a complete type for - // this die. + // We found a real definition for this type in the Clang module, so lets use + // it and cache the fact that we found a complete type for this die. TypeSP dwo_type_sp = dwo_types.GetTypeAtIndex(0); if (!dwo_type_sp) return TypeSP(); @@ -211,8 +210,7 @@ static void CompleteExternalTagDeclType(ClangASTImporter &ast_importer, if (!tag_decl_ctx) return; - // If this type was not imported from an external AST, there's - // nothing to do. + // If this type was not imported from an external AST, there's nothing to do. CompilerType type = ClangASTContext::GetTypeForDecl(tag_decl_ctx); if (!type || !ast_importer.CanImport(type)) return; @@ -223,8 +221,8 @@ static void CompleteExternalTagDeclType(ClangASTImporter &ast_importer, "Unable to complete the Decl context for DIE '%s' at offset " "0x%8.8x.\nPlease file a bug report.", type_name_cstr ? type_name_cstr : "", die.GetOffset()); - // We need to make the type look complete otherwise, we - // might crash in Clang when adding children. + // We need to make the type look complete otherwise, we might crash in + // Clang when adding children. if (ClangASTContext::StartTagDeclarationDefinition(type)) ClangASTContext::CompleteTagDeclarationDefinition(type); } @@ -312,8 +310,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, type_name_cstr = form_value.AsCString(); // Work around a bug in llvm-gcc where they give a name to a - // reference type which doesn't - // include the "&"... + // reference type which doesn't include the "&"... if (tag == DW_TAG_reference_type) { if (strchr(type_name_cstr, '&') == NULL) type_name_cstr = NULL; @@ -339,32 +336,32 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } if (tag == DW_TAG_typedef && encoding_uid.IsValid()) { - // Try to parse a typedef from the DWO file first as modules - // can contain typedef'ed structures that have no names like: + // Try to parse a typedef from the DWO file first as modules can + // contain typedef'ed structures that have no names like: // // typedef struct { int a; } Foo; // - // In this case we will have a structure with no name and a - // typedef named "Foo" that points to this unnamed structure. - // The name in the typedef is the only identifier for the struct, - // so always try to get typedefs from DWO files if possible. + // In this case we will have a structure with no name and a typedef + // named "Foo" that points to this unnamed structure. The name in the + // typedef is the only identifier for the struct, so always try to + // get typedefs from DWO files if possible. // - // The type_sp returned will be empty if the typedef doesn't exist - // in a DWO file, so it is cheap to call this function just to check. + // The type_sp returned will be empty if the typedef doesn't exist in + // a DWO file, so it is cheap to call this function just to check. // - // If we don't do this we end up creating a TypeSP that says this - // is a typedef to type 0x123 (the DW_AT_type value would be 0x123 - // in the DW_TAG_typedef), and this is the unnamed structure type. - // We will have a hard time tracking down an unnammed structure - // type in the module DWO file, so we make sure we don't get into - // this situation by always resolving typedefs from the DWO file. + // If we don't do this we end up creating a TypeSP that says this is + // a typedef to type 0x123 (the DW_AT_type value would be 0x123 in + // the DW_TAG_typedef), and this is the unnamed structure type. We + // will have a hard time tracking down an unnammed structure type in + // the module DWO file, so we make sure we don't get into this + // situation by always resolving typedefs from the DWO file. const DWARFDIE encoding_die = dwarf->GetDIE(DIERef(encoding_uid)); - // First make sure that the die that this is typedef'ed to _is_ - // just a declaration (DW_AT_declaration == 1), not a full definition + // First make sure that the die that this is typedef'ed to _is_ just + // a declaration (DW_AT_declaration == 1), not a full definition // since template types can't be represented in modules since only - // concrete instances of templates are ever emitted and modules - // won't contain those + // concrete instances of templates are ever emitted and modules won't + // contain those if (encoding_die && encoding_die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0) == 1) { @@ -563,10 +560,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, case DW_AT_decl_file: if (die.GetCU()->DW_AT_decl_file_attributes_are_invalid()) { // llvm-gcc outputs invalid DW_AT_decl_file attributes that - // always - // point to the compile unit file, so we clear this invalid - // value - // so that we can still unique types efficiently. + // always point to the compile unit file, so we clear this + // invalid value so that we can still unique types + // efficiently. decl.SetFile(FileSpec("<invalid>", false)); } else decl.SetFile( @@ -625,10 +621,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } } - // UniqueDWARFASTType is large, so don't create a local variables on the - // stack, put it on the heap. This function is often called recursively - // and clang isn't good and sharing the stack space for variables in - // different blocks. + // UniqueDWARFASTType is large, so don't create a local variables on + // the stack, put it on the heap. This function is often called + // recursively and clang isn't good and sharing the stack space for + // variables in different blocks. std::unique_ptr<UniqueDWARFASTType> unique_ast_entry_ap( new UniqueDWARFASTType()); @@ -639,10 +635,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, LanguageType die_language = die.GetLanguage(); if (Language::LanguageIsCPlusPlus(die_language)) { // For C++, we rely solely upon the one definition rule that says - // only - // one thing can exist at a given decl context. We ignore the file - // and - // line that things are declared on. + // only one thing can exist at a given decl context. We ignore the + // file and line that things are declared on. std::string qualified_name; if (die.GetQualifiedName(qualified_name)) unique_typename = ConstString(qualified_name); @@ -679,17 +673,16 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, if (byte_size_valid && byte_size == 0 && type_name_cstr && die.HasChildren() == false && sc.comp_unit->GetLanguage() == eLanguageTypeObjC) { - // Work around an issue with clang at the moment where - // forward declarations for objective C classes are emitted - // as: + // Work around an issue with clang at the moment where forward + // declarations for objective C classes are emitted as: // DW_TAG_structure_type [2] // DW_AT_name( "ForwardObjcClass" ) // DW_AT_byte_size( 0x00 ) // DW_AT_decl_file( "..." ) // DW_AT_decl_line( 1 ) // - // Note that there is no DW_AT_declaration and there are - // no children, and the byte size is zero. + // Note that there is no DW_AT_declaration and there are no children, + // and the byte size is zero. is_forward_declaration = true; } @@ -697,11 +690,11 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, class_language == eLanguageTypeObjC_plus_plus) { if (!is_complete_objc_class && die.Supports_DW_AT_APPLE_objc_complete_type()) { - // We have a valid eSymbolTypeObjCClass class symbol whose - // name matches the current objective C class that we - // are trying to find and this DIE isn't the complete - // definition (we checked is_complete_objc_class above and - // know it is false), so the real definition is in here somewhere + // We have a valid eSymbolTypeObjCClass class symbol whose name + // matches the current objective C class that we are trying to find + // and this DIE isn't the complete definition (we checked + // is_complete_objc_class above and know it is false), so the real + // definition is in here somewhere type_sp = dwarf->FindCompleteObjCDefinitionTypeForDIE( die, type_name_const_str, true); @@ -709,9 +702,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, SymbolFileDWARFDebugMap *debug_map_symfile = dwarf->GetDebugMapSymfile(); if (debug_map_symfile) { - // We weren't able to find a full declaration in - // this DWARF, see if we have a declaration anywhere - // else... + // We weren't able to find a full declaration in this DWARF, + // see if we have a declaration anywhere else... type_sp = debug_map_symfile->FindCompleteObjCDefinitionTypeForDIE( die, type_name_const_str, true); @@ -728,9 +720,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, type_sp->GetID()); } - // We found a real definition for this type elsewhere - // so lets use it and cache the fact that we found - // a complete type for this die + // We found a real definition for this type elsewhere so lets use + // it and cache the fact that we found a complete type for this + // die dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); return type_sp; } @@ -738,11 +730,11 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } if (is_forward_declaration) { - // We have a forward declaration to a type and we need - // to try and find a full declaration. We look in the - // current type index just in case we have a forward - // declaration followed by an actual declarations in the - // DWARF. If this fails, we need to look elsewhere... + // We have a forward declaration to a type and we need to try and + // find a full declaration. We look in the current type index just in + // case we have a forward declaration followed by an actual + // declarations in the DWARF. If this fails, we need to look + // elsewhere... if (log) { dwarf->GetObjectFile()->GetModule()->LogMessage( log, "SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a " @@ -768,9 +760,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, SymbolFileDWARFDebugMap *debug_map_symfile = dwarf->GetDebugMapSymfile(); if (debug_map_symfile) { - // We weren't able to find a full declaration in - // this DWARF, see if we have a declaration anywhere - // else... + // We weren't able to find a full declaration in this DWARF, see + // if we have a declaration anywhere else... type_sp = debug_map_symfile->FindDefinitionTypeForDWARFDeclContext( die_decl_ctx); @@ -786,9 +777,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, DW_TAG_value_to_name(tag), type_name_cstr, type_sp->GetID()); } - // We found a real definition for this type elsewhere - // so lets use it and cache the fact that we found - // a complete type for this die + // We found a real definition for this type elsewhere so lets use + // it and cache the fact that we found a complete type for this die dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); clang::DeclContext *defn_decl_ctx = GetCachedClangDeclContextForDIE( dwarf->DebugInfo()->GetDIE(DIERef(type_sp->GetID(), dwarf))); @@ -805,18 +795,17 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, clang::DeclContext *decl_ctx = GetClangDeclContextContainingDIE(die, nullptr); - // If your decl context is a record that was imported from - // another AST context (in the gmodules case), we need to - // make sure the type backing the Decl is complete before - // adding children to it. This is not an issue in the - // non-gmodules case because the debug info will always contain - // a full definition of parent types in that case. + // If your decl context is a record that was imported from another + // AST context (in the gmodules case), we need to make sure the type + // backing the Decl is complete before adding children to it. This is + // not an issue in the non-gmodules case because the debug info will + // always contain a full definition of parent types in that case. CompleteExternalTagDeclType(GetClangASTImporter(), decl_ctx, die, type_name_cstr); if (accessibility == eAccessNone && decl_ctx) { - // Check the decl context that contains this class/struct/union. - // If it is a class we must give it an accessibility. + // Check the decl context that contains this class/struct/union. If + // it is a class we must give it an accessibility. const clang::Decl::Kind containing_decl_kind = decl_ctx->getDeclKind(); if (DeclKindIsCXXClass(containing_decl_kind)) @@ -868,8 +857,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } // Store a forward declaration to this class type in case any - // parameters in any class methods need it for the clang - // types for function prototypes. + // parameters in any class methods need it for the clang types for + // function prototypes. LinkDeclContextToDIE(m_ast.GetDeclContextForType(clang_type), die); type_sp.reset(new Type(die.GetID(), dwarf, type_name_const_str, byte_size, NULL, LLDB_INVALID_UID, @@ -878,9 +867,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, type_sp->SetIsCompleteObjCClass(is_complete_objc_class); - // Add our type to the unique type map so we don't - // end up creating many copies of the same type over - // and over in the ASTContext for our module + // Add our type to the unique type map so we don't end up creating many + // copies of the same type over and over in the ASTContext for our + // module unique_ast_entry_ap->m_type_sp = type_sp; unique_ast_entry_ap->m_die = die; unique_ast_entry_ap->m_declaration = unique_decl; @@ -892,8 +881,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, // Check to see if the DIE actually has a definition, some version of // GCC will // emit DIEs with DW_AT_declaration set to true, but yet still have - // subprogram, - // members, or inheritance, so we can't trust it + // subprogram, members, or inheritance, so we can't trust it DWARFDIE child_die = die.GetFirstChild(); while (child_die) { switch (child_die.Tag()) { @@ -917,10 +905,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } if (!is_forward_declaration) { - // Always start the definition for a class type so that - // if the class has child classes or types that require - // the class to be created for use as their decl contexts - // the class will be ready to accept these child definitions. + // Always start the definition for a class type so that if the class + // has child classes or types that require the class to be created + // for use as their decl contexts the class will be ready to accept + // these child definitions. if (die.HasChildren() == false) { // No children for this struct/union/class, lets finish it if (ClangASTContext::StartTagDeclarationDefinition(clang_type)) { @@ -944,33 +932,30 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } } } else if (clang_type_was_created) { - // Start the definition if the class is not objective C since - // the underlying decls respond to isCompleteDefinition(). Objective + // Start the definition if the class is not objective C since the + // underlying decls respond to isCompleteDefinition(). Objective // C decls don't respond to isCompleteDefinition() so we can't // start the declaration definition right away. For C++ - // class/union/structs - // we want to start the definition in case the class is needed as - // the - // declaration context for a contained class or type without the - // need - // to complete that type.. + // class/union/structs we want to start the definition in case the + // class is needed as the declaration context for a contained class + // or type without the need to complete that type.. if (class_language != eLanguageTypeObjC && class_language != eLanguageTypeObjC_plus_plus) ClangASTContext::StartTagDeclarationDefinition(clang_type); - // Leave this as a forward declaration until we need - // to know the details of the type. lldb_private::Type - // will automatically call the SymbolFile virtual function - // "SymbolFileDWARF::CompleteType(Type *)" - // When the definition needs to be defined. + // Leave this as a forward declaration until we need to know the + // details of the type. lldb_private::Type will automatically call + // the SymbolFile virtual function + // "SymbolFileDWARF::CompleteType(Type *)" When the definition + // needs to be defined. assert(!dwarf->GetForwardDeclClangTypeToDie().count( ClangUtil::RemoveFastQualifiers(clang_type) .GetOpaqueQualType()) && "Type already in the forward declaration map!"); - // Can't assume m_ast.GetSymbolFile() is actually a SymbolFileDWARF, - // it can be a - // SymbolFileDWARFDebugMap for Apple binaries. + // Can't assume m_ast.GetSymbolFile() is actually a + // SymbolFileDWARF, it can be a SymbolFileDWARFDebugMap for Apple + // binaries. dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] = clang_type.GetOpaqueQualType(); dwarf->GetForwardDeclClangTypeToDie() @@ -980,11 +965,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } } - // If we made a clang type, set the trivial abi if applicable: - // We only do this for pass by value - which implies the Trivial ABI. - // There isn't a way to assert that something that would normally be - // pass by value is pass by reference, so we ignore that attribute if - // set. + // If we made a clang type, set the trivial abi if applicable: We only + // do this for pass by value - which implies the Trivial ABI. There + // isn't a way to assert that something that would normally be pass by + // value is pass by reference, so we ignore that attribute if set. if (calling_convention == llvm::dwarf::DW_CC_pass_by_value) { clang::CXXRecordDecl *record_decl = m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType()); @@ -1070,9 +1054,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, SymbolFileDWARFDebugMap *debug_map_symfile = dwarf->GetDebugMapSymfile(); if (debug_map_symfile) { - // We weren't able to find a full declaration in - // this DWARF, see if we have a declaration anywhere - // else... + // We weren't able to find a full declaration in this DWARF, + // see if we have a declaration anywhere else... type_sp = debug_map_symfile->FindDefinitionTypeForDWARFDeclContext( die_decl_ctx); @@ -1089,9 +1072,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, type_sp->GetID()); } - // We found a real definition for this type elsewhere - // so lets use it and cache the fact that we found - // a complete type for this die + // We found a real definition for this type elsewhere so lets use + // it and cache the fact that we found a complete type for this + // die dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); clang::DeclContext *defn_decl_ctx = GetCachedClangDeclContextForDIE(dwarf->DebugInfo()->GetDIE( @@ -1317,8 +1300,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, bool is_cxx_method = DeclKindIsCXXClass(containing_decl_kind); // Start off static. This will be set to false in - // ParseChildParameters(...) - // if we find a "this" parameters as the first parameter + // ParseChildParameters(...) if we find a "this" parameters as the + // first parameter if (is_cxx_method) { is_static = true; } @@ -1333,25 +1316,22 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, bool ignore_containing_context = false; // Check for templatized class member functions. If we had any - // DW_TAG_template_type_parameter - // or DW_TAG_template_value_parameter the DW_TAG_subprogram DIE, then we - // can't let this become - // a method in a class. Why? Because templatized functions are only - // emitted if one of the - // templatized methods is used in the current compile unit and we will - // end up with classes - // that may or may not include these member functions and this means one - // class won't match another - // class definition and it affects our ability to use a class in the - // clang expression parser. So - // for the greater good, we currently must not allow any template member - // functions in a class definition. + // DW_TAG_template_type_parameter or DW_TAG_template_value_parameter + // the DW_TAG_subprogram DIE, then we can't let this become a method in + // a class. Why? Because templatized functions are only emitted if one + // of the templatized methods is used in the current compile unit and + // we will end up with classes that may or may not include these member + // functions and this means one class won't match another class + // definition and it affects our ability to use a class in the clang + // expression parser. So for the greater good, we currently must not + // allow any template member functions in a class definition. if (is_cxx_method && has_template_params) { ignore_containing_context = true; is_cxx_method = false; } - // clang_type will get the function prototype clang type after this call + // clang_type will get the function prototype clang type after this + // call clang_type = m_ast.CreateFunctionType( return_clang_type, function_param_types.data(), function_param_types.size(), is_variadic, type_quals); @@ -1379,8 +1359,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, if (class_opaque_type) { // If accessibility isn't set to anything valid, assume public - // for - // now... + // for now... if (accessibility == eAccessNone) accessibility = eAccessPublic; @@ -1402,9 +1381,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } } } else if (is_cxx_method) { - // Look at the parent of this DIE and see if is is - // a class or struct and see if this is actually a - // C++ method + // Look at the parent of this DIE and see if is is a class or + // struct and see if this is actually a C++ method Type *class_type = dwarf->ResolveType(decl_ctx_die); if (class_type) { bool alternate_defn = false; @@ -1413,10 +1391,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, alternate_defn = true; // We uniqued the parent class of this function to another - // class - // so we now need to associate all dies under "decl_ctx_die" - // to - // DIEs in the DIE for "class_type"... + // class so we now need to associate all dies under + // "decl_ctx_die" to DIEs in the DIE for "class_type"... SymbolFileDWARF *class_symfile = NULL; DWARFDIE class_type_die; @@ -1442,10 +1418,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, // FIXME do something with these failures that's smarter // than // just dropping them on the ground. Unfortunately classes - // don't - // like having stuff added to them after their definitions - // are - // complete... + // don't like having stuff added to them after their + // definitions are complete... type_ptr = dwarf->GetDIEToType()[die.GetDIE()]; if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) { @@ -1457,16 +1431,13 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, if (specification_die_form.IsValid()) { // We have a specification which we are going to base our - // function - // prototype off of, so we need this type to be completed so - // that the - // m_die_to_decl_ctx for the method in the specification has a - // valid - // clang decl context. + // function prototype off of, so we need this type to be + // completed so that the m_die_to_decl_ctx for the method in + // the specification has a valid clang decl context. class_type->GetForwardCompilerType(); // If we have a specification, then the function type should - // have been - // made with the specification and not with this die. + // have been made with the specification and not with this + // die. DWARFDIE spec_die = dwarf->DebugInfo()->GetDIE( DIERef(specification_die_form)); clang::DeclContext *spec_clang_decl_ctx = @@ -1482,12 +1453,9 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, type_handled = true; } else if (abstract_origin_die_form.IsValid()) { // We have a specification which we are going to base our - // function - // prototype off of, so we need this type to be completed so - // that the - // m_die_to_decl_ctx for the method in the abstract origin has - // a valid - // clang decl context. + // function prototype off of, so we need this type to be + // completed so that the m_die_to_decl_ctx for the method in + // the abstract origin has a valid clang decl context. class_type->GetForwardCompilerType(); DWARFDIE abs_die = dwarf->DebugInfo()->GetDIE( @@ -1510,17 +1478,16 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, if (class_opaque_type.IsBeingDefined() || alternate_defn) { if (!is_static && !die.HasChildren()) { // We have a C++ member function with no children (this - // pointer!) - // and clang will get mad if we try and make a function - // that isn't - // well formed in the DWARF, so we will just skip it... + // pointer!) and clang will get mad if we try and make + // a function that isn't well formed in the DWARF, so + // we will just skip it... type_handled = true; } else { bool add_method = true; if (alternate_defn) { // If an alternate definition for the class exists, - // then add the method only if an - // equivalent is not already present. + // then add the method only if an equivalent is not + // already present. clang::CXXRecordDecl *record_decl = m_ast.GetAsCXXRecordDecl( class_opaque_type.GetOpaqueQualType()); @@ -1560,9 +1527,8 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, const bool is_attr_used = false; // Neither GCC 4.2 nor clang++ currently set a valid - // accessibility - // in the DWARF for C++ methods... Default to public - // for now... + // accessibility in the DWARF for C++ methods... + // Default to public for now... if (accessibility == eAccessNone) accessibility = eAccessPublic; @@ -1603,25 +1569,21 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } } else { // We were asked to parse the type for a method in a - // class, yet the - // class hasn't been asked to complete itself through the - // clang::ExternalASTSource protocol, so we need to just - // have the - // class complete itself and do things the right way, then - // our + // class, yet the class hasn't been asked to complete + // itself through the clang::ExternalASTSource protocol, + // so we need to just have the class complete itself and + // do things the right way, then our // DIE should then have an entry in the // dwarf->GetDIEToType() map. First // we need to modify the dwarf->GetDIEToType() so it - // doesn't think we are - // trying to parse this DIE anymore... + // doesn't think we are trying to parse this DIE + // anymore... dwarf->GetDIEToType()[die.GetDIE()] = NULL; // Now we get the full type to force our class type to - // complete itself - // using the clang::ExternalASTSource protocol which will - // parse all - // base classes and all methods (including the method for - // this DIE). + // complete itself using the clang::ExternalASTSource + // protocol which will parse all base classes and all + // methods (including the method for this DIE). class_type->GetFullCompilerType(); // The type for this DIE should have been filled in the @@ -1635,8 +1597,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, // FIXME This is fixing some even uglier behavior but we // really need to // uniq the methods of each class as well as the class - // itself. - // <rdar://problem/11240464> + // itself. <rdar://problem/11240464> type_handled = true; } } @@ -1821,11 +1782,10 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc, } // We have no choice other than to pretend that the element class - // type - // is complete. If we don't do this, clang will crash when trying - // to layout the class. Since we provide layout assistance, all - // ivars in this class and other classes will be fine, this is - // the best we can do short of crashing. + // type is complete. If we don't do this, clang will crash when + // trying to layout the class. Since we provide layout + // assistance, all ivars in this class and other classes will be + // fine, this is the best we can do short of crashing. if (ClangASTContext::StartTagDeclarationDefinition( array_element_type)) { ClangASTContext::CompleteTagDeclarationDefinition( @@ -2148,9 +2108,9 @@ bool DWARFASTParserClang::ParseTemplateParameterInfos( return template_param_infos.args.size() == template_param_infos.names.size(); } -// Checks whether m1 is an overload of m2 (as opposed to an override). -// This is called by addOverridesForMethod to distinguish overrides (which share -// a vtable entry) from overloads (which require distinct entries). +// Checks whether m1 is an overload of m2 (as opposed to an override). This is +// called by addOverridesForMethod to distinguish overrides (which share a +// vtable entry) from overloads (which require distinct entries). static bool isOverload(clang::CXXMethodDecl *m1, clang::CXXMethodDecl *m2) { // FIXME: This should detect covariant return types, but currently doesn't. lldbassert(&m1->getASTContext() == &m2->getASTContext() && @@ -2179,8 +2139,8 @@ static bool isOverload(clang::CXXMethodDecl *m1, clang::CXXMethodDecl *m2) { } // If decl is a virtual method, walk the base classes looking for methods that -// decl overrides. This table of overridden methods is used by IRGen to determine -// the vtable layout for decl's parent class. +// decl overrides. This table of overridden methods is used by IRGen to +// determine the vtable layout for decl's parent class. static void addOverridesForMethod(clang::CXXMethodDecl *decl) { if (!decl->isVirtual()) return; @@ -2254,10 +2214,10 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die, #if defined LLDB_CONFIGURATION_DEBUG //---------------------------------------------------------------------- - // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES - // environment variable can be set with one or more typenames separated - // by ';' characters. This will cause this function to not complete any - // types whose names match. + // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES environment + // variable can be set with one or more typenames separated by ';' + // characters. This will cause this function to not complete any types whose + // names match. // // Examples of setting this environment variable: // @@ -2308,8 +2268,8 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die, LanguageType class_language = eLanguageTypeUnknown; if (ClangASTContext::IsObjCObjectOrInterfaceType(clang_type)) { class_language = eLanguageTypeObjC; - // For objective C we don't start the definition when - // the class is created. + // For objective C we don't start the definition when the class is + // created. ClangASTContext::StartTagDeclarationDefinition(clang_type); } @@ -2381,29 +2341,27 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die, clang::TTK_Class); } - // Since DW_TAG_structure_type gets used for both classes - // and structures, we may need to set any DW_TAG_member - // fields to have a "private" access if none was specified. - // When we parsed the child members we tracked that actual - // accessibility value for each DW_TAG_member in the - // "member_accessibilities" array. If the value for the - // member is zero, then it was set to the "default_accessibility" - // which for structs was "public". Below we correct this - // by setting any fields to "private" that weren't correctly - // set. + // Since DW_TAG_structure_type gets used for both classes and + // structures, we may need to set any DW_TAG_member fields to have a + // "private" access if none was specified. When we parsed the child + // members we tracked that actual accessibility value for each + // DW_TAG_member in the "member_accessibilities" array. If the value + // for the member is zero, then it was set to the + // "default_accessibility" which for structs was "public". Below we + // correct this by setting any fields to "private" that weren't + // correctly set. if (is_a_class && !member_accessibilities.empty()) { - // This is a class and all members that didn't have - // their access specified are private. + // This is a class and all members that didn't have their access + // specified are private. m_ast.SetDefaultAccessForRecordFields( m_ast.GetAsRecordDecl(clang_type), eAccessPrivate, &member_accessibilities.front(), member_accessibilities.size()); } if (!base_classes.empty()) { - // Make sure all base classes refer to complete types and not - // forward declarations. If we don't do this, clang will crash - // with an assertion in the call to - // clang_type.SetBaseClassesForClassType() + // Make sure all base classes refer to complete types and not forward + // declarations. If we don't do this, clang will crash with an + // assertion in the call to clang_type.SetBaseClassesForClassType() for (auto &base_class : base_classes) { clang::TypeSourceInfo *type_source_info = base_class->getTypeSourceInfo(); @@ -2423,11 +2381,10 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die, // We have no choice other than to pretend that the base class // is complete. If we don't do this, clang will crash when we // call setBases() inside of - // "clang_type.SetBaseClassesForClassType()" - // below. Since we provide layout assistance, all ivars in this - // class and other classes will be fine, this is the best we can - // do - // short of crashing. + // "clang_type.SetBaseClassesForClassType()" below. Since we + // provide layout assistance, all ivars in this class and other + // classes will be fine, this is the best we can do short of + // crashing. if (ClangASTContext::StartTagDeclarationDefinition( base_class_type)) { ClangASTContext::CompleteTagDeclarationDefinition( @@ -2440,8 +2397,8 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const DWARFDIE &die, &base_classes.front(), base_classes.size()); - // Clang will copy each CXXBaseSpecifier in "base_classes" - // so we have to free them all. + // Clang will copy each CXXBaseSpecifier in "base_classes" so we have + // to free them all. ClangASTContext::DeleteBaseClassSpecifiers(&base_classes.front(), base_classes.size()); } @@ -2751,10 +2708,8 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(const SymbolContext &sc, Language::LanguageIsCPlusPlus(die.GetLanguage()) && name && strcmp(name, "main") != 0) { // If the mangled name is not present in the DWARF, generate the - // demangled name - // using the decl context. We skip if the function is "main" as its name - // is - // never mangled. + // demangled name using the decl context. We skip if the function is + // "main" as its name is never mangled. bool is_static = false; bool is_variadic = false; bool has_template_params = false; @@ -2928,8 +2883,8 @@ bool DWARFASTParserClang::ParseChildMembers( } } else { // With DWARF 3 and later, if the value is an integer constant, - // this form value is the offset in bytes from the beginning - // of the containing entity. + // this form value is the offset in bytes from the beginning of + // the containing entity. member_byte_offset = form_value.Unsigned(); } break; @@ -2971,8 +2926,8 @@ bool DWARFASTParserClang::ParseChildMembers( ConstString fixed_getter; ConstString fixed_setter; - // Check if the property getter/setter were provided as full - // names. We want basenames, so we extract them. + // Check if the property getter/setter were provided as full names. + // We want basenames, so we extract them. if (prop_getter_name && prop_getter_name[0] == '-') { ObjCLanguage::MethodName prop_getter_method(prop_getter_name, true); @@ -2984,8 +2939,7 @@ bool DWARFASTParserClang::ParseChildMembers( prop_setter_name = prop_setter_method.GetSelector().GetCString(); } - // If the names haven't been provided, they need to be - // filled in. + // If the names haven't been provided, they need to be filled in. if (!prop_getter_name) { prop_getter_name = prop_name; @@ -3001,19 +2955,18 @@ bool DWARFASTParserClang::ParseChildMembers( } } - // Clang has a DWARF generation bug where sometimes it - // represents fields that are references with bad byte size - // and bit size/offset information such as: + // Clang has a DWARF generation bug where sometimes it represents + // fields that are references with bad byte size and bit size/offset + // information such as: // // DW_AT_byte_size( 0x00 ) // DW_AT_bit_size( 0x40 ) // DW_AT_bit_offset( 0xffffffffffffffc0 ) // - // So check the bit offset to make sure it is sane, and if - // the values are not sane, remove them. If we don't do this - // then we will end up with a crash if we try to use this - // type in an expression when clang becomes unhappy with its - // recycled debug info. + // So check the bit offset to make sure it is sane, and if the values + // are not sane, remove them. If we don't do this then we will end up + // with a crash if we try to use this type in an expression when clang + // becomes unhappy with its recycled debug info. if (byte_size == 0 && bit_offset < 0) { bit_size = 0; @@ -3027,12 +2980,10 @@ bool DWARFASTParserClang::ParseChildMembers( if (member_idx == 0 && !is_artificial && name && (strstr(name, "_vptr$") == name)) { - // Not all compilers will mark the vtable pointer - // member as artificial (llvm-gcc). We can't have - // the virtual members in our classes otherwise it - // throws off all child offsets since we end up - // having and extra pointer sized member in our - // class layouts. + // Not all compilers will mark the vtable pointer member as + // artificial (llvm-gcc). We can't have the virtual members in our + // classes otherwise it throws off all child offsets since we end up + // having and extra pointer sized member in our class layouts. is_artificial = true; } @@ -3072,15 +3023,15 @@ bool DWARFASTParserClang::ParseChildMembers( ///////////////////////////////////////////////////////////// // How to locate a field given the DWARF debug information // - // AT_byte_size indicates the size of the word in which the - // bit offset must be interpreted. + // AT_byte_size indicates the size of the word in which the bit + // offset must be interpreted. // // AT_data_member_location indicates the byte offset of the // word from the base address of the structure. // // AT_bit_offset indicates how many bits into the word - // (according to the host endianness) the low-order bit of - // the field starts. AT_bit_offset can be negative. + // (according to the host endianness) the low-order bit of the + // field starts. AT_bit_offset can be negative. // // AT_bit_size indicates the size of the field in bits. ///////////////////////////////////////////////////////////// @@ -3121,12 +3072,9 @@ bool DWARFASTParserClang::ParseChildMembers( field_bit_offset = this_field_info.bit_offset; // If the member to be emitted did not start on a character - // boundary and there is - // empty space between the last field and this one, then we need - // to emit an - // anonymous member filling up the space up to its start. There - // are three cases - // here: + // boundary and there is empty space between the last field and + // this one, then we need to emit an anonymous member filling + // up the space up to its start. There are three cases here: // // 1 If the previous member ended on a character boundary, then // we can emit an @@ -3151,10 +3099,8 @@ bool DWARFASTParserClang::ParseChildMembers( const uint64_t word_width = 32; // Objective-C has invalid DW_AT_bit_offset values in older - // versions - // of clang, so we have to be careful and only insert unnamed - // bitfields - // if we have a new enough clang. + // versions of clang, so we have to be careful and only insert + // unnamed bitfields if we have a new enough clang. bool detect_unnamed_bitfields = true; if (class_language == eLanguageTypeObjC || @@ -3217,10 +3163,10 @@ bool DWARFASTParserClang::ParseChildMembers( { // Older versions of clang emit array[0] and array[1] in the - // same way (<rdar://problem/12566646>). - // If the current field is at the end of the structure, then - // there is definitely no room for extra - // elements and we override the type to array[0]. + // same way (<rdar://problem/12566646>). If the current field + // is at the end of the structure, then there is definitely no + // room for extra elements and we override the type to + // array[0]. CompilerType member_array_element_type; uint64_t member_array_size; @@ -3272,12 +3218,11 @@ bool DWARFASTParserClang::ParseChildMembers( die.GetOffset(), name, sc.comp_unit ? sc.comp_unit->GetPath().c_str() : "the source file"); - // We have no choice other than to pretend that the member class - // is complete. If we don't do this, clang will crash when - // trying - // to layout the class. Since we provide layout assistance, all - // ivars in this class and other classes will be fine, this is - // the best we can do short of crashing. + // We have no choice other than to pretend that the member + // class is complete. If we don't do this, clang will crash + // when trying to layout the class. Since we provide layout + // assistance, all ivars in this class and other classes will + // be fine, this is the best we can do short of crashing. if (ClangASTContext::StartTagDeclarationDefinition( member_clang_type)) { ClangASTContext::CompleteTagDeclarationDefinition( @@ -3399,8 +3344,8 @@ bool DWARFASTParserClang::ParseChildMembers( } } else { // With DWARF 3 and later, if the value is an integer constant, - // this form value is the offset in bytes from the beginning - // of the containing entity. + // this form value is the offset in bytes from the beginning of + // the containing entity. member_byte_offset = form_value.Unsigned(); } break; @@ -3446,18 +3391,16 @@ bool DWARFASTParserClang::ParseChildMembers( if (is_virtual) { // Do not specify any offset for virtual inheritance. The DWARF - // produced by clang doesn't - // give us a constant offset, but gives us a DWARF expressions that - // requires an actual object - // in memory. the DW_AT_data_member_location for a virtual base - // class looks like: + // produced by clang doesn't give us a constant offset, but gives + // us a DWARF expressions that requires an actual object in memory. + // the DW_AT_data_member_location for a virtual base class looks + // like: // DW_AT_data_member_location( DW_OP_dup, DW_OP_deref, // DW_OP_constu(0x00000018), DW_OP_minus, DW_OP_deref, // DW_OP_plus ) // Given this, there is really no valid response we can give to - // clang for virtual base - // class offsets, and this should eventually be removed from - // LayoutRecordType() in the external + // clang for virtual base class offsets, and this should eventually + // be removed from LayoutRecordType() in the external // AST source in clang. } else { layout_info.base_offsets.insert(std::make_pair( @@ -3547,14 +3490,13 @@ size_t DWARFASTParserClang::ParseChildParameters( bool skip = false; if (skip_artificial) { if (is_artificial) { - // In order to determine if a C++ member function is - // "const" we have to look at the const-ness of "this"... - // Ugly, but that + // In order to determine if a C++ member function is "const" we + // have to look at the const-ness of "this"... Ugly, but that if (arg_idx == 0) { if (DeclKindIsCXXClass(containing_decl_ctx->getDeclKind())) { // Often times compilers omit the "this" name for the - // specification DIEs, so we can't rely upon the name - // being in the formal parameter DIE... + // specification DIEs, so we can't rely upon the name being in + // the formal parameter DIE... if (name == NULL || ::strcmp(name, "this") == 0) { Type *this_type = die.ResolveTypeUID(DIERef(param_type_die_form)); @@ -3618,10 +3560,10 @@ size_t DWARFASTParserClang::ParseChildParameters( case DW_TAG_template_type_parameter: case DW_TAG_template_value_parameter: case DW_TAG_GNU_template_parameter_pack: - // The one caller of this was never using the template_param_infos, - // and the local variable was taking up a large amount of stack space - // in SymbolFileDWARF::ParseType() so this was removed. If we ever need - // the template params back, we can add them back. + // The one caller of this was never using the template_param_infos, and + // the local variable was taking up a large amount of stack space in + // SymbolFileDWARF::ParseType() so this was removed. If we ever need the + // template params back, we can add them back. // ParseTemplateDIE (dwarf_cu, die, template_param_infos); has_template_params = true; break; @@ -4157,8 +4099,8 @@ bool DWARFASTParserClang::CopyUniqueClassMethodTypes( // Now do the work of linking the DeclContexts and Types. if (fast_path) { - // We can do this quickly. Just run across the tables index-for-index since - // we know each node has matching names and tags. + // We can do this quickly. Just run across the tables index-for-index + // since we know each node has matching names and tags. for (idx = 0; idx < src_size; ++idx) { src_die = src_name_to_die.GetValueAtIndexUnchecked(idx); dst_die = dst_name_to_die.GetValueAtIndexUnchecked(idx); @@ -4195,9 +4137,9 @@ bool DWARFASTParserClang::CopyUniqueClassMethodTypes( } } } else { - // We must do this slowly. For each member of the destination, look - // up a member in the source with the same name, check its tag, and - // unique them if everything matches up. Report failures. + // We must do this slowly. For each member of the destination, look up a + // member in the source with the same name, check its tag, and unique them + // if everything matches up. Report failures. if (!src_name_to_die.IsEmpty() && !dst_name_to_die.IsEmpty()) { src_name_to_die.Sort(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp index 631e40f4423..28a93805547 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp @@ -157,7 +157,8 @@ TypeSP DWARFASTParserGo::ParseTypeFromDWARF( Type *type = dwarf->ResolveTypeUID(encoding_uid); if (type) { if (go_kind == 0 && type->GetName() == type_name_const_str) { - // Go emits extra typedefs as a forward declaration. Ignore these. + // Go emits extra typedefs as a forward declaration. Ignore + // these. dwarf->m_die_to_type[die.GetDIE()] = type; return type->shared_from_this(); } @@ -212,10 +213,10 @@ TypeSP DWARFASTParserGo::ParseTypeFromDWARF( // TODO(ribrdb): Do we need this? - // UniqueDWARFASTType is large, so don't create a local variables on the - // stack, put it on the heap. This function is often called recursively - // and clang isn't good and sharing the stack space for variables in - // different blocks. + // UniqueDWARFASTType is large, so don't create a local variables on + // the stack, put it on the heap. This function is often called + // recursively and clang isn't good and sharing the stack space for + // variables in different blocks. std::unique_ptr<UniqueDWARFASTType> unique_ast_entry_ap( new UniqueDWARFASTType()); @@ -224,11 +225,10 @@ TypeSP DWARFASTParserGo::ParseTypeFromDWARF( dwarf->GetUniqueDWARFASTTypeMap().Find( type_name_const_str, die, decl, byte_size_valid ? byte_size : -1, *unique_ast_entry_ap)) { - // We have already parsed this type or from another - // compile unit. GCC loves to use the "one definition - // rule" which can result in multiple definitions - // of the same class over and over in each compile - // unit. + // We have already parsed this type or from another compile unit. GCC + // loves to use the "one definition rule" which can result in + // multiple definitions of the same class over and over in each + // compile unit. type_sp = unique_ast_entry_ap->m_type_sp; if (type_sp) { dwarf->m_die_to_type[die.GetDIE()] = type_sp.get(); @@ -254,9 +254,9 @@ TypeSP DWARFASTParserGo::ParseTypeFromDWARF( Type::eEncodingIsUID, &decl, compiler_type, Type::eResolveStateForward)); - // Add our type to the unique type map so we don't - // end up creating many copies of the same type over - // and over in the ASTContext for our module + // Add our type to the unique type map so we don't end up creating many + // copies of the same type over and over in the ASTContext for our + // module unique_ast_entry_ap->m_type_sp = type_sp; unique_ast_entry_ap->m_die = die; unique_ast_entry_ap->m_declaration = decl; @@ -265,19 +265,19 @@ TypeSP DWARFASTParserGo::ParseTypeFromDWARF( *unique_ast_entry_ap); if (!is_forward_declaration) { - // Always start the definition for a class type so that - // if the class has child classes or types that require - // the class to be created for use as their decl contexts - // the class will be ready to accept these child definitions. + // Always start the definition for a class type so that if the class + // has child classes or types that require the class to be created + // for use as their decl contexts the class will be ready to accept + // these child definitions. if (die.HasChildren() == false) { // No children for this struct/union/class, lets finish it m_ast.CompleteStructType(compiler_type); } else if (compiler_type_was_created) { - // Leave this as a forward declaration until we need - // to know the details of the type. lldb_private::Type - // will automatically call the SymbolFile virtual function - // "SymbolFileDWARF::CompleteType(Type *)" - // When the definition needs to be defined. + // Leave this as a forward declaration until we need to know the + // details of the type. lldb_private::Type will automatically call + // the SymbolFile virtual function + // "SymbolFileDWARF::CompleteType(Type *)" When the definition + // needs to be defined. dwarf->m_forward_decl_die_to_clang_type[die.GetDIE()] = compiler_type.GetOpaqueQualType(); dwarf->m_forward_decl_clang_type_to_die[compiler_type @@ -670,8 +670,8 @@ size_t DWARFASTParserGo::ParseChildMembers(const SymbolContext &sc, } } else { // With DWARF 3 and later, if the value is an integer constant, - // this form value is the offset in bytes from the beginning - // of the containing entity. + // this form value is the offset in bytes from the beginning of + // the containing entity. member_byte_offset = form_value.Unsigned(); } break; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp index 1cf0e7eeeb6..affe4b85bda 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp @@ -80,8 +80,8 @@ DWARFAbbreviationDeclarationSet::GetAbbreviationDeclaration( //---------------------------------------------------------------------- // DWARFAbbreviationDeclarationSet::AppendAbbrevDeclSequential() // -// Append an abbreviation declaration with a sequential code for O(n) -// lookups. Handy when creating an DWARFAbbreviationDeclarationSet. +// Append an abbreviation declaration with a sequential code for O(n) lookups. +// Handy when creating an DWARFAbbreviationDeclarationSet. //---------------------------------------------------------------------- dw_uleb128_t DWARFAbbreviationDeclarationSet::AppendAbbrevDeclSequential( const DWARFAbbreviationDeclaration &abbrevDecl) { @@ -115,9 +115,9 @@ void DWARFAbbreviationDeclarationSet::GetUnsupportedForms( //---------------------------------------------------------------------- // Encode // -// Encode the abbreviation table onto the end of the buffer provided -// into a byte representation as would be found in a ".debug_abbrev" -// debug information section. +// Encode the abbreviation table onto the end of the buffer provided into a +// byte representation as would be found in a ".debug_abbrev" debug information +// section. //---------------------------------------------------------------------- // void // DWARFAbbreviationDeclarationSet::Encode(BinaryStreamBuf& debug_abbrev_buf) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp index cecb69c8fb4..00265361f86 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp @@ -46,19 +46,17 @@ void DWARFDebugArangeSet::Compact() { if (m_arange_descriptors.empty()) return; - // Iterate through all arange descriptors and combine any ranges that - // overlap or have matching boundaries. The m_arange_descriptors are assumed - // to be in ascending order after being built by adding descriptors - // using the AddDescriptor method. + // Iterate through all arange descriptors and combine any ranges that overlap + // or have matching boundaries. The m_arange_descriptors are assumed to be in + // ascending order after being built by adding descriptors using the + // AddDescriptor method. uint32_t i = 0; while (i + 1 < m_arange_descriptors.size()) { if (m_arange_descriptors[i].end_address() >= m_arange_descriptors[i + 1].address) { // The current range ends at or exceeds the start of the next address - // range. - // Compute the max end address between the two and use that to make the - // new - // length. + // range. Compute the max end address between the two and use that to + // make the new length. const dw_addr_t max_end_addr = std::max(m_arange_descriptors[i].end_address(), m_arange_descriptors[i + 1].end_address()); @@ -82,8 +80,8 @@ static bool DescriptorLessThan(const DWARFDebugArangeSet::Descriptor &range1, } //---------------------------------------------------------------------- -// Add a range descriptor and keep things sorted so we can easily -// compact the ranges before being saved or used. +// Add a range descriptor and keep things sorted so we can easily compact the +// ranges before being saved or used. //---------------------------------------------------------------------- void DWARFDebugArangeSet::AddDescriptor( const DWARFDebugArangeSet::Descriptor &range) { @@ -103,15 +101,14 @@ void DWARFDebugArangeSet::AddDescriptor( // Non-contiguous entries, add this one before the found entry m_arange_descriptors.insert(pos, range); } else if (range_end_addr == pos->address) { - // The top end of 'range' is the lower end of the entry - // pointed to by 'pos'. We can combine range with the - // entry we found by setting the starting address and - // increasing the length since they don't overlap. + // The top end of 'range' is the lower end of the entry pointed to by + // 'pos'. We can combine range with the entry we found by setting the + // starting address and increasing the length since they don't overlap. pos->address = range.address; pos->length += range.length; } else { - // We can combine these two and make sure the largest end - // address is used to make end address. + // We can combine these two and make sure the largest end address is + // used to make end address. pos->address = range.address; pos->length = std::max(found_end_addr, range_end_addr) - pos->address; } @@ -142,18 +139,18 @@ bool DWARFDebugArangeSet::Extract(const DWARFDataExtractor &data, // 7.20 Address Range Table // - // Each set of entries in the table of address ranges contained in - // the .debug_aranges section begins with a header consisting of: a - // 4-byte length containing the length of the set of entries for this - // compilation unit, not including the length field itself; a 2-byte - // version identifier containing the value 2 for DWARF Version 2; a - // 4-byte offset into the.debug_infosection; a 1-byte unsigned integer - // containing the size in bytes of an address (or the offset portion of - // an address for segmented addressing) on the target system; and a - // 1-byte unsigned integer containing the size in bytes of a segment - // descriptor on the target system. This header is followed by a series - // of tuples. Each tuple consists of an address and a length, each in - // the size appropriate for an address on the target architecture. + // Each set of entries in the table of address ranges contained in the + // .debug_aranges section begins with a header consisting of: a 4-byte + // length containing the length of the set of entries for this compilation + // unit, not including the length field itself; a 2-byte version identifier + // containing the value 2 for DWARF Version 2; a 4-byte offset into + // the.debug_infosection; a 1-byte unsigned integer containing the size in + // bytes of an address (or the offset portion of an address for segmented + // addressing) on the target system; and a 1-byte unsigned integer + // containing the size in bytes of a segment descriptor on the target + // system. This header is followed by a series of tuples. Each tuple + // consists of an address and a length, each in the size appropriate for an + // address on the target architecture. m_header.length = data.GetDWARFInitialLength(offset_ptr); m_header.version = data.GetU16(offset_ptr); m_header.cu_offset = data.GetDWARFOffset(offset_ptr); @@ -195,8 +192,8 @@ bool DWARFDebugArangeSet::Extract(const DWARFDataExtractor &data, arangeDescriptor.length = data.GetMaxU64(offset_ptr, m_header.addr_size); - // Each set of tuples is terminated by a 0 for the address and 0 - // for the length. + // Each set of tuples is terminated by a 0 for the address and 0 for + // the length. if (arangeDescriptor.address || arangeDescriptor.length) m_arange_descriptors.push_back(arangeDescriptor); else diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp index fc7140003f7..f365d224f49 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp @@ -120,8 +120,8 @@ DWARFUnit *DWARFDebugInfo::GetCompileUnitAtIndex(uint32_t idx) { } bool DWARFDebugInfo::ContainsCompileUnit(const DWARFUnit *cu) const { - // Not a verify efficient function, but it is handy for use in assertions - // to make sure that a compile unit comes from a debug information file. + // Not a verify efficient function, but it is handy for use in assertions to + // make sure that a compile unit comes from a debug information file. CompileUnitColl::const_iterator end_pos = m_compile_units.end(); CompileUnitColl::const_iterator pos; @@ -227,12 +227,12 @@ DWARFDebugInfo::GetDIE(const DIERef &die_ref) { //---------------------------------------------------------------------- // Parse // -// Parses the .debug_info section and uses the .debug_abbrev section -// and various other sections in the SymbolFileDWARF class and calls the -// supplied callback function each time a compile unit header, or debug -// information entry is successfully parsed. This function can be used -// for different tasks such as parsing the file contents into a -// structured data, dumping, verifying and much more. +// Parses the .debug_info section and uses the .debug_abbrev section and +// various other sections in the SymbolFileDWARF class and calls the supplied +// callback function each time a compile unit header, or debug information +// entry is successfully parsed. This function can be used for different tasks +// such as parsing the file contents into a structured data, dumping, verifying +// and much more. //---------------------------------------------------------------------- void DWARFDebugInfo::Parse(SymbolFileDWARF *dwarf2Data, Callback callback, void *userData) { @@ -252,8 +252,8 @@ void DWARFDebugInfo::Parse(SymbolFileDWARF *dwarf2Data, Callback callback, // Make sure we are within our compile unit if (offset < next_cu_offset) { - // We are in our compile unit, parse starting at the offset - // we were told to parse + // We are in our compile unit, parse starting at the offset we were + // told to parse bool done = false; while (!done && die.Extract(dwarf2Data, cu.get(), &offset)) { // Call the callback function with DIE pointer that falls within the @@ -301,11 +301,11 @@ typedef struct DumpInfo { // DumpCallback // // A callback function for the static DWARFDebugInfo::Parse() function -// that gets called each time a compile unit header or debug information -// entry is successfully parsed. +// that gets called each time a compile unit header or debug information entry +// is successfully parsed. // -// This function dump DWARF information and obey recurse depth and -// whether a single DIE is to be dumped (or all of the data). +// This function dump DWARF information and obey recurse depth and whether a +// single DIE is to be dumped (or all of the data). //---------------------------------------------------------------------- static dw_offset_t DumpCallback(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, DWARFDebugInfoEntry *die, @@ -403,8 +403,8 @@ static dw_offset_t DumpCallback(SymbolFileDWARF *dwarf2Data, dumpInfo->ancestors.resize(1); } - // We are dumping only a single DIE possibly with it's children and - // we must find it's compile unit before we can dump it properly + // We are dumping only a single DIE possibly with it's children and we + // must find it's compile unit before we can dump it properly if (cu && dumpInfo->die_offset < cu->GetFirstDIEOffset()) { // Not found, maybe the DIE offset provided wasn't correct? // *ostrm_ptr << "DIE at offset " << HEX32 << dumpInfo->die_offset << " @@ -436,14 +436,13 @@ static dw_offset_t DumpCallback(SymbolFileDWARF *dwarf2Data, //---------------------------------------------------------------------- // Dump // -// Dump the information in the .debug_info section to the specified -// ostream. If die_offset is valid, a single DIE will be dumped. If the -// die_offset is invalid, all the DWARF information will be dumped. Both -// cases will obey a "recurse_depth" or how deep to traverse into the -// children of each DIE entry. A recurse_depth of zero will dump all -// compile unit headers. A recurse_depth of 1 will dump all compile unit -// headers and the DW_TAG_compile unit tags. A depth of 2 will also -// dump all types and functions. +// Dump the information in the .debug_info section to the specified ostream. If +// die_offset is valid, a single DIE will be dumped. If the die_offset is +// invalid, all the DWARF information will be dumped. Both cases will obey a +// "recurse_depth" or how deep to traverse into the children of each DIE entry. +// A recurse_depth of zero will dump all compile unit headers. A recurse_depth +// of 1 will dump all compile unit headers and the DW_TAG_compile unit tags. A +// depth of 2 will also dump all types and functions. //---------------------------------------------------------------------- void DWARFDebugInfo::Dump(Stream *s, SymbolFileDWARF *dwarf2Data, const uint32_t die_offset, @@ -469,8 +468,8 @@ void DWARFDebugInfo::Dump(Stream *s, SymbolFileDWARF *dwarf2Data, //---------------------------------------------------------------------- // Dump // -// Dump the contents of this DWARFDebugInfo object as has been parsed -// and/or modified after it has been parsed. +// Dump the contents of this DWARFDebugInfo object as has been parsed and/or +// modified after it has been parsed. //---------------------------------------------------------------------- void DWARFDebugInfo::Dump(Stream *s, const uint32_t die_offset, const uint32_t recurse_depth) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index 2498cd7a72a..da8efbd9b7f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -189,9 +189,9 @@ bool DWARFDebugInfoEntry::FastExtract( //---------------------------------------------------------------------- // Extract // -// Extract a debug info entry for a given compile unit from the -// .debug_info and .debug_abbrev data within the SymbolFileDWARF class -// starting at the given offset +// Extract a debug info entry for a given compile unit from the .debug_info and +// .debug_abbrev data within the SymbolFileDWARF class starting at the given +// offset //---------------------------------------------------------------------- bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -246,8 +246,7 @@ bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data, uint32_t form_size = 0; switch (form) { // Blocks if inlined data that have a length field and the data - // bytes - // inlined in the .debug_info + // bytes inlined in the .debug_info case DW_FORM_exprloc: case DW_FORM_block: form_size = debug_info_data.GetULEB128(&offset); @@ -357,8 +356,8 @@ bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data, //---------------------------------------------------------------------- // DumpAncestry // -// Dumps all of a debug information entries parents up until oldest and -// all of it's attributes to the specified stream. +// Dumps all of a debug information entries parents up until oldest and all of +// it's attributes to the specified stream. //---------------------------------------------------------------------- void DWARFDebugInfoEntry::DumpAncestry(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -375,8 +374,7 @@ void DWARFDebugInfoEntry::DumpAncestry(SymbolFileDWARF *dwarf2Data, // GetDIENamesAndRanges // // Gets the valid address ranges for a given DIE by looking for a -// DW_AT_low_pc/DW_AT_high_pc pair, DW_AT_entry_pc, or DW_AT_ranges -// attributes. +// DW_AT_low_pc/DW_AT_high_pc pair, DW_AT_entry_pc, or DW_AT_ranges attributes. //---------------------------------------------------------------------- bool DWARFDebugInfoEntry::GetDIENamesAndRanges( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, const char *&name, @@ -452,9 +450,9 @@ bool DWARFDebugInfoEntry::GetDIENamesAndRanges( const DWARFDebugRanges *debug_ranges = dwarf2Data->DebugRanges(); if (debug_ranges) { debug_ranges->FindRanges(cu->GetRangesBase(), form_value.Unsigned(), ranges); - // All DW_AT_ranges are relative to the base address of the - // compile unit. We add the compile unit base address to make - // sure all the addresses are properly fixed up. + // All DW_AT_ranges are relative to the base address of the compile + // unit. We add the compile unit base address to make sure all the + // addresses are properly fixed up. ranges.Slide(cu->GetBaseAddress()); } else { cu->GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError( @@ -583,8 +581,8 @@ bool DWARFDebugInfoEntry::GetDIENamesAndRanges( //---------------------------------------------------------------------- // Dump // -// Dumps a debug information entry and all of it's attributes to the -// specified stream. +// Dumps a debug information entry and all of it's attributes to the specified +// stream. //---------------------------------------------------------------------- void DWARFDebugInfoEntry::Dump(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, Stream &s, @@ -659,9 +657,9 @@ void DWARFDebugInfoEntry::DumpLocation(SymbolFileDWARF *dwarf2Data, //---------------------------------------------------------------------- // DumpAttribute // -// Dumps a debug information entry attribute along with it's form. Any -// special display of attributes is done (disassemble location lists, -// show enumeration values for attributes, etc). +// Dumps a debug information entry attribute along with it's form. Any special +// display of attributes is done (disassemble location lists, show enumeration +// values for attributes, etc). //---------------------------------------------------------------------- void DWARFDebugInfoEntry::DumpAttribute( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -717,9 +715,8 @@ void DWARFDebugInfoEntry::DumpAttribute( DWARFExpression::PrintDWARFExpression( s, locationData, DWARFUnit::GetAddressByteSize(cu), 4, false); } else { - // We have a location list offset as the value that is - // the offset into the .debug_loc section that describes - // the value over it's lifetime + // We have a location list offset as the value that is the offset into + // the .debug_loc section that describes the value over it's lifetime uint64_t debug_loc_offset = form_value.Unsigned(); if (dwarf2Data) { DWARFExpression::PrintDWARFLocationList( @@ -760,9 +757,9 @@ void DWARFDebugInfoEntry::DumpAttribute( //---------------------------------------------------------------------- // Get all attribute values for a given DIE, including following any -// specification or abstract origin attributes and including those in -// the results. Any duplicate attributes will have the first instance -// take precedence (this can happen for declaration attributes). +// specification or abstract origin attributes and including those in the +// results. Any duplicate attributes will have the first instance take +// precedence (this can happen for declaration attributes). //---------------------------------------------------------------------- size_t DWARFDebugInfoEntry::GetAttributes( const DWARFUnit *cu, DWARFFormValue::FixedFormSizes fixed_form_sizes, @@ -804,9 +801,9 @@ size_t DWARFDebugInfoEntry::GetAttributes( case DW_AT_sibling: case DW_AT_declaration: if (curr_depth > 0) { - // This attribute doesn't make sense when combined with - // the DIE that references this DIE. We know a DIE is - // referencing this DIE because curr_depth is not zero + // This attribute doesn't make sense when combined with the DIE that + // references this DIE. We know a DIE is referencing this DIE because + // curr_depth is not zero break; } LLVM_FALLTHROUGH; @@ -842,9 +839,9 @@ size_t DWARFDebugInfoEntry::GetAttributes( // GetAttributeValue // // Get the value of an attribute and return the .debug_info offset of the -// attribute if it was properly extracted into form_value, or zero -// if we fail since an offset of zero is invalid for an attribute (it -// would be a compile unit header). +// attribute if it was properly extracted into form_value, or zero if we fail +// since an offset of zero is invalid for an attribute (it would be a compile +// unit header). //---------------------------------------------------------------------- dw_offset_t DWARFDebugInfoEntry::GetAttributeValue( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -930,10 +927,10 @@ dw_offset_t DWARFDebugInfoEntry::GetAttributeValue( //---------------------------------------------------------------------- // GetAttributeValueAsString // -// Get the value of an attribute as a string return it. The resulting -// pointer to the string data exists within the supplied SymbolFileDWARF -// and will only be available as long as the SymbolFileDWARF is still around -// and it's content doesn't change. +// Get the value of an attribute as a string return it. The resulting pointer +// to the string data exists within the supplied SymbolFileDWARF and will only +// be available as long as the SymbolFileDWARF is still around and it's content +// doesn't change. //---------------------------------------------------------------------- const char *DWARFDebugInfoEntry::GetAttributeValueAsString( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -981,8 +978,8 @@ int64_t DWARFDebugInfoEntry::GetAttributeValueAsSigned( //---------------------------------------------------------------------- // GetAttributeValueAsReference // -// Get the value of an attribute as reference and fix up and compile -// unit relative offsets as needed. +// Get the value of an attribute as reference and fix up and compile unit +// relative offsets as needed. //---------------------------------------------------------------------- uint64_t DWARFDebugInfoEntry::GetAttributeValueAsReference( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -1009,8 +1006,8 @@ uint64_t DWARFDebugInfoEntry::GetAttributeValueAsAddress( //---------------------------------------------------------------------- // GetAttributeHighPC // -// Get the hi_pc, adding hi_pc to lo_pc when specified -// as an <offset-from-low-pc>. +// Get the hi_pc, adding hi_pc to lo_pc when specified as an <offset-from-low- +// pc>. // // Returns the hi_pc or fail_value. //---------------------------------------------------------------------- @@ -1033,8 +1030,8 @@ dw_addr_t DWARFDebugInfoEntry::GetAttributeHighPC( //---------------------------------------------------------------------- // GetAttributeAddressRange // -// Get the lo_pc and hi_pc, adding hi_pc to lo_pc when specified -// as an <offset-from-low-pc>. +// Get the lo_pc and hi_pc, adding hi_pc to lo_pc when specified as an <offset- +// from-low-pc>. // // Returns true or sets lo_pc and hi_pc to fail_value. //---------------------------------------------------------------------- @@ -1085,8 +1082,8 @@ size_t DWARFDebugInfoEntry::GetAttributeAddressRanges( //---------------------------------------------------------------------- // GetName // -// Get value of the DW_AT_name attribute and return it if one exists, -// else return NULL. +// Get value of the DW_AT_name attribute and return it if one exists, else +// return NULL. //---------------------------------------------------------------------- const char *DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu) const { @@ -1096,8 +1093,8 @@ const char *DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data, //---------------------------------------------------------------------- // GetMangledName // -// Get value of the DW_AT_MIPS_linkage_name attribute and return it if -// one exists, else return the value of the DW_AT_name attribute +// Get value of the DW_AT_MIPS_linkage_name attribute and return it if one +// exists, else return the value of the DW_AT_name attribute //---------------------------------------------------------------------- const char * DWARFDebugInfoEntry::GetMangledName(SymbolFileDWARF *dwarf2Data, @@ -1125,8 +1122,8 @@ DWARFDebugInfoEntry::GetMangledName(SymbolFileDWARF *dwarf2Data, //---------------------------------------------------------------------- // GetPubname // -// Get value the name for a DIE as it should appear for a -// .debug_pubnames or .debug_pubtypes section. +// Get value the name for a DIE as it should appear for a .debug_pubnames or +// .debug_pubtypes section. //---------------------------------------------------------------------- const char *DWARFDebugInfoEntry::GetPubname(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu) const { @@ -1151,11 +1148,10 @@ const char *DWARFDebugInfoEntry::GetPubname(SymbolFileDWARF *dwarf2Data, //---------------------------------------------------------------------- // GetName // -// Get value of the DW_AT_name attribute for a debug information entry -// that exists at offset "die_offset" and place that value into the -// supplied stream object. If the DIE is a NULL object "NULL" is placed -// into the stream, and if no DW_AT_name attribute exists for the DIE -// then nothing is printed. +// Get value of the DW_AT_name attribute for a debug information entry that +// exists at offset "die_offset" and place that value into the supplied stream +// object. If the DIE is a NULL object "NULL" is placed into the stream, and if +// no DW_AT_name attribute exists for the DIE then nothing is printed. //---------------------------------------------------------------------- bool DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -1186,10 +1182,9 @@ bool DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data, //---------------------------------------------------------------------- // AppendTypeName // -// Follows the type name definition down through all needed tags to -// end up with a fully qualified type name and dump the results to -// the supplied stream. This is used to show the name of types given -// a type identifier. +// Follows the type name definition down through all needed tags to end up with +// a fully qualified type name and dump the results to the supplied stream. +// This is used to show the name of types given a type identifier. //---------------------------------------------------------------------- bool DWARFDebugInfoEntry::AppendTypeName(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -1345,10 +1340,10 @@ void DWARFDebugInfoEntry::BuildAddressRangeTable( //---------------------------------------------------------------------- // BuildFunctionAddressRangeTable // -// This function is very similar to the BuildAddressRangeTable function -// except that the actual DIE offset for the function is placed in the -// table instead of the compile unit offset (which is the way the -// standard .debug_aranges section does it). +// This function is very similar to the BuildAddressRangeTable function except +// that the actual DIE offset for the function is placed in the table instead +// of the compile unit offset (which is the way the standard .debug_aranges +// section does it). //---------------------------------------------------------------------- void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable( SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, @@ -1421,9 +1416,9 @@ DWARFDebugInfoEntry::GetParentDeclContextDIE( DWARFDIE die(cu, const_cast<DWARFDebugInfoEntry *>(this)); while (die) { - // If this is the original DIE that we are searching for a declaration - // for, then don't look in the cache as we don't want our own decl - // context to be our decl context... + // If this is the original DIE that we are searching for a declaration for, + // then don't look in the cache as we don't want our own decl context to be + // our decl context... if (die.GetDIE() != this) { switch (die.Tag()) { case DW_TAG_compile_unit: @@ -1712,9 +1707,10 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address, break; } } - } else { // compile units may not have a valid high/low pc when there + } else { + // Compile units may not have a valid high/low pc when there // are address gaps in subroutines so we must always search - // if there is no valid high and low PC + // if there is no valid high and low PC. check_children = (m_tag == DW_TAG_compile_unit || m_tag == DW_TAG_partial_unit) && ((function_die != NULL) || (block_die != NULL)); @@ -1726,9 +1722,9 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address, DWARFRangeList ranges; DWARFDebugRanges *debug_ranges = dwarf2Data->DebugRanges(); debug_ranges->FindRanges(cu->GetRangesBase(), debug_ranges_offset, ranges); - // All DW_AT_ranges are relative to the base address of the - // compile unit. We add the compile unit base address to make - // sure all the addresses are properly fixed up. + // All DW_AT_ranges are relative to the base address of the compile + // unit. We add the compile unit base address to make sure all the + // addresses are properly fixed up. ranges.Slide(cu->GetBaseAddress()); if (ranges.FindEntryThatContains(address)) { found_address = true; @@ -1790,8 +1786,8 @@ DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr( const DWARFAbbreviationDeclaration *abbrev_decl = abbrev_set->GetAbbreviationDeclaration(m_abbr_idx); if (abbrev_decl) { - // Make sure the abbreviation code still matches. If it doesn't and - // the DWARF data was mmap'ed, the backing file might have been modified + // Make sure the abbreviation code still matches. If it doesn't and the + // DWARF data was mmap'ed, the backing file might have been modified // which is bad news. const uint64_t abbrev_code = dwarf2Data->get_debug_info_data().GetULEB128(&offset); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp index 8016d0257bf..1f66d8a23d8 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp @@ -242,8 +242,8 @@ dw_offset_t DWARFDebugLine::DumpStatementOpcodes( log->Printf("0x%8.8x: DW_LNE_??? (%2.2x) - Skipping unknown upcode", op_offset, opcode); // Length doesn't include the zero opcode byte or the length itself, - // but - // it does include the sub_opcode, so we have to adjust for that below + // but it does include the sub_opcode, so we have to adjust for that + // below offset += arg_size; break; } @@ -324,9 +324,9 @@ dw_offset_t DWARFDebugLine::DumpStatementOpcodes( // Special Opcodes default: if (opcode < prologue.opcode_base) { - // We have an opcode that this parser doesn't know about, skip - // the number of ULEB128 numbers that is says to skip in the - // prologue's standard_opcode_lengths array + // We have an opcode that this parser doesn't know about, skip the + // number of ULEB128 numbers that is says to skip in the prologue's + // standard_opcode_lengths array uint8_t n = prologue.standard_opcode_lengths[opcode - 1]; log->Printf("0x%8.8x: Special : Unknown skipping %u ULEB128 values.", op_offset, n); @@ -357,9 +357,9 @@ dw_offset_t DWARFDebugLine::DumpStatementOpcodes( //---------------------------------------------------------------------- // Parse // -// Parse the entire line table contents calling callback each time a -// new prologue is parsed and every time a new row is to be added to -// the line table. +// Parse the entire line table contents calling callback each time a new +// prologue is parsed and every time a new row is to be added to the line +// table. //---------------------------------------------------------------------- void DWARFDebugLine::Parse(const DWARFDataExtractor &debug_line_data, DWARFDebugLine::State::Callback callback, @@ -472,9 +472,9 @@ bool DWARFDebugLine::ParseSupportFiles( //---------------------------------------------------------------------- // ParseStatementTable // -// Parse a single line table (prologue and all rows) and call the -// callback function once for the prologue (row in state will be zero) -// and each time a row is to be added to the line table. +// Parse a single line table (prologue and all rows) and call the callback +// function once for the prologue (row in state will be zero) and each time a +// row is to be added to the line table. //---------------------------------------------------------------------- bool DWARFDebugLine::ParseStatementTable( const DWARFDataExtractor &debug_line_data, lldb::offset_t *offset_ptr, @@ -511,8 +511,8 @@ bool DWARFDebugLine::ParseStatementTable( uint8_t opcode = debug_line_data.GetU8(offset_ptr); if (opcode == 0) { - // Extended Opcodes always start with a zero opcode followed by - // a uleb128 length so you can skip ones you don't know about + // Extended Opcodes always start with a zero opcode followed by a uleb128 + // length so you can skip ones you don't know about lldb::offset_t ext_offset = *offset_ptr; dw_uleb128_t len = debug_line_data.GetULEB128(offset_ptr); dw_offset_t arg_size = len - (*offset_ptr - ext_offset); @@ -522,12 +522,12 @@ bool DWARFDebugLine::ParseStatementTable( switch (sub_opcode) { case DW_LNE_end_sequence: // Set the end_sequence register of the state machine to true and - // append a row to the matrix using the current values of the - // state-machine registers. Then reset the registers to the initial - // values specified above. Every statement program sequence must end - // with a DW_LNE_end_sequence instruction which creates a row whose - // address is that of the byte after the last target machine instruction - // of the sequence. + // append a row to the matrix using the current values of the state- + // machine registers. Then reset the registers to the initial values + // specified above. Every statement program sequence must end with a + // DW_LNE_end_sequence instruction which creates a row whose address is + // that of the byte after the last target machine instruction of the + // sequence. state.end_sequence = true; state.AppendRowToMatrix(*offset_ptr); state.Reset(); @@ -537,8 +537,8 @@ bool DWARFDebugLine::ParseStatementTable( // Takes a single relocatable address as an operand. The size of the // operand is the size appropriate to hold an address on the target // machine. Set the address register to the value given by the - // relocatable address. All of the other statement program opcodes - // that affect the address register add a delta to it. This instruction + // relocatable address. All of the other statement program opcodes that + // affect the address register add a delta to it. This instruction // stores a relocatable value into it instead. if (arg_size == 4) state.address = debug_line_data.GetU32(offset_ptr); @@ -549,24 +549,24 @@ bool DWARFDebugLine::ParseStatementTable( case DW_LNE_define_file: // Takes 4 arguments. The first is a null terminated string containing // a source file name. The second is an unsigned LEB128 number - // representing - // the directory index of the directory in which the file was found. The - // third is an unsigned LEB128 number representing the time of last - // modification of the file. The fourth is an unsigned LEB128 number - // representing the length in bytes of the file. The time and length - // fields may contain LEB128(0) if the information is not available. + // representing the directory index of the directory in which the file + // was found. The third is an unsigned LEB128 number representing the + // time of last modification of the file. The fourth is an unsigned + // LEB128 number representing the length in bytes of the file. The time + // and length fields may contain LEB128(0) if the information is not + // available. // // The directory index represents an entry in the include_directories - // section of the statement program prologue. The index is LEB128(0) - // if the file was found in the current directory of the compilation, + // section of the statement program prologue. The index is LEB128(0) if + // the file was found in the current directory of the compilation, // LEB128(1) if it was found in the first directory in the // include_directories section, and so on. The directory index is // ignored for file names that represent full path names. // // The files are numbered, starting at 1, in the order in which they - // appear; the names in the prologue come before names defined by - // the DW_LNE_define_file instruction. These numbers are used in the - // file register of the state machine. + // appear; the names in the prologue come before names defined by the + // DW_LNE_define_file instruction. These numbers are used in the file + // register of the state machine. { FileNameEntry fileEntry; fileEntry.name = debug_line_data.GetCStr(offset_ptr); @@ -578,8 +578,9 @@ bool DWARFDebugLine::ParseStatementTable( break; default: - // Length doesn't include the zero opcode byte or the length itself, but - // it does include the sub_opcode, so we have to adjust for that below + // Length doesn't include the zero opcode byte or the length itself, + // but it does include the sub_opcode, so we have to adjust for that + // below (*offset_ptr) += arg_size; break; } @@ -587,23 +588,23 @@ bool DWARFDebugLine::ParseStatementTable( switch (opcode) { // Standard Opcodes case DW_LNS_copy: - // Takes no arguments. Append a row to the matrix using the - // current values of the state-machine registers. Then set - // the basic_block register to false. + // Takes no arguments. Append a row to the matrix using the current + // values of the state-machine registers. Then set the basic_block + // register to false. state.AppendRowToMatrix(*offset_ptr); break; case DW_LNS_advance_pc: // Takes a single unsigned LEB128 operand, multiplies it by the - // min_inst_length field of the prologue, and adds the - // result to the address register of the state machine. + // min_inst_length field of the prologue, and adds the result to the + // address register of the state machine. state.address += debug_line_data.GetULEB128(offset_ptr) * prologue->min_inst_length; break; case DW_LNS_advance_line: - // Takes a single signed LEB128 operand and adds that value to - // the line register of the state machine. + // Takes a single signed LEB128 operand and adds that value to the line + // register of the state machine. state.line += debug_line_data.GetSLEB128(offset_ptr); break; @@ -614,35 +615,35 @@ bool DWARFDebugLine::ParseStatementTable( break; case DW_LNS_set_column: - // Takes a single unsigned LEB128 operand and stores it in the - // column register of the state machine. + // Takes a single unsigned LEB128 operand and stores it in the column + // register of the state machine. state.column = debug_line_data.GetULEB128(offset_ptr); break; case DW_LNS_negate_stmt: - // Takes no arguments. Set the is_stmt register of the state - // machine to the logical negation of its current value. + // Takes no arguments. Set the is_stmt register of the state machine to + // the logical negation of its current value. state.is_stmt = !state.is_stmt; break; case DW_LNS_set_basic_block: - // Takes no arguments. Set the basic_block register of the - // state machine to true + // Takes no arguments. Set the basic_block register of the state + // machine to true state.basic_block = true; break; case DW_LNS_const_add_pc: - // Takes no arguments. Add to the address register of the state - // machine the address increment value corresponding to special - // opcode 255. The motivation for DW_LNS_const_add_pc is this: - // when the statement program needs to advance the address by a - // small amount, it can use a single special opcode, which occupies - // a single byte. When it needs to advance the address by up to - // twice the range of the last special opcode, it can use - // DW_LNS_const_add_pc followed by a special opcode, for a total - // of two bytes. Only if it needs to advance the address by more - // than twice that range will it need to use both DW_LNS_advance_pc - // and a special opcode, requiring three or more bytes. + // Takes no arguments. Add to the address register of the state machine + // the address increment value corresponding to special opcode 255. The + // motivation for DW_LNS_const_add_pc is this: when the statement + // program needs to advance the address by a small amount, it can use a + // single special opcode, which occupies a single byte. When it needs + // to advance the address by up to twice the range of the last special + // opcode, it can use DW_LNS_const_add_pc followed by a special opcode, + // for a total of two bytes. Only if it needs to advance the address by + // more than twice that range will it need to use both + // DW_LNS_advance_pc and a special opcode, requiring three or more + // bytes. { uint8_t adjust_opcode = 255 - prologue->opcode_base; dw_addr_t addr_offset = (adjust_opcode / prologue->line_range) * @@ -652,40 +653,40 @@ bool DWARFDebugLine::ParseStatementTable( break; case DW_LNS_fixed_advance_pc: - // Takes a single uhalf operand. Add to the address register of - // the state machine the value of the (unencoded) operand. This - // is the only extended opcode that takes an argument that is not - // a variable length number. The motivation for DW_LNS_fixed_advance_pc - // is this: existing assemblers cannot emit DW_LNS_advance_pc or - // special opcodes because they cannot encode LEB128 numbers or - // judge when the computation of a special opcode overflows and - // requires the use of DW_LNS_advance_pc. Such assemblers, however, - // can use DW_LNS_fixed_advance_pc instead, sacrificing compression. + // Takes a single uhalf operand. Add to the address register of the + // state machine the value of the (unencoded) operand. This is the only + // extended opcode that takes an argument that is not a variable length + // number. The motivation for DW_LNS_fixed_advance_pc is this: existing + // assemblers cannot emit DW_LNS_advance_pc or special opcodes because + // they cannot encode LEB128 numbers or judge when the computation of a + // special opcode overflows and requires the use of DW_LNS_advance_pc. + // Such assemblers, however, can use DW_LNS_fixed_advance_pc instead, + // sacrificing compression. state.address += debug_line_data.GetU16(offset_ptr); break; case DW_LNS_set_prologue_end: - // Takes no arguments. Set the prologue_end register of the - // state machine to true + // Takes no arguments. Set the prologue_end register of the state + // machine to true state.prologue_end = true; break; case DW_LNS_set_epilogue_begin: - // Takes no arguments. Set the basic_block register of the - // state machine to true + // Takes no arguments. Set the basic_block register of the state + // machine to true state.epilogue_begin = true; break; case DW_LNS_set_isa: - // Takes a single unsigned LEB128 operand and stores it in the - // column register of the state machine. + // Takes a single unsigned LEB128 operand and stores it in the column + // register of the state machine. state.isa = debug_line_data.GetULEB128(offset_ptr); break; default: - // Handle any unknown standard opcodes here. We know the lengths - // of such opcodes because they are specified in the prologue - // as a multiple of LEB128 operands for each opcode. + // Handle any unknown standard opcodes here. We know the lengths of + // such opcodes because they are specified in the prologue as a + // multiple of LEB128 operands for each opcode. { uint8_t i; assert(static_cast<size_t>(opcode - 1) < @@ -702,32 +703,32 @@ bool DWARFDebugLine::ParseStatementTable( // A special opcode value is chosen based on the amount that needs // to be added to the line and address registers. The maximum line - // increment for a special opcode is the value of the line_base - // field in the header, plus the value of the line_range field, - // minus 1 (line base + line range - 1). If the desired line - // increment is greater than the maximum line increment, a standard - // opcode must be used instead of a special opcode. The "address - // advance" is calculated by dividing the desired address increment - // by the minimum_instruction_length field from the header. The - // special opcode is then calculated using the following formula: + // increment for a special opcode is the value of the line_base field in + // the header, plus the value of the line_range field, minus 1 (line base + // + line range - 1). If the desired line increment is greater than the + // maximum line increment, a standard opcode must be used instead of a + // special opcode. The "address advance" is calculated by dividing the + // desired address increment by the minimum_instruction_length field from + // the header. The special opcode is then calculated using the following + // formula: // // opcode = (desired line increment - line_base) + (line_range * address // advance) + opcode_base // - // If the resulting opcode is greater than 255, a standard opcode - // must be used instead. + // If the resulting opcode is greater than 255, a standard opcode must be + // used instead. // - // To decode a special opcode, subtract the opcode_base from the - // opcode itself to give the adjusted opcode. The amount to - // increment the address register is the result of the adjusted - // opcode divided by the line_range multiplied by the - // minimum_instruction_length field from the header. That is: + // To decode a special opcode, subtract the opcode_base from the opcode + // itself to give the adjusted opcode. The amount to increment the + // address register is the result of the adjusted opcode divided by the + // line_range multiplied by the minimum_instruction_length field from the + // header. That is: // // address increment = (adjusted opcode / line_range) * // minimum_instruction_length // - // The amount to increment the line register is the line_base plus - // the result of the adjusted opcode modulo the line_range. That is: + // The amount to increment the line register is the line_base plus the + // result of the adjusted opcode modulo the line_range. That is: // // line increment = line_base + (adjusted opcode % line_range) @@ -755,8 +756,8 @@ static void ParseStatementTableCallback(dw_offset_t offset, void *userData) { DWARFDebugLine::LineTable *line_table = (DWARFDebugLine::LineTable *)userData; if (state.row == DWARFDebugLine::State::StartParsingLineTable) { - // Just started parsing the line table, so lets keep a reference to - // the prologue using the supplied shared pointer + // Just started parsing the line table, so lets keep a reference to the + // prologue using the supplied shared pointer line_table->prologue = state.prologue; } else if (state.row == DWARFDebugLine::State::DoneParsingLineTable) { // Done parsing line table, nothing to do for the cleanup @@ -769,8 +770,8 @@ static void ParseStatementTableCallback(dw_offset_t offset, //---------------------------------------------------------------------- // ParseStatementTable // -// Parse a line table at offset and populate the LineTable class with -// the prologue and all rows. +// Parse a line table at offset and populate the LineTable class with the +// prologue and all rows. //---------------------------------------------------------------------- bool DWARFDebugLine::ParseStatementTable( const DWARFDataExtractor &debug_line_data, lldb::offset_t *offset_ptr, @@ -936,11 +937,10 @@ uint32_t DWARFDebugLine::LineTable::LookupAddress(dw_addr_t address, if (address < cu_high_pc) return rows.size() - 1; } else { - // Rely on fact that we are using a std::vector and we can do - // pointer arithmetic to find the row index (which will be one less - // that what we found since it will find the first position after - // the current address) since std::vector iterators are just - // pointers to the container type. + // Rely on fact that we are using a std::vector and we can do pointer + // arithmetic to find the row index (which will be one less that what we + // found since it will find the first position after the current address) + // since std::vector iterators are just pointers to the container type. index = pos - begin_pos; if (pos->address > address) { if (index > 0) @@ -1005,9 +1005,9 @@ static bool AddressLessThan(const DWARFDebugLine::Row &a, return a.address < b.address; } -// Insert a row at the correct address if the addresses can be out of -// order which can only happen when we are linking a line table that -// may have had it's contents rearranged. +// Insert a row at the correct address if the addresses can be out of order +// which can only happen when we are linking a line table that may have had +// it's contents rearranged. void DWARFDebugLine::Row::Insert(Row::collection &state_coll, const Row &state) { // If we don't have anything yet, or if the address of the last state in our @@ -1020,12 +1020,12 @@ void DWARFDebugLine::Row::Insert(Row::collection &state_coll, state_coll.begin(), state_coll.end(), state, AddressLessThan)); // If the addresses are equal, we can safely replace the previous entry - // with the current one if the one it is replacing is an end_sequence entry. - // We currently always place an extra end sequence when ever we exit a valid - // address range for a function in case the functions get rearranged by - // optimizations or by order specifications. These extra end sequences will - // disappear by getting replaced with valid consecutive entries within a - // compile unit if there are no gaps. + // with the current one if the one it is replacing is an end_sequence + // entry. We currently always place an extra end sequence when ever we exit + // a valid address range for a function in case the functions get + // rearranged by optimizations or by order specifications. These extra end + // sequences will disappear by getting replaced with valid consecutive + // entries within a compile unit if there are no gaps. if (range.first == range.second) { state_coll.insert(range.first, state); } else { @@ -1065,10 +1065,9 @@ void DWARFDebugLine::State::Reset() { Row::Reset(prologue->default_is_stmt); } // DWARFDebugLine::State::AppendRowToMatrix //---------------------------------------------------------------------- void DWARFDebugLine::State::AppendRowToMatrix(dw_offset_t offset) { - // Each time we are to add an entry into the line table matrix - // call the callback function so that someone can do something with - // the current state of the state machine (like build a line table - // or dump the line table!) + // Each time we are to add an entry into the line table matrix call the + // callback function so that someone can do something with the current state + // of the state machine (like build a line table or dump the line table!) if (log) { if (row == 0) { log->PutCString("Address Line Column File ISA Flags"); @@ -1088,8 +1087,8 @@ void DWARFDebugLine::State::AppendRowToMatrix(dw_offset_t offset) { // DWARFDebugLine::State::Finalize //---------------------------------------------------------------------- void DWARFDebugLine::State::Finalize(dw_offset_t offset) { - // Call the callback with a special row state when we are done parsing a - // line table + // Call the callback with a special row state when we are done parsing a line + // table row = DoneParsingLineTable; if (callback) callback(offset, *this, callbackUserData); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp index a8c48b7f2f8..89e27efb3cc 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp @@ -89,8 +89,8 @@ void DWARFDebugRanges::Dump(Stream &s, debug_ranges_data.ValidOffsetForDataOfSize(*offset_ptr, 2 * addr_size)) { dw_addr_t begin = debug_ranges_data.GetMaxU64(offset_ptr, addr_size); dw_addr_t end = debug_ranges_data.GetMaxU64(offset_ptr, addr_size); - // Extend 4 byte addresses that consists of 32 bits of 1's to be 64 bits - // of ones + // Extend 4 byte addresses that consists of 32 bits of 1's to be 64 bits of + // ones if (begin == 0xFFFFFFFFull && addr_size == 4) begin = LLDB_INVALID_ADDRESS; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp index 79f2f221696..dbaf0b0ed12 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.cpp @@ -67,8 +67,8 @@ bool DWARFDeclContext::operator==(const DWARFDeclContext &rhs) const { // First compare the tags before we do expensive name compares for (pos = begin, rhs_pos = rhs_begin; pos != end; ++pos, ++rhs_pos) { if (pos->tag != rhs_pos->tag) { - // Check for DW_TAG_structure_type and DW_TAG_class_type as they are often - // used interchangeably in GCC + // Check for DW_TAG_structure_type and DW_TAG_class_type as they are + // often used interchangeably in GCC if (pos->tag == DW_TAG_structure_type && rhs_pos->tag == DW_TAG_class_type) continue; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index 579c6d61ab8..4fde5748d3f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -299,8 +299,8 @@ bool DWARFFormValue::SkipValue(dw_form_t form, const DWARFUnit *cu) { uint8_t ref_addr_size; switch (form) { - // Blocks if inlined data that have a length field and the data bytes - // inlined in the .debug_info + // Blocks if inlined data that have a length field and the data bytes inlined + // in the .debug_info case DW_FORM_exprloc: case DW_FORM_block: { dw_uleb128_t size = debug_info_data.GetULEB128(offset_ptr); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index 18590fab270..754ffed6ae3 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -38,8 +38,7 @@ DWARFUnit::~DWARFUnit() {} //---------------------------------------------------------------------- // ParseCompileUnitDIEsIfNeeded // -// Parses a compile unit and indexes its DIEs if it hasn't already been -// done. +// Parses a compile unit and indexes its DIEs if it hasn't already been done. //---------------------------------------------------------------------- size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) { const size_t initial_die_array_size = m_die_array.size(); @@ -71,8 +70,8 @@ size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) { } uint32_t depth = 0; - // We are in our compile unit, parse starting at the offset - // we were told to parse + // We are in our compile unit, parse starting at the offset we were told to + // parse const DWARFDataExtractor &debug_info_data = m_dwarf->get_debug_info_data(); std::vector<uint32_t> die_index_stack; die_index_stack.reserve(32); @@ -105,11 +104,10 @@ size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) { } else { if (null_die) { if (prev_die_had_children) { - // This will only happen if a DIE says is has children - // but all it contains is a NULL tag. Since we are removing - // the NULL DIEs from the list (saves up to 25% in C++ code), - // we need a way to let the DIE know that it actually doesn't - // have children. + // This will only happen if a DIE says is has children but all it + // contains is a NULL tag. Since we are removing the NULL DIEs from + // the list (saves up to 25% in C++ code), we need a way to let the + // DIE know that it actually doesn't have children. if (!m_die_array.empty()) m_die_array.back().SetEmptyChildren(true); } @@ -148,9 +146,9 @@ size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) { } } - // Give a little bit of info if we encounter corrupt DWARF (our offset - // should always terminate at or before the start of the next compilation - // unit header). + // Give a little bit of info if we encounter corrupt DWARF (our offset should + // always terminate at or before the start of the next compilation unit + // header). if (offset > next_cu_offset) { m_dwarf->GetObjectFile()->GetModule()->ReportWarning( "DWARF compile unit extends beyond its bounds cu 0x%8.8x at " @@ -158,10 +156,9 @@ size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) { GetOffset(), offset); } - // Since std::vector objects will double their size, we really need to - // make a new array with the perfect size so we don't end up wasting - // space. So here we copy and swap to make sure we don't have any extra - // memory taken up. + // Since std::vector objects will double their size, we really need to make a + // new array with the perfect size so we don't end up wasting space. So here + // we copy and swap to make sure we don't have any extra memory taken up. if (m_die_array.size() < m_die_array.capacity()) { DWARFDebugInfoEntry::collection exact_size_die_array(m_die_array.begin(), @@ -196,8 +193,8 @@ void DWARFUnit::AddUnitDIE(DWARFDebugInfoEntry &die) { // Only reserve the memory if we are adding children of the main compile unit // DIE. The compile unit DIE is always the first entry, so if our size is 1, - // then we are adding the first compile unit child DIE and should reserve - // the memory. + // then we are adding the first compile unit child DIE and should reserve the + // memory. m_die_array.reserve(GetDebugInfoSize() / 24); m_die_array.push_back(die); @@ -307,13 +304,12 @@ void DWARFUnit::SetAddrBase(dw_addr_t addr_base, void DWARFUnit::ClearDIEs(bool keep_compile_unit_die) { if (m_die_array.size() > 1) { - // std::vectors never get any smaller when resized to a smaller size, - // or when clear() or erase() are called, the size will report that it - // is smaller, but the memory allocated remains intact (call capacity() - // to see this). So we need to create a temporary vector and swap the - // contents which will cause just the internal pointers to be swapped - // so that when "tmp_array" goes out of scope, it will destroy the - // contents. + // std::vectors never get any smaller when resized to a smaller size, or + // when clear() or erase() are called, the size will report that it is + // smaller, but the memory allocated remains intact (call capacity() to see + // this). So we need to create a temporary vector and swap the contents + // which will cause just the internal pointers to be swapped so that when + // "tmp_array" goes out of scope, it will destroy the contents. // Save at least the compile unit DIE DWARFDebugInfoEntry::collection tmp_array; @@ -328,9 +324,9 @@ void DWARFUnit::ClearDIEs(bool keep_compile_unit_die) { void DWARFUnit::BuildAddressRangeTable(SymbolFileDWARF *dwarf, DWARFDebugAranges *debug_aranges) { - // This function is usually called if there in no .debug_aranges section - // in order to produce a compile unit level set of address ranges that - // is accurate. + // This function is usually called if there in no .debug_aranges section in + // order to produce a compile unit level set of address ranges that is + // accurate. size_t num_debug_aranges = debug_aranges->GetNumRanges(); @@ -343,10 +339,10 @@ void DWARFUnit::BuildAddressRangeTable(SymbolFileDWARF *dwarf, const size_t num_ranges = die->GetAttributeAddressRanges(dwarf, this, ranges, false); if (num_ranges > 0) { - // This compile unit has DW_AT_ranges, assume this is correct if it - // is present since clang no longer makes .debug_aranges by default - // and it emits DW_AT_ranges for DW_TAG_compile_units. GCC also does - // this with recent GCC builds. + // This compile unit has DW_AT_ranges, assume this is correct if it is + // present since clang no longer makes .debug_aranges by default and it + // emits DW_AT_ranges for DW_TAG_compile_units. GCC also does this with + // recent GCC builds. for (size_t i = 0; i < num_ranges; ++i) { const DWARFRangeList::Entry &range = ranges.GetEntryRef(i); debug_aranges->AppendRange(cu_offset, range.GetRangeBase(), @@ -359,9 +355,8 @@ void DWARFUnit::BuildAddressRangeTable(SymbolFileDWARF *dwarf, // We don't have a DW_AT_ranges attribute, so we need to parse the DWARF // If the DIEs weren't parsed, then we don't want all dies for all compile - // units - // to stay loaded when they weren't needed. So we can end up parsing the DWARF - // and then throwing them all away to keep memory usage down. + // units to stay loaded when they weren't needed. So we can end up parsing + // the DWARF and then throwing them all away to keep memory usage down. const bool clear_dies = ExtractDIEsIfNeeded(false) > 1; die = DIEPtr(); @@ -419,8 +414,8 @@ void DWARFUnit::BuildAddressRangeTable(SymbolFileDWARF *dwarf, } } - // Keep memory down by clearing DIEs if this generate function - // caused them to be parsed + // Keep memory down by clearing DIEs if this generate function caused them to + // be parsed if (clear_dies) ClearDIEs(true); } @@ -456,10 +451,9 @@ static bool CompareDIEOffset(const DWARFDebugInfoEntry &die, //---------------------------------------------------------------------- // GetDIE() // -// Get the DIE (Debug Information Entry) with the specified offset by -// first checking if the DIE is contained within this compile unit and -// grabbing the DIE from this compile unit. Otherwise we grab the DIE -// from the DWARF file. +// Get the DIE (Debug Information Entry) with the specified offset by first +// checking if the DIE is contained within this compile unit and grabbing the +// DIE from this compile unit. Otherwise we grab the DIE from the DWARF file. //---------------------------------------------------------------------- DWARFDIE DWARFUnit::GetDIE(dw_offset_t die_offset) { @@ -515,8 +509,8 @@ bool DWARFUnit::Supports_DW_AT_APPLE_objc_complete_type() { } bool DWARFUnit::DW_AT_decl_file_attributes_are_invalid() { - // llvm-gcc makes completely invalid decl file attributes and won't ever - // be fixed, so we need to know to ignore these. + // llvm-gcc makes completely invalid decl file attributes and won't ever be + // fixed, so we need to know to ignore these. return GetProducer() == eProducerLLVMGCC; } @@ -602,8 +596,8 @@ uint32_t DWARFUnit::GetProducerVersionUpdate() { return m_producer_version_update; } LanguageType DWARFUnit::LanguageTypeFromDWARF(uint64_t val) { - // Note: user languages between lo_user and hi_user - // must be handled explicitly here. + // Note: user languages between lo_user and hi_user must be handled + // explicitly here. switch (val) { case DW_LANG_Mips_Assembler: return eLanguageTypeMipsAssembler; @@ -851,8 +845,8 @@ void DWARFUnit::IndexPrivate( func_fullnames.Insert(objc_fullname_no_category_name, DIERef(cu_offset, die.GetOffset())); } - // If we have a mangled name, then the DW_AT_name attribute - // is usually the method name without the class or any parameters + // If we have a mangled name, then the DW_AT_name attribute is + // usually the method name without the class or any parameters const DWARFDebugInfoEntry *parent = die.GetParent(); bool is_method = false; if (parent) { @@ -883,10 +877,10 @@ void DWARFUnit::IndexPrivate( DIERef(cu_offset, die.GetOffset())); } if (mangled_cstr) { - // Make sure our mangled name isn't the same string table entry - // as our name. If it starts with '_', then it is ok, else compare - // the string to make sure it isn't the same and we don't end up - // with duplicate entries + // Make sure our mangled name isn't the same string table entry as + // our name. If it starts with '_', then it is ok, else compare the + // string to make sure it isn't the same and we don't end up with + // duplicate entries if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { @@ -908,10 +902,10 @@ void DWARFUnit::IndexPrivate( func_basenames.Insert(ConstString(name), DIERef(cu_offset, die.GetOffset())); if (mangled_cstr) { - // Make sure our mangled name isn't the same string table entry - // as our name. If it starts with '_', then it is ok, else compare - // the string to make sure it isn't the same and we don't end up - // with duplicate entries + // Make sure our mangled name isn't the same string table entry as + // our name. If it starts with '_', then it is ok, else compare the + // string to make sure it isn't the same and we don't end up with + // duplicate entries if (name && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { @@ -956,15 +950,15 @@ void DWARFUnit::IndexPrivate( case DW_TAG_variable: if (name && has_location_or_const_value && is_global_or_static_variable) { globals.Insert(ConstString(name), DIERef(cu_offset, die.GetOffset())); - // Be sure to include variables by their mangled and demangled - // names if they have any since a variable can have a basename - // "i", a mangled named "_ZN12_GLOBAL__N_11iE" and a demangled - // mangled name "(anonymous namespace)::i"... - - // Make sure our mangled name isn't the same string table entry - // as our name. If it starts with '_', then it is ok, else compare - // the string to make sure it isn't the same and we don't end up - // with duplicate entries + // Be sure to include variables by their mangled and demangled names if + // they have any since a variable can have a basename "i", a mangled + // named "_ZN12_GLOBAL__N_11iE" and a demangled mangled name + // "(anonymous namespace)::i"... + + // Make sure our mangled name isn't the same string table entry as our + // name. If it starts with '_', then it is ok, else compare the string + // to make sure it isn't the same and we don't end up with duplicate + // entries if (mangled_cstr && name != mangled_cstr && ((mangled_cstr[0] == '_') || (::strcmp(name, mangled_cstr) != 0))) { Mangled mangled(ConstString(mangled_cstr), true); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp index 629ae8b0a6a..36211a08557 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -75,15 +75,14 @@ void DWARFMappedHash::ExtractClassOrStructDIEArray( die_tag == DW_TAG_structure_type) { if (die_info_array[i].type_flags & eTypeFlagClassIsImplementation) { if (return_implementation_only_if_available) { - // We found the one true definition for this class, so - // only return that + // We found the one true definition for this class, so only return + // that die_offsets.clear(); die_offsets.emplace_back(die_info_array[i].cu_offset, die_info_array[i].offset); return; } else { - // Put the one true definition as the first entry so it - // matches first + // Put the one true definition as the first entry so it matches first die_offsets.emplace(die_offsets.begin(), die_info_array[i].cu_offset, die_info_array[i].offset); } @@ -137,9 +136,8 @@ DWARFMappedHash::DIEInfo::DIEInfo(dw_offset_t c, dw_offset_t o, dw_tag_t t, DWARFMappedHash::Prologue::Prologue(dw_offset_t _die_base_offset) : die_base_offset(_die_base_offset), atoms(), atom_mask(0), min_hash_data_byte_size(0), hash_data_has_fixed_byte_size(true) { - // Define an array of DIE offsets by first defining an array, - // and then define the atom type for the array, in this case - // we have an array of DIE offsets + // Define an array of DIE offsets by first defining an array, and then define + // the atom type for the array, in this case we have an array of DIE offsets AppendAtom(eAtomTypeDIEOffset, DW_FORM_data4); } @@ -239,8 +237,7 @@ DWARFMappedHash::Prologue::Read(const lldb_private::DataExtractor &data, size_t DWARFMappedHash::Prologue::GetByteSize() const { // Add an extra count to the atoms size for the zero termination Atom that - // gets - // written to disk + // gets written to disk return sizeof(die_base_offset) + sizeof(uint32_t) + atoms.size() * sizeof(Atom); } @@ -384,13 +381,13 @@ DWARFMappedHash::MemoryTable::GetHashDataForName( pair.key = m_data.GetU32(hash_data_offset_ptr); pair.value.clear(); - // If the key is zero, this terminates our chain of HashData objects - // for this hash value. + // If the key is zero, this terminates our chain of HashData objects for this + // hash value. if (pair.key == 0) return eResultEndOfHashData; - // There definitely should be a string for this string offset, if - // there isn't, there is something wrong, return and error + // There definitely should be a string for this string offset, if there + // isn't, there is something wrong, return and error const char *strp_cstr = m_string_table.PeekCStr(pair.key); if (strp_cstr == NULL) { *hash_data_offset_ptr = UINT32_MAX; @@ -403,22 +400,21 @@ DWARFMappedHash::MemoryTable::GetHashDataForName( if (count > 0 && m_data.ValidOffsetForDataOfSize(*hash_data_offset_ptr, min_total_hash_data_size)) { - // We have at least one HashData entry, and we have enough - // data to parse at least "count" HashData entries. + // We have at least one HashData entry, and we have enough data to parse at + // least "count" HashData entries. // First make sure the entire C string matches... const bool match = name == strp_cstr; if (!match && m_header.header_data.HashDataHasFixedByteSize()) { - // If the string doesn't match and we have fixed size data, - // we can just add the total byte size of all HashData objects - // to the hash data offset and be done... + // If the string doesn't match and we have fixed size data, we can just + // add the total byte size of all HashData objects to the hash data + // offset and be done... *hash_data_offset_ptr += min_total_hash_data_size; } else { - // If the string does match, or we don't have fixed size data - // then we need to read the hash data as a stream. If the - // string matches we also append all HashData objects to the - // value array. + // If the string does match, or we don't have fixed size data then we + // need to read the hash data as a stream. If the string matches we also + // append all HashData objects to the value array. for (uint32_t i = 0; i < count; ++i) { DIEInfo die_info; if (m_header.Read(m_data, hash_data_offset_ptr, die_info)) { @@ -432,16 +428,15 @@ DWARFMappedHash::MemoryTable::GetHashDataForName( } } } - // Return the correct response depending on if the string matched - // or not... + // Return the correct response depending on if the string matched or not... if (match) return eResultKeyMatch; // The key (cstring) matches and we have lookup // results! else return eResultKeyMismatch; // The key doesn't match, this function will // get called - // again for the next key/value or the key terminator - // which in our case is a zero .debug_str offset. + // again for the next key/value or the key terminator which in our case is + // a zero .debug_str offset. } else { *hash_data_offset_ptr = UINT32_MAX; return eResultError; @@ -453,13 +448,13 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression( const lldb_private::RegularExpression ®ex, lldb::offset_t *hash_data_offset_ptr, Pair &pair) const { pair.key = m_data.GetU32(hash_data_offset_ptr); - // If the key is zero, this terminates our chain of HashData objects - // for this hash value. + // If the key is zero, this terminates our chain of HashData objects for this + // hash value. if (pair.key == 0) return eResultEndOfHashData; - // There definitely should be a string for this string offset, if - // there isn't, there is something wrong, return and error + // There definitely should be a string for this string offset, if there + // isn't, there is something wrong, return and error const char *strp_cstr = m_string_table.PeekCStr(pair.key); if (strp_cstr == NULL) return eResultError; @@ -473,15 +468,14 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression( const bool match = regex.Execute(llvm::StringRef(strp_cstr)); if (!match && m_header.header_data.HashDataHasFixedByteSize()) { - // If the regex doesn't match and we have fixed size data, - // we can just add the total byte size of all HashData objects - // to the hash data offset and be done... + // If the regex doesn't match and we have fixed size data, we can just + // add the total byte size of all HashData objects to the hash data + // offset and be done... *hash_data_offset_ptr += min_total_hash_data_size; } else { - // If the string does match, or we don't have fixed size data - // then we need to read the hash data as a stream. If the - // string matches we also append all HashData objects to the - // value array. + // If the string does match, or we don't have fixed size data then we + // need to read the hash data as a stream. If the string matches we also + // append all HashData objects to the value array. for (uint32_t i = 0; i < count; ++i) { DIEInfo die_info; if (m_header.Read(m_data, hash_data_offset_ptr, die_info)) { @@ -495,16 +489,15 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression( } } } - // Return the correct response depending on if the string matched - // or not... + // Return the correct response depending on if the string matched or not... if (match) return eResultKeyMatch; // The key (cstring) matches and we have lookup // results! else return eResultKeyMismatch; // The key doesn't match, this function will // get called - // again for the next key/value or the key terminator - // which in our case is a zero .debug_str offset. + // again for the next key/value or the key terminator which in our case is + // a zero .debug_str offset. } else { *hash_data_offset_ptr = UINT32_MAX; return eResultError; @@ -529,8 +522,7 @@ size_t DWARFMappedHash::MemoryTable::AppendAllDIEsThatMatchingRegex( switch (hash_result) { case eResultKeyMatch: case eResultKeyMismatch: - // Whether we matches or not, it doesn't matter, we - // keep looking. + // Whether we matches or not, it doesn't matter, we keep looking. break; case eResultEndOfHashData: @@ -553,8 +545,8 @@ size_t DWARFMappedHash::MemoryTable::AppendAllDIEsInRange( lldb::offset_t hash_data_offset = GetHashDataOffset(offset_idx); while (!done && hash_data_offset != UINT32_MAX) { KeyType key = m_data.GetU32(&hash_data_offset); - // If the key is zero, this terminates our chain of HashData objects - // for this hash value. + // If the key is zero, this terminates our chain of HashData objects for + // this hash value. if (key == 0) break; @@ -610,17 +602,16 @@ size_t DWARFMappedHash::MemoryTable::FindCompleteObjCClassByName( if (FindByName(name, die_info_array)) { if (must_be_implementation && GetHeader().header_data.ContainsAtom(eAtomTypeTypeFlags)) { - // If we have two atoms, then we have the DIE offset and - // the type flags so we can find the objective C class - // efficiently. + // If we have two atoms, then we have the DIE offset and the type flags + // so we can find the objective C class efficiently. DWARFMappedHash::ExtractTypesFromDIEArray(die_info_array, UINT32_MAX, eTypeFlagClassIsImplementation, die_offsets); } else { - // We don't only want the one true definition, so try and see - // what we can find, and only return class or struct DIEs. - // If we do have the full implementation, then return it alone, - // else return all possible matches. + // We don't only want the one true definition, so try and see what we can + // find, and only return class or struct DIEs. If we do have the full + // implementation, then return it alone, else return all possible + // matches. const bool return_implementation_only_if_available = true; DWARFMappedHash::ExtractClassOrStructDIEArray( die_info_array, return_implementation_only_if_available, die_offsets); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index a8b55b415d4..27606ac9ec8 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -164,8 +164,8 @@ static const char *removeHostnameFromPathname(const char *path_from_dwarf) { return path_from_dwarf; } - // check whether we have a windows path, and so the first character - // is a drive-letter not a hostname. + // check whether we have a windows path, and so the first character is a + // drive-letter not a hostname. if (colon_pos == path_from_dwarf + 1 && isalpha(*path_from_dwarf) && strlen(path_from_dwarf) > 2 && '\\' == path_from_dwarf[2]) { return path_from_dwarf; @@ -503,15 +503,14 @@ uint32_t SymbolFileDWARF::CalculateAbilities() { if (section_list == NULL) return 0; - // On non Apple platforms we might have .debug_types debug info that - // is created by using "-fdebug-types-section". LLDB currently will try - // to load this debug info, but it causes crashes during debugging when - // types are missing since it doesn't know how to parse the info in - // the .debug_types type units. This causes all complex debug info - // types to be unresolved. Because this causes LLDB to crash and since - // it really doesn't provide a solid debuggiung experience, we should - // disable trying to debug this kind of DWARF until support gets - // added or deprecated. + // On non Apple platforms we might have .debug_types debug info that is + // created by using "-fdebug-types-section". LLDB currently will try to + // load this debug info, but it causes crashes during debugging when types + // are missing since it doesn't know how to parse the info in the + // .debug_types type units. This causes all complex debug info types to be + // unresolved. Because this causes LLDB to crash and since it really + // doesn't provide a solid debuggiung experience, we should disable trying + // to debug this kind of DWARF until support gets added or deprecated. if (section_list->FindSectionByName(ConstString(".debug_types"))) { m_obj_file->GetModule()->ReportWarning( "lldb doesn’t support .debug_types debug info"); @@ -563,10 +562,10 @@ uint32_t SymbolFileDWARF::CalculateAbilities() { if (symfile_dir_cstr) { if (strcasestr(symfile_dir_cstr, ".dsym")) { if (m_obj_file->GetType() == ObjectFile::eTypeDebugInfo) { - // We have a dSYM file that didn't have a any debug info. - // If the string table has a size of 1, then it was made from - // an executable with no debug info, or from an executable that - // was stripped. + // We have a dSYM file that didn't have a any debug info. If the + // string table has a size of 1, then it was made from an + // executable with no debug info, or from an executable that was + // stripped. section = section_list->FindSectionByType(eSectionTypeDWARFDebugStr, true) .get(); @@ -730,8 +729,8 @@ SymbolFileDWARF::GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) { DWARFDebugInfo *info = DebugInfo(); if (info) { - // Just a normal DWARF file whose user ID for the compile unit is - // the DWARF offset itself + // Just a normal DWARF file whose user ID for the compile unit is the DWARF + // offset itself DWARFUnit *dwarf_cu = info->GetCompileUnit((dw_offset_t)comp_unit->GetID()); @@ -784,8 +783,8 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFUnit *dwarf_cu, FileSpec cu_file_spec{cu_die.GetName(), false}; if (cu_file_spec) { // If we have a full path to the compile unit, we don't need to - // resolve - // the file. This can be expensive e.g. when the source files are + // resolve the file. This can be expensive e.g. when the source + // files are // NFS mounted. if (cu_file_spec.IsRelative()) { const char *cu_comp_dir{ @@ -808,10 +807,8 @@ lldb::CompUnitSP SymbolFileDWARF::ParseCompileUnit(DWARFUnit *dwarf_cu, cu_language, is_optimized ? eLazyBoolYes : eLazyBoolNo)); if (cu_sp) { // If we just created a compile unit with an invalid file spec, - // try and get the - // first entry in the supports files from the line table as that - // should be the - // compile unit. + // try and get the first entry in the supports files from the + // line table as that should be the compile unit. if (!cu_file_spec) { cu_file_spec = cu_sp->GetSupportFiles().GetFileSpecAtIndex(1); if (cu_file_spec) { @@ -1005,8 +1002,7 @@ static void ParseDWARFLineTableCallback(dw_offset_t offset, (ParseDWARFLineTableCallbackInfo *)userData; LineTable *line_table = info->line_table; - // If this is our first time here, we need to create a - // sequence container. + // If this is our first time here, we need to create a sequence container. if (!info->sequence_ap.get()) { info->sequence_ap.reset(line_table->CreateLineSequenceContainer()); assert(info->sequence_ap.get()); @@ -1070,10 +1066,10 @@ bool SymbolFileDWARF::ParseCompileUnitLineTable(const SymbolContext &sc) { &info); SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile(); if (debug_map_symfile) { - // We have an object file that has a line table with addresses - // that are not linked. We need to link the line table and convert - // the addresses that are relative to the .o file into addresses - // for the main executable. + // We have an object file that has a line table with addresses that + // are not linked. We need to link the line table and convert the + // addresses that are relative to the .o file into addresses for + // the main executable. sc.comp_unit->SetLineTable( debug_map_symfile->LinkOSOLineTable(this, line_table_ap.get())); } else { @@ -1149,9 +1145,9 @@ size_t SymbolFileDWARF::ParseFunctionBlocks(const SymbolContext &sc, case DW_TAG_lexical_block: { Block *block = NULL; if (tag == DW_TAG_subprogram) { - // Skip any DW_TAG_subprogram DIEs that are inside - // of a normal or inlined functions. These will be - // parsed on their own as separate entities. + // Skip any DW_TAG_subprogram DIEs that are inside of a normal or + // inlined functions. These will be parsed on their own as separate + // entities. if (depth > 0) break; @@ -1179,18 +1175,14 @@ size_t SymbolFileDWARF::ParseFunctionBlocks(const SymbolContext &sc, assert(subprogram_low_pc == LLDB_INVALID_ADDRESS); subprogram_low_pc = ranges.GetMinRangeBase(0); } else if (tag == DW_TAG_inlined_subroutine) { - // We get called here for inlined subroutines in two ways. - // The first time is when we are making the Function object - // for this inlined concrete instance. Since we're creating a top - // level block at + // We get called here for inlined subroutines in two ways. The first + // time is when we are making the Function object for this inlined + // concrete instance. Since we're creating a top level block at // here, the subprogram_low_pc will be LLDB_INVALID_ADDRESS. So we - // need to - // adjust the containing address. - // The second time is when we are parsing the blocks inside the - // function that contains - // the inlined concrete instance. Since these will be blocks inside - // the containing "real" - // function the offset will be for that function. + // need to adjust the containing address. The second time is when we + // are parsing the blocks inside the function that contains the + // inlined concrete instance. Since these will be blocks inside the + // containing "real" function the offset will be for that function. if (subprogram_low_pc == LLDB_INVALID_ADDRESS) { subprogram_low_pc = ranges.GetMinRangeBase(0); } @@ -1245,9 +1237,9 @@ size_t SymbolFileDWARF::ParseFunctionBlocks(const SymbolContext &sc, break; } - // Only parse siblings of the block if we are not at depth zero. A depth - // of zero indicates we are currently parsing the top level - // DW_TAG_subprogram DIE + // Only parse siblings of the block if we are not at depth zero. A depth of + // zero indicates we are currently parsing the top level DW_TAG_subprogram + // DIE if (depth == 0) die.Clear(); @@ -1293,12 +1285,12 @@ void SymbolFileDWARF::ParseDeclsForContext(CompilerDeclContext decl_ctx) { } SymbolFileDWARF *SymbolFileDWARF::GetDWARFForUID(lldb::user_id_t uid) { - // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API - // we must make sure we use the correct DWARF file when resolving things. - // On MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple - // SymbolFileDWARF classes, one for each .o file. We can often end up - // with references to other DWARF objects and we must be ready to receive - // a "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF + // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API we + // must make sure we use the correct DWARF file when resolving things. On + // MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple + // SymbolFileDWARF classes, one for each .o file. We can often end up with + // references to other DWARF objects and we must be ready to receive a + // "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF // instance. SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile(); if (debug_map) @@ -1309,12 +1301,12 @@ SymbolFileDWARF *SymbolFileDWARF::GetDWARFForUID(lldb::user_id_t uid) { DWARFDIE SymbolFileDWARF::GetDIEFromUID(lldb::user_id_t uid) { - // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API - // we must make sure we use the correct DWARF file when resolving things. - // On MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple - // SymbolFileDWARF classes, one for each .o file. We can often end up - // with references to other DWARF objects and we must be ready to receive - // a "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF + // Anytime we get a "lldb::user_id_t" from an lldb_private::SymbolFile API we + // must make sure we use the correct DWARF file when resolving things. On + // MacOSX, when using SymbolFileDWARFDebugMap, we will use multiple + // SymbolFileDWARF classes, one for each .o file. We can often end up with + // references to other DWARF objects and we must be ready to receive a + // "lldb::user_id_t" that specifies a DIE from another SymbolFileDWARF // instance. SymbolFileDWARF *dwarf = GetDWARFForUID(uid); if (dwarf) @@ -1323,9 +1315,9 @@ SymbolFileDWARF::GetDIEFromUID(lldb::user_id_t uid) { } CompilerDecl SymbolFileDWARF::GetDeclForUID(lldb::user_id_t type_uid) { - // Anytime we have a lldb::user_id_t, we must get the DIE by - // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside - // the SymbolFileDWARF::GetDIEFromUID() for details. + // Anytime we have a lldb::user_id_t, we must get the DIE by calling + // SymbolFileDWARF::GetDIEFromUID(). See comments inside the + // SymbolFileDWARF::GetDIEFromUID() for details. DWARFDIE die = GetDIEFromUID(type_uid); if (die) return die.GetDecl(); @@ -1334,9 +1326,9 @@ CompilerDecl SymbolFileDWARF::GetDeclForUID(lldb::user_id_t type_uid) { CompilerDeclContext SymbolFileDWARF::GetDeclContextForUID(lldb::user_id_t type_uid) { - // Anytime we have a lldb::user_id_t, we must get the DIE by - // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside - // the SymbolFileDWARF::GetDIEFromUID() for details. + // Anytime we have a lldb::user_id_t, we must get the DIE by calling + // SymbolFileDWARF::GetDIEFromUID(). See comments inside the + // SymbolFileDWARF::GetDIEFromUID() for details. DWARFDIE die = GetDIEFromUID(type_uid); if (die) return die.GetDeclContext(); @@ -1345,9 +1337,9 @@ SymbolFileDWARF::GetDeclContextForUID(lldb::user_id_t type_uid) { CompilerDeclContext SymbolFileDWARF::GetDeclContextContainingUID(lldb::user_id_t type_uid) { - // Anytime we have a lldb::user_id_t, we must get the DIE by - // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside - // the SymbolFileDWARF::GetDIEFromUID() for details. + // Anytime we have a lldb::user_id_t, we must get the DIE by calling + // SymbolFileDWARF::GetDIEFromUID(). See comments inside the + // SymbolFileDWARF::GetDIEFromUID() for details. DWARFDIE die = GetDIEFromUID(type_uid); if (die) return die.GetContainingDeclContext(); @@ -1355,9 +1347,9 @@ SymbolFileDWARF::GetDeclContextContainingUID(lldb::user_id_t type_uid) { } Type *SymbolFileDWARF::ResolveTypeUID(lldb::user_id_t type_uid) { - // Anytime we have a lldb::user_id_t, we must get the DIE by - // calling SymbolFileDWARF::GetDIEFromUID(). See comments inside - // the SymbolFileDWARF::GetDIEFromUID() for details. + // Anytime we have a lldb::user_id_t, we must get the DIE by calling + // SymbolFileDWARF::GetDIEFromUID(). See comments inside the + // SymbolFileDWARF::GetDIEFromUID() for details. DWARFDIE type_die = GetDIEFromUID(type_uid); if (type_die) return type_die.ResolveType(); @@ -1378,9 +1370,9 @@ Type *SymbolFileDWARF::ResolveTypeUID(const DWARFDIE &die, log, "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s'", die.GetOffset(), die.GetTagAsCString(), die.GetName()); - // We might be coming in in the middle of a type tree (a class - // within a class, an enum within a class), so parse any needed - // parent DIEs before we get to this one... + // We might be coming in in the middle of a type tree (a class within a + // class, an enum within a class), so parse any needed parent DIEs before + // we get to this one... DWARFDIE decl_ctx_die = GetDeclContextDIEContainingDIE(die); if (decl_ctx_die) { if (log) { @@ -1408,8 +1400,8 @@ Type *SymbolFileDWARF::ResolveTypeUID(const DWARFDIE &die, } // This function is used when SymbolFileDWARFDebugMap owns a bunch of -// SymbolFileDWARF objects to detect if this DWARF file is the one that -// can resolve a compiler_type. +// SymbolFileDWARF objects to detect if this DWARF file is the one that can +// resolve a compiler_type. bool SymbolFileDWARF::HasForwardDeclForClangType( const CompilerType &compiler_type) { CompilerType compiler_type_no_qualifiers = @@ -1455,12 +1447,10 @@ bool SymbolFileDWARF::CompleteType(CompilerType &compiler_type) { DWARFDIE dwarf_die = GetDIE(die_it->getSecond()); if (dwarf_die) { - // Once we start resolving this type, remove it from the forward declaration - // map in case anyone child members or other types require this type to get - // resolved. - // The type will get resolved when all of the calls to - // SymbolFileDWARF::ResolveClangOpaqueTypeDefinition - // are done. + // Once we start resolving this type, remove it from the forward + // declaration map in case anyone child members or other types require this + // type to get resolved. The type will get resolved when all of the calls + // to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition are done. GetForwardDeclClangTypeToDie().erase(die_it); Type *type = GetDIEToType().lookup(dwarf_die.GetDIE()); @@ -1505,8 +1495,8 @@ SymbolFileDWARF::GetCompUnitForDWARFCompUnit(DWARFUnit *dwarf_cu, uint32_t cu_idx) { // Check if the symbol vendor already knows about this compile unit? if (dwarf_cu->GetUserData() == NULL) { - // The symbol vendor doesn't know about this compile unit, we - // need to parse and add it to the symbol vendor object. + // The symbol vendor doesn't know about this compile unit, we need to parse + // and add it to the symbol vendor object. return ParseCompileUnit(dwarf_cu, cu_idx).get(); } return (CompileUnit *)dwarf_cu->GetUserData(); @@ -1652,20 +1642,18 @@ void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() { dwo_module_spec.GetArchitecture() = m_obj_file->GetModule()->GetArchitecture(); - // When LLDB loads "external" modules it looks at the - // presence of DW_AT_GNU_dwo_name. - // However, when the already created module - // (corresponding to .dwo itself) is being processed, - // it will see the presence of DW_AT_GNU_dwo_name - // (which contains the name of dwo file) and - // will try to call ModuleList::GetSharedModule again. - // In some cases (i.e. for empty files) Clang 4.0 - // generates a *.dwo file which has DW_AT_GNU_dwo_name, - // but no DW_AT_comp_dir. In this case the method - // ModuleList::GetSharedModule will fail and - // the warning will be printed. However, as one can notice - // in this case we don't actually need to try to load the already - // loaded module (corresponding to .dwo) so we simply skip it. + // When LLDB loads "external" modules it looks at the presence of + // DW_AT_GNU_dwo_name. However, when the already created module + // (corresponding to .dwo itself) is being processed, it will see + // the presence of DW_AT_GNU_dwo_name (which contains the name of + // dwo file) and will try to call ModuleList::GetSharedModule + // again. In some cases (i.e. for empty files) Clang 4.0 generates + // a *.dwo file which has DW_AT_GNU_dwo_name, but no + // DW_AT_comp_dir. In this case the method + // ModuleList::GetSharedModule will fail and the warning will be + // printed. However, as one can notice in this case we don't + // actually need to try to load the already loaded module + // (corresponding to .dwo) so we simply skip it. if (m_obj_file->GetFileSpec() .GetFileNameExtension() .GetStringRef() == "dwo" && @@ -1759,13 +1747,11 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(const Address &so_addr, const dw_offset_t cu_offset = debug_info->GetCompileUnitAranges().FindAddress(file_vm_addr); if (cu_offset == DW_INVALID_OFFSET) { - // Global variables are not in the compile unit address ranges. The only - // way to - // currently find global variables is to iterate over the - // .debug_pubnames or the - // __apple_names table and find all items in there that point to - // DW_TAG_variable - // DIEs and then find the address that matches. + // Global variables are not in the compile unit address ranges. The + // only way to currently find global variables is to iterate over the + // .debug_pubnames or the __apple_names table and find all items in + // there that point to DW_TAG_variable DIEs and then find the address + // that matches. if (resolve_scope & eSymbolContextVariable) { GlobalVariableMap &map = GetGlobalAranges(); const GlobalVariableMap::Entry *entry = @@ -1833,13 +1819,10 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(const Address &so_addr, LineTable *line_table = sc.comp_unit->GetLineTable(); if (line_table != NULL) { // And address that makes it into this function should be in - // terms - // of this debug file if there is no debug map, or it will be an - // address in the .o file which needs to be fixed up to be in - // terms - // of the debug map executable. Either way, calling - // FixupAddress() - // will work for us. + // terms of this debug file if there is no debug map, or it + // will be an address in the .o file which needs to be fixed up + // to be in terms of the debug map executable. Either way, + // calling FixupAddress() will work for us. Address exe_so_addr(so_addr); if (FixupAddress(exe_so_addr)) { if (line_table->FindLineEntryByAddress(exe_so_addr, @@ -1853,11 +1836,11 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(const Address &so_addr, if (force_check_line_table && !(resolved & eSymbolContextLineEntry)) { // We might have had a compile unit that had discontiguous - // address ranges where the gaps are symbols that don't have - // any debug info. Discontiguous compile unit address ranges - // should only happen when there aren't other functions from - // other compile units in these gaps. This helps keep the size - // of the aranges down. + // address ranges where the gaps are symbols that don't have any + // debug info. Discontiguous compile unit address ranges should + // only happen when there aren't other functions from other + // compile units in these gaps. This helps keep the size of the + // aranges down. sc.comp_unit = NULL; resolved &= ~eSymbolContextCompUnit; } @@ -1899,8 +1882,8 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(const FileSpec &file_spec, if (sc.comp_unit) { uint32_t file_idx = UINT32_MAX; - // If we are looking for inline functions only and we don't - // find it in the support files, we are done. + // If we are looking for inline functions only and we don't find it + // in the support files, we are done. if (check_inlines) { file_idx = sc.comp_unit->GetSupportFiles().FindFileIndex( 1, file_spec, true); @@ -1912,8 +1895,8 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(const FileSpec &file_spec, LineTable *line_table = sc.comp_unit->GetLineTable(); if (line_table != NULL && line != 0) { - // We will have already looked up the file index if - // we are searching for inline entries. + // We will have already looked up the file index if we are + // searching for inline entries. if (!check_inlines) file_idx = sc.comp_unit->GetSupportFiles().FindFileIndex( 1, file_spec, true); @@ -1970,16 +1953,14 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(const FileSpec &file_spec, } } else if (file_spec_matches_cu_file_spec && !check_inlines) { // only append the context if we aren't looking for inline call - // sites - // by file and line and if the file spec matches that of the - // compile unit + // sites by file and line and if the file spec matches that of + // the compile unit sc_list.Append(sc); } } else if (file_spec_matches_cu_file_spec && !check_inlines) { // only append the context if we aren't looking for inline call - // sites - // by file and line and if the file spec matches that of the - // compile unit + // sites by file and line and if the file spec matches that of + // the compile unit sc_list.Append(sc); } @@ -2044,8 +2025,8 @@ void SymbolFileDWARF::Index() { auto extract_fn = [debug_info, &clear_cu_dies](size_t cu_idx) { DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); if (dwarf_cu) { - // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the - // DIEs for a compile unit have already been parsed. + // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the DIEs + // for a compile unit have already been parsed. if (dwarf_cu->ExtractDIEsIfNeeded(false) > 1) clear_cu_dies[cu_idx] = true; } @@ -2056,17 +2037,15 @@ void SymbolFileDWARF::Index() { //---------------------------------------------------------------------- // First figure out which compile units didn't have their DIEs already // parsed and remember this. If no DIEs were parsed prior to this index - // function call, we are going to want to clear the CU dies after we - // are done indexing to make sure we don't pull in all DWARF dies, but - // we need to wait until all compile units have been indexed in case - // a DIE in one compile unit refers to another and the indexes accesses - // those DIEs. + // function call, we are going to want to clear the CU dies after we are + // done indexing to make sure we don't pull in all DWARF dies, but we need + // to wait until all compile units have been indexed in case a DIE in one + // compile unit refers to another and the indexes accesses those DIEs. //---------------------------------------------------------------------- TaskMapOverInt(0, num_compile_units, extract_fn); // Now create a task runner that can index each DWARF compile unit in a - // separate - // thread so we can index quickly. + // separate thread so we can index quickly. TaskMapOverInt(0, num_compile_units, parser_fn); @@ -2130,9 +2109,9 @@ void SymbolFileDWARF::Index() { bool SymbolFileDWARF::DeclContextMatchesThisSymbolFile( const lldb_private::CompilerDeclContext *decl_ctx) { if (decl_ctx == nullptr || !decl_ctx->IsValid()) { - // Invalid namespace decl which means we aren't matching only things - // in this symbol file, so return true to indicate it matches this - // symbol file. + // Invalid namespace decl which means we aren't matching only things in + // this symbol file, so return true to indicate it matches this symbol + // file. return true; } @@ -2175,8 +2154,8 @@ uint32_t SymbolFileDWARF::FindGlobalVariables( if (!append) variables.Clear(); - // Remember how many variables are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many variables are in the list before we search in case we + // are appending the results to a variable list. const uint32_t original_size = variables.GetSize(); DIEArray die_offsets; @@ -2285,8 +2264,8 @@ uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression ®ex, if (!append) variables.Clear(); - // Remember how many variables are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many variables are in the list before we search in case we + // are appending the results to a variable list. const uint32_t original_size = variables.GetSize(); DIEArray die_offsets; @@ -2443,9 +2422,8 @@ void SymbolFileDWARF::ParseFunctions(const DIEArray &die_offsets, bool SymbolFileDWARF::DIEInDeclContext(const CompilerDeclContext *decl_ctx, const DWARFDIE &die) { // If we have no parent decl context to match this DIE matches, and if the - // parent - // decl context isn't valid, we aren't trying to look for any particular decl - // context so any die matches. + // parent decl context isn't valid, we aren't trying to look for any + // particular decl context so any die matches. if (decl_ctx == nullptr || !decl_ctx->IsValid()) return true; @@ -2494,8 +2472,8 @@ SymbolFileDWARF::FindFunctions(const ConstString &name, if (name.IsEmpty()) return 0; - // Remember how many sc_list are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many sc_list are in the list before we search in case we are + // appending the results to a variable list. const uint32_t original_size = sc_list.GetSize(); @@ -2513,10 +2491,8 @@ SymbolFileDWARF::FindFunctions(const ConstString &name, if (name_type_mask & eFunctionNameTypeFull) { // If they asked for the full name, match what they typed. At some - // point we may - // want to canonicalize this (strip double spaces, etc. For now, we - // just add all the - // dies that we find by exact match. + // point we may want to canonicalize this (strip double spaces, etc. + // For now, we just add all the dies that we find by exact match. num_matches = m_apple_names_ap->FindByName(name.GetStringRef(), die_offsets); for (uint32_t i = 0; i < num_matches; i++) { @@ -2546,8 +2522,8 @@ SymbolFileDWARF::FindFunctions(const ConstString &name, num_matches = m_apple_names_ap->FindByName(name.GetStringRef(), die_offsets); // Now make sure these are actually ObjC methods. In this case we can - // simply look up the name, - // and if it is an ObjC method name, we're good. + // simply look up the name, and if it is an ObjC method name, we're + // good. for (uint32_t i = 0; i < num_matches; i++) { const DIERef &die_ref = die_offsets[i]; @@ -2573,10 +2549,9 @@ SymbolFileDWARF::FindFunctions(const ConstString &name, if (((name_type_mask & eFunctionNameTypeMethod) && !parent_decl_ctx) || name_type_mask & eFunctionNameTypeBase) { // The apple_names table stores just the "base name" of C++ methods in - // the table. So we have to - // extract the base name, look that up, and if there is any other - // information in the name we were - // passed in we have to post-filter based on that. + // the table. So we have to extract the base name, look that up, and + // if there is any other information in the name we were passed in we + // have to post-filter based on that. // FIXME: Arrange the logic above so that we don't calculate the base // name twice: @@ -2597,8 +2572,8 @@ SymbolFileDWARF::FindFunctions(const ConstString &name, if ((name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeMethod)) != (eFunctionNameTypeBase | eFunctionNameTypeMethod)) { - // We are looking for either basenames or methods, so we need to - // trim out the ones we won't want by looking at the type + // We are looking for either basenames or methods, so we need + // to trim out the ones we won't want by looking at the type SymbolContext sc; if (sc_list.GetLastContext(sc)) { if (sc.block) { @@ -2651,14 +2626,13 @@ SymbolFileDWARF::FindFunctions(const ConstString &name, FindFunctions(name, m_function_fullname_index, include_inlines, sc_list); // FIXME Temporary workaround for global/anonymous namespace - // functions debugging FreeBSD and Linux binaries. - // If we didn't find any functions in the global namespace try - // looking in the basename index but ignore any returned - // functions that have a namespace but keep functions which - // have an anonymous namespace + // functions debugging FreeBSD and Linux binaries. If we didn't find any + // functions in the global namespace try looking in the basename index + // but ignore any returned functions that have a namespace but keep + // functions which have an anonymous namespace // TODO: The arch in the object file isn't correct for MSVC - // binaries on windows, we should find a way to make it - // correct and handle those symbols as well. + // binaries on windows, we should find a way to make it correct and + // handle those symbols as well. if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && GetObjectFile()->GetArchitecture(arch) && @@ -2764,8 +2738,8 @@ uint32_t SymbolFileDWARF::FindFunctions(const RegularExpression ®ex, if (!append) sc_list.Clear(); - // Remember how many sc_list are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many sc_list are in the list before we search in case we are + // appending the results to a variable list. uint32_t original_size = sc_list.GetSize(); if (m_using_apple_tables) { @@ -3016,8 +2990,8 @@ SymbolFileDWARF::FindNamespace(const SymbolContext &sc, const ConstString &name, if (info) { DIEArray die_offsets; - // Index if we already haven't to make sure the compile units - // get indexed and make their global DIE index list + // Index if we already haven't to make sure the compile units get indexed + // and make their global DIE index list if (m_using_apple_tables) { if (m_apple_namespaces_ap.get()) { m_apple_namespaces_ap->FindByName(name.GetStringRef(), die_offsets); @@ -3166,12 +3140,10 @@ SymbolFileDWARF::GetObjCClassSymbol(const ConstString &objc_class_name) { } // Some compilers don't emit the DW_AT_APPLE_objc_complete_type attribute. If -// they don't -// then we can end up looking through all class types for a complete type and -// never find -// the full definition. We need to know if this attribute is supported, so we -// determine -// this here and cache th result. We also need to worry about the debug map +// they don't then we can end up looking through all class types for a complete +// type and never find the full definition. We need to know if this attribute +// is supported, so we determine this here and cache th result. We also need to +// worry about the debug map // DWARF file // if we are doing darwin DWARF in .o file debugging. bool SymbolFileDWARF::Supports_DW_AT_APPLE_objc_complete_type( @@ -3234,7 +3206,8 @@ TypeSP SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE( if (type_die) { bool try_resolving_type = false; - // Don't try and resolve the DIE we are looking for with the DIE itself! + // Don't try and resolve the DIE we are looking for with the DIE + // itself! if (type_die != die) { switch (type_die.Tag()) { case DW_TAG_class_type: @@ -3283,16 +3256,15 @@ TypeSP SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE( } //---------------------------------------------------------------------- -// This function helps to ensure that the declaration contexts match for -// two different DIEs. Often times debug information will refer to a -// forward declaration of a type (the equivalent of "struct my_struct;". -// There will often be a declaration of that type elsewhere that has the -// full definition. When we go looking for the full type "my_struct", we -// will find one or more matches in the accelerator tables and we will -// then need to make sure the type was in the same declaration context -// as the original DIE. This function can efficiently compare two DIEs -// and will return true when the declaration context matches, and false -// when they don't. +// This function helps to ensure that the declaration contexts match for two +// different DIEs. Often times debug information will refer to a forward +// declaration of a type (the equivalent of "struct my_struct;". There will +// often be a declaration of that type elsewhere that has the full definition. +// When we go looking for the full type "my_struct", we will find one or more +// matches in the accelerator tables and we will then need to make sure the +// type was in the same declaration context as the original DIE. This function +// can efficiently compare two DIEs and will return true when the declaration +// context matches, and false when they don't. //---------------------------------------------------------------------- bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, const DWARFDIE &die2) { @@ -3301,32 +3273,31 @@ bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, DWARFDIECollection decl_ctx_1; DWARFDIECollection decl_ctx_2; - // The declaration DIE stack is a stack of the declaration context - // DIEs all the way back to the compile unit. If a type "T" is - // declared inside a class "B", and class "B" is declared inside - // a class "A" and class "A" is in a namespace "lldb", and the - // namespace is in a compile unit, there will be a stack of DIEs: + // The declaration DIE stack is a stack of the declaration context DIEs all + // the way back to the compile unit. If a type "T" is declared inside a class + // "B", and class "B" is declared inside a class "A" and class "A" is in a + // namespace "lldb", and the namespace is in a compile unit, there will be a + // stack of DIEs: // // [0] DW_TAG_class_type for "B" // [1] DW_TAG_class_type for "A" // [2] DW_TAG_namespace for "lldb" // [3] DW_TAG_compile_unit or DW_TAG_partial_unit for the source file. // - // We grab both contexts and make sure that everything matches - // all the way back to the compiler unit. + // We grab both contexts and make sure that everything matches all the way + // back to the compiler unit. // First lets grab the decl contexts for both DIEs die1.GetDeclContextDIEs(decl_ctx_1); die2.GetDeclContextDIEs(decl_ctx_2); - // Make sure the context arrays have the same size, otherwise - // we are done + // Make sure the context arrays have the same size, otherwise we are done const size_t count1 = decl_ctx_1.Size(); const size_t count2 = decl_ctx_2.Size(); if (count1 != count2) return false; - // Make sure the DW_TAG values match all the way back up the - // compile unit. If they don't, then we are done. + // Make sure the DW_TAG values match all the way back up the compile unit. If + // they don't, then we are done. DWARFDIE decl_ctx_die1; DWARFDIE decl_ctx_die2; size_t i; @@ -3339,27 +3310,28 @@ bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, #if defined LLDB_CONFIGURATION_DEBUG // Make sure the top item in the decl context die array is always - // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then something - // went wrong in the DWARFDIE::GetDeclContextDIEs() function... + // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then + // something went wrong in the DWARFDIE::GetDeclContextDIEs() + // function. dw_tag_t cu_tag = decl_ctx_1.GetDIEAtIndex(count1 - 1).Tag(); UNUSED_IF_ASSERT_DISABLED(cu_tag); assert(cu_tag == DW_TAG_compile_unit || cu_tag == DW_TAG_partial_unit); #endif - // Always skip the compile unit when comparing by only iterating up to - // "count - 1". Here we compare the names as we go. + // Always skip the compile unit when comparing by only iterating up to "count + // - 1". Here we compare the names as we go. for (i = 0; i < count1 - 1; i++) { decl_ctx_die1 = decl_ctx_1.GetDIEAtIndex(i); decl_ctx_die2 = decl_ctx_2.GetDIEAtIndex(i); const char *name1 = decl_ctx_die1.GetName(); const char *name2 = decl_ctx_die2.GetName(); - // If the string was from a DW_FORM_strp, then the pointer will often - // be the same! + // If the string was from a DW_FORM_strp, then the pointer will often be + // the same! if (name1 == name2) continue; - // Name pointers are not equal, so only compare the strings - // if both are not NULL. + // Name pointers are not equal, so only compare the strings if both are not + // NULL. if (name1 && name2) { // If the strings don't compare, we are done... if (strcmp(name1, name2) != 0) @@ -3369,8 +3341,8 @@ bool SymbolFileDWARF::DIEDeclContextsMatch(const DWARFDIE &die1, return false; } } - // We made it through all of the checks and the declaration contexts - // are equal. + // We made it through all of the checks and the declaration contexts are + // equal. return true; } @@ -3432,10 +3404,9 @@ TypeSP SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext( const size_t num_matches = die_offsets.size(); - // Get the type system that we are looking to find a type for. We will use - // this - // to ensure any matches we find are in a language that this type system - // supports + // Get the type system that we are looking to find a type for. We will + // use this to ensure any matches we find are in a language that this + // type system supports const LanguageType language = dwarf_decl_ctx.GetLanguage(); TypeSystem *type_system = (language == eLanguageTypeUnknown) ? nullptr @@ -3448,10 +3419,8 @@ TypeSP SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext( if (type_die) { // Make sure type_die's langauge matches the type system we are - // looking for. - // We don't want to find a "Foo" type from Java if we are looking - // for a "Foo" - // type for C, C++, ObjC, or ObjC++. + // looking for. We don't want to find a "Foo" type from Java if we + // are looking for a "Foo" type for C, C++, ObjC, or ObjC++. if (type_system && !type_system->SupportsLanguage(type_die.GetLanguage())) continue; @@ -3465,24 +3434,23 @@ TypeSP SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext( // The tags match, lets try resolving this type try_resolving_type = true; } else { - // The tags don't match, but we need to watch our for a - // forward declaration for a struct and ("struct foo") - // ends up being a class ("class foo { ... };") or - // vice versa. + // The tags don't match, but we need to watch our for a forward + // declaration for a struct and ("struct foo") ends up being a + // class ("class foo { ... };") or vice versa. switch (type_tag) { case DW_TAG_class_type: - // We had a "class foo", see if we ended up with a "struct foo { - // ... };" + // We had a "class foo", see if we ended up with a "struct foo + // { ... };" try_resolving_type = (tag == DW_TAG_structure_type); break; case DW_TAG_structure_type: - // We had a "struct foo", see if we ended up with a "class foo { - // ... };" + // We had a "struct foo", see if we ended up with a "class foo + // { ... };" try_resolving_type = (tag == DW_TAG_class_type); break; default: - // Tags don't match, don't event try to resolve - // using this type whose name matches.... + // Tags don't match, don't event try to resolve using this type + // whose name matches.... break; } } @@ -3693,8 +3661,8 @@ size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext &sc) { } } } else { - // Index if we already haven't to make sure the compile units - // get indexed and make their global DIE index list + // Index if we already haven't to make sure the compile units get + // indexed and make their global DIE index list if (!m_indexed) Index(); @@ -3910,10 +3878,9 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc, // TODO: Handle the case when DW_AT_start_scope have form // constant. The // dwarf spec is a bit ambiguous about what is the expected - // behavior in - // case the enclosing block have a non coninious address range and - // the - // DW_AT_start_scope entry have a form constant. + // behavior in case the enclosing block have a non coninious + // address range and the DW_AT_start_scope entry have a form + // constant. GetObjectFile()->GetModule()->ReportWarning( "0x%8.8" PRIx64 ": DW_AT_start_scope has unsupported form type (0x%x)\n", @@ -3958,16 +3925,15 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc, bool has_explicit_mangled = mangled != nullptr; if (!mangled) { // LLDB relies on the mangled name (DW_TAG_linkage_name or - // DW_AT_MIPS_linkage_name) to - // generate fully qualified names of global variables with commands like - // "frame var j". - // For example, if j were an int variable holding a value 4 and declared - // in a namespace - // B which in turn is contained in a namespace A, the command "frame var - // j" returns - // "(int) A::B::j = 4". If the compiler does not emit a linkage name, we - // should be able - // to generate a fully qualified name from the declaration context. + // DW_AT_MIPS_linkage_name) to generate fully qualified names + // of global variables with commands like "frame var j". For + // example, if j were an int variable holding a value 4 and + // declared in a namespace B which in turn is contained in a + // namespace A, the command "frame var j" returns + // "(int) A::B::j = 4". + // If the compiler does not emit a linkage name, we should be + // able to generate a fully qualified name from the + // declaration context. if ((parent_tag == DW_TAG_compile_unit || parent_tag == DW_TAG_partial_unit) && Language::LanguageIsCPlusPlus(die.GetLanguage())) { @@ -4017,24 +3983,21 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc, scope = eValueTypeVariableStatic; if (debug_map_symfile) { - // When leaving the DWARF in the .o files on darwin, - // when we have a global variable that wasn't initialized, - // the .o file might not have allocated a virtual - // address for the global variable. In this case it will - // have created a symbol for the global variable - // that is undefined/data and external and the value will - // be the byte size of the variable. When we do the - // address map in SymbolFileDWARFDebugMap we rely on - // having an address, we need to do some magic here - // so we can get the correct address for our global - // variable. The address for all of these entries - // will be zero, and there will be an undefined symbol - // in this object file, and the executable will have - // a matching symbol with a good address. So here we - // dig up the correct address and replace it in the - // location for the variable, and set the variable's - // symbol context scope to be that of the main executable - // so the file address will resolve correctly. + // When leaving the DWARF in the .o files on darwin, when we have a + // global variable that wasn't initialized, the .o file might not + // have allocated a virtual address for the global variable. In + // this case it will have created a symbol for the global variable + // that is undefined/data and external and the value will be the + // byte size of the variable. When we do the address map in + // SymbolFileDWARFDebugMap we rely on having an address, we need to + // do some magic here so we can get the correct address for our + // global variable. The address for all of these entries will be + // zero, and there will be an undefined symbol in this object file, + // and the executable will have a matching symbol with a good + // address. So here we dig up the correct address and replace it in + // the location for the variable, and set the variable's symbol + // context scope to be that of the main executable so the file + // address will resolve correctly. bool linked_oso_file_addr = false; if (is_external && location_DW_OP_addr == 0) { // we have a possible uninitialized extern global @@ -4066,8 +4029,7 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc, if (!linked_oso_file_addr) { // The DW_OP_addr is not zero, but it contains a .o file address - // which - // needs to be linked up correctly. + // which needs to be linked up correctly. const lldb::addr_t exe_file_addr = debug_map_symfile->LinkOSOFileAddress(this, location_DW_OP_addr); @@ -4137,16 +4099,16 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const SymbolContext &sc, var_sp->SetLocationIsConstantValueData(location_is_const_value_data); } else { - // Not ready to parse this variable yet. It might be a global - // or static variable that is in a function scope and the function - // in the symbol context wasn't filled in yet + // Not ready to parse this variable yet. It might be a global or static + // variable that is in a function scope and the function in the symbol + // context wasn't filled in yet return var_sp; } } - // Cache var_sp even if NULL (the variable was just a specification or - // was missing vital information to be able to be displayed in the debugger - // (missing location due to optimization, etc)) so we don't re-parse - // this DIE over and over later... + // Cache var_sp even if NULL (the variable was just a specification or was + // missing vital information to be able to be displayed in the debugger + // (missing location due to optimization, etc)) so we don't re-parse this + // DIE over and over later... GetDIEToVariable()[die.GetDIE()] = var_sp; if (spec_die) GetDIEToVariable()[spec_die.GetDIE()] = var_sp; @@ -4254,8 +4216,8 @@ size_t SymbolFileDWARF::ParseVariables(const SymbolContext &sc, Block *block = sc.function->GetBlock(true).FindBlockByID( sc_parent_die.GetID()); if (block == NULL) { - // This must be a specification or abstract origin with - // a concrete block counterpart in the current function. We need + // This must be a specification or abstract origin with a + // concrete block counterpart in the current function. We need // to find the concrete block so we can correctly add the // variable to it const DWARFDIE concrete_block_die = diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index eabff86a542..0d7fd321ed0 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -44,10 +44,8 @@ using namespace lldb; using namespace lldb_private; // Subclass lldb_private::Module so we can intercept the -// "Module::GetObjectFile()" -// (so we can fixup the object file sections) and also for -// "Module::GetSymbolVendor()" -// (so we can fixup the symbol file id. +// "Module::GetObjectFile()" (so we can fixup the object file sections) and +// also for "Module::GetSymbolVendor()" (so we can fixup the symbol file id. const SymbolFileDWARFDebugMap::FileRangeMap & SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap( @@ -84,8 +82,8 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap( /// const uint32_t fun_resolve_flags = SymbolContext::Module | /// eSymbolContextCompUnit | eSymbolContextFunction; // SectionList *oso_sections = oso_objfile->Sections(); - // Now we need to make sections that map from zero based object - // file addresses to where things ended up in the main executable. + // Now we need to make sections that map from zero based object file + // addresses to where things ended up in the main executable. assert(comp_unit_info->first_symbol_index != UINT32_MAX); // End index is one past the last valid symbol index @@ -104,9 +102,9 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap( break; case eSymbolTypeCode: { - // For each N_FUN, or function that we run into in the debug map - // we make a new section that we add to the sections found in the - // .o file. This new section has the file address set to what the + // For each N_FUN, or function that we run into in the debug map we + // make a new section that we add to the sections found in the .o + // file. This new section has the file address set to what the // addresses are in the .o file, and the load address is adjusted // to match where it ended up in the final executable! We do this // before we parse any dwarf info so that when it goes get parsed @@ -129,21 +127,21 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap( } break; case eSymbolTypeData: { - // For each N_GSYM we remap the address for the global by making - // a new section that we add to the sections found in the .o file. - // This new section has the file address set to what the - // addresses are in the .o file, and the load address is adjusted - // to match where it ended up in the final executable! We do this - // before we parse any dwarf info so that when it goes get parsed - // all section/offset addresses that get registered will resolve + // For each N_GSYM we remap the address for the global by making a + // new section that we add to the sections found in the .o file. + // This new section has the file address set to what the addresses + // are in the .o file, and the load address is adjusted to match + // where it ended up in the final executable! We do this before we + // parse any dwarf info so that when it goes get parsed all + // section/offset addresses that get registered will resolve // correctly to the new addresses in the main executable. We // initially set the section size to be 1 byte, but will need to // fix up these addresses further after all globals have been // parsed to span the gaps, or we can find the global variable // sizes from the DWARF info as we are parsing. - // Next we find the non-stab entry that corresponds to the N_GSYM in - // the .o file + // Next we find the non-stab entry that corresponds to the N_GSYM + // in the .o file Symbol *oso_gsym_symbol = oso_symtab->FindFirstSymbolWithNameAndType( exe_symbol->GetMangled().GetName(lldb::eLanguageTypeUnknown, @@ -198,9 +196,9 @@ public: SymbolVendor *symbol_vendor = Module::GetSymbolVendor(can_create, feedback_strm); if (symbol_vendor) { - // Set a pointer to this class to set our OSO DWARF file know - // that the DWARF is being used along with a debug map and that - // it will have the remapped sections that we do below. + // Set a pointer to this class to set our OSO DWARF file know that + // the DWARF is being used along with a debug map and that it will + // have the remapped sections that we do below. SymbolFileDWARF *oso_symfile = SymbolFileDWARFDebugMap::GetSymbolFileAsSymbolFileDWARF( symbol_vendor->GetSymbolFile()); @@ -292,8 +290,8 @@ void SymbolFileDWARFDebugMap::InitOSO() { // In order to get the abilities of this plug-in, we look at the list of // N_OSO entries (object files) from the symbol table and make sure that - // these files exist and also contain valid DWARF. If we get any of that - // then we return the abilities of the first N_OSO's DWARF. + // these files exist and also contain valid DWARF. If we get any of that then + // we return the abilities of the first N_OSO's DWARF. Symtab *symtab = m_obj_file->GetSymtab(); if (symtab) { @@ -303,10 +301,10 @@ void SymbolFileDWARFDebugMap::InitOSO() { // When a mach-o symbol is encoded, the n_type field is encoded in bits // 23:16, and the n_desc field is encoded in bits 15:0. // - // To find all N_OSO entries that are part of the DWARF + debug map - // we find only object file symbols with the flags value as follows: - // bits 23:16 == 0x66 (N_OSO) - // bits 15: 0 == 0x0001 (specifies this is a debug map object file) + // To find all N_OSO entries that are part of the DWARF + debug map we find + // only object file symbols with the flags value as follows: bits 23:16 == + // 0x66 (N_OSO) bits 15: 0 == 0x0001 (specifies this is a debug map object + // file) const uint32_t k_oso_symbol_flags_value = 0x660001u; const uint32_t oso_index_count = @@ -443,16 +441,15 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo( return NULL; } } - // Always create a new module for .o files. Why? Because we - // use the debug map, to add new sections to each .o file and - // even though a .o file might not have changed, the sections - // that get added to the .o file can change. + // Always create a new module for .o files. Why? Because we use the debug + // map, to add new sections to each .o file and even though a .o file + // might not have changed, the sections that get added to the .o file can + // change. ArchSpec oso_arch; // Only adopt the architecture from the module (not the vendor or OS) - // since .o files for "i386-apple-ios" will historically show up as - // "i386-apple-macosx" - // due to the lack of a LC_VERSION_MIN_MACOSX or LC_VERSION_MIN_IPHONEOS - // load command... + // since .o files for "i386-apple-ios" will historically show up as "i386 + // -apple-macosx" due to the lack of a LC_VERSION_MIN_MACOSX or + // LC_VERSION_MIN_IPHONEOS load command... oso_arch.SetTriple(m_obj_file->GetModule() ->GetArchitecture() .GetTriple() @@ -546,8 +543,8 @@ SymbolFileDWARF *SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo( uint32_t SymbolFileDWARFDebugMap::CalculateAbilities() { // In order to get the abilities of this plug-in, we look at the list of // N_OSO entries (object files) from the symbol table and make sure that - // these files exist and also contain valid DWARF. If we get any of that - // then we return the abilities of the first N_OSO's DWARF. + // these files exist and also contain valid DWARF. If we get any of that then + // we return the abilities of the first N_OSO's DWARF. const uint32_t oso_index_count = GetNumCompileUnits(); if (oso_index_count > 0) { @@ -576,9 +573,8 @@ CompUnitSP SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex(uint32_t cu_idx) { if (oso_module) { FileSpec so_file_spec; if (GetFileSpecForSO(cu_idx, so_file_spec)) { - // User zero as the ID to match the compile unit at offset - // zero in each .o file since each .o file can only have - // one compile unit for now. + // User zero as the ID to match the compile unit at offset zero in each + // .o file since each .o file can only have one compile unit for now. lldb::user_id_t cu_id = 0; m_compile_unit_infos[cu_idx].compile_unit_sp.reset( new CompileUnit(m_obj_file->GetModule(), NULL, so_file_spec, cu_id, @@ -767,8 +763,8 @@ uint32_t SymbolFileDWARFDebugMap::ResolveSymbolContext( const uint32_t cu_count = GetNumCompileUnits(); for (uint32_t i = 0; i < cu_count; ++i) { - // If we are checking for inlines, then we need to look through all - // compile units no matter if "file_spec" matches. + // If we are checking for inlines, then we need to look through all compile + // units no matter if "file_spec" matches. bool resolve = check_inlines; if (!resolve) { @@ -823,8 +819,8 @@ uint32_t SymbolFileDWARFDebugMap::FindGlobalVariables( if (!append) variables.Clear(); - // Remember how many variables are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many variables are in the list before we search in case we + // are appending the results to a variable list. const uint32_t original_size = variables.GetSize(); uint32_t total_matches = 0; @@ -843,8 +839,8 @@ uint32_t SymbolFileDWARFDebugMap::FindGlobalVariables( if (max_matches >= total_matches) return true; - // Update the max matches for any subsequent calls to find globals - // in any other object files with DWARF + // Update the max matches for any subsequent calls to find globals in any + // other object files with DWARF max_matches -= oso_matches; } @@ -863,8 +859,8 @@ SymbolFileDWARFDebugMap::FindGlobalVariables(const RegularExpression ®ex, if (!append) variables.Clear(); - // Remember how many variables are in the list before we search in case - // we are appending the results to a variable list. + // Remember how many variables are in the list before we search in case we + // are appending the results to a variable list. const uint32_t original_size = variables.GetSize(); uint32_t total_matches = 0; @@ -882,8 +878,8 @@ SymbolFileDWARFDebugMap::FindGlobalVariables(const RegularExpression ®ex, if (max_matches >= total_matches) return true; - // Update the max matches for any subsequent calls to find globals - // in any other object files with DWARF + // Update the max matches for any subsequent calls to find globals in any + // other object files with DWARF max_matches -= oso_matches; } @@ -965,12 +961,12 @@ SymbolFileDWARFDebugMap::GetCompileUnitInfoForSymbolWithID( static void RemoveFunctionsWithModuleNotEqualTo(const ModuleSP &module_sp, SymbolContextList &sc_list, uint32_t start_idx) { - // We found functions in .o files. Not all functions in the .o files - // will have made it into the final output file. The ones that did - // make it into the final output file will have a section whose module - // matches the module from the ObjectFile for this SymbolFile. When - // the modules don't match, then we have something that was in a - // .o file, but doesn't map to anything in the final executable. + // We found functions in .o files. Not all functions in the .o files will + // have made it into the final output file. The ones that did make it into + // the final output file will have a section whose module matches the module + // from the ObjectFile for this SymbolFile. When the modules don't match, + // then we have something that was in a .o file, but doesn't map to anything + // in the final executable. uint32_t i = start_idx; while (i < sc_list.GetSize()) { SymbolContext sc; @@ -1105,8 +1101,8 @@ TypeSP SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE( // the type name and whose type is eSymbolTypeObjCClass. If we can find that // symbol and find its containing parent, we can locate the .o file that will // contain the implementation definition since it will be scoped inside the - // N_SO - // and we can then locate the SymbolFileDWARF that corresponds to that N_SO. + // N_SO and we can then locate the SymbolFileDWARF that corresponds to that + // N_SO. SymbolFileDWARF *oso_dwarf = NULL; TypeSP type_sp; ObjectFile *module_objfile = m_obj_file->GetModule()->GetObjectFile(); @@ -1118,8 +1114,7 @@ TypeSP SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE( Symtab::eVisibilityAny); if (objc_class_symbol) { // Get the N_SO symbol that contains the objective C class symbol as - // this - // should be the .o file that contains the real definition... + // this should be the .o file that contains the real definition... const Symbol *source_file_symbol = symtab->GetParent(objc_class_symbol); if (source_file_symbol && @@ -1147,10 +1142,8 @@ TypeSP SymbolFileDWARFDebugMap::FindCompleteObjCDefinitionTypeForDIE( } // Only search all .o files for the definition if we don't need the - // implementation - // because otherwise, with a valid debug map we should have the ObjC class - // symbol and - // the code above should have found it. + // implementation because otherwise, with a valid debug map we should have + // the ObjC class symbol and the code above should have found it. if (must_be_implementation == false) { TypeSP type_sp; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp b/lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp index 77fa92d2574..8273d975e57 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp @@ -27,8 +27,8 @@ bool UniqueDWARFASTTypeList::Find(const DWARFDIE &die, udt.m_byte_size == byte_size) { // Make sure the file and line match if (udt.m_declaration == decl) { - // The type has the same name, and was defined on the same - // file and line. Now verify all of the parent DIEs match. + // The type has the same name, and was defined on the same file and + // line. Now verify all of the parent DIEs match. DWARFDIE parent_arg_die = die.GetParent(); DWARFDIE parent_pos_die = udt.m_die.GetParent(); bool match = true; |