summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Modify ObjectFileELF::GetArchitecture() to avoid calling ↵Todd Fiala2014-07-111-2/+5
| | | | | | | | ParseSectionHeaders() when we have headers. Change by Matthew Gardiner. llvm-svn: 212825
* Prevent ObjectFileELF::GetSectionHeaderInfo() from reparsing section headers.Todd Fiala2014-07-111-4/+4
| | | | | | | | | | | | | If we have any section headers in the collection, we already parsed them. Therefore, don't reparse the section headers when the section_headers collection is not empty. See this thread for more details: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140707/011721.html Change by Matthew Gardiner llvm-svn: 212822
* Fix typos.Bruce Mitchener2014-07-011-3/+3
| | | | llvm-svn: 212132
* Fix ObjectFileELF to determine architectures independent of host.Todd Fiala2014-06-271-35/+293
| | | | | | | | | | | | | | | | | | Previously ObjectFileELF was simplifying and assuming the object file it was looking at was the same as the host architecture/triple. This would break attempts to run, say, lldb on MacOSX against lldb-gdbserver on Linux since the MacOSX lldb would say that the linux elf file was really an Apple MacOSX architecture. Chaos would ensue. This change allows the elf file to parse ELF notes for Linux, FreeBSD and NetBSD, and determine the OS appropriately from them. It also initializes the OS type from the ELF header OSABI if it is set (which it is for FreeBSD but not for Linux). Added a test with freebsd and linux images that verify that '(lldb) image list -t -A' prints out the expected architecture for each. llvm-svn: 211907
* Replace GCC-specific intrinsic with portable alternative.Zachary Turner2014-06-251-1/+5
| | | | | | | | | | | | | | | | Not all supported compilers have GCC intrinsics, so this patch uses the correct portable alternative. Additionally, this patch fixes an off-by-one error. __builtin_ffs returns the 1-based index of the least-significant 1-bit, but the function expects the base 2 logarithm of the number, which is equivalent to the 0-based index of the least-significant 1-bit. Reviewed by: Keno Fischer Differential Revision: http://reviews.llvm.org/D4284 llvm-svn: 211669
* Patch from Keno Fischer to enable JITLoaderGDB with mach-o file support.Greg Clayton2014-06-241-0/+1
| | | | | | The patch is as is with the functionality left disabled for apple vendors because of performance regressions. If this is enabled it ends up searching for symbols in all shared libraries that are loadeded. llvm-svn: 211638
* <rdar://problem/14515139>Enrico Granata2014-03-251-1/+1
| | | | | | | Add a GetFoundationVersion() to AppleObjCRuntime This API is used to return and cache the major version of Foundation.framework, which is potentially a useful piece of data to key off of to enable or disable certain ObjC related behaviors (especially in data formatters) llvm-svn: 204756
* Improve Elf object file UUID calculation performance.Todd Fiala2014-03-251-26/+150
| | | | | | | | | | | This change makes significant improvements in the performance of calculating a UUID within ObjectFileELF, and handles both running processes and core files correctly. This does lazy evaluation of UUID generation and caches the result when calculated. Change by Piotr Rak. llvm-svn: 204749
* Cleanup some dead assignements reported by scan-buildArnaud A. de Grandmaison2014-03-221-5/+3
| | | | | | No functionnal change. llvm-svn: 204545
* Add support for JIT debugging on Linux using the GDB JIT interface. Patch ↵Andrew MacPherson2014-03-051-5/+232
| | | | | | written with Keno Fischer. llvm-svn: 202956
* remove dead code + simplify a littleSylvestre Ledru2014-02-211-4/+2
| | | | llvm-svn: 201865
* Modified ObjectFile::SetLoadAddress() to now be:Greg Clayton2014-02-071-13/+24
| | | | | | | | | | | | | | ObjectFile::SetLoadAddress (Target &target, lldb::addr_t value, bool value_is_offset); Now "value" is a slide if "value_is_offset" is true, and "value" is an image base address otherwise. All previous usage of this API was using slides. Updated the ObjectFileELF and ObjectFileMachO SetLoadAddress methods to do the right thing. Also updated the ObjectFileMachO::SetLoadAddress() function to not load __LINKEDIT when it isn't needed and to only load sections that belong to the executable object file. llvm-svn: 201003
* Factor some methods that were in DynamicLoaderPOSIXDYLD.Steve Pucci2014-02-061-0/+33
| | | | | | | | | | | | | | | Move some code that was in DynamicLoaderPOSIXDLYD into the base class DynamicLoader. In the case of UpdateLoadedSections(), the test to see whether a file is loadable (its address is zero) is not generally applicable so that test is changed to a more universally applicable check for the SHF_ALLOC flag on the section. Also make it explicit that the reading of the module_id in DynamicLoaderPOSIXDYLD::GetThreadLocalData() is using a hardcoded size (of module_id) of 4, which might not be appropriate on big-endian 64-bit systems, leaving a FIXME comment in place. llvm-svn: 200939
* elf: Move elf note parsing to ObjectFileELF.cppEd Maste2013-12-021-25/+48
| | | | | | | | | Separate ELF note implementations were introduced for core files and GNU build-id. Move the more general one from elf-core to ObjectFileELF and use it for build-id as well. Review: http://llvm-reviews.chandlerc.com/D1902 llvm-svn: 196125
* Simplify indirect rld_map for mips (rework r192408).Ed Maste2013-10-111-3/+14
| | | | | | | | | Just pass a Target* into ObjectFileELF::GetImageInfoAddress so that it can do the extra dereference necessary on MIPS, instead of passing a flag back to the caller. Review: http://llvm-reviews.chandlerc.com/D1899 llvm-svn: 192469
* Support mips shared object debug infoEd Maste2013-10-111-2/+3
| | | | | | | | | | MIPS's .dyanamic section is read-only. Instead of using DT_DEBUG for the pointer to dyld information it uses a separate tag DT_MIPS_RLD_MAP which points to storage in the read-write .rld_map section, which in turn points to the dyld information. Review: http://llvm-reviews.chandlerc.com/D1890 llvm-svn: 192408
* Adds an option to resolve a symbol from an address that can be usedAshok Thirumurthi2013-09-241-0/+52
| | | | | | | | | | | | | | | | | to build out the symbol table as addresses are used, and implements the mechanism for ELF to add stripped symbols from eh_frame. Uses this mechanism to allow disassembly for addresses corresponding to stripped symbols for ELF, and provide hooks to implement this for PE COFF. Also removes eSymbolContextTailCall in favor of an option for ResolveSymbolContextForAddress for consistency with the documentation for eSymbolContextEverything. Essentially, this is just an option for interpreting the so_addr. llvm-svn: 191307
* Round plt entsize to addralignMichael Sartain2013-08-221-2/+17
| | | | llvm-svn: 189066
* simple plugin now works with Linux fix assert in SetPluginInfo implement ↵Michael Sartain2013-07-171-1/+2
| | | | | | | | Linux ePathTypeLLDBSystemPlugins and ePathTypeLLDBUserPlugins implement Linux Host::Backtrace and Host::GetEnvironment add .gnu_debugdata comment Differential Revision: http://llvm-reviews.chandlerc.com/D1159 llvm-svn: 186475
* Adds methods to ObjectFileELF to access data in ELF segmentsAshok Thirumurthi2013-07-111-1/+28
| | | | | | | | in preparation to add support for ELF core files. Patch by Samuel Jacob! llvm-svn: 186114
* Cleanup on the unified section list changes. Main changes are:Greg Clayton2013-07-101-190/+159
| | | | | | | | | | | | | | | - 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) llvm-svn: 185990
* Fix ObjectFileELF crc32 code used when no build id is present.Michael Sartain2013-07-031-67/+86
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D1081 llvm-svn: 185494
* Split symbol support for ELF and Linux.Michael Sartain2013-07-011-166/+379
| | | | llvm-svn: 185366
* Adds PT_TLS and PT_GNU_EH_FRAME names to DumpELFProgramHeadersFilipe Cabecinhas2013-05-231-10/+12
| | | | llvm-svn: 182619
* ObjectFileELF::GetModuleSpecifications on Linux should work now.Michael Sartain2013-05-231-10/+72
| | | | | | | Which means "platform process list" should work and list the architecture. We are now parsing the elf build-id if it exists, which should allow us to load stripped symbols (looking at that next). llvm-svn: 182610
* Comment out ObjectFileELF::GetModuleSpecifications() function until I can ↵Michael Sartain2013-05-171-1/+5
| | | | | | debug where it's causing tests to fail. llvm-svn: 182069
* Implement ObjectFileELF::GetModuleSpecifications(), and add PlatformLinux ↵Michael Sartain2013-05-171-1/+39
| | | | | | | code to deal with unknown arch properties. CR: Greg Clayton llvm-svn: 182065
* Fix ObjectFileELF to not use the file_offset twice.Filipe Cabecinhas2013-05-161-1/+1
| | | | llvm-svn: 182061
* <rdar://problem/13854277>Greg Clayton2013-05-101-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <rdar://problem/13594769> Main changes in this patch include: - cleanup plug-in interface and use ConstStrings for plug-in names - Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp - Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging The plug-in interface changes: Modified the lldb_private::PluginInterface class that all plug-ins inherit from: Changed: virtual const char * GetPluginName() = 0; To: virtual ConstString GetPluginName() = 0; Removed: virtual const char * GetShortPluginName() = 0; - Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. - Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc. llvm-svn: 181631
* Added the ability to extract a ModuleSpecList (a new class) from an ↵Greg Clayton2013-04-241-1/+14
| | | | | | | | | | | | | | | | | ObjectFile. This is designed to be used when you have an object file that contains one or more architectures (MacOSX universal (fat) files) and/or one or more objects (BSD archive (.a files)). There is a new static ObjectFile function you can call: size_t ObjectFile::GetModuleSpecifications (const FileSpec &file, lldb::offset_t file_offset, ModuleSpecList &specs) This will fill in "specs" which the details of all the module specs (file + arch + UUID (if there is one) + object name (for BSD archive objects eventually) + file offset to the object in question). This helps us when a user specifies a file that contains a single architecture, and also helps us when we are given a debug symbol file (like a dSYM file on MacOSX) that contains one or more architectures and we need to be able to match it up to an existing Module that has no debug info. llvm-svn: 180224
* After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton2013-04-181-1/+1
| | | | | | the macros and just use C++11. llvm-svn: 179805
* Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton2013-04-181-1/+1
| | | | | | | | C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++. Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro. llvm-svn: 179779
* Fixed issues with the way ELF symbols are parsed:Greg Clayton2013-04-131-2/+12
| | | | | | | | | | - 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. llvm-svn: 179466
* <rdar://problem/13338643>Greg Clayton2013-03-041-2/+0
| | | | | | | | | | | | | | | | 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 llvm-svn: 176454
* Add GNU indirect function support in expressions for Linux.Matt Kopec2013-02-271-0/+6
| | | | llvm-svn: 176206
* Fix ELF parsing where undefined symbols were being added to the symbol table ↵Matt Kopec2013-02-121-26/+30
| | | | | | with the incorrect symbol type. llvm-svn: 174984
* Be sure to set the data offset to zero if we actually mmap the entire ELF file.Greg Clayton2013-02-071-1/+2
| | | | llvm-svn: 174668
* Fixing stale pointer problem in ELFObjectFileAndrew Kaylor2013-02-071-2/+3
| | | | llvm-svn: 174665
* <rdar://problem/13159777> Greg Clayton2013-02-061-11/+23
| | | | | | | | | | | | | | lldb was mmap'ing archive files once per .o file it loads, now it correctly shares the archive between modules. LLDB was also always mapping entire contents of universal mach-o files, now it maps just the slice that is required. Added a new logging channel for "lldb" called "mmap" to help track future regressions. Modified the ObjectFile and ObjectContainer plugin interfaces to take a data offset along with the file offset and size so we can implement the correct caching and efficient reading of parts of files without mmap'ing the entire file like we used to. The current implementation still keeps entire .a files mmaped (once) and entire slices from universal files mmaped to ensure that if a client builds their binaries during a debug session we don't lose our data and get corrupt object file info and debug info. llvm-svn: 174524
* <rdar://problem/13069948>Greg Clayton2013-01-251-22/+21
| | | | | | | | | | | | 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
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-9/+9
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* Fixed an error in the ELF parser that was comparing a bool to 4 causing 32 ↵Greg Clayton2012-11-121-1/+1
| | | | | | bit ELF relocations to get parsed incorrectly. llvm-svn: 167773
* Ran the static analyzer on the codebase and found a few things.Greg Clayton2012-07-171-3/+0
| | | | llvm-svn: 160338
* Committed a change to the SectionList that introducesSean Callanan2012-06-081-0/+2
| | | | | | | | | | | a cache of address ranges for child sections, accelerating lookups. This cache is built during object file loading, and is then set in stone once the object files are done loading. (In Debug builds, we ensure that the cache is never invalidated after that.) llvm-svn: 158188
* Use integers instead of NULL.Bill Wendling2012-04-031-3/+3
| | | | llvm-svn: 153941
* lldb_private::Section objects have a boolean flag that can be set that Greg Clayton2012-03-271-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | indicates that the section is thread specific. Any functions the load a module given a slide, will currently ignore any sections that are thread specific. lldb_private::Section now has: bool Section::IsThreadSpecific () const { return m_thread_specific; } void Section::SetIsThreadSpecific (bool b) { m_thread_specific = b; } The ELF plug-in has been modified to set this for the ".tdata" and the ".tbss" sections. Eventually we need to have each lldb_private::Thread subclass be able to resolve a thread specific section, but for now they will just not resolve. The code for that should be trivual to add, but the address resolving functions will need to be changed to take a "ExecutionContext" object instead of just a target so that thread specific sections can be resolved. llvm-svn: 153537
* Fixed a few things in the ELF object file:Greg Clayton2012-03-271-6/+8
| | | | | | | | | 1 - sections only get a valid VM size if they have SHF_ALLOC in the section flags 2 - symbol names are marked as mangled if they start with "_Z" Also fixed the DWARF parser to correctly use the section file size when extracting the DWARF. llvm-svn: 153496
* <rdar://problem/10103468>Greg Clayton2012-02-241-57/+68
| | | | | | | | | | | | | | | | | | | | | | | | | I started work on being able to add symbol files after a debug session had started with a new "target symfile add" command and quickly ran into problems with stale Address objects in breakpoint locations that had lldb_private::Section pointers into modules that had been removed or replaced. This also let to grabbing stale modules from those sections. So I needed to thread harded the Address, Section and related objects. To do this I modified the ModuleChild class to now require a ModuleSP on initialization so that a weak reference can created. I also changed all places that were handing out "Section *" to have them hand out SectionSP. All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild so all of the find plug-in, static creation function and constructors now require ModuleSP references instead of Module *. Address objects now have weak references to their sections which can safely go stale when a module gets destructed. This checkin doesn't complete the "target symfile add" command, but it does get us a lot clioser to being able to do such things without a high risk of crashing or memory corruption. llvm-svn: 151336
* <rdar://problem/10560053>Greg Clayton2012-02-051-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed "target modules list" (aliased to "image list") to output more information by default. Modified the "target modules list" to have a few new options: "--header" or "-h" => show the image header address "--offset" or "-o" => show the image header address offset from the address in the file (the slide applied to the shared library) Removed the "--symfile-basename" or "-S" option, and repurposed it to "--symfile-unique" "-S" which will show the symbol file if it differs from the executable file. ObjectFile's can now be loaded from memory for cases where we don't have the files cached locally in an SDK or net mounted root. ObjectFileMachO can now read mach files from memory. Moved the section data reading code into the ObjectFile so that the object file can get the section data from Process memory if the file is only in memory. lldb_private::Module can now load its object file in a target with a rigid slide (very common operation for most dynamic linkers) by using: bool Module::SetLoadAddress (Target &target, lldb::addr_t offset, bool &changed) lldb::SBModule() now has a new constructor in the public interface: SBModule::SBModule (lldb::SBProcess &process, lldb::addr_t header_addr); This will find an appropriate ObjectFile plug-in to load an image from memory where the object file header is at "header_addr". llvm-svn: 149804
* Big change in the way ObjectFile file contents are managed. We nowGreg Clayton2012-01-121-20/+9
| | | | | | | | | | mmap() the entire object file contents into memory with MAP_PRIVATE. We do this because object file contents can change on us and currently this helps alleviate this situation. It also make the code for accessing object file data much easier to manage and we don't end up opening the file, reading some data and closing the file over and over. llvm-svn: 148017
OpenPOWER on IntegriCloud