History log of /external/lldb/source/Symbol/Symtab.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
7940069905bee0b2e5f0661bf37c9f906ddf8603 10-Jul-2013 Greg Clayton <gclayton@apple.com> Cleanup on the unified section list changes. Main changes are:
- ObjectFile::GetSymtab() and ObjectFile::ClearSymtab() no longer takes any flags
- Module coordinates with the object files and contain a unified section list so that object file and symbol file can share sections when they need to, yet contain their own sections.

Other cleanups:
- Fixed Symbol::GetByteSize() to not have the symbol table compute the byte sizes on the fly
- Modified the ObjectFileMachO class to compute symbol sizes all at once efficiently
- Modified the Symtab class to store a file address lookup table for more efficient lookups
- Removed Section::Finalize() and SectionList::Finalize() as they did nothing
- Improved performance of the detection of symbol files that have debug maps by excluding stripped files and core files, debug files, object files and stubs
- Added the ability to tell if an ObjectFile has been stripped with ObjectFile::IsStripped() (used this for the above performance improvement)

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185990 91177308-0d34-0410-b5e6-96231b3b80d8
5226e7dac92875aaf334591edc37f4a9893c352d 03-Jul-2013 Jim Ingham <jingham@apple.com> Workaround for infinite recursion in InitOSO->GetByteSize->GetSymbolVendor.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@185491 91177308-0d34-0410-b5e6-96231b3b80d8
3e11c7ec050648ba865f1d451f8cb46fd39072a8 19-Jun-2013 Andy Gibbs <andyg1001@hotmail.co.uk> Sort out a number of mismatched integer types in order to cut down the number of compiler warnings.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@184333 91177308-0d34-0410-b5e6-96231b3b80d8
83d90c5e68f4a977150c6791a49ade7a23c92177 18-May-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/11398407>

Name matching was working inconsistently across many places in LLDB. Anyone doing name lookups where you want to look for all types of names should used "eFunctionNameTypeAuto" as the sole name type mask. This will ensure that we get consistent "lookup function by name" results. We had many function calls using as mask like "eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector". This was due to the function lookup by name evolving over time, but as it stands today, use eFunctionNameTypeAuto when you want general name lookups. Either ModuleList::FindFunctions() or Module::FindFunctions() will figure out the right kinds of names to lookup and remove the "eFunctionNameTypeAuto" and replace it with the exact subset of what the name can be.

This checkin also changes eFunctionNameTypeAny over to use eFunctionNameTypeAuto to reflect this.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@182179 91177308-0d34-0410-b5e6-96231b3b80d8
97a19b21dacd9063bb5475812df7781777262198 29-Apr-2013 Greg Clayton <gclayton@apple.com> Cleanup logging to use the new "std::string FileSpec::GetPath()" function. Also added a similar function for modules:

Module::GetSpecificationDescription () const;

This returns the module as "/usr/lib/libfoo.dylib" for normal files (calls "std::string FileSpec::GetPath()" on m_file) but it also might include the object name in case the module is for a .o file in a BSD archive ("/usr/lib/libfoo.a(bar.o)"). Cleaned up necessary logging code to use it.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180717 91177308-0d34-0410-b5e6-96231b3b80d8
977260cc6e57003ed02940a81f9b1af0aa5c89ba 22-Apr-2013 Matt Kopec <Matt.Kopec@intel.com> Fix for expression/breakpoint setting of gnu indirect functions.

Do this until we are able to resolve these symbols to their actual implementations without needing runtime support.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@180029 91177308-0d34-0410-b5e6-96231b3b80d8
f58438fa7751274b6f4e4b1805940127dce13b00 14-Apr-2013 Greg Clayton <gclayton@apple.com> Fixed issues with the way ELF symbols are parsed:
- Do not add symbols with no names
- Make sure that symbols from ELF symbol tables know that the byte size is correct. Previously the symbols would calculate their sizes by looking for the next symbol and take symbols that had zero size and make them have invalid sizes.
- Added the ability to dump raw ELF symbols by adding a Dump method to ELFSymbol

Also removed some unused code from lldb_private::Symtab.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@179466 91177308-0d34-0410-b5e6-96231b3b80d8
296b06d325413723f5aac5988eed977b278a7807 03-Apr-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13506727>

Symbol table function names should support lookups like symbols with debug info.

