summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Module.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Only get the script interpreter if we find scripting resources in the symbol ↵Greg Clayton2013-03-231-13/+13
| | | | | | file. This helps us avoid initializing python when it isn't needed. llvm-svn: 177793
* Add GNU indirect function support in expressions for Linux.Matt Kopec2013-02-271-4/+10
| | | | llvm-svn: 176206
* <rdar://problem/13265297> Greg Clayton2013-02-231-2/+2
| | | | | | StackFrame assumes m_sc is additive, but m_sc can lose its target. So now the SymbolContext::Clear() method takes a bool that indicates if the target should be cleared. Modified all existing code to properly set the bool argument. llvm-svn: 175953
* <rdar://problem/13159777> Greg Clayton2013-02-061-3/+5
| | | | | | | | | | | | | | 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-44/+39
| | | | | | | | | | | | 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
* <rdar://problem/12973809> Greg Clayton2013-01-111-18/+34
| | | | | | | | | | | | | Fixed an issue with the auto loading of script resources in debug info files. Any platform can add support for this, and on MacOSX we allow dSYM files to contain python modules that get automatically loaded when a dSYM file is associated with an executable or shared library. The modifications will now: - Let the module locate the symbol file naturally instead of using a function that only works in certain cases. This helps us to locate the script resources as long as the dSYM file can be found. - Don't try and do any of this if the script interpreter has scripting disabled. - Allow more than one scripting resource to be found in a symbol file by returning the list - Load the scripting resources when a symbol file is added via the "target symbols add" command. - Be smarter about matching the dSYM mach-o file to an existing executable in the target images by stripping extensions on the symfile basname if needed. llvm-svn: 172275
* <rdar://problem/12953853>Greg Clayton2013-01-081-0/+19
| | | | | | | | | | 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. llvm-svn: 171816
* Cleaned up the UUID mismatch just printing itself whenever it wants to by ↵Greg Clayton2012-12-141-2/+2
| | | | | | allowing an optional feedback stream to be passed along when getting the symbol vendor. llvm-svn: 170174
* Removed the == and != operators from ArchSpec, sinceSean Callanan2012-12-131-2/+2
| | | | | | | | | | | | equality can be strict or loose and we want code to explicitly choose one or the other. Also renamed the Compare function to IsEqualTo, to avoid confusion. <rdar://problem/12856749> llvm-svn: 170152
* Separate initing the stdout/stderr for running the Python Script interpreter ↵Jim Ingham2012-12-071-1/+3
| | | | | | | | | | from initing the lldb.target/frame/etc globals, and only do the latter when it makes sense to. <rdar://problem/12554049> llvm-svn: 169614
* <rdar://problem/12749733>Greg Clayton2012-12-051-0/+13
| | | | | | Always allows getting builtin types by name even if there is no backing debug information. llvm-svn: 169424
* Fix Linux build warnings due to redefinition of macros:Daniel Malea2012-12-051-0/+2
| | | | | | | | | - add new header lldb-python.h to be included before other system headers - short term fix (eventually python dependencies must be cleaned up) Patch by Matt Kopec! llvm-svn: 169341
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-3/+3
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* <rdar://problem/12586350>Enrico Granata2012-11-081-1/+46
| | | | | | | | | | | | | | This commit does three things: (a) introduces a new notification model for adding/removing/changing modules to a ModuleList, and applies it to the Target's ModuleList, so that we make sure to always trigger the right set of actions whenever modules come and go in a target. Certain spots in the code still need to "manually" notify the Target for several reasons, so this is a work in progress (b) adds a new capability to the Platforms: locating a scripting resources associated to a module. A scripting resource is a Python file that can load commands, formatters, ... and any other action of interest corresponding to the loading of a module. At the moment, this is only implemented on Mac OS X and only for files inside .dSYM bundles - the next step is going to be letting the frameworks themselves hold their scripting resources. Implementors of platforms for other systems are free to implement "the right thing" for their own worlds (c) hooking up items (a) and (b) so that targets auto-load the scripting resources as the corresponding modules get loaded in a target. This has a few caveats at the moment: - the user needs to manually add the .py file to the dSYM (soon, it will also work in the framework itself) - if two modules with the same name show up during the lifetime of an LLDB session, the second one won't be able to load its scripting resource, but will otherwise work just fine llvm-svn: 167569
* <rdar://problem/12473003> Greg Clayton2012-10-221-3/+15
| | | | | | | | Allow type searches to specify a type keyword when searching for type. Currently supported type keywords are: struct, class, union, enum, and typedef. So now you can search for types with a string like "struct foo". llvm-svn: 166420
* llvm needs the OS to be set to either iOS or Mac OS XJason Molenda2012-10-161-0/+16
| | | | | | | | to work properly; when doing bare-boards rom debugging force the OS to be one of those when initializing llvm. <rdar://problem/12504138> llvm-svn: 166057
* Added a new "module" log channel which covers module creation, deletion, and ↵Greg Clayton2012-10-081-6/+6
| | | | | | | | | | common module list actions. Also added a new option for "log enable" which is "--stack" which will print out a stack backtrace for each log line. This was used to track down the leaking module issue I fixed last week. llvm-svn: 165438
* <rdar://problem/11791234>Greg Clayton2012-10-021-1/+1
| | | | | | | | | Shared libraries on MacOSX were not properly being removed from the shared module list when re-running a debug session due to an error in: Module::MatchesModuleSpec() llvm-svn: 164991
* Stop using the "%z" size_t modifier and cast all size_t values to uint64_t. ↵Greg Clayton2012-09-181-1/+1
| | | | | | Some platforms don't support this modification. llvm-svn: 164148
* <rdar://problem/11485744> Implement important data formatters in C++. Have ↵Enrico Granata2012-09-041-0/+14
| | | | | | the Objective-C language runtime plugin expose class descriptors objects akin to the objc_runtime.py Pythonic implementation. Rewrite the data formatters for some core Cocoa classes in C++ instead of Python. llvm-svn: 163155
* <rdar://problem/11757916>Greg Clayton2012-08-291-0/+3
| | | | | | | | | | | | Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes: - Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file". - modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly - Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was. - modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile() Cleaned up header includes a bit as well. llvm-svn: 162860
* <rdar://problem/11740973>Greg Clayton2012-07-121-41/+35
| | | | | | Fixed issues that could happen when the UUID doesn't change in a binary and old stale debug info could end up being used. llvm-svn: 160145
* <rdar://problem/11357711>Greg Clayton2012-07-071-3/+3
| | | | | | Fixed a crasher where the section load list was not thread safe. llvm-svn: 159884
* <rdar://problem/11819635>Greg Clayton2012-07-061-4/+0
| | | | llvm-svn: 159844
* Added the ability to log a message with a backtrace when verbose logging is ↵Greg Clayton2012-04-231-0/+18
| | | | | | enabled to the Module class. Used this new function in the DWARF parser. llvm-svn: 155404
* <rdar://problem/11282938>Greg Clayton2012-04-231-2/+5
| | | | | | Fixed an issue where we get NULL compile units back from the symbol vendor. We need symbol vendors to be able to quickly give an estimate of the compile units that they have without having to fully vette them first, so anyone getting compile units from a module should be able to deal with a NULL compile unit being returned for a given index. llvm-svn: 155398
* Don't put the address of the module in the module basename as this hoses up ↵Greg Clayton2012-04-201-6/+5
| | | | | | our ability to find shared libraries by name. We now put it into the Module object name. llvm-svn: 155223
* <rdar://problem/11202426> Greg Clayton2012-04-091-1/+2
| | | | | | Work around a deadlocking issue where "SBDebugger::MemoryPressureDetected ()" is being called and is causing a deadlock. We now just try and get the lock when trying to trim down the unique modules so we don't deadlock debugger GUI programs until we can find the root cause. llvm-svn: 154339
* lldb_private::Section objects have a boolean flag that can be set that Greg Clayton2012-03-271-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* <rdar://problem/11113279>Greg Clayton2012-03-261-32/+50
| | | | | | | | | | Fixed type lookups to "do the right thing". Prior to this fix, looking up a type using "foo::bar" would result in a type list that contains all types that had "bar" as a basename unless the symbol file was able to match fully qualified names (which our DWARF parser does not). This fix will allow type matches to be made based on the basename and then have the types that don't match filtered out. Types by name can be fully qualified, or partially qualified with the new "bool exact_match" parameter to the Module::FindTypes() method. This fixes some issue that we discovered with dynamic type resolution as well as improves the overall type lookups in LLDB. llvm-svn: 153482
* <rdar://problem/11072382>Greg Clayton2012-03-191-0/+7
| | | | | | | | | | Fixed a case where the source path remappings on the module were too expensive to use when we try to verify (stat the file system) that the remapped path points to a valid file. Now we will use the lldb_private::Module path remappings (if any) when parsing the debug info without verifying that the paths exist so we don't slow down line table parsing speeds. llvm-svn: 153059
* <rdar://problem/8196933>Greg Clayton2012-03-151-0/+9
| | | | | | Use the metadata in the dSYM bundle Info.plist to remap source paths when they keys are available. llvm-svn: 152836
* Made a ModuleSpec class in Module.h which can specify a module using one orGreg Clayton2012-02-261-0/+83
| | | | | | | | | | | | | | | | | | more of the local path, platform path, associated symbol file, UUID, arch, object name and object offset. This allows many of the calls that were GetSharedModule to reduce the number of arguments that were used in a call to these functions. It also allows a module to be created with a ModuleSpec which allows many things to be specified prior to any accessors being called on the Module class itself. I was running into problems when adding support for "target symbol add" where you can specify a stand alone debug info file after debugging has started where I needed to specify the associated symbol file path and if I waited until after construction, the wrong symbol file had already been located. By using the ModuleSpec it allows us to construct a module with as little or as much information as needed and not have to change the parameter list. llvm-svn: 151476
* Fixed a crasher that was happening after making ObjectFile objects have aGreg Clayton2012-02-241-57/+53
| | | | | | | | | weak reference back to the Module. We were crashing when trying to make a memory object file since it was trying to get the object in the Module constructor before the "Module *" had been put into a shared pointer, and the module was trying to initialize a weak pointer back to it. llvm-svn: 151397
* <rdar://problem/10103468>Greg Clayton2012-02-241-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Extended function lookup to allow the user toSean Callanan2012-02-101-4/+6
| | | | | | | | | indicate whether inline functions are desired. This allows the expression parser, for instance, to filter out inlined functions when looking for functions it can call. llvm-svn: 150279
* <rdar://problem/10560053>Greg Clayton2012-02-051-0/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Switching back to using std::tr1::shared_ptr. We originally switched awayGreg Clayton2012-01-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | due to RTTI worries since llvm and clang don't use RTTI, but I was able to switch back with no issues as far as I can tell. Once the RTTI issue wasn't an issue, we were looking for a way to properly track weak pointers to objects to solve some of the threading issues we have been running into which naturally led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared pointer from just a pointer, which is also easily solved using the std::tr1::enable_shared_from_this class. The main reason for this move back is so we can start properly having weak references to objects. Currently a lldb_private::Thread class has a refrence to its parent lldb_private::Process. This doesn't work well when we now hand out a SBThread object that contains a shared pointer to a lldb_private::Thread as this SBThread can be held onto by external clients and if they end up using one of these objects we can easily crash. So the next task is to start adopting std::tr1::weak_ptr where ever it makes sense which we can do with lldb_private::Debugger, lldb_private::Target, lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and many more objects now that they are no longer using intrusive ref counted pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive pointers). llvm-svn: 149207
* Added a ModuleList::Destroy() method which will reclaim the std::vectorGreg Clayton2012-01-271-0/+34
| | | | | | | | | | memory by doing a swap. Also added a few utilty functions that can be enabled for debugging issues with modules staying around too long when external clients still have references to them. llvm-svn: 149138
* Fixed an issue that could happen during global object destruction in ourGreg Clayton2012-01-271-3/+10
| | | | | | | map that tracks all live Module classes. We must leak our mutex for our collection class as it might be destroyed in an order we can't control. llvm-svn: 149131
* Let the Module FindType do the stripping of namespace components, that's not ↵Jim Ingham2012-01-121-2/+7
| | | | | | | | | | expensive and doing it both at the ModuleList and Module levels means we look 4 times for a negative search. Also, don't do the search for the stripped name if that is the same as the original one. llvm-svn: 148054
* Big change in the way ObjectFile file contents are managed. We nowGreg Clayton2012-01-121-1/+2
| | | | | | | | | | 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
* Fixed a missing space when reporting errors and warning through the moduleGreg Clayton2012-01-111-3/+4
| | | | | | and also print out the full path and architecture. llvm-svn: 147908
* Added code in the Host layer that can report system log messagesGreg Clayton2012-01-051-17/+94
| | | | | | | | | | | | 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
* http://llvm.org/bugs/show_bug.cgi?id=11560 lldb::SBTarget::FindFirstType ↵Johnny Chen2011-12-141-0/+3
| | | | | | | | crashes when passed None Add null checks to several functions. Plus add test scenario for passing None to SBTarget.FindFirstType(None) and friends. llvm-svn: 146540
* CommandObjectProcess was recently changed to automatically use the platformGreg Clayton2011-11-281-6/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* We can't have the global vector of modules be a static object, or it might ↵Jim Ingham2011-10-311-2/+11
| | | | | | | | get destroyed before all the modules, which will then crash when the next modules tries to take itself off it. llvm-svn: 143402
* Removed namespace qualification from symbol queries.Sean Callanan2011-10-131-1/+1
| | | | llvm-svn: 141866
* Completed the glue that passes a ClangNamespaceDecl *Sean Callanan2011-10-131-6/+6
| | | | | | | | down through Module and SymbolVendor into SymbolFile. Added checks to SymbolFileDWARF that restrict symbol searches when a namespace is passed in. llvm-svn: 141847
* Added ClangNamespaceDecl * parameters to severalSean Callanan2011-10-121-4/+5
| | | | | | | core Module functions that the expression parser will soon be using. llvm-svn: 141766
OpenPOWER on IntegriCloud