summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Resubmitting 240466 after fixing the linux test suite failures.Greg Clayton2015-06-251-3/+2
| | | | | | | | | | | | | | | A few extras were fixed - Symbol::GetAddress() now returns an Address object, not a reference. There were places where people were accessing the address of a symbol when the symbol's value wasn't an address symbol. On MacOSX, undefined symbols have a value zero and some places where using the symbol's address and getting an absolute address of zero (since an Address object with no section and an m_offset whose value isn't LLDB_INVALID_ADDRESS is considered an absolute address). So fixing this required some changes to make sure people were getting what they expected. - Since some places want to access the address as a reference, I added a few new functions to symbol: Address &Symbol::GetAddressRef(); const Address &Symbol::GetAddressRef() const; Linux test suite passes just fine now. <rdar://problem/21494354> llvm-svn: 240702
* Don't #include "lldb-python.h" from anywhere.Zachary Turner2015-05-291-2/+0
| | | | | | | | | | | | | Since interaction with the python interpreter is moving towards being more isolated, we won't be able to include this header from normal files anymore, all includes of it should be localized to the python library which will live under source/bindings/API/Python after a future patch. None of the files that were including this header actually depended on it anyway, so it was just a dead include in every single instance. llvm-svn: 238581
* Make sure that "add-dsym" can't crash us when using it.Greg Clayton2015-03-311-8/+38
| | | | | | | | | | I am fixing this by: 1 - make sure we aren't trying to set the symbol file for a module to the same thing it already has and leaving it alone if it is the same 2 - keep all old symbol files around in the module in case there are any outstanding type references <rdar://problem/18029116> llvm-svn: 233757
* Move lldb-log.cpp to core/Logging.cppZachary Turner2015-03-181-1/+0
| | | | | | | | | So that we don't have to update every single #include in the entire codebase to #include this new header (which used to get included by lldb-private-log.h, we automatically #include "Logging.h" from within "Log.h". llvm-svn: 232653
* Remove Host::Backtrace in favor of llvm::sys::PrintStackTrace()Zachary Turner2015-03-061-1/+9
| | | | | | | | | | | | This removes Host::Backtrace from the codebase, and changes all call sites to use llvm::sys::PrintStackTrace(). This makes the functionality available for all platforms, and even for platforms which currently had a supported implementation of Host::Backtrace, this patch should enable richer information in stack traces, such as file and line number information, as well as giving it the ability to unwind through inlined functions. llvm-svn: 231511
* Don't #include ClangASTContext.h from Module.hZachary Turner2015-03-031-5/+6
| | | | | | | | | | | | This is part of a larger effort to reduce header file footprints. Combined, these patches reduce the build time of LLDB locally by over 30%. However, they touch many files and make many changes, so will be submitted in small incremental pieces. Reviewed By: Greg Clayton Differential Revision: http://reviews.llvm.org/D8022 llvm-svn: 231097
* Fix Bug 20400Chaoren Lin2015-02-261-1/+1
| | | | | | | | | | | | | | | | | | | Summary: http://llvm.org/bugs/show_bug.cgi?id=20400 The default triple of i686-pc-linux-gnu for 32 bit linux targets is compatible but not necessarily identical to the inferior binaries. Applying Azat Khuzhin's solution of using ArchSpec::IsCompatibleMatch() instead of ArchSpec::IsExactMatch() when comparing ObjectFile and Modules architecture. Reviewers: vharron Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7897 llvm-svn: 230694
* Don't wait for the dynamic loader to set a module as a dynamic link editor, ↵Greg Clayton2015-02-051-3/+10
| | | | | | | | | | figure it out through the ObjectFile. Background: dyld binaries often have extra symbols in their symbol table like "malloc" and "free" for the early bringup of dyld and we often don't want to set breakpoints in dynamic linker binaries. We also don't want to call the "malloc" or "free" function in dyld when a user writes an expression like "(void *)malloc(123)" so we need to avoid doing name lookups in dyld. We mark Modules as being dynamic link editors and this helps do correct lookups for breakpoints by name and function lookups. <rdar://problem/19716267> llvm-svn: 228261
* If we say:Greg Clayton2015-01-281-1/+1
| | | | | | | | (lldb) b isEqual: We end up calling "breakpoint set --name "isEqual:" and it was not checking for selectors due to a logic error. llvm-svn: 227281
* Don't stomp the triple when loading a PECOFF target.Zachary Turner2015-01-221-3/+7
| | | | | | | | | | | | | | | | | | | | | When you create a target, it tries to look for the platform's list of supported architectures for a match. The match it finds can contain specific triples, like i386-pc-windows-msvc. Later, we overwrite this value with the most generic triple that can apply to any platform with COFF support, causing some of the fields of the triple to get overwritten. This patch changes the behavior to only merge in values from the COFF triple if the fields of the matching triple were unknown/unspecified to begin with. This fixes load address resolution on Windows, since it enables the DynamicLoaderWindows to be used instead of DynamicLoaderStatic. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D7120 llvm-svn: 226849
* Setting breakpoints with name mask eFunctionNameTypeBase was broken for ↵Jim Ingham2014-10-251-20/+11
| | | | | | | | straight C names by 220432. Get that working again. llvm-svn: 220602
* Fixed name lookups for names that contain "::" but aren't actually C++ ↵Greg Clayton2014-10-221-0/+2
| | | | | | | | | | | | qualified C++ names. To do this, I fixed the CPPLanguageRuntime::StripNamespacesFromVariableName() function to use a regular expression that correctly determines if the name passed to it is a qualfied C++ name like "a::b::c" or "b::c". The old version of this function was treating '__54-[NSUserScriptTask executeWithInterpreter:arguments::]_block_invoke' as a match with a basename of ']_block_invoke'. Also fixed a case in the by name lookup of functions where we wouldn't look for the full name if we actually tried to call CPPLanguageRuntime::StripNamespacesFromVariableName() and got an empty basename back. <rdar://problem/18527866> llvm-svn: 220432
* Add error report when Module::GetObjectFile() fails to find a plugin to open ↵Todd Fiala2014-09-051-0/+4
| | | | | | | | an object file. Change by Stephane Sezer. llvm-svn: 217251
* When adding a dSYM to an existing ObjectFile, we can have a situationJason Molenda2014-08-221-0/+11
| | | | | | | | | | | | | | | | | | with binaries in the dyld shared cache (esp on iOS) where the file address for the executable binary (maybe from memory, maybe from an expanded copy of the dyld shared cache) is different from the file address in the dSYM. In that case, ObjectFileMachO replaces the file addresses from the original binary with the dSYM file addresses (usually 0-based) -- lldb doesn't have a notion of two file addresses for a given module so they need to agree. There was a cache of file addresses over in the Symtab so I added a method to the Module and the objects within to clear any file address caches if they exist, and added an implementation in the Symtab module to do that. <rdar://problem/16929569> llvm-svn: 216258
* Don't search for module resources at all if the setting is set to "false". Greg Clayton2014-08-181-2/+3
| | | | llvm-svn: 215936
* In order for the debug script filename to be valid as a module name, LLDB ↵Enrico Granata2014-08-161-1/+2
| | | | | | does some textual replacements. However, if one were unaware of this, they might name their script using the 'untampered' file name and they would get no feedback about it. Add logic to LLDB to make sure we tell people about those changes if it turns out they might need to know. Fixes rdar://14310572 llvm-svn: 215798
* Update lldb to track recent Triple arm64 enum removal and collapse into aarch64.Todd Fiala2014-07-231-1/+1
| | | | | | | | | | | See the following llvm change for details: r213743 | tnorthover | 2014-07-23 05:32:47 -0700 (Wed, 23 Jul 2014) | 9 lines AArch64: remove arm64 triple enumerator. This change fixes build breaks on Linux and MacOSX lldb. llvm-svn: 213755
* Start converting usages of off_t to other types.Zachary Turner2014-07-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | off_t is a type which is used for file offsets. Even more specifically, it is only used by a limited number of C APIs that deal with files. Any usage of off_t where the variable is not intended to be used with one of these APIs is a bug, by definition. This patch corrects some easy mis-uses of off_t, generally by converting them to lldb::offset_t, but sometimes by using other types such as size_t, when appropriate. The use of off_t to represent these offsets has worked fine in practice on linux-y platforms, since we used _FILE_OFFSET_64 to guarantee that off_t was a uint64. On Windows, however, _FILE_OFFSET_64 is unrecognized, and off_t will always be 32-bit. So the usage of off_t on Windows actually leads to legitimate bugs. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D4358 llvm-svn: 212192
* Fix typos.Bruce Mitchener2014-07-011-6/+6
| | | | llvm-svn: 212132
* iOS simulator cleanup to make sure we use "*-apple-ios" for iOS simulator ↵Greg Clayton2014-05-291-8/+38
| | | | | | | | | | | | | | | | | | apps and binaries. Changes include: - ObjectFileMachO can now determine if a binary is "*-apple-ios" or "*-apple-macosx" by checking the min OS and SDK load commands - ArchSpec now says "<arch>-apple-macosx" is equivalent to "<arch>-apple-ios" since the simulator mixes and matches binaries (some from the system and most from the iOS SDK). - Getting process inforamtion on MacOSX now correctly classifies iOS simulator processes so they have "*-apple-ios" architectures in the ProcessInstanceInfo - PlatformiOSSimulator can now list iOS simulator processes correctly instead of showing nothing by using: (lldb) platform select ios-simulator (lldb) platform process list - debugserver can now properly return "*-apple-ios" for the triple in the process info packets for iOS simulator executables - GDBRemoteCommunicationClient now correctly passes along the triples it gets for process info by setting the OS in the llvm::Triple correctly <rdar://problem/17060217> llvm-svn: 209852
* Fixed the Module::Module(ModuleSpec) constructor to properly copy the file ↵Greg Clayton2014-05-291-2/+2
| | | | | | offset and object file mod time from the actual module specifications so we will always be able to directly load the image we care about when calling Module::GetObjectFile(). llvm-svn: 209833
* sweep up -Wformat warnings from gccSaleem Abdulrasool2014-04-041-10/+11
| | | | | | | This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
* lldb arm64 import.Jason Molenda2014-03-291-0/+1
| | | | | | | | | | | | | | | | These changes were written by Greg Clayton, Jim Ingham, Jason Molenda. It builds cleanly against TOT llvm with xcodebuild. I updated the cmake files by visual inspection but did not try a build. I haven't built these sources on any non-Mac platforms - I don't think this patch adds any code that requires darwin, but please let me know if I missed something. In debugserver, MachProcess.cpp and MachTask.cpp were renamed to MachProcess.mm and MachTask.mm as they picked up some new Objective-C code needed to launch processes when running on iOS. llvm-svn: 205113
* <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
* JITed functions can now have debug info and be debugged with debug and ↵Greg Clayton2014-03-241-0/+57
| | | | | | | | | | | | | | | | | | | source info: (lldb) b puts (lldb) expr -g -i0 -- (int)puts("hello") First we will stop at the entry point of the expression before it runs, then we can step over a few times and hit the breakpoint in "puts", then we can continue and finishing stepping and fininsh the expression. Main features: - New ObjectFileJIT class that can be easily created for JIT functions - debug info can now be enabled when parsing expressions - source for any function that is run throught the JIT is now saved in LLDB process specific temp directory and cleaned up on exit - "expr -g --" allows you to single step through your expression function with source code <rdar://problem/16382881> llvm-svn: 204682
* Cleanup some dead assignements reported by scan-buildArnaud A. de Grandmaison2014-03-221-1/+1
| | | | | | No functionnal change. llvm-svn: 204545
* Add support for JIT debugging on Linux using the GDB JIT interface. Patch ↵Andrew MacPherson2014-03-051-3/+3
| | | | | | written with Keno Fischer. llvm-svn: 202956
* Fixed SBDebugger.CreateTarget("filename") and also make sure remote targets ↵Greg Clayton2014-03-041-13/+42
| | | | | | | | | don't pickup bogus locally cached files. <rdar://problem/16217254> <rdar://problem/16078651> llvm-svn: 202890
* Temporarily revert part of Greg's changes in r202738 which are causing ↵Jason Molenda2014-03-041-42/+13
| | | | | | problems with the testsuite and SBDebugger::CreateTarget(). llvm-svn: 202776
* "size_t" isn't always 64 bit, it is 32 bit on 32 bit systems. All printf ↵Greg Clayton2014-03-031-13/+42
| | | | | | | | style statements that were assuming size_t were 64 bit were changed, and they were also changed to display them as unsigned values as "size_t" isn't signed. If you print anything with 'size_t', please cast it to "uint64_t" in the printf and use PRIu64 or PRIx64. llvm-svn: 202738
* Modified ObjectFile::SetLoadAddress() to now be:Greg Clayton2014-02-071-2/+2
| | | | | | | | | | | | | | 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
* Implement ObjectFileMachO::SetLoadAddress().Greg Clayton2014-02-061-1/+6
| | | | llvm-svn: 200943
* Factor some methods that were in DynamicLoaderPOSIXDYLD.Steve Pucci2014-02-061-20/+4
| | | | | | | | | | | | | | | 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
* For logical backtrace work, lldb needs to track Module unloads etc & ↵Greg Clayton2013-12-061-0/+1
| | | | | | | | | | symoblicate an address based on a point in time <rdar://problem/15314403> This patch adds a new lldb_private::SectionLoadHistory class that tracks what shared libraries were loaded given a process stop ID. This allows us to keep a history of the sections that were loaded for a time T. Many items in history objects will rely upon the process stop ID in the future. llvm-svn: 196557
* Expose SBPlatform through the public API.Greg Clayton2013-11-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example code: remote_platform = lldb.SBPlatform("remote-macosx"); remote_platform.SetWorkingDirectory("/private/tmp") debugger.SetSelectedPlatform(remote_platform) connect_options = lldb.SBPlatformConnectOptions("connect://localhost:1111"); err = remote_platform.ConnectRemote(connect_options) if err.Success(): print >> result, 'Connected to remote platform:' print >> result, 'hostname: %s' % (remote_platform.GetHostname()) src = lldb.SBFileSpec("/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework", False) dst = lldb.SBFileSpec() # copy src to platform working directory since "dst" is empty err = remote_platform.Install(src, dst); if err.Success(): print >> result, '%s installed successfully' % (src) else: print >> result, 'error: failed to install "%s": %s' % (src, err) Implemented many calls needed in lldb-platform to be able to install a directory that contains symlinks, file and directories. The remote lldb-platform can now launch GDB servers on the remote system so that remote debugging can be spawned through the remote platform when connected to a remote platform. The API in SBPlatform is subject to change and will be getting many new functions. llvm-svn: 195273
* <rdar://problem/15191078>Greg Clayton2013-10-111-0/+32
| | | | | | Fixed Module::ResolveSymbolContextForAddress() to be able to also look in the SymbolVendor's SymbolFile's ObjectFile for a more meaningful symbol when a symbol lookup finds a synthetic symbol from the main object file. This will help lookups on MacOSX as the main executable might be stripped, but the dSYM file always has a full symbol table. llvm-svn: 192510
* Changed the bool conversion operator on ConstStringSean Callanan2013-10-031-3/+3
| | | | | | | | | | | | | | | to be explicit, to prevent horrid things like std::string a = ConstString("foo") from taking the path ConstString -> bool -> char -> std::string. This fixes, among other things, ClangFunction. <rdar://problem/15137989> llvm-svn: 191934
* Adds an option to resolve a symbol from an address that can be usedAshok Thirumurthi2013-09-241-4/+14
| | | | | | | | | | | | | | | | | 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
* Fix lldb regressions due to r190812 in the case where debug info is present.Ashok Thirumurthi2013-09-201-2/+2
| | | | | | | | | | | | Specifically, allows the unwinder to handle the case where sc.function gets resolved with a pc that is one past the address range of the function (consistent with a tail call). However, there is no matching symbol. Adds eSymbolContextTailCall to provide callers with control over the scope of symbol resolution and to allow ResolveSymbolContextForAddress to handle tail calls since this routine is common to unwind and disassembly. llvm-svn: 191102
* Fixed a logic error in Module::ResolveSymbolContextForAddress(). Asking an ↵Greg Clayton2013-09-181-2/+2
| | | | | | address if its offet is greater than zero doesn't actually correctly tell us wether the address is section offset or not. A symbol could be the first symbol in a section and its offset can be zero. Also, a non-section offset lldb_private::Address can have a NULL section and calling GetOffset() will return the absolute address. To really test if an address is section offset clients should use Address::IsSectionOffset(). Also simplified the code that backs the address up by one to use the Address::Slide() function. llvm-svn: 190955
* Fixes symbol resolution for a function with a tail call because the PCAshok Thirumurthi2013-09-161-11/+41
| | | | | | | | | | | | | | | for the frame is one past the address range of the calling function. - Lowers the fix from RegisterContextLLDB for use with disassembly - Fixes one of three issues in the disassembly test in TestInferiorAssert.py Also adds documentation that explains the resolution depths and interface. Note: This change affects the resolution scope for eSymbolContextFunction without impacting the performance of eSymbolContextSymbol. Thanks to Matt Kopec for his review. llvm-svn: 190812
* Added a 'jump' command, similar to GDBs.Richard Mitton2013-09-121-1/+23
| | | | | | | | | This allows the PC to be directly changed to a different line. It's similar to the example python script in examples/python/jump.py, except implemented as a builtin. Also this version will track the current function correctly even if the target line resolves to multiple addresses. (e.g. debugging a templated function) llvm-svn: 190572
* When adding a dSYM file, don't remove all sections for the Module's object ↵Greg Clayton2013-08-131-1/+3
| | | | | | file if the symbol vendor used the same object file. llvm-svn: 188289
* Fixed GetModuleSpecifications() to work better overall:Greg Clayton2013-07-121-12/+16
| | | | | | | | | | | - MachO files now correctly extract the UUID all the time - More file size and offset verification done for universal mach-o files to watch for truncated files - ObjectContainerBSDArchive now supports enumerating all objects in BSD archives (.a files) - lldb_private::Module() can not be properly constructed using a ModuleSpec for a .o file in a .a file - The BSD archive plug-in shares its cache for GetModuleSpecifications() and the create callback - Improved printing for ModuleSpec objects llvm-svn: 186211
* Cleanup on the unified section list changes. Main changes are:Greg Clayton2013-07-101-35/+37
| | | | | | | | | | | | | | | - 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
* Split symbol support for ELF and Linux.Michael Sartain2013-07-011-40/+72
| | | | llvm-svn: 185366
* Formatting cleanup.Jim Ingham2013-07-011-3/+10
| | | | llvm-svn: 185357
* Huge performance improvements when one breakpoint contains many locations.Greg Clayton2013-06-121-7/+42
| | | | | | | | | | 325,000 breakpoints for running "breakpoint set --func-regex ." on lldb itself (after hitting a breakpoint at main so that LLDB.framework is loaded) used to take up to an hour to set, now we are down under a minute. With warm file caches, we are at 40 seconds, and that is with setting 325,000 breakpoint through the GDB remote API. Linux and the native debuggers might be faster. I haven't timed what how much is debug info parsing and how much is the protocol traffic to/from GDB remote. That there were many performance issues. Most of them were due to storing breakpoints in the wrong data structures, or using the wrong iterators to traverse the lists, traversing the lists in inefficient ways, and not optimizing certain function name lookups/symbol merges correctly. Debugging after that is also now very efficient. There were issues with replacing the breakpoint opcodes in memory that was read, and those routines were also fixed. llvm-svn: 183820
* <rdar://problem/11109316>Enrico Granata2013-05-311-1/+1
| | | | | | | | | | | | | | | | | command script import now does reloads - for real If you invoke command script import foo and it detects that foo has already been imported, it will - invoke reload(foo) to reload the module in Python - re-invoke foo.__lldb_init_module This second step is necessary to ensure that LLDB does not keep cached copies of any formatter, command, ... that the module is providing Usual caveats with Python imports persist. Among these: - if you have objects lurking around, reloading the module won't magically update them to reflect changes - if module A imports module B, reloading A won't reload B These are Python-specific issues independent of LLDB that would require more extensive design work The --allow-reload (-r) option is maintained for compatibility with existing scripts, but is clearly documented as redundant - reloading is always enabled whether you use it or not llvm-svn: 182977
* <rdar://problem/13880690>Greg Clayton2013-05-221-0/+3
| | | | | | Lock the lldb_private::Module mutex while tearing down the module to make sure we don't get clients accessing the contents on a module as it is going away. llvm-svn: 182511
OpenPOWER on IntegriCloud