To fix this I:
- Gutted the way FindFunctions is used, there used to be way too much smarts only in the DWARF plug-in
- Made it more efficient by chopping the name up once and using simpler queries so that SymbolFile and Symtab plug-ins don't need to do as much
- Filter the results at a higher level
- Make the lldb_private::Symtab able to chop up C++ mangled names and make as much sense out of them as possible and also be able to search by basename, fullname, method name, and selector name.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178608 91177308-0d34-0410-b5e6-96231b3b80d8
464a5063bc59755cb6ec063d0b2491097302d2ab 04-Mar-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13338643>

DWARF with .o files now uses 40-60% less memory!

Big fixes include:
- Change line table internal representation to contain "file addresses". Since each line table is owned by a compile unit that is owned by a module, it makes address translation into lldb_private::Address easy to do when needed.
- Removed linked address members/methods from lldb_private::Section and lldb_private::Address
- lldb_private::LineTable can now relink itself using a FileRangeMap to make it easier to re-link line tables in the future
- Added ObjectFile::ClearSymtab() so that we can get rid of the object file symbol tables after we parse them once since they are not needed and kept memory allocated for no reason
- Moved the m_sections_ap (std::auto_ptr to section list) and m_symtab_ap (std::auto_ptr to the lldb_private::Symtab) out of each of the ObjectFile subclasses and put it into lldb_private::ObjectFile.
- Changed how the debug map is parsed and stored to be able to:
- Lazily parse the debug map for each object file
- not require the address map for a .o file until debug information is linked for a .o file

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176454 91177308-0d34-0410-b5e6-96231b3b80d8
f892c42725ed36c97e8ce10e758170cf6f1aff83 30-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/9141269>

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:]

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173858 91177308-0d34-0410-b5e6-96231b3b80d8
36da2aa6dc5ad9994b638ed09eb81c44cc05540b 25-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/13069948>

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.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@173463 91177308-0d34-0410-b5e6-96231b3b80d8
2fcbf6e3d86ac0e6a95e11e5e232a9f72bd612d2 08-Jan-2013 Greg Clayton <gclayton@apple.com> <rdar://problem/12953853>

Setting breakpoints using "breakpoint set --selector <SEL>" previously didn't when there was no dSYM file.

Also fixed issues in the test suite that arose after fixing the bug.

Also fixed the log channels to properly ref count the log streams using weak pointers to the streams. This fixes a test suite problem that would happen when you specified a full path to the compiler with the "--compiler" option.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@171816 91177308-0d34-0410-b5e6-96231b3b80d8
99c63be2c47f5f01d3b0885c4405a4488456417f 01-May-2012 Jim Ingham <jingham@apple.com> Use a cache of the results of "GetFileAddress" from a symbol in the Comparator we are using to sort the various lookup indices by symbol address. When we switched to weak pointers,
this lookup got slightly slower. Not enough to matter for most uses, but in the sort algorithm it does matter.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@155873 91177308-0d34-0410-b5e6-96231b3b80d8
0c31d3d3a4a1d00d53346d8a23b0519f47e55d1f 07-Mar-2012 Greg Clayton <gclayton@apple.com> <rdar://problem/10997402>

This fix really needed to happen as a previous fix I had submitted for
calculating symbol sizes made many symbols appear to have zero size since
the function that was calculating the symbol size was calling another function
that would cause the calculation to happen again. This resulted in some symbols
having zero size when they shouldn't. This could then cause infinite stack
traces and many other side affects.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152244 91177308-0d34-0410-b5e6-96231b3b80d8
9f69f982142c1c6d4dbece98879eaf746e66728b 02-Mar-2012 Greg Clayton <gclayton@apple.com> Fixed Symbol objects being able to get their byte size.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151878 91177308-0d34-0410-b5e6-96231b3b80d8
662e56733faaeee932eba120d756257682f1bf04 19-Jan-2012 Greg Clayton <gclayton@apple.com> Fixed an issue with the Instruction subclasses where the strings might
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.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@148460 91177308-0d34-0410-b5e6-96231b3b80d8
e14d3d3209f4260acc6e84d656460d5bdeade2c2 19-Jan-2012 Greg Clayton <gclayton@apple.com> Added an extra way to chop up an objective C prototype and use it where necessary.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@148445 91177308-0d34-0410-b5e6-96231b3b80d8
d3850ab15ed119ae36136656df0bae4feb0c9fc1 28-Dec-2011 Greg Clayton <gclayton@apple.com> Save a little bit of memory that was being reserved in a UniqueCStringMap
vector that can be sized to fit.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@147324 91177308-0d34-0410-b5e6-96231b3b80d8
16d2187c0c3992f22e9cb011f863dc0fe35e3cde 03-Dec-2011 Greg Clayton <gclayton@apple.com> Added the ability for clients to grab a set of symbol table indexes and then
add them to a fast lookup map. lldb_private::Symtab now export the following
public typedefs:

