summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/POSIX/POSIXThread.cpp
Commit message (Collapse)AuthorAgeFilesLines
* First cut of PowerPC(64) support in LLDB.Justin Hibbits2014-10-311-0/+22
| | | | | | | | | | | | | | | | | | | | | | | 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
* Enable llgs to build against experimental Android AOSP ↵Todd Fiala2014-09-271-9/+8
| | | | | | | | | | | | lldb/llvm/clang/compiler-rt repos. See http://reviews.llvm.org/D5495 for more details. These are changes that are part of an effort to support building llgs, within the AOSP source tree, using the Android.mk build system, when using the llvm/clang/lldb git repos from AOSP replaced with the experimental ones currently in github.com/tfiala/aosp-{llvm,clang,lldb,compiler-rt}. llvm-svn: 218568
* Create a HostThread abstraction.Zachary Turner2014-09-091-1/+5
| | | | | | | | | | | | | This patch moves creates a thread abstraction that represents a thread running inside the LLDB process. This is a replacement for otherwise using lldb::thread_t, and provides a platform agnostic interface to managing these threads. Differential Revision: http://reviews.llvm.org/D5198 Reviewed by: Jim Ingham llvm-svn: 217460
* Linux ARM64: add ProcessMonitor-related RegisterContext support.Todd Fiala2014-09-021-0/+10
| | | | | | | | See http://reviews.llvm.org/D5089 for more details. Change by Paul Osmialowski. llvm-svn: 216907
* lldb - Register Context Linux ARM64Todd Fiala2014-08-291-0/+5
| | | | | | | | | | | | | Yet another step toward ARM64 support. With this commit, lldb-gdbserver started on ARM64 target can be accessed by lldb running on desktop PC and it can process simple commands (like 'continue'). Still ARM64 support lacks NativeRegisterContextLinux_arm64.* code which waits to be implemented. Based on similar files for Linux x86_64 and Darwin ARM64. Due to common code extraction from Darwin related files, lldb should be tested for any unexpected regression on Darwin ARM64 machines too. See the following for more details: http://reviews.llvm.org/D4580 http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140825/012670.html Change by Paul Osmialowski. llvm-svn: 216737
* Move Host::GetArchitecture to HostInfo::GetArchitecture.Zachary Turner2014-08-201-4/+6
| | | | | | | | As a side effect, this patch also eliminates all of the preprocessor conditionals previously used to implement GetArchitecture(). llvm-svn: 216074
* Address hung tests in Linux.Todd Fiala2014-04-181-1/+1
| | | | | | Follow-up patch coming to address test failures exposed by this change. llvm-svn: 206618
* Suppress SIGSTOP under Linux and don't explicitly call SetResumeSignal() in ↵Andrew MacPherson2014-03-211-5/+0
| | | | | | POSIXThread, instead just let StopInfo handle it. llvm-svn: 204504
* Fixed case typo.Greg Clayton2014-03-201-3/+3
| | | | llvm-svn: 204402
* Switch over to use the ArchSpec::GetMachine() instead of ArchSpec::GetCore() ↵Greg Clayton2014-03-201-29/+19
| | | | | | to keep the code more portable as we add new core types to ArchSpec. llvm-svn: 204400
* Simplify POSIXThread register context handlingEd Maste2014-02-281-30/+38
| | | | | | | | | | | This seems a little more straightforward and is equivalent to r201457 for ELF core files. A case for FreeBSD i386 is also added (it was incorrectly using the 64-bit register context and corrupting mememory). Better (user-facing) error handling is still needed. Review: http://llvm-reviews.chandlerc.com/D2765 llvm-svn: 202549
* Fix linux x86 debugging on a linux x86 host (32-bit on 32-bit).Todd Fiala2014-02-271-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes up issues with specifying the size of the i386 register infos for FPU registers. The bug was that for the i386 register context, the size of the FPU registers were still being computed based on the x86_64 FXSAVE structure. This change permits the FPR_SIZE macro to optionally be defined outside of RegisterInfos_i386.h, which RegisterContextLinux_i386.cpp does properly. It redefines the FPR_i386 structure with all the accessible parts that RegisterInfos_i386.h wants to see, which we had not done before when we made the overall size of the structure properly sized a recently. This change also modifies POSIXThread to create a RegisterContextLinux_i386 only when the host is 32-bit; otherwise, it uses the RegisterContextLinux_x86_64, which works properly for 32-bit and 64-bit inferiors on a 64-bit host. I tested this debugging a Linux x86 exe on an x86 host (Ubuntu 13.10 x86), and debugging a Linux x86 exe and a Linux x86-64 exe on an x86-64 host (Ubuntu 12.04 LTS). Those cases all worked. Thanks to Matthew Gardiner who discoverd may key insights into tracking down the issue. The motivation for this change and some of the code originates from him via this thread: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140224/010554.html llvm-svn: 202428
* FreeBSD hardware watchpoint implementationEd Maste2014-02-191-1/+25
| | | | | | | | | | | | | | | Implement x86_64 debug register read/write in support of hardware watchpoints. Hoist LinuxThread::TraceNotify code back into POSIXThread::TraceNotify() Patch by John Wolfe. We still need to rework this later to avoid the #ifdef FreeBSD. llvm-reviews.chandlerc.com/D2572 llvm.org/pr16706 llvm-svn: 201706
* Avoid undesired variable shadowingEd Maste2014-02-131-2/+0
| | | | | | | | Michael Sartain refactored RegisterContextPOSIX_* in r192332, and I must have missed the now-shadowed variable when I rebased the FreeBSD MIPS64 register context after that. llvm-svn: 201334
* Fix Linux by partially reverting 196787Ed Maste2013-12-111-0/+37
| | | | llvm-svn: 197065
* Threaded inferior support for FreeBSDEd Maste2013-12-091-37/+2
| | | | | | | Modelled in part on GDBRemoteCommunicationClient. Review: http://llvm-reviews.chandlerc.com/D2267 llvm-svn: 196787
* Added support for reading thread-local storage variables, as defined using ↵Richard Mitton2013-10-171-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Initial FreeBSD mips64 ProcessMonitor supportEd Maste2013-10-101-13/+54
| | | | | | | Committing early to ease tracking other ongoing POSIX changes. Review: http://llvm-reviews.chandlerc.com/D1886 llvm-svn: 192387
* Merge RegisterContextPOSIX_x86_64 and RegisterContextPOSIX_i386 into ↵Michael Sartain2013-10-101-58/+16
| | | | | | RegisterContextPOSIX_x86 llvm-svn: 192332
* Add exec support for Linux including common support for POSIX.Matt Kopec2013-10-091-0/+10
| | | | llvm-svn: 192319
* Clean up RegisterContextPOSIX i386 code.Michael Sartain2013-10-091-8/+29
| | | | | | | | | | | Use 32-bit register enums without gaps on 64-bit hosts. Don't show 64-bit registers when debugging 32-bit targets. Add psuedo gpr registers (ax, ah, al, etc.) Add mmx registers. Fix TestRegisters.py to not read ymm15 register on 32-bit targets. Fill out and move gcc/dwarf/gdb register enums to RegisterContext_x86.h llvm-svn: 192263
* Change posix thread so that it creates a breakpoint stop reason if the ↵Matt Kopec2013-09-201-18/+9
| | | | | | breakpoint isn't valid for the current thread but specify should stop to false. Also remove selecting a thread on a breakpoint hit. llvm-svn: 191110
* Clean up RegisterContextPOSIX. Renamed to POSIXBreakpointProtocol.Michael Sartain2013-09-141-14/+28
| | | | | | Will clean up header files and m_register_infos shortly. llvm-svn: 190757
* Cleanup POSIX RegisterContext class hierarchies.Michael Sartain2013-09-131-6/+6
| | | | llvm-svn: 190647
* Fix thread name updating in Linux. "thread list" should report correct names ↵Michael Sartain2013-07-311-17/+9
| | | | | | | | | | | always now. Created new LinuxThread class inherited from POSIXThread and removed linux / freebsd ifdefs Removed several un-needed set thread name calls CR (and multiple suggestions): mkopec llvm-svn: 187545
* Run-time reg context selection for POSIX targetsEd Maste2013-07-301-8/+12
| | | | | | | | | | | | Instantiate RegisterContext... based on getOS() instead of with compile-time #ifdef-ery. The assert() here is unfortunate, but better than crashing with no explanation. This change is equivalent to r186865 for elf-core. llvm-svn: 187422
* Handle BreakNotify for threads whose tid doesn't match the ThreadSpec of the ↵Ashok Thirumurthi2013-07-121-7/+27
| | | | | | | | | BreakpointSite to avoid asserts when stepping in a multi-threaded application. Note: Test to follow shortly. llvm-svn: 186190
* Add support for listing inferior thread names on Linux.Matt Kopec2013-07-101-1/+20
| | | | llvm-svn: 186033
* Use LLDB_INVALID_REGNUM at Mike Sartain's suggestionAndy Gibbs2013-06-191-1/+1
| | | | llvm-svn: 184342
* Fix two 'variable is used uninitialised' warnings. Change assert to ↵Andy Gibbs2013-06-191-2/+2
| | | | | | llvm_unreachable. llvm-svn: 184334
* Add assertion for when no watchpoint found in POSIX watchnotify handler.Matt Kopec2013-06-181-3/+3
| | | | | | Also, ensure x86_64 watchpoint registers are initialized before they are accessed on the POSIX side. llvm-svn: 184246
* Temporarily disable checking of watchpoint hit on FreeBSD on trace message.Matt Kopec2013-06-181-0/+2
| | | | | | Patch from Ed Maste. llvm-svn: 184241
* Add output of fault address on an address related crash (ie. segfault).Matt Kopec2013-06-101-3/+7
| | | | llvm-svn: 183701
* Fix setting of watchpoints on inferior thread creation for Linux.Matt Kopec2013-06-031-18/+43
| | | | llvm-svn: 183139
* Adding support for stopping all threads of multithreaded inferiors on Linux. ↵Andrew Kaylor2013-05-281-12/+40
| | | | | | Also adding multithreaded test cases. llvm-svn: 182809
* Fixed "log enable linux registers" and added a test.Ashok Thirumurthi2013-05-091-9/+9
| | | | | | | | | | - Eliminated the use of static for methods that read m_register_infos, so that these routines can be implemented in the base class. - Eliminated m_register_infos in the base class because this is not used when derived classes call UpdateRegisterInfo. - Also moved the namespace using declarations from headers to source files. Thanks to Daniel and Samuel for their review feedback. llvm-svn: 181538
* Fixed a build failure introduced by r181501.Ashok Thirumurthi2013-05-091-1/+1
| | | | | | Patch by Yao Qi. llvm-svn: 181511
* Changed the formerly pure virtual function:Greg Clayton2013-05-091-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | namespace lldb_private { class Thread { virtual lldb::StopInfoSP GetPrivateStopReason() = 0; }; } To not be virtual. The lldb_private::Thread now handles the correct caching and will call a new pure virtual function: namespace lldb_private { class Thread { virtual bool CalculateStopInfo() = 0; } } This function must be overridden by thead lldb_private::Thread subclass and the only thing it needs to do is to set the Thread::StopInfo() with the current stop reason and return true, or return false if there is no stop reason. The lldb_private::Thread class will take care of calling this function only when it is required. This allows lldb_private::Thread subclasses to be a bit simpler and not all need to duplicate the cache and invalidation settings. Also renamed: lldb::StopInfoSP lldb_private::Thread::GetPrivateStopReason(); To: lldb::StopInfoSP lldb_private::Thread::GetPrivateStopInfo(); Also cleaned up a case where the ThreadPlanStepOverBreakpoint might not re-set its breakpoint if the thread disappears (which was happening due to a bug when using the OperatingSystem plug-ins with memory threads and real threads). llvm-svn: 181501
* Attempt to fix failing watchpoints for debian os buildbot.Matt Kopec2013-05-081-0/+14
| | | | llvm-svn: 181447
* Add watchpoint support for Linux on 64-bit host.Matt Kopec2013-05-071-1/+96
| | | | llvm-svn: 181341
* Reinstating r181091 and r181106 with fix for Linux regressions.Andrew Kaylor2013-05-071-9/+8
| | | | llvm-svn: 181340
* Refactoring for struct UserArea:Ashok Thirumurthi2013-05-031-0/+2
| | | | | | | | | | | | | - Decouples RegisterContext_x86_64 from UserArea. - Restores the original definition of UserArea so that it can be used to generate offsets for use with ptrace. - Moves UserArea to the 64-bit Linux specialization. - Also fixes an off-by-one error for the size of m_gpr. - Also adds a TODO comment noting the need for a mechanism to identify the correct plugin based on the target OS (and architecture). Reviewed by: Matt Kopec and Samuel Jacob llvm-svn: 181055
* <rdar://problem/13700260>Greg Clayton2013-05-011-10/+3
| | | | | | | | | | | | | | <rdar://problem/13723772> Modified the lldb_private::Thread to work much better with the OperatingSystem plug-ins. Operating system plug-ins can now return have a "core" key/value pair in each thread dictionary for the OperatingSystemPython plug-ins which allows the core threads to be contained with memory threads. It also allows these memory threads to be stepped, resumed, and controlled just as if they were the actual backing threads themselves. A few things are introduced: - lldb_private::Thread now has a GetProtocolID() method which returns the thread protocol ID for a given thread. The protocol ID (Thread::GetProtocolID()) is usually the same as the thread id (Thread::GetID()), but it can differ when a memory thread has its own id, but is backed by an actual API thread. - Cleaned up the Thread::WillResume() code to do the mandatory parts in Thread::ShouldResume(), and let the thread subclasses override the Thread::WillResume() which is now just a notification. - Cleaned up ClearStackFrames() implementations so that fewer thread subclasses needed to override them - Changed the POSIXThread class a bit since it overrode Thread::WillResume(). It is doing the wrong thing by calling "Thread::SetResumeState()" on its own, this shouldn't be done by thread subclasses, but the current code might rely on it so I left it in with a TODO comment with an explanation. llvm-svn: 180886
* Platform-specific specialization for the GPR register file.Ashok Thirumurthi2013-05-011-1/+8
| | | | | | | | - Required for platform-independant handling of general purpose registers (i.e. for core dumps). Thanks to Samuel Jacob for this patch. llvm-svn: 180878
* More fallout unique_ptr changes for from ↵Greg Clayton2013-04-181-1/+1
| | | | | | http://lab.llvm.org:8011/builders/lldb-x86_64-linux/builds/3565. llvm-svn: 179815
* Fix the Linux build issues introduced by r178191.Ashok Thirumurthi2013-03-281-7/+7
| | | | | | | | | - All Linux logging channels now use a single global instance of lldb_private::Log, to handle the case of logging during process tear down. - Also removed a single use of LogSP in FreeBSD and fixed a typo in a comment while reading through ProcessKDPLog. Reviewed by Daniel Malea. llvm-svn: 178242
* Allow expression evaluation to work when multiple threads exist in the ↵Daniel Malea2013-02-131-0/+4
| | | | | | | | inferior (on Linux) - handle m_resume_state == eStateStopped || eStateSuspended in DoResume rather than asserting llvm-svn: 175094
* Add initial support to trace spawned threads in a process on Linux.Matt Kopec2013-01-081-0/+10
| | | | llvm-svn: 171864
* Fix TestSendSignals.py on Linux. The wrong stop reason was being set when ↵Matt Kopec2013-01-081-2/+1
| | | | | | stopping for a received signal. llvm-svn: 171819
* 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
OpenPOWER on IntegriCloud