summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Debug Info: remove form from function addDIEEntry.Manman Ren2013-10-111-12/+6
| | | | | | | | | The form must be a reference form in addDIEEntry. Which reference form to use will be decided by the callee. No functionality change. llvm-svn: 192517
* Debug Info: In DIBuilder, the context field of subprogram is updated to useManman Ren2013-10-101-3/+4
| | | | | | | | DIScopeRef. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192378
* Add DbgVariable::resolve per Eric's suggestion.Manman Ren2013-10-081-2/+9
| | | | llvm-svn: 192218
* Remove some really nasty uses of hasRawTextSupport.Rafael Espindola2013-10-051-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When MC was first added, targets could use hasRawTextSupport to keep features working before they were added to the MC interface. The design goal of MC is to provide an uniform api for printing assembly and object files. Short of relaxations and other corner cases, a object file is just another representation of the assembly. It was never the intention that targets would keep doing things like if (hasRawTextSupport()) Set flags in one way. else Set flags in another way. When they do that they create two code paths and the object file is no longer just another representation of the assembly. This also then requires testing with llc -filetype=obj, which is extremelly brittle. This patch removes some of these hacks by replacing them with smaller ones. The ARM flag setting is trivial, so I just moved it to the constructor. For Mips, the patch adds two temporary hack directives that allow the assembly to represent the same things as the object file was already able to. The hope is that the mips developers will replace the hack directives with the same ones that gas uses and drop the -print-hack-directives flag. I will also try to implement a target streamer interface, so that we can move this out of the common code. In summary, for any new work, two rules of the thumb are * Don't use "llc -filetype=obj" in tests. * Don't add calls to hasRawTextSupport. llvm-svn: 192035
* Debug Info: In DIBuilder, the derived-from field of a DW_TAG_pointer_typeManman Ren2013-10-051-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | is updated to use DITypeRef. Move isUnsignedDIType and getOriginalTypeSize from DebugInfo.h to be static helper functions in DwarfCompileUnit. We already have a static helper function "isTypeSigned" in DwarfCompileUnit, and a pointer to DwarfDebug is added to resolve the derived-from field. All three functions need to go across link for derived-from fields, so we need to get hold of a type identifier map. A pointer to DwarfDebug is also added to DbgVariable in order to resolve the derived-from field. Debug info verifier is updated to check a derived-from field is a TypeRef. Verifier will not go across link for derived-from fields, in debug info finder, we go across the link to add derived-from fields to types. Function getDICompositeType is only used by dragonegg and since dragonegg does not generate identifier for types, we use an empty map to resolve the derived-from field. When printing a derived-from field, we use DITypeRef::getName to either return the type identifier or getName of the DIType. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 192018
* Temporarily revert r176882 as it needs to be implemented in a differentEric Christopher2013-10-041-34/+4
| | | | | | way for all platforms. llvm-svn: 191975
* Temporarily revert r191792 as it is causing some LTO debug failuresEric Christopher2013-10-041-47/+13
| | | | | | | on platforms with relocations in debug info and also temporarily revert r191800 due to conflicts with the revert of r191792. llvm-svn: 191967
* Fixed a bug with section names containing special characters.Richard Mitton2013-10-031-8/+24
| | | | | | | | | | Changed the dwarf aranges code to not use getLabelEndName, as it turns out it's not reliable to call that given user-defined section names. Section names can have characters in that aren't representable as symbol names. The dwarf-aranges test case has been updated to include a special character, to check this. This fixes pr17416. llvm-svn: 191932
* DebugInfo: Avoid redundantly adding child DIEs to parents.David Blaikie2013-10-031-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DIE::addChild had a shortcircuit that silently no-op'd when a child was readded to the same parent. This hid some quirky/redundant code in DwarfDebug/CompileUnit. By removing that functionality and replacing it with an assert I was able to find and cleanup those cases, mostly centering around adding members to types in various circumstances. 1) The original oddity I noticed while working on type units (which actually was helping me in the short term, by accident) was the addToContextOwner call in constructTypeDIE. This call was completely bogus (why was it only done for non-virtual types? what relevance does that have at all) and redundant with the more uniform addToContextOwner made in getOrCreateTypeDIE. 2) If a member function definition was visited (createSubprogramDIE), it would attempt to build the member function declaration. The declaration DIE would then be added to its context, but in building the context (the type for which this function is a member) the members of the type would be added to the type automatically, so by the time the context was constructed, the member function was already associated with it. 3) The same as (2) but without the member function being constructed first. Whenever a type was constructed, the members would be created and member functions would be created by getOrCreateSubprogramDIE - this would lead to the subprogram being added to the (incomplete) type already, then the general member-construction code would add it again. llvm-svn: 191928
* Make sure we emit a section for pubnames even if that section isEric Christopher2013-10-031-3/+0
| | | | | | | going to be empty. This is particularly important for the gnu pubnames case since we're emitting a relocation to the section. llvm-svn: 191915
* Fix cut and paste typo.Eric Christopher2013-10-031-2/+2
| | | | llvm-svn: 191914
* Remove wild .debug_aranges entries generated from unimportant labelsAlexey Samsonov2013-10-031-6/+3
| | | | | | | | | | | | | | | | r191052 added emitting .debug_aranges to Clang, but this functionality is broken: it uses all MC labels added in DWARF Asm printer, including the labels for build relocations between different DWARF sections, like .Lsection_line or .Ldebug_loc0. As a result, if any DIE .debug_info would contain "DW_AT_location=0x123" attribute, .debug_aranges would also contain a range starting from 0x123, breaking tools that rely on this section. This patch fixes this by using only MC labels that corresponds to the addresses in the user program. llvm-svn: 191884
* Debug Info: In DIBuilder, the derived-from field of a DW_TAG_pointer_typeManman Ren2013-10-011-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | is updated to use DITypeRef. Move isUnsignedDIType and getOriginalTypeSize from DebugInfo.h to be static helper functions in DwarfCompileUnit. We already have a static helper function "isTypeSigned" in DwarfCompileUnit, and a pointer to DwarfDebug is added to resolve the derived-from field. All three functions need to go across link for derived-from fields, so we need to get hold of a type identifier map. A pointer to DwarfDebug is also added to DbgVariable in order to resolve the derived-from field. Debug info verifier is updated to check a derived-from field is a TypeRef. Verifier will not go across link for derived-from fields, in debug info finder, we go across the link to add derived-from fields to types. Function getDICompositeType is only used by dragonegg and since dragonegg does not generate identifier for types, we use an empty map to resolve the derived-from field. When printing a derived-from field, we use DITypeRef::getName to either return the type identifier or getName of the DIType. A paired commit at clang is required due to changes to DIBuilder. llvm-svn: 191800
* Debug Info: remove duplication of DIEs when a DIE is part of the type systemManman Ren2013-10-011-5/+39
| | | | | | | | | | | | | | | | | | | | | | | and it is shared across CUs. We add a few maps in DwarfDebug to map MDNodes for the type system to the corresponding DIEs: MDTypeNodeToDieMap, MDSPNodeToDieMap, and MDStaticMemberNodeToDieMap. These DIEs can be shared across CUs, that is why we keep the maps in DwarfDebug instead of CompileUnit. Sometimes, when we try to add an attribute to a DIE, the DIE is not yet added to its owner yet, so we don't know whether we should use ref_addr or ref4. We create a worklist that will be processed during finalization to add attributes with the correct form (ref_addr or ref4). We add addDIEEntry to DwarfDebug to be a wrapper around DIE->addValue. It checks whether we know the correct form, if not, we update the worklist (DIEEntryWorklist). A testing case is added to show that we only create a single DIE for a type MDNode and we use ref_addr to refer to the type DIE. llvm-svn: 191792
* Add the DW_AT_GNU_ranges_base attribute if we've emitted any rangesEric Christopher2013-10-011-2/+11
| | | | | | into the debug_ranges section. llvm-svn: 191721
* Update comments.Eric Christopher2013-10-011-2/+2
| | | | llvm-svn: 191720
* The DW_AT_GNU_pubnames/pubtypes attributes are actually formEric Christopher2013-09-301-6/+57
| | | | | | | SEC_OFFSET from the beginning of the section so go ahead and emit a label at the beginning of each one. llvm-svn: 191710
* Unify conditionals and reformat.Eric Christopher2013-09-271-16/+16
| | | | llvm-svn: 191582
* Rename IsStatic variable to Linkage in order to be a bit more descriptive.Eric Christopher2013-09-231-3/+3
| | | | llvm-svn: 191236
* Handle gnu pubtypes sections:Eric Christopher2013-09-231-5/+11
| | | | | | | | | | | a) Make sure we are emitting the correct section in our section labels when we begin the module. b) Make sure we are emitting the correct pubtypes section in the presence of gnu pubtypes. c) For C++ struct, union, class, and enumeration types are default external. llvm-svn: 191225
* Fixed debug_aranges handling for common symbols.Richard Mitton2013-09-231-5/+10
| | | | | | | | | | The size of common symbols is now tracked correctly, so they can be listed in the arange section without needing knowledge of other following symbols. .comm (and .lcomm) do not indicate to the system assembler any particular section to use, so we have to treat them as having no section. Test case update to account for this. llvm-svn: 191210
* Move emission of the debug string table to early in the debugEric Christopher2013-09-201-6/+8
| | | | | | | info finalization to greatly reduce the number of fixups that the assembler has to handle in order to improve compile time. llvm-svn: 191119
* DebugInfo: GDBIndexEntry*String conversion functions now return const char* ↵David Blaikie2013-09-201-2/+2
| | | | | | | | | for easy llvm::formating This was previously invoking UB by passing a user-defined type to format. Thanks to Jordan Rose for pointing this out. llvm-svn: 191060
* Added support for generate DWARF .debug_aranges sections automatically.Richard Mitton2013-09-191-11/+195
| | | | llvm-svn: 191052
* DebugInfo: llvm-dwarfdump support for gnu_pubnames sectionDavid Blaikie2013-09-191-2/+2
| | | | llvm-svn: 191050
* DebugInfo: Improve IR annotation comments for GNU pubthings.David Blaikie2013-09-191-4/+10
| | | | llvm-svn: 191043
* Unshift the GDB index/GNU pubnames constants modified in r191025David Blaikie2013-09-191-13/+14
| | | | | | | | | | | | Based on code review feedback from Eric Christopher, unshifting these constants as they can appear in the gdb_index itself, shifted a further 24 bits. This means that keeping them preshifted is a bit inflexible, so let's not do that. Given the motivation, wrap up some nicer enums, more type safety, and some utility functions. llvm-svn: 191035
* DebugInfo: Simplify gnu_pubnames index computation.David Blaikie2013-09-191-35/+10
| | | | | | | Names open to bikeshedding. Could switch back to the constants being unshifted, but this way seems a bit easier to work with. llvm-svn: 191025
* Remove unnecessary conditional operators performing bool->bool conversion.David Blaikie2013-09-191-2/+2
| | | | llvm-svn: 191020
* Fix a typo and simplify a boolean expression.David Blaikie2013-09-191-3/+2
| | | | llvm-svn: 191018
* Add initial support for handling gnu style pubnames accepted by someEric Christopher2013-09-131-6/+109
| | | | | | | | versions of gold. This support is designed to allow gold to produce gdb_index sections similar to the accelerator tables and consumable by gdb. llvm-svn: 190649
* Reformat and hoist section grabbing to top level.Eric Christopher2013-09-131-25/+30
| | | | llvm-svn: 190648
* Debug info: add more comments.Manman Ren2013-09-111-2/+14
| | | | llvm-svn: 190544
* Hoist section call out of loop.Eric Christopher2013-09-101-2/+2
| | | | llvm-svn: 190440
* Debug Info: create scope children DIEs when the scope DIE is not null.Manman Ren2013-09-101-19/+48
| | | | | | | | | | | | | | | | We try to create the scope children DIEs after we create the scope DIE. But to avoid emitting empty lexical block DIE, we first check whether a scope DIE is going to be null, then create the scope children if it is not null. From the number of children, we decide whether to actually create the scope DIE. This patch also removes an early exit which checks for a special condition. It also removes deletion of un-used children DIEs that are generated because we used to generate children DIEs before the scope DIE. Deletion of un-used children DIEs may cause problem because we sometimes keep created DIEs in a member variable of a CU. llvm-svn: 190421
* Debug Info: define a DIRef template.Manman Ren2013-09-101-5/+0
| | | | | | | | | | | | | Specialize the constructors for DIRef<DIScope> and DIRef<DIType> to make sure the Value is indeed a scope ref and a type ref. Use DIScopeRef for DIScope::getContext and DIType::getContext and use DITypeRef for getContainingType and getClassType. DIScope::generateRef now returns a DIScopeRef instead of a "Value *" for readability and type safety. llvm-svn: 190418
* Debug Info: move DIScope::getContext back from DwarfDebug.Manman Ren2013-09-091-23/+0
| | | | | | | | This partially reverts r190330. DIScope::getContext now returns DIScopeRef instead of DIScope. We construct a DIScopeRef from DIScope when we are dealing with subprogram, lexical block or name space. llvm-svn: 190362
* Always add global names. We're adding them in the rest of the codeEric Christopher2013-09-091-3/+2
| | | | | | | | | as well as types. No functional change as they're not emitted unless the option is true anyhow. llvm-svn: 190346
* Rename for consistency.Eric Christopher2013-09-091-3/+3
| | | | llvm-svn: 190345
* Debug Info: Use DIScopeRef for DIType::getContext.Manman Ren2013-09-091-2/+2
| | | | | | | | | | | | | | | | | In DIBuilder, the context field of a TAG_member is updated to use the scope reference. Verifier is updated accordingly. DebugInfoFinder now needs to generate a type identifier map to have access to the actual scope. Same applies for BreakpointPrinter. processModule of DebugInfoFinder is called during initialization phase of the verifier to make sure the type identifier map is constructed early enough. We are now able to unique a simple class as demonstrated by the added testing case. llvm-svn: 190334
* Debug Info: move DIScope::getContext to DwarfDebug.Manman Ren2013-09-091-0/+23
| | | | | | | | | | | | DIScope::getContext is a wrapper function that calls the specific getContext method on each subclass. When we switch DIType::getContext to return DIScopeRef instead of DIScope, DIScope::getContext can no longer return a DIScope without a type identifier map. DIScope::getContext is only used by DwarfDebug, so we move it to DwarfDebug to have easy access to the type identifier map. llvm-svn: 190330
* Debug Info: Move isSubprogramContext from DebugInfo to DwarfDebug.Manman Ren2013-09-091-0/+13
| | | | | | | | | | This helper function needs the type identifier map when we switch DIType::getContext to return DIScopeRef instead of DIScope. Since isSubprogramContext is used by DwarfDebug only, We move it to DwarfDebug to have easy access to the map. llvm-svn: 190325
* Debug Info: Rename DITypeRef to DIScopeRef.Manman Ren2013-09-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | A reference to a scope is more general than a reference to a type since DIType is a subclass of DIScope. A reference to a type can be either an identifier for the type or the DIType itself, while a reference to a scope can be either an identifier for the type (when the scope is indeed a type) or the DIScope itself. A reference to a type and a reference to a scope will be resolved in the same way. The only difference is in the verifier when a field is a reference to a type (i.e. the containing type field of a DICompositeType) or a field is a reference to a scope (i.e. the context field of a DIType). This is to get ready for switching DIType::getContext to return DIScopeRef instead of DIScope. Tighten up isTypeRef and isScopeRef to make sure the identifier is not empty and the MDNode is DIType for TypeRef and DIScope for ScopeRef. llvm-svn: 190322
* Debug Info: Use identifier to reference DIType in base type field ofManman Ren2013-09-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | ptr_to_member. We introduce a new class DITypeRef that represents a reference to a DIType. It wraps around a Value*, which can be either an identifier in MDString or an actual MDNode. The class has a helper function "resolve" that finds the actual MDNode for a given DITypeRef. We specialize getFieldAs to return a field that is a reference to a DIType. To correctly access the base type field of ptr_to_member, getClassType now calls getFieldAs<DITypeRef> to return a DITypeRef. Also add a typedef for DITypeIdentifierMap and a helper generateDITypeIdentifierMap in DebugInfo.h. In DwarfDebug.cpp, we keep a DITypeIdentifierMap and call generateDITypeIdentifierMap to actually populate the map. Verifier is updated accordingly. llvm-svn: 190081
* Move accelerator table defines and constants to Dwarf.h sinceEric Christopher2013-09-051-6/+6
| | | | | | | | we're proposing it for DWARF5. No functional change intended. llvm-svn: 190074
* Remove hack ensuring that darwin didn't produce dwarf > 3 for modulesEric Christopher2013-09-041-5/+1
| | | | | | | | without a limiting factor. Update all testcases accordingly. llvm-svn: 190002
* Revert "Revert r189902 as the workaround shouldn't be necessary anymore."Eric Christopher2013-09-041-1/+5
| | | | | | Needs testcase updates. llvm-svn: 190000
* Revert r189902 as the workaround shouldn't be necessary anymore.Eric Christopher2013-09-041-5/+1
| | | | llvm-svn: 189999
* Unify and clean up.Eric Christopher2013-09-041-9/+4
| | | | llvm-svn: 189977
* Revert "Revert "Remove the darwin gdb option, that version of gdb is now ↵Michael Gottesman2013-09-041-15/+2
| | | | | | | | | | | | | | dead and the rest of the compatibility should be done on a dwarf-N level."" This reverts commit r189913. Talked with Eric on IRC. I am going to XFAIL the failing test since it is using what Eric described as "the member hack" which was needed on that old GDB. Sorry for the noise! llvm-svn: 189914
OpenPOWER on IntegriCloud