namespace lldb_private {

class Symtab {
typedef std::vector<uint32_t> IndexCollection;
typedef UniqueCStringMap<uint32_t> NameToIndexMap;

Clients can then find symbols by name and or type and end up with a
Symtab::IndexCollection that is filled with indexes. These indexes can then
be put into a name to index lookup map and control if the mangled and
demangled names get added to the map:

bool add_demangled = true;
bool add_mangled = true;
Symtab::NameToIndexMap name_to_index;
symtab->AppendSymbolNamesToMap (indexes, add_demangled, add_mangled, name_to_index).

This can be repeated as many times as needed to get a lookup table that
you are happy with, and then this can be sorted:


Now name lookups can be done using a subset of the symbols you extracted from
the symbol table. This is currently being used to extract objective C types
from object files when there is no debug info in SymbolFileSymtab.

Cleaned up how the objective C types were being vended to be more efficient
and fixed some errors in the regular expression that was being used.

git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145777 91177308-0d34-0410-b5e6-96231b3b80d8
7e5fa7fc1f8efd24c078e063b2c4b5e13ba5be20 20-Sep-2011 Jason Molenda <jmolenda@apple.com> Update declarations for all functions/methods that accept printf-style
stdarg formats to use __attribute__ format so the compiler can flag
incorrect uses. Fix all incorrect uses. Most of these are innocuous,
a few were resulting in crashes.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@140185 91177308-0d34-0410-b5e6-96231b3b80d8
448bd2fe5693c3ef591743d460b8b830607cfa09 11-Sep-2011 Greg Clayton <gclayton@apple.com> Fixes for Symtab.cpp to take advantage of the new unique C string map
changes that were just submitted.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@139478 91177308-0d34-0410-b5e6-96231b3b80d8
3ad4da0f2c2afdea3352deaaf9c044855dc5c95b 15-Aug-2011 Jim Ingham <jingham@apple.com> Factor out the code that parses ObjC Method names into a static method
in ObjCLanguageRuntime.
Add the category-free name of symbols to the Symtab name-to-index list.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@137600 91177308-0d34-0410-b5e6-96231b3b80d8
b344843f75ef893762c93fd0a22d2d45712ce74d 24-Mar-2011 Greg Clayton <gclayton@apple.com> Fixed the LLDB build so that we can have private types, private enums and
public types and public enums. This was done to keep the SWIG stuff from
parsing all sorts of enums and types that weren't needed, and allows us to
abstract our API better.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128239 91177308-0d34-0410-b5e6-96231b3b80d8
cd151697a4b4d32d8818488b793ea44712945448 20-Jan-2011 Greg Clayton <gclayton@apple.com> Made the DWARF + debug map symbol file parser be much more efficient when it isn't
going to actually be used as the symbol file plug-in by looking only for suitable
N_OSO symbols and avoiding sorting function (N_FUN) and global/static (N_GSYM/N_STSYM)
symbols when there are no suitable N_OSO objects.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@123889 91177308-0d34-0410-b5e6-96231b3b80d8
8d3802d9d6c1be4c0d37c4d269b18bcb865823e6 08-Oct-2010 Greg Clayton <gclayton@apple.com> Added mutex protection to the Symtab class.

Added a new SortOrder enumeration and hooked it up to the "image dump symtab"
command so we can dump symbol tables in the original order, sorted by address,
or sorted by name.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116049 91177308-0d34-0410-b5e6-96231b3b80d8
3fed8b9b2696fc2ea78005c8f9b1c621d5748042 08-Oct-2010 Greg Clayton <gclayton@apple.com> Hooked up ability to look up data symbols so they show up in disassembly
if the address comes from a data section.

Fixed an issue that could occur when looking up a symbol that has a zero
byte size where no match would be returned even if there was an exact symbol

Cleaned up the section dump output and added the section type into the output.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116017 91177308-0d34-0410-b5e6-96231b3b80d8
eea264007bc5fb42c8f3239726a9d28ae42e1b7b 15-Sep-2010 Greg Clayton <gclayton@apple.com> Moved the section load list up into the target so we can use the target
to symbolicate things without the need for a valid process subclass.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113895 91177308-0d34-0410-b5e6-96231b3b80d8
637029b85196806ce0f39271764efae43c888e85 12-Sep-2010 Greg Clayton <gclayton@apple.com> Fixed an issue I found in the mach-o symbol table parsing where
we cached remapping information using the old nlist index to the
new symbol index, yet we tried to lookup the symbol stubs that
were for symbols that had been remapped by ID instead of using
the new symbol index. This is now fixed and the mach-o symbol tables
are fixed.

Use the delta between two vector entries to determine the stride
in case any padding is inserted by compilers for bsearch calls
on symbol tables when finding symbols by their original ID.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113719 91177308-0d34-0410-b5e6-96231b3b80d8
7c36fa07bc2c2c7efc4a28ad540f7711491f379d 11-Sep-2010 Greg Clayton <gclayton@apple.com> Remove the eSymbolTypeFunction, eSymbolTypeGlobal, and eSymbolTypeStatic.
They will now be represented as:
eSymbolTypeFunction: eSymbolTypeCode with IsDebug() == true
eSymbolTypeGlobal: eSymbolTypeData with IsDebug() == true and IsExternal() == true
eSymbolTypeStatic: eSymbolTypeData with IsDebug() == true and IsExternal() == false

This simplifies the logic when dealing with symbols and allows for symbols
to be coalesced into a single symbol most of the time.

Enabled the minimal symbol table for mach-o again after working out all the
kinks. We now get nice concise symbol tables and debugging with DWARF in the
.o files with a debug map in the binary works well again. There were issues
where the SymbolFileDWARFDebugMap symbol file parser was using symbol IDs and
symbol indexes interchangeably. Now that all those issues are resolved
debugging is working nicely.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113678 91177308-0d34-0410-b5e6-96231b3b80d8
0ad086f3ab18d6927b9df2f79169607d3a5d90e4 07-Sep-2010 Greg Clayton <gclayton@apple.com> Added Symtab::FindSymbolByID() in preparation for enabling the minimal
symbol tables. Minimal symbol tables enable us to merge two symbols, one
debug symbol and one linker symbol, into a single symbol that can carry
just as much information and will avoid duplicate symbols in the symbol

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113223 91177308-0d34-0410-b5e6-96231b3b80d8
53d68e749f0715691a95f23e9490d97e484b15da 21-Jul-2010 Greg Clayton <gclayton@apple.com> Remove use of STL collection class use of the "data()" method since it isn't
part of C++'98. Most of these were "std::vector<T>::data()" and

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108957 91177308-0d34-0410-b5e6-96231b3b80d8
0b1409833c8f77befd311854c8f4482a42876a1e 20-Jul-2010 Greg Clayton <gclayton@apple.com> Logic fix to properly determine when a symbol is not from the current
symbol table (from William Lynch).

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@108871 91177308-0d34-0410-b5e6-96231b3b80d8
a1e14750737ce399beb491973e8f9a349c3e3a1c 17-Jun-2010 Owen Anderson <resistor@mac.com> Fix comment, per Chris' suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106192 91177308-0d34-0410-b5e6-96231b3b80d8
c3d68556a5ae14219eb7638dade1799ab94b69fe 16-Jun-2010 Owen Anderson <resistor@mac.com> Switch from qsort_r to std::stable_sort for a performance win and improved portability.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106116 91177308-0d34-0410-b5e6-96231b3b80d8
7dbd6da9a222b6bcef35f1cb8ab838a30b7f75e5 11-Jun-2010 Owen Anderson <resistor@mac.com> Revert my previous patch. Apparently the code-size impact of std::sort isn't acceptable.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105835 91177308-0d34-0410-b5e6-96231b3b80d8
c0b52f43342b9916c4c384a3a78fdf72d753d375 11-Jun-2010 Owen Anderson <resistor@mac.com> Replace qsort_r with std::sort. This gets rid of a lot of portability
ickiness, and is cleaner to boot.

I'm fairly confident that I converted the comparator over properly,
and what testing I could figure out how to run seemed to pass, but it
would be great if someone in the know could check behind me.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105834 91177308-0d34-0410-b5e6-96231b3b80d8
beb7742b18e7d1e5afe9555d6656fe38d514386f 11-Jun-2010 Greg Clayton <gclayton@apple.com> Fixed an issue where a return value wasn't being returned from Symtab::CompareSymbolValueByIndexLinux.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105802 91177308-0d34-0410-b5e6-96231b3b80d8
020f353bf792f1028e4037ea92d03acc90594c40 11-Jun-2010 Eli Friedman <eli.friedman@gmail.com> Make qsort_r usage "portable". Why does a function which seems so simple
have to be so complicated?

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105797 91177308-0d34-0410-b5e6-96231b3b80d8
24943d2ee8bfaa7cf5893e4709143924157a5c1e 08-Jun-2010 Chris Lattner <sabre@nondot.org> Initial checkin of lldb code from internal Apple repo.

git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@105619 91177308-0d34-0410-b5e6-96231b3b80d8