summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
Commit message (Collapse)AuthorAgeFilesLines
* <rdar://problem/13521159>Greg Clayton2013-03-271-7/+7
| | | | | | | | LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down. All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down. llvm-svn: 178191
* Fix clang warnings related to python macro redefinition and printf format ↵Matt Kopec2013-02-211-1/+1
| | | | | | specifiers. llvm-svn: 175829
* <rdar://problem/9141269>Greg Clayton2013-01-301-21/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cleaned up the objective C name parsing code to use a class. Now breakpoints that are set by name that are objective C methods without the leading '+' or '-' will resolve. We do this by expanding all the objective C names for a given string. For example: (lldb) b [MyString cStringUsingEncoding:] Will set a breakpoint with multiple possible names: -[MyString cStringUsingEncoding:] +[MyString cStringUsingEncoding:] Also if you have a category, it will strip the category and set a breakpoint in all variants: (lldb) [MyString(my_category) cStringUsingEncoding:] Will resolve to the following names: -[MyString(my_category) cStringUsingEncoding:] +[MyString(my_category) cStringUsingEncoding:] -[MyString cStringUsingEncoding:] +[MyString cStringUsingEncoding:] Likewise when we have: (lldb) b -[MyString(my_category) cStringUsingEncoding:] It will resolve to two names: -[MyString(my_category) cStringUsingEncoding:] -[MyString cStringUsingEncoding:] llvm-svn: 173858
* <rdar://problem/13069948>Greg Clayton2013-01-251-5/+5
| | | | | | | | | | | | Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary. So I defined a new "lldb::offset_t" which should be used for all file offsets. After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed. Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections. llvm-svn: 173463
* Allow LLDB to work with dSYM files that have a DWARF compile unit with ↵Greg Clayton2012-12-121-0/+27
| | | | | | nothing else to support clang's new -gline-tables-only mode of compiling. llvm-svn: 169994
* Make sure to check for DW_AT_linkage_name to get the mangled name in the ↵Greg Clayton2012-12-081-0/+1
| | | | | | DWARF along with the older DW_AT_MIPS_linkage_name attribute. llvm-svn: 169657
* <rdar://problem/12636970>Greg Clayton2012-11-271-1/+2
| | | | | | Properly detect the if unnamed bitfields are supported by clang if the major calng version is higher than 425. llvm-svn: 168734
* <rdar://problem/12636970>Greg Clayton2012-11-271-19/+82
| | | | | | Detect the new fixed clang that properly supports bitfields in objc classes. llvm-svn: 168655
* Bunch of cleanups for warnings found by the llvm static analyzer.Jim Ingham2012-10-121-2/+6
| | | | llvm-svn: 165808
* Cleaned up the lldb_private::Mangled class to get rid of the tokenizing code ↵Greg Clayton2012-07-181-3/+3
| | | | | | that has bit rotted and isn't being used. Also cleaned up the API to the "lldb_private::Mangled" to always take "const ConstString &" arguments instead of both "const ConstString &" and "const char *". llvm-svn: 160466
* Ran the static analyzer on the codebase and found a few things.Greg Clayton2012-07-171-9/+6
| | | | llvm-svn: 160338
* Added the ability to log a message with a backtrace when verbose logging is ↵Greg Clayton2012-04-231-3/+3
| | | | | | enabled to the Module class. Used this new function in the DWARF parser. llvm-svn: 155404
* Fixed an issue with the Instruction subclasses where the strings mightGreg Clayton2012-01-191-6/+5
| | | | | | | | | | be fetched too many times and the DisassemblerLLVM was appending to strings when the opcode, mnemonic and comment accessors were called multiple times and if any of the strings were empty. Also fixed the test suite failures from recent Objective C modifications. llvm-svn: 148460
* Added an extra way to chop up an objective C prototype and use it where ↵Greg Clayton2012-01-191-1/+5
| | | | | | necessary. llvm-svn: 148445
* <rdar://problem/10681814>Greg Clayton2012-01-121-1/+46
| | | | | | | | | | Fix DWARF parsing issue we can run into when using llvm-gcc based dSYM files. Also fix the parsing of objective C built-in types (Class, id and SEL) so they don't parse more information that is not needed due to the way they are represented in DWARF. llvm-svn: 148016
* We finalized on the new .apple_types accelerator table format where we don'tGreg Clayton2012-01-061-1/+1
| | | | | | | emit fully qualified names, so now we make sure the DW_TAG values match and still lookup using the basename. llvm-svn: 147634
* Added code in the Host layer that can report system log messagesGreg Clayton2012-01-051-14/+13
| | | | | | | | | | | | so that we don't have "fprintf (stderr, ...)" calls sprinkled everywhere. Changed all needed locations over to using this. For non-darwin, we log to stderr only. On darwin, we log to stderr _and_ to ASL (Apple System Log facility). This will allow GUI apps to have a place for these error and warning messages to go, and also allows the command line apps to log directly to the terminal. llvm-svn: 147596
* CommandObjectProcess was recently changed to automatically use the platformGreg Clayton2011-11-281-20/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to launch a process for debugging. Since this isn't supported on all platforms, we need to do what we used to do if this isn't supported. I added: bool Platform::CanDebugProcess (); This will get checked before trying to launch a process for debugging and then fall back to launching the process through the current host debugger. This should solve the issue for linux and keep the platform code clean. Centralized logging code for logging errors, warnings and logs when reporting things for modules or symbol files. Both lldb_private::Module and lldb_private::SymbolFile now have the following member functions: void LogMessage (Log *log, const char *format, ...); void ReportWarning (const char *format, ...); void ReportError (const char *format, ...); These will all output the module name and object (if any) such as: "error: lldb.so ...." "warning: my_archive.a(foo.o) ...." This will keep the output consistent and stop a lot of logging calls from having to try and output all of the information that uniquely identifies a module or symbol file. Many places in the code were grabbing the path to the object file manually and if the module represented a .o file in an archive, we would see log messages like: error: foo.a - some error happened llvm-svn: 145219
* Shrink-to-fit our std::vector<DWARFDebugInfoEntry> collections and save 20%Greg Clayton2011-11-221-0/+10
| | | | | | | to 30% of memory. The size doubling was killing us and we ended up with up to just under 50% of empty capacity. Cleaning this up saves us a ton of memory. llvm-svn: 145086
* Further performance improvements in the DWARF parser:Greg Clayton2011-11-191-124/+54
| | | | | | | | | 1 - the DIE collections no longer have the NULL tags which saves up to 25% of the memory on typical C++ code 2 - faster parsing by not having to run the SetDIERelations() function anymore it is done when parsing the DWARF very efficiently. llvm-svn: 144983
* Looking at our memory usage with Instruments when debugging a large applicationGreg Clayton2011-11-181-19/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | we say that the vectors of DWARFDebugInfoEntry objects were the highest on the the list. With these changes we cut our memory usage by 40%!!! I did this by reducing the size of the DWARFDebugInfoEntry from a previous: uint32_t offset uint32_t parent_idx uint32_t sibling_idx Abbrev * abbrev_ptr which was 20 bytes, but rounded up to 24 bytes due to alignment. Now we have: uint32_t offset uint32_t parent_idx uint32_t sibling_idx uint32_t abbr_idx:15, // 32767 possible abbreviation codes has_children:1, // 0 = no children, 1 = has children tag:16; // DW_TAG_XXX value This gets us down to 16 bytes per DIE. I tested some VERY large DWARF files (900MB) and found there were only ~700 unique abbreviations, so 32767 should be enough for any sane compiler. If it isn't there are built in assertions that will fire off and tell us. llvm-svn: 144975
* Added support for the C++Ox "nullptr_t" type.Greg Clayton2011-10-281-0/+2
| | | | llvm-svn: 143225
* Since we use address ranges a lot I added a templatized class that allows us ↵Greg Clayton2011-10-071-2/+1
| | | | | | to easily control the base address type, the size type, and the data that is stored with each range. It is designed to be populated by appending all needed items, then sorting the resulting list, and optionally minimizing the list when done. I adopted this new list in the DWARFDebugAranges for even further memory savings. llvm-svn: 141352
* Added a new logging channel to the DWARF called "lookups":Greg Clayton2011-10-061-1/+2
| | | | | | | | | (lldb) log enable dwarf lookups This allows us to see when lookups are being done on functions, addresses, and types by both name and regular expresssion. llvm-svn: 141259
* Enable all the new accelerator tables if they are present and don't manuallyGreg Clayton2011-10-041-10/+9
| | | | | | | | | | index the DWARF. Also fixed an issue with memory accelerator tables with a size of 1 where we would loop infinitely. Added support for parsing the new .apple_namespaces section which gives us a memory hash table for looking up namespaces. llvm-svn: 141128
* Huge memory and performance improvements in the DWARF parser.Greg Clayton2011-09-121-94/+83
| | | | | | | | | | | | | | | | | | | | | | Address ranges are now split up into two different tables: - one in DWARFDebugInfo that is compile unit specific - one in each DWARFCompileUnit that has exact function DIE offsets This helps keep the size of the aranges down since the main table will get uniqued and sorted and have consecutive ranges merged. We then only parse the compile unit one on demand once we have determined that a compile unit contains the address in question. We also now use the .debug_aranges section if there is one instead of always indexing the DWARF manually. NameToDIE now uses a UniqueCStringMap<dw_offset> map instead of a std::map. std::map is very bulky as each node has 3 pointers and the key and value types. This gets our NameToDIE entry down to 12 bytes each instead of 48 which saves us a lot of memory when we have very large DWARF. DWARFDebugAranges now has a smaller footprint for each range it contains to save on memory. llvm-svn: 139557
* Move the SourceManager from the Debugger to the Target. That way it can ↵Jim Ingham2011-09-081-14/+19
| | | | | | | | | | store the per-Target default Source File & Line. Set the default Source File & line to main (if it can be found.) at startup. Selecting the current thread & or frame resets the current source file & line, and "source list" as well as the breakpoint command "break set -l <NUM>" will use the current source file. llvm-svn: 139323
* Factor out the code that parses ObjC Method names into a static methodJim Ingham2011-08-151-44/+17
| | | | | | | in ObjCLanguageRuntime. Add the category-free name of symbols to the Symtab name-to-index list. llvm-svn: 137600
* Fixed some issues with parsing C++ methods where our detectionGreg Clayton2011-08-121-1/+1
| | | | | | | | | | | | | was failing if the DWARF was laid out in a certain way. The way we detect C++ classes is now more robust so that a class method can be defined outside of the class and refer to a definition inside the class with a DW_AT_specification or DW_AT_abstract_origin attribute. Fixed a case in Thread.cpp where we were looking up info in the frame when we didn't need to. This was from some changes to support external editors. Now the info is only looked up if needed. llvm-svn: 137436
* Do not parse DIE's outside a compilation units range.Stephen Wilson2011-05-201-11/+19
| | | | | | | | | | | | | | | In DWARFCompileUnit::ExtractDIEsIfNeeded we are relying on a compilation units DIEs to be terminated by a null entry. I think the standard is fairly clear that all sibling chains are to be terminated by null, but at least gcc 4.5.2 disagrees -- the top level chain drops the final entry. This results in us interpreting the next compilation unit header as a DIE. Regardless of whether gcc is right or wrong, we should not overstep a compilation units extent. This patch ensures that we do not attempt to extract a DIE beyond the length specified for a given DWARFCompileUnit by ensuring our current offset is strictly less than the start of the next CU. llvm-svn: 131721
* Use the portable memchr function instead of the BSD-only strnstrPeter Collingbourne2011-05-191-2/+2
| | | | llvm-svn: 131646
* For the purposes of setting breakpoints treat methods defined in the class ↵Jim Ingham2011-05-141-0/+18
| | | | | | and methods defined in a category on the class as the same. llvm-svn: 131331
* Fixed a case where if a function, inlined function, or global with a mangledGreg Clayton2011-04-211-14/+42
| | | | | | | name had a DW_AT_name that was the same string as the DW_AT_MIPS_linkage_name, then it would get added twice to the DWARF index. llvm-svn: 129942
* Enabled extra warnings and fixed a bunch of small issues.Greg Clayton2011-01-251-4/+2
| | | | llvm-svn: 124250
* Fixed a crasher that would happen when we run into malformed DWARF. It isGreg Clayton2011-01-231-1/+12
| | | | | | nice to know about the issue, but we shouldn't crash. llvm-svn: 124050
* Just like functions can have a basename and a mangled/demangled name, variableGreg Clayton2010-11-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | can too. So now the lldb_private::Variable class has support for this. Variables now have support for having a basename ("i"), and a mangled name ("_ZN12_GLOBAL__N_11iE"), and a demangled name ("(anonymous namespace)::i"). Nowwhen searching for a variable by name, users might enter the fully qualified name, or just the basename. So new test functions were added to the Variable and Mangled classes as: bool NameMatches (const ConstString &name); bool NameMatches (const RegularExpression &regex); I also modified "ClangExpressionDeclMap::FindVariableInScope" to also search for global variables that are not in the current file scope by first starting with the current module, then moving on to all modules. Fixed an issue in the DWARF parser that could cause a varaible to get parsed more than once. Now, once we have parsed a VariableSP for a DIE, we cache the result even if a variable wasn't made so we don't do any re-parsing. Some DW_TAG_variable DIEs don't have locations, or are missing vital info that stops a debugger from being able to display anything for it, we parse a NULL variable shared pointer for these DIEs so we don't keep trying to reparse it. llvm-svn: 119085
* Did a lot of code cleanup.Greg Clayton2010-11-091-9/+2
| | | | | | | | Fixed the DWARF plug-in such that when it gets all attributes for a DIE, that it omits the DW_AT_sibling and DW_AT_declaration when getting attributes from a DW_AT_abstract_origin or DW_AT_specification DIE. llvm-svn: 118654
* Minor comment fix.Johnny Chen2010-11-081-1/+1
| | | | llvm-svn: 118450
* Did a bit of parameter renaming.Greg Clayton2010-10-151-20/+20
| | | | llvm-svn: 116562
* Separated the DWARF index for types from that the index of the namespacesGreg Clayton2010-10-151-1/+6
| | | | | | | | | | | since we can't parse DW_TAG_namespace DIEs as types. They are only decls in clang. All of the types we handle right now have both clang "XXXType" classes to go with the "XXXDecl" classes which means they can be used within the lldb_private::Type class. I need to check to see which other decls that don't have associated type objects need to float around the debugger and possibly make a lldb_private::Decl class to manage them. llvm-svn: 116558
* Fixed C++ class clang type creation and display by making sure we omit Greg Clayton2010-10-131-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | artifical members (like the vtable pointer member that shows up in the DWARF). We were adding this to each class which was making all member variables be off by a pointer size. Added a test case so we can track this with "test/forward". Fixed the type name index in DWARF to include all the types after finding some types were being omitted due to the DW_AT_specification having the DW_AT_declaration attribute which was being read into the real type instances when there were forward declarations in the DWARF, causing the type to be omitted. We now check to make sure any DW_AT_declaration values are only respected when parsing types if the attribute is from the current DIE. After fixing the missing types, we ran into some issues with the expression parser finding duplicate entries for __va_list_tag since they are built in types and would result in a "duplicate __va_list_tag definition" error. We are now just ignoring this name during lookup, but we will need to see if we can get the name lookup function to not get called in these cases. Fixed an issue that would cause an assertion where DW_TAG_subroutine_types that had no children, would not properly make a clang function type of: "void (*) (void)". llvm-svn: 116392
* Fixed the Objective C method prototypes to be correct (the selectors weren'tGreg Clayton2010-10-121-0/+7
| | | | | | | | being chopped up correctly). The DWARF plug-in also keeps a map of the ObjC class names to selectors for easy parsing of all class selectors when we parse the class type. llvm-svn: 116290
* Fixed an issue where if a method funciton was asked to be parsed beforeGreg Clayton2010-10-011-1/+1
| | | | | | its containing class was parsed, we would crash. llvm-svn: 115343
* 15-20% speed improvement when parsing DWARF. I used instruments toGreg Clayton2010-09-151-12/+26
| | | | | | | | | find the hotspots in our code when indexing the DWARF. A combination of using SmallVector to avoid collection allocations, using fixed form sizes when possible, and optimizing the hot loops contributed to the speedup. llvm-svn: 113961
* So we can't use .debug_pubtypes as it, as designed, does not tell us about Greg Clayton2010-09-151-40/+44
| | | | | | | | | | | | | | | | | all types in all compile units. I added a new kind of accelerator table to the DWARF that allows us to index the DWARF compile units and DIEs in a way that doesn't require the data to stay loaded. Currently when indexing the DWARF we check if the compile unit had parsed its DIEs and if it hasn't we index the data and free all of the DIEs so we can reparse later when we need to after using one of our complete accelerator tables to determine we need to reparse some DWARF. If the DIEs had already been parsed we leave them loaded. The new accelerator table uses the "const char *" pointers from our ConstString class as the keys, and NameToDIE::Info as the value. This info contains the compile unit index and the DIE index which means we are pointed right to the DIE we need unlike the other DWARF accelerator tables that often just point us to the compile unit we would find our answer in. llvm-svn: 113933
* Looking at some of the test suite failures in DWARF in .o files with theGreg Clayton2010-09-141-2/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | debug map showed that the location lists in the .o files needed some refactoring in order to work. The case that was failing was where a function that was in the "__TEXT.__textcoal_nt" in the .o file, and in the "__TEXT.__text" section in the main executable. This made symbol lookup fail due to the way we were finding a real address in the debug map which was by finding the section that the function was in in the .o file and trying to find this in the main executable. Now the section list supports finding a linked address in a section or any child sections. After fixing this, we ran into issue that were due to DWARF and how it represents locations lists. DWARF makes a list of address ranges and expressions that go along with those address ranges. The location addresses are expressed in terms of a compile unit address + offset. This works fine as long as nothing moves around. When stuff moves around and offsets change between the remapped compile unit base address and the new function address, then we can run into trouble. To deal with this, we now store supply a location list slide amount to any location list expressions that will allow us to make the location list addresses into zero based offsets from the object that owns the location list (always a function in our case). With these fixes we can now re-link random address ranges inside the debugger for use with our DWARF + debug map, incremental linking, and more. Another issue that arose when doing the DWARF in the .o files was that GCC 4.2 emits a ".debug_aranges" that only mentions functions that are externally visible. This makes .debug_aranges useless to us and we now generate a real address range lookup table in the DWARF parser at the same time as we index the name tables (that are needed because .debug_pubnames is just as useless). llvm-gcc doesn't generate a .debug_aranges section, though this could be fixed, we aren't going to rely upon it. Renamed a bunch of "UINT_MAX" to "UINT32_MAX". llvm-svn: 113829
* Improved name demangling performance by 20% on darwin.Greg Clayton2010-09-031-6/+11
| | | | llvm-svn: 113032
* I enabled some extra warnings for hidden local variables and for hiddenGreg Clayton2010-07-141-8/+6
| | | | | | virtual functions and caught some things and did some general code cleanup. llvm-svn: 108299
* Merged Eli Friedman's linux build changes where he added Makefile files thatGreg Clayton2010-07-091-2/+1
| | | | | | | enabled LLVM make style building and made this compile LLDB on Mac OS X. We can now iterate on this to make the build work on both linux and macosx. llvm-svn: 108009
* Added function name types to allow us to set breakpoints by name moreGreg Clayton2010-06-281-14/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | intelligently. The four name types we currently have are: eFunctionNameTypeFull = (1 << 1), // The function name. // For C this is the same as just the name of the function // For C++ this is the demangled version of the mangled name. // For ObjC this is the full function signature with the + or // - and the square brackets and the class and selector eFunctionNameTypeBase = (1 << 2), // The function name only, no namespaces or arguments and no class // methods or selectors will be searched. eFunctionNameTypeMethod = (1 << 3), // Find function by method name (C++) with no namespace or arguments eFunctionNameTypeSelector = (1 << 4) // Find function by selector name (ObjC) names this allows much more flexibility when setting breakoints: (lldb) breakpoint set --name main --basename (lldb) breakpoint set --name main --fullname (lldb) breakpoint set --name main --method (lldb) breakpoint set --name main --selector The default: (lldb) breakpoint set --name main will inspect the name "main" and look for any parens, or if the name starts with "-[" or "+[" and if any are found then a full name search will happen. Else a basename search will be the default. Fixed some command option structures so not all options are required when they shouldn't be. Cleaned up the breakpoint output summary. Made the "image lookup --address <addr>" output much more verbose so it shows all the important symbol context results. Added a GetDescription method to many of the SymbolContext objects for the more verbose output. llvm-svn: 107075
OpenPOWER on IntegriCloud