summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/DynamicLoader
Commit message (Collapse)AuthorAgeFilesLines
...
* Reduce header footprint of Target.hZachary Turner2015-03-034-0/+4
| | | | | | | | | | | | This continues the effort to reduce header footprint and improve build speed by removing clang and other unnecessary headers from Target.h. In one case, some headers were included solely for the purpose of declaring a nested class in Target, which was not needed by anybody outside the class. In this case the definition and implementation of the nested class were isolated in the .cpp file so the header could be removed. llvm-svn: 231107
* Don't #include ClangASTContext.h from Module.hZachary Turner2015-03-031-0/+1
| | | | | | | | | | | | 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
* Silence unused variable warnings in release buildsPavel Labath2015-02-191-0/+1
| | | | llvm-svn: 229843
* Don't wait for the dynamic loader to set a module as a dynamic link editor, ↵Greg Clayton2015-02-051-3/+0
| | | | | | | | | | 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
* Use basename of main executable in POSIX-DYLD on Android.Stephane Sezer2015-02-032-6/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The Android dynamic linker reports only the basename of each SO entry, so for the above check to be successful, we need to compare it to the basename of the main executable. This also has a nasty side-effect when working with older version of Android (verified on platform version 16), and debugging PIE executables: the dynamic linker has a bug and reports the load address of the main executable (which is a shared object, because PIE) to be 0. We then try to update the list of loaded sections for all shared objects, including the main executable, and set the load address to 0, which breaks everything that relies on resolving addresses in the main executable (breakpoints, stepping, etc). This commit also fixes that broken behavior when debugging on older Androids. This bug doesn't happen on newer Android versions (verified for Android L). Test Plan: Run test suite on linux. Reviewers: clayborg, tfiala, richard.mitton Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7188 llvm-svn: 228057
* Make "process attach" command to support attaching to remote process in case ↵Oleksiy Vyalov2015-02-031-0/+3
| | | | | | | | if selected platform allows this. http://reviews.llvm.org/D7358 llvm-svn: 227899
* Make DynamicLoaderPOSIXDYLD::DidAttach to deduce a target executable by pid ↵Oleksiy Vyalov2015-01-072-5/+32
| | | | | | | | if no executable hasn't been assigned to a target so far. http://reviews.llvm.org/D6740 llvm-svn: 225332
* First cut of PowerPC(64) support in LLDB.Justin Hibbits2014-10-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: This adds preliminary support for PowerPC/PowerPC64, for FreeBSD. There are some issues still: * Breakpoints don't work well on powerpc64. * Shared libraries don't yet get loaded for a 32-bit process on powerpc64 host. * Backtraces don't work. This is due to PowerPC ABI using a backchain pointer in memory, instead of a dedicated frame pointer register for the backchain. * Breakpoints on functions without debug info may not work correctly for 32-bit powerpc. Reviewers: emaste, tfiala, jingham, clayborg Reviewed By: clayborg Subscribers: emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D5988 llvm-svn: 220944
* Most of this function checks to see if m_process is non-null beforeJason Molenda2014-10-161-6/+8
| | | | | | | | dereferencing it, except for this one section of code. Add a null check around it. clang static analyzer fix. llvm-svn: 219920
* Update assertion in DYLDRendezvous.Andrew MacPherson2014-10-101-1/+1
| | | | | | This accounts for the case where a dlopen() call fails when loading a library with a missing dependency. llvm-svn: 219520
* POSIX dynamic loader: add more logging around launch/attach, fix breakpoint ↵Todd Fiala2014-10-091-2/+37
| | | | | | | | | | | | | | | | | | | | | handling on entry callback. This change adds some logging around dynamic loader handling. It also fixes an issue where the dynamic loader entry breakpoint can end up being re-inserted, showing the wrong (i.e. software breakpoint) instruction at the stop location when a backtrace is displayed at program startup. I discussed with Jim Ingham a few weeks back. Essentially the one-hit breakpoints need to make it back to public state handling before the software breakpoint gets cleared. The flow I was hitting was that the breakpoint would get set, it would get hit, it would get cleared to step over, then it would get reapplied, when we never wanted it reapplied. Stops at the beginning of execution would then show backtraces with software breakpoint instructions in it, erroneously. This change fixes it. There might be a more elegant way to do this, or a flow change somewhere else to avoid, but it does fix an issue I experienced in startup breakpoint handling. llvm-svn: 219371
* Add another address to check for the kernel's load addr in debug configs.Jason Molenda2014-10-061-8/+11
| | | | | | <rdar://problem/18560328> llvm-svn: 219152
* We had to squirrel away the dyld module before doing ↵Jim Ingham2014-09-191-1/+7
| | | | | | | | | | | | ResolveExecutableModule, since that would clear the module list, and then put it back by hand. But we forgot to also put its sections back in the target SectionList, so we would jettison it as unloaded when we finished handling the first real load event. Add its sections. <rdar://problem/18385947> llvm-svn: 218156
* Test suite runs better again after recent fixes that would select a platform ↵Greg Clayton2014-09-191-1/+2
| | | | | | | | | | | | | if a "file a.out" auto selected a different platform than the selected one. Changes include: - fix it so you can select the "host" platform using "platform select host" - change all callbacks that create platforms to returns shared pointers - fix TestImageListMultiArchitecture.py to restore the "host" platform by running "platform select host" - Add a new "PlatformSP Platform::Find(const ConstString &name)" method to get a cached platform - cache platforms that are created and re-use them instead of always creating a new one llvm-svn: 218145
* Added logging of the POSIX-DYLD rendezvous address (i.e. the info_location ↵Todd Fiala2014-09-051-1/+11
| | | | | | address) llvm-svn: 217287
* Add more logging to DynamicLoaderPOSIXDYLD, especially around rendezvous ↵Todd Fiala2014-09-051-15/+78
| | | | | | | | | handling. Covers more of the behavior of rendezvous breakpoint handling and other dynamic loader aspects, all on the 'enable log lldb dyld' log channel. llvm-svn: 217283
* Properly handle the DYLD attach step for GDB remotes.Todd Fiala2014-09-051-1/+20
| | | | | | Change by Stephane Sezer. llvm-svn: 217253
* Use the process' ReadCStringFromMemory from ↵Todd Fiala2014-09-041-13/+1
| | | | | | | | | | | | | | | DYLDRendezvous::ReadStringFromMemory. Tested: Ubuntu 14.04 x86_64, clang-3.5-built lldb. MacOSX 10.9.4, Xcode6-Beta7-built lldb. Visual packet inspection on lldb <-> llgs shows significant reduction in overly-verbose memory read traffic on start-up when scanning shared library info. Change by Stephane Sezer. llvm-svn: 217153
* When doing an exhaustive search for the kernel in memory, also lookJason Molenda2014-07-311-0/+4
| | | | | | | at 16k offsets. <rdar://problem/17861781> llvm-svn: 214387
* 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
* Fix the warnings introducedDeepak Panickal2014-07-221-4/+2
| | | | llvm-svn: 213643
* Dynamic loader for the Hexagon DSPDeepak Panickal2014-07-217-0/+1614
| | | | llvm-svn: 213565
* Cleanup the iOS simulator code.Greg Clayton2014-07-101-1/+1
| | | | | | | | | | | Fixes include: - Don't say that "<arch>-apple-ios" is compatible with "<arch>-apple-macosx" - Fixed DynamicLoaderMacOSXDYLD so specify an architecture that was converted solely from a cputype and subtype, just specify the file + UUID. - Fixed PlatformiOSSimulator::GetSupportedArchitectureAtIndex() so it returns the correct archs - Fixed SymbolFileDWARFDebugMap to load .o files correctly by just specifying the architecture without the vendor and OS now that "<arch>-apple-ios" is not compatible with "<arch>-apple-macosx" so we can load .o files correctly for DWARF with debug map - Fixed the coded in TargetList::CreateTarget() so it does the right thing with an underspecified triple where just the arch is specified. llvm-svn: 212783
* Fix typos.Bruce Mitchener2014-07-083-4/+4
| | | | llvm-svn: 212553
* Fix typos.Bruce Mitchener2014-07-011-3/+3
| | | | llvm-svn: 212132
* Add lldb-gdbserver support for Linux x86_64.Todd Fiala2014-06-302-6/+63
| | | | | | | | | | | | | | | | | | | | | This change brings in lldb-gdbserver (llgs) specifically for Linux x86_64. (More architectures coming soon). Not every debugserver option is covered yet. Currently the lldb-gdbserver command line can start unattached, start attached to a pid (process-name attach not supported yet), or accept lldb attaching and launching a process or connecting by process id. The history of this large change can be found here: https://github.com/tfiala/lldb/tree/dev-tfiala-native-protocol-linux-x86_64 Until mid/late April, I was not sharing the work and continued to rebase it off of head (developed via id tfiala@google.com). I switched over to user todd.fiala@gmail.com in the middle, and once I went to github, I did merges rather than rebasing so I could share with others. llvm-svn: 212069
* Add some basic sanity checks to ↵Jason Molenda2014-04-151-0/+24
| | | | | | | | | | DynamicLoaderDarwinKernel::ReadKextSummaryHeader() when it is reading the kext table, in case we're reading out of a core file with corrupt contents in this region. <rdar://problem/16601915> llvm-svn: 206233
* Workaround for collision between enum members in LLVM's MachO.h and system ↵Jim Ingham2014-04-025-6/+6
| | | | | | | | | | headers on Mac OS X (in particular mach/machine.h). <rdar://problem/16494607> llvm-svn: 205480
* Don’t include “llvm/Support/MachO.h” as it isn’t needed here.Greg Clayton2014-04-021-2/+0
| | | | llvm-svn: 205461
* Don’t #include “llvm/Support/MachO.h” in a header file if we can avoid ↵Greg Clayton2014-04-022-2/+2
| | | | | | it. llvm-svn: 205460
* sanitise sign comparisonsSaleem Abdulrasool2014-04-021-2/+2
| | | | | | | | This is a mechanical change addressing the various sign comparison warnings that are identified by both clang and gcc. This helps cleanup some of the warning spew that occurs during builds. llvm-svn: 205390
* lldb arm64 import.Jason Molenda2014-03-291-1/+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
* Small fix to ↵Jason Molenda2014-03-051-1/+1
| | | | | | | | DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule needed with Greg's change to how we load modules in r202890. llvm-svn: 202933
* Fix minor build warning on Mac OS X x86_64.Jason Molenda2014-02-141-1/+1
| | | | llvm-svn: 201387
* Revert r201292 which relaxed the stack frame alignment requirements.Jason Molenda2014-02-131-1/+1
| | | | | | | | | This was primarily working around problems where we weren't able to identify trap handlers for different environments -- but instead, I'm working to make it easier to specify those trap handler function names. llvm-svn: 201366
* Change the ABI CallFrameAddressIsValid methods for i386 and x86_64.Jason Molenda2014-02-131-1/+1
| | | | | | | | | | | | | | | | | | They were enforcing 16-byte alignment on stack frames for Darwin x86 programs. But we've found that trap handlers typically don't have the stack pointer aligned correctly when a trap happens and lldb wasn't backtracing all the way through. This method is only used as a safety guard to prevent lldb's unwinder from using a bogus address as a stack frame - we'll still enforce word-size alignment on stack frames so that should be fine. Also rolled back akaylor's changes from August 2013 in r188952 which changed the i386 ABI plugin to relax the CallFrameAddressIsValid offsets for non-Darwin targets where only 4-byte alignment is enforced. Now Darwin is the same as those environments. <rdar://problem/15982682> llvm-svn: 201292
* Modified ObjectFile::SetLoadAddress() to now be:Greg Clayton2014-02-071-1/+1
| | | | | | | | | | | | | | 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-062-145/+10
| | | | | | | | | | | | | | | 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
* Merging the iohandler branch back into main. Greg Clayton2014-01-271-6/+7
| | | | | | | | | | | | The many many benefits include: 1 - Input/Output/Error streams are now handled as real streams not a push style input 2 - auto completion in python embedded interpreter 3 - multi-line input for "script" and "expression" commands now allow you to edit previous/next lines using up and down arrow keys and this makes multi-line input actually a viable thing to use 4 - it is now possible to use curses to drive LLDB (please try the "gui" command) We will need to deal with and fix any buildbot failures and tests and arise now that input/output and error are correctly hooked up in all cases. llvm-svn: 200263
* Sometimes the trampoline refers directly to the indirect symbol. Handle ↵Jim Ingham2014-01-111-0/+23
| | | | | | that too. llvm-svn: 198990
* Get the breakpoint setting, and the Mac OS X DYLD trampolines and expression ↵Jim Ingham2014-01-101-77/+88
| | | | | | | | | | | | | | | | | | | | | | | | evaluator to handle Indirect symbols correctly. There were a couple of pieces to this. 1) When a breakpoint location finds itself pointing to an Indirect symbol, when the site for it is created it needs to resolve the symbol and actually set the site at its target. 2) Not all breakpoints want to do this (i.e. a straight address breakpoint should always set itself on the specified address, so somem machinery was needed to specify that. 3) I added some info to the break list output for indirect symbols so you could see what was happening. Also I made it clear when we re-route through re-exported symbols. 4) I moved ResolveIndirectFunction from ProcessPosix to Process since it works the exact same way on Mac OS X and the other posix systems. If we find a platform that doesn't do it this way, they can override the call in Process. 5) Fixed one bug in RunThreadPlan, if you were trying to run a thread plan after a "running" event had been broadcast, the event coalescing would cause you to miss the ThreadPlan running event. So I added a way to override the coalescing. 6) Made DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan handle Indirect & Re-exported symbols. <rdar://problem/15280639> llvm-svn: 198976
* Fixed an issue when attaching to a process without specifying a file where ↵Greg Clayton2014-01-071-1/+11
| | | | | | | | we wouldn't set the dyld gdb image notifier breakpoint correctly. <rdar://problem/15720040> llvm-svn: 198717
* For logical backtrace work, lldb needs to track Module unloads etc & ↵Greg Clayton2013-12-064-19/+10
| | | | | | | | | | 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
* <rdar://problem/15367122>Greg Clayton2013-11-052-2/+2
| | | | | | | | Fixed the test case for "test/functionalities/exec/TestExec.py" on Darwin. The issue was breakpoints were persisting and causing problems. When we exec, we need to clear out the process and target and start fresh with nothing and let the breakpoints populate themselves again. This patch correctly clears out the breakpoints and also flushes the process so that the objects (process/thread/frame) give out valid information. llvm-svn: 194106
* Roll back the changes I made in r193907 which created a new FrameJason Molenda2013-11-043-5/+5
| | | | | | | | | | pure virtual base class and made StackFrame a subclass of that. As I started to build on top of that arrangement today, I found that it wasn't working out like I intended. Instead I'll try sticking with the single StackFrame class -- there's too much code duplication to make a more complicated class hierarchy sensible I think. llvm-svn: 193983
* Add a new base class, Frame. It is a pure virtual function whichJason Molenda2013-11-023-5/+5
| | | | | | | | | | | | | | | | | | | | | defines a protocol that all subclasses will implement. StackFrame is currently the only subclass and the methods that Frame vends are nearly identical to StackFrame's old methods. Update all callers to use Frame*/Frame& instead of pointers to StackFrames. This is almost entirely a mechanical change that touches a lot of the code base so I'm committing it alone. No new functionality is added with this patch, no new subclasses of Frame exist yet. I'll probably need to tweak some of the separation, possibly moving some of StackFrame's methods up in to Frame, but this is a good starting point. <rdar://problem/15314068> llvm-svn: 193907
* Fixes to get LLDB building on Windows again.Deepak Panickal2013-10-222-4/+4
| | | | llvm-svn: 193159
* Fix build failure on FreeBSD/clang by using auto iterator typeEd Maste2013-10-181-1/+1
| | | | llvm-svn: 192999
* Added support for reading thread-local storage variables, as defined using ↵Richard Mitton2013-10-174-11/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | the __thread modifier. To make this work this patch extends LLDB to: - Explicitly track the link_map address for each module. This is effectively the module handle, not sure why it wasn't already being stored off anywhere. As an extension later, it would be nice if someone were to add support for printing this as part of the modules list. - Allow reading the per-thread data pointer via ptrace. I have added support for Linux here. I'll be happy to add support for FreeBSD once this is reviewed. OS X does not appear to have __thread variables, so maybe we don't need it there. Windows support should eventually be workable along the same lines. - Make DWARF expressions track which module they originated from. - Add support for the DW_OP_GNU_push_tls_address DWARF opcode, as generated by gcc and recent versions of clang. Earlier versions of clang (such as 3.2, which is default on Ubuntu right now) do not generate TLS debug info correctly so can not be supported here. - Understand the format of the pthread DTV block. This is where it gets tricky. We have three basic options here: 1) Call "dlinfo" or "__tls_get_addr" on the inferior and ask it directly. However this won't work on core dumps, and generally speaking it's not a good idea for the debugger to call functions itself, as it has the potential to not work depending on the state of the target. 2) Use libthread_db. This is what GDB does. However this option requires having a version of libthread_db on the host cross-compiled for each potential target. This places a large burden on the user, and would make it very hard to cross-debug from Windows to Linux, for example. Trying to build a library intended exclusively for one OS on a different one is not pleasant. GDB sidesteps the problem and asks the user to figure it out. 3) Parse the DTV structure ourselves. On initial inspection this seems to be a bad option, as the DTV structure (the format used by the runtime to manage TLS data) is not in fact a kernel data structure, it is implemented entirely in useerland in libc. Therefore the layout of it's fields are version and OS dependent, and are not standardized. However, it turns out not to be such a problem. All OSes use basically the same algorithm (a per-module lookup table) as detailed in Ulrich Drepper's TLS ELF ABI document, so we can easily write code to decode it ourselves. The only question therefore is the exact field layouts required. Happily, the implementors of libpthread expose the structure of the DTV via metadata exported as symbols from the .so itself, designed exactly for this kind of thing. So this patch simply reads that metadata in, and re-implements libthread_db's algorithm itself. We thereby get cross-platform TLS lookup without either requiring third-party libraries, while still being independent of the version of libpthread being used. Test case included. llvm-svn: 192922
* <rdar://problem/13635174>Greg Clayton2013-10-113-4/+6
| | | | | | | | Added a way to set hardware breakpoints from the "breakpoint set" command with the new "--hardware" option. Hardware breakpoints are not a request, they currently are a requirement. So when breakpoints are specified as hardware breakpoints, they might fail to be set when they are able to be resolved and should be used sparingly. This is currently hooked up for GDB remote debugging. Linux and FreeBSD should quickly enable this feature if possible, or return an error for any breakpoints that are hardware breakpoint sites in the "virtual Error Process::EnableBreakpointSite (BreakpointSite *bp_site);" function. llvm-svn: 192491
OpenPOWER on IntegriCloud