summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
Commit message (Collapse)AuthorAgeFilesLines
* Fix race in IOHandlerProcessSTDIOPavel Labath2015-05-281-74/+55
| | | | | | | | | | | | | | | | | | Summary: IOHandlerProcessSTDIO::Run() was opening the pipe for interrupt requests lazily. This was racing with another thread executing IOHandlerProcessSTDIO::Cancel() simultaneously. I fix this by opening the pipe in the object constructor. The pipe will be automatically closed when the object is destroyed. Test Plan: Tests pass on linux. Reviewers: clayborg, ribrdb Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D10060 llvm-svn: 238423
* I finally found the strong reference that was keeping all ↵Greg Clayton2015-05-281-0/+7
| | | | | | | | | | | | lldb_private::Process instances from ever destroying themselves: ProcessModID.m_mod_id was holding onto the last stop event with ProcessModID::SetStopEventForLastNaturalStopID(EventSP). This is a bad idea because ProcessEventData contains a strong refereence to the process. This is now fixed by calling ProcessModID::SetStopEventForLastNaturalStopID(EventSP()) to clear this event in Process::SetExitStatus() and in Process::Finalize(). This was the original cause of the file descriptor leaks that would cause the test suite to die after running a few hundred processes since no process would ever get destroyed and the communication channel in ProcessGDBRemote and the ProcessIOHandler would never close their pipes. This process leak was previously worked around by closing the pipes when the communication channel was disconnected. This was found by using "ptr_refs" from the heap.py in the lldb.macosx.heap module. It was able to find all strong references to the Process and helped me to figure out who was holding this extra reference. llvm-svn: 238392
* Improve LLDB prompt handlingPavel Labath2015-05-271-51/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: There is an issue in lldb where the command prompt can appear at the wrong time. The partial fix we have in for this is not working all the time and is introducing unnecessary delays. This change does: - Change Process:SyncIOHandler to use integer start id's for synchronization to avoid it being confused by quick start-stop cycles. I picked this up from a suggested patch by Greg to lldb-dev. - coordinates printing of asynchronous text with the iohandlers. This is also based on a (different) Greg's patch, but I have added stronger synchronization to it to avoid races. Together, these changes solve the prompt problem for me on linux (both with and without libedit). I think they should behave similarly on Mac and FreeBSD and I think they will not make matters worse for windows. Test Plan: Prompt comes out alright. All tests still pass on linux. Reviewers: clayborg, emaste, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9823 llvm-svn: 238313
* Did some cleanup to stop us from leaking Pipe file descriptors.Greg Clayton2015-05-232-1/+30
| | | | | | | | | | The main issue was the Communication::Disconnect() was calling its Connection::Disconnect() but this wouldn't release the pipes that the ConnectionFileDescriptor was using. We also have someone that is holding a strong reference to the Process so that when you re-run, target replaces its m_process_sp, but it doesn't get destructed because someone has a strong reference to it. I need to track that down. But, even if we have a strong reference to the a process that is outstanding, we need to call Process::Finalize() to have it release as much of its resources as possible to avoid memory bloat. Removed the ProcessGDBRemote::SetExitStatus() override and replaced it with ProcessGDBRemote::DidExit(). Now we aren't leaking file descriptors and the stand alone test suite should run much better. llvm-svn: 238089
* Implement attach to process on Windows.Zachary Turner2015-05-201-1/+5
| | | | | | | Differential Revision: http://reviews.llvm.org/D9801 Reviewed by: Adrian McCarthy llvm-svn: 237817
* Fix handling of hijacked events in synchronous modeIlia K2015-05-202-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch includes the following changes: * Fix Target::Launch to handle hijacked event in synchronous mode * Improve MiStartupOptionsTestCase tests to expect *stopped (MI) * Add SBProcess::GetStopEventForStopID * Add ProcessModID::SetStopEventForLastNaturalStopID/GetStopEventForStopID * Add const qualifier to ProcessModID::GetLastNaturalStopID * Add SBProcess::GetStopEventForStopID * Don't broadcast hijacked event in Target::Launch * Add CMICmnLLDBDebugger::CheckIfNeedToRebroadcastStopEvent/RebroadcastStopEvent Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/startup_options/ Reviewers: zturner, jingham, clayborg, abidh Reviewed By: clayborg Subscribers: abidh, zturner, lldb-commits, clayborg, jingham Differential Revision: http://reviews.llvm.org/D9371 llvm-svn: 237781
* Enable debugging of multithreaded programs on Windows.Adrian McCarthy2015-05-181-2/+2
| | | | llvm-svn: 237637
* Add --move-to-nearest-code / target.move-to-nearest-code options (attempt 2)Ilia K2015-05-181-4/+20
| | | | | | | | | | | | This patch initially was committed in r237460 but later it was reverted (r237479) due to 4 new failures: * TestExitDuringStep.py * TestNumThreads.py * TestThreadExit.py * TestThreadStates.py This patch also fixes these tests. llvm-svn: 237566
* Reverting r237460 to fix test failures introduced on OSX & LinuxVince Harron2015-05-151-20/+4
| | | | | | | | | TestExitDuringStep.py TestNumThreads.py TestThreadExit.py TestThreadStates.py llvm-svn: 237479
* OperatingSystem plug-ins need to avoid running code when fetching thread ↵Greg Clayton2015-05-152-0/+22
| | | | | | | | | | lists. This patch helps with that by making all SBValue objects that are fetched not try to do dynamic type resolution. Objective C can end up running code to fetch a list of all ISA pointers so we can tell when something is dynamic and this running code could cause the OS plug-in to continue the target. This fix disabled dynamic types, fetches the new threads from the OS plug-in, then restores the setting. <rdar://problem/20768407> llvm-svn: 237465
* Add --move-to-nearest-code / target.move-to-nearest-code optionsIlia K2015-05-151-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This option forces to only set a source line breakpoint when there is an exact-match This patch includes the following commits: # Add the -m/--exact-match option in "breakpoint set" command ## Add exact_match arg in BreakpointResolverFileLine ctor ## Add m_exact_match field in BreakpointResolverFileLine ## Add exact_match arg in BreakpointResolverFileRegex ctor ## Add m_exact_match field in BreakpointResolverFileRegex ## Add exact_match arg in Target::CreateSourceRegexBreakpoint ## Add exact_match arg in Target::CreateBreakpoint ## Add -m/--exact-match option in "breakpoint set" command # Add target.exact-match option to skip BP if source line doesn't match ## Add target.exact-match global option ## Add Target::GetExactMatch ## Refactor Target::CreateSourceRegexBreakpoint to accept LazyBool exact_match (was bool) ## Refactor Target::CreateBreakpoint to accept LazyBool exact_match (was bool) # Add target.exact-match test in SettingsCommandTestCase # Add BreakpointOptionsTestCase tests to test --skip-prologue/--exact-match options # Fix a few typos in lldbutil.check_breakpoint_result func # Rename --exact-match/m_exact_match/exact_match/GetExactMatch to --move-to-nearest-code/m_move_to_nearest_code/move_to_nearest_code/GetMoveToNearestCode # Add exact_match field in BreakpointResolverFileLine::GetDescription and BreakpointResolverFileRegex::GetDescription, for example: was: ``` 1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, locations = 1, resolved = 1, hit count = 2 1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2 ``` now: ``` 1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, exact_match = 0, locations = 1, resolved = 1, hit count = 2 1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2 ``` Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb functionalities/breakpoint/ ./dotest.py -v --executable $BUILDDIR/bin/lldb settings/ ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/breakpoint/ Reviewers: jingham, clayborg Reviewed By: clayborg Subscribers: lldb-commits, clayborg, jingham Differential Revision: http://reviews.llvm.org/D9273 llvm-svn: 237460
* Fix virtual step handling in ThreadPlanStepInRangeTamas Berghammer2015-05-151-0/+1
| | | | | | Differential revision: http://reviews.llvm.org/D9773 llvm-svn: 237435
* Assembly profiler for mips32Bhushan D. Attarde2015-05-151-0/+2
| | | | | | | | | | | Summary: Implementation of assembly profiler for MIPS32 using EmulateInstruction which currently scans only prologue/epilogue assembly instructions. It uses llvm::MCDisassembler to decode assembly instructions. Reviewers: clayborg, jasonmolenda Differential Revision: http://reviews.llvm.org/D9769 llvm-svn: 237420
* Reverting r237392 since it broke TestNumThreads on ubuntu builder.Oleksiy Vyalov2015-05-151-2/+2
| | | | llvm-svn: 237415
* The StopInfo base class has an m_description std::string.Jason Molenda2015-05-151-5/+1
| | | | | | | | | Remove the m_description ivar from the StopInfoBreakpoint and StopInfoWatchpoint subclasses of StopInfo. Also, initialize the m_description ivar in the StopInfo ctor. <rdar://problem/20902950> llvm-svn: 237411
* Enable multithreaded debugging on Windows.Adrian McCarthy2015-05-141-2/+2
| | | | llvm-svn: 237392
* Have Platform::KillProcess try to use the process plugin first.Zachary Turner2015-05-131-3/+21
| | | | llvm-svn: 237280
* Remote Non-Stop SupportEwan Crawford2015-05-131-1/+10
| | | | | | | | | | | | | | | | | | | | Summary: This patch is the beginnings of support for Non-stop mode in the remote protocol. Letting a user examine stopped threads, while other threads execute freely. Non-stop mode is enabled using the setting target.non-stop-mode, which sends a QNonStop packet when establishing the remote connection. Changes are also made to treat the '?' stop reply packet differently in non-stop mode, according to spec https://sourceware.org/gdb/current/onlinedocs/gdb/Remote-Non_002dStop.html#Remote-Non_002dStop. A setting for querying the remote for default thread on setup is also included. Handling of '%' async notification packets will be added next. Reviewers: clayborg Subscribers: lldb-commits, ADodds, ted, deepak2427 Differential Revision: http://reviews.llvm.org/D9656 llvm-svn: 237239
* Don't change the selected platform when creating the dummy target.Robert Flack2015-05-131-2/+2
| | | | | | | | | | | | | | | | | | | A dummy target is used by TargetList::CreateTargetInternal to prime newly created targets. the first time this is done it creates the dummy target. The dummy target is created with the host platform (See TargetList::CreateDummyTarget) which results in switching the selected platform back to the host platform even when creating a target for a different platform. This change avoids changing the selected platform while creating the dummy target to prevent this side effect. Test Plan: ./dotest.py $DOTEST_OPTS -t -p TestCreateAfterAttach.py Tests using process attach (e.g. TestCreateAfterAttach.py, TestHelloWorld.py) now run successfully mac -> linux. Differential Revision: http://reviews.llvm.org/D9712 llvm-svn: 237221
* Windows: fix bug in getcwd() and add chdir().Ted Woodward2015-05-121-5/+0
| | | | | | | | | | | | | | | | | Summary: GetCurrentDirectory() returns the number of characters copied; 0 is a failure, not a success. Add implementation for chdir(). Reviewers: zturner Reviewed By: zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9300 llvm-svn: 237162
* Fix selecting the Platform in TargetList::CreateTargetInternal()Ted Woodward2015-05-111-22/+17
| | | | | | | | | | | | | | | | | Summary: TargetList::CreateTargetInternal() will only select the current Platform. A previous patch always sets platform_sp to the current Platform, so a check later to see if platform_sp was not defined always failed, and the current Platform was used. This patch removes that check, so if the current Platform is not compatible with the target architecture, CreateTargetInternal() will call Platform::GetPlatformForArchitecture() to select a compatible Platform. Vince, remote linux tests (Ubuntu -> remote Ubuntu) pass the same with and without this patch. Reviewers: vharron, clayborg Reviewed By: clayborg Subscribers: jingham, lldb-commits Differential Revision: http://reviews.llvm.org/D8749 llvm-svn: 237053
* Add Hexagon packet support to ThreadPlanStepRangeTed Woodward2015-05-111-1/+2
| | | | | | | | | | | | | | | | | Summary: Hexagon is a VLIW processor. It can execute multiple instructions at once, called a packet. Breakpoints need to be alone in a packet. This patch will make sure that temporary breakpoints used for stepping are set at the start of a packet, which will put the breakpoint in a packet by itself. Patch by Deepak Panickal of CodePlay and Ted Woodward of Qualcomm. Reviewers: deepak2427, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9437 llvm-svn: 237047
* Convert mmap options for target in InferiorCallMmap.Robert Flack2015-05-091-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | Converts the MAP_PRIVATE and MAP_ANON options to the target platform constants (on which the call runs) rather than using those of the compiled host. Test Plan: Run test suite, the following tests requiring memory allocation / JIT support begin passing when running mac -> linux: Test11588.py TestAnonymous.py TestBreakpointConditions.py TestCPPStaticMethods.py TestCStrings.py TestCallStdStringFunction.py TestDataFormatterCpp.py TestDataFormatterStdList.py TestExprDoesntBlock.py TestExprHelpExamples.py TestFunctionTypes.py TestPrintfAfterUp.py TestSBValuePersist.py TestSetValues.py Differential Revision: http://reviews.llvm.org/D9511 llvm-svn: 236933
* Set path syntax for remote executable FileSpec.Chaoren Lin2015-05-091-1/+2
| | | | | | | | | | Reviewers: ovyalov, zturner Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D9579 llvm-svn: 236925
* Fix build on windows.Colin Riley2015-05-081-1/+5
| | | | llvm-svn: 236836
* This patch allows LLDB to use the $qXfer:Libraries: packet.Aidan Dodds2015-05-081-2/+13
| | | | | | Differential Revision: http://reviews.llvm.org/D9471 llvm-svn: 236817
* Add a missing check for m_real_stop_reason.Jim Ingham2015-05-071-1/+1
| | | | | | <rdar://problem/20738527> llvm-svn: 236762
* Use file locks to synchronize access to ModuleCache.Oleksiy Vyalov2015-05-071-9/+1
| | | | | | http://reviews.llvm.org/D9056 llvm-svn: 236736
* Don't call the Process::SyncIOHandler in Target::LaunchIlia K2015-05-071-12/+0
| | | | | | | | | | | | | | Summary: This patch moves synchronization of iohandler to CommandObjectProcessLaunch::DoExecute like it was done in CommandObjectProcessContinue::DoExecute. Reviewers: jingham, clayborg Reviewed By: clayborg Subscribers: lldb-commits, clayborg, jingham Differential Revision: http://reviews.llvm.org/D9373 llvm-svn: 236699
* Add a language objc class-table dump commandEnrico Granata2015-05-061-0/+8
| | | | | | This command dumps a bunch of interesting facts about all Objective-C classes known to LLDB in the inferior process llvm-svn: 236640
* Fix process launch from Windows host to Android target.Chaoren Lin2015-05-051-0/+1
| | | | | | | | | | | | | | | | Summary: - Denormalized path on Windows host causes bad `A` packet. - Executables copied from Windows host doesn't have executable bits. Reviewers: tberghammer, zturner, ovyalov Reviewed By: ovyalov Subscribers: tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D9492 llvm-svn: 236516
* Add language command and LanguageRuntime plugin changes to allow vending of ↵Colin Riley2015-05-041-0/+28
| | | | | | | | command objects. Differential Revision: http://reviews.llvm.org/D9402 llvm-svn: 236443
* Fix Process::ResumeSynchronous which waits a process even in case of errorIlia K2015-04-301-5/+7
| | | | llvm-svn: 236231
* [LLDB][MIPS] Add MIPS32 and MIPS64 core revisionsMohit K. Bhakkad2015-04-231-0/+1
| | | | | | | | | | | | | | | Patch by Jaydeep Patil Added MIPS32 and MIPS64 core revisions. This would be followed by register context and emulate-instruction for MIPS32. DYLDRendezvous.cpp: On Linux link map struct does not contain extra load offset field. Reviewers: clayborg Subscribers: bhushan, mohit.bhakkad, sagar, lldb-commits. Differential Revision: http://reviews.llvm.org/D9190 llvm-svn: 235574
* Missed one piece when committing r235538.Jim Ingham2015-04-231-2/+17
| | | | llvm-svn: 235564
* This is some groundwork for filtering the language ExceptionJim Ingham2015-04-223-5/+75
| | | | | | | | | | | | | | breakpoints, for instance on the class of the thrown object. This change doesn't actually make that work, the part where we extract the thrown object type from the throw site isn't done yet. This provides a general programmatic "precondition" that you can add to breakpoints to give them the ability to do filtering on the LLDB side before we pass the stop on to the user-provided conditions & callbacks. llvm-svn: 235538
* Formatting fix.Jim Ingham2015-04-221-1/+2
| | | | llvm-svn: 235527
* This patch implements several improvements to theSean Callanan2015-04-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | module-loading support for the expression parser. - It adds support for auto-loading modules referred to by a compile unit. These references are currently in the form of empty translation units. This functionality is gated by the setting target.auto-import-clang-modules (boolean) = false - It improves and corrects support for loading macros from modules, currently by textually pasting all #defines into the user's expression. The improvements center around including only those modules that are relevant to the current context - hand-loaded modules and the modules that are imported from the current compile unit. - It adds an "opt-in" mechanism for all of this functionality. Modules have to be explicitly imported (via @import) or auto-loaded (by enabling the above setting) to enable any of this functionality. It also adds support to the compile unit and symbol file code to deal with empty translation units that indicate module imports, and plumbs this through to the CompileUnit interface. Finally, it makes the following changes to the test suite: - It adds a testcase that verifies that modules are automatically loaded when the appropriate setting is enabled (lang/objc/modules-auto-import); and - It modifies lanb/objc/modules-incomplete to test the case where a module #undefs something that is #defined in another module. <rdar://problem/20299554> llvm-svn: 235313
* Add a "force_kill" arg to Process::Destroy(). This is needed afterJason Molenda2015-04-172-6/+9
| | | | | | | | | | | | | | | | | | the changes in r233255/r233258. Normally if lldb attaches to a running process, when we call Process::Destroy, we want to detach from the process. If lldb launched the process itself, ::Destroy should kill it. However, if we attach to a process and the driver calls SBProcess::Kill() (which calls Destroy), we need to kill it even if we didn't launch it originally. The force_kill param allows for the SBProcess::Kill method to force the behavior of Destroy. <rdar://problem/20424439> llvm-svn: 235158
* Fix "help language", the languages printer was assuming the Jim Ingham2015-04-171-0/+9
| | | | | | | eLanguageType numbers would be sequential, but vendor types are not and the printer went crazy. llvm-svn: 235153
* Add new virtual method for language runtime plug-ins:Greg Clayton2015-04-163-20/+17
| | | | | | | | | virtual void LanguageRuntime::ModulesDidLoad (const ModuleList &module_list); Then reorganized how the objective C plug-in is notified so it will work for all LanguageRuntime subclasses. llvm-svn: 235118
* Add Modulecache::GetAndPut method which wraps sequence of Get and Put (if ↵Oleksiy Vyalov2015-04-151-56/+23
| | | | | | | | module wasn't found in cache) calls. http://reviews.llvm.org/D9013 llvm-svn: 235011
* Fix segfault when doing `thread info` on a thread without stop info.Chaoren Lin2015-04-081-7/+10
| | | | | | | | | | | | | | | | Summary: E.g., if thread 1 hits a breakpoint, then a `thread info` on thread 2 will cause a segfault, since thread 2 will have no stop info (intended behavior?). Reviewers: kubabrecka, clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8905 llvm-svn: 234437
* Fix stepping a virtual thread when the python operating system was enabled.Greg Clayton2015-04-071-0/+13
| | | | | | | | | | | | The OperatingSystem plug-ins allow code to detect threads in memory and then say "memory thread 0x11111" is backed by the actual thread 1. You can then single step these virtual threads. A problem arose when thread specific breakpoints were used during thread plans where we would say "set a breakpoint on thread 0x11111" and we would hit the breakpoint on the real thread 1 and the thread IDs wouldn't match and we would get rid of the "stopped at breakpoint" stop info due to this mismatch. Code was added to ensure these events get forwarded and thus allow single stepping a memory thread to work correctly. Added a test case for this as well. <rdar://problem/19211770> llvm-svn: 234364
* Added a testcase that covers loading a module andSean Callanan2015-04-031-0/+20
| | | | | | | | | | | verifying that the types from that module don't override types from DWARF. Also added a target setting to LLDB so we can tell Clang where to look for these local modules. <rdar://problem/18805055> llvm-svn: 234016
* Adding the RenderScript language type.Colin Riley2015-04-031-0/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D8803 llvm-svn: 234002
* Fix warnings generated by clang-cl.Zachary Turner2015-04-021-1/+1
| | | | | | | | | | | | | | There were a couple of real bugs here regarding error checking and signed/unsigned comparisons, but mostly these were just noise. There was one class of bugs fixed here which is particularly annoying, dealing with MSVC's non-standard behavior regarding the underlying type of enums. See the comment in lldb-enumerations.h for details. In short, from now on please use FLAGS_ENUM and FLAGS_ANONYMOUS_ENUM when defining enums which contain values larger than can fit into a signed integer. llvm-svn: 233943
* Don't return a reference to a temp variable.Greg Clayton2015-04-021-3/+0
| | | | llvm-svn: 233940
* Fix a crasher that could happen when you run LLDB and evaluate an expression ↵Greg Clayton2015-04-021-2/+27
| | | | | | | | | | where the objective C runtime registers a helper function, and also have an Objective C or C++ exception breakpoint. When shutting down the process in Process::Finalize() we clear a STL collection class and that causes objects to be destroyed that could re-enter Process and cause it to try to iterate over that same collection class that is being destroyed. Guard against this by setting a new "m_finalizing" flag that lets us know we are in the process of finalizing. <rdar://problem/20369152> llvm-svn: 233935
* Fix a race condition in Target::LaunchZachary Turner2015-03-261-14/+23
| | | | | | | | | | | | | | | | When no hijack listener is set up, the global event listener will try to pull events off the queue, racing with the event thread. By always forcing a hijack listener, even when one was not given, we guarantee that the listener always gets all events. This was causing problems in synchronous mode with the process stop event sometimes never being picked up and causing the debugger to hang while processing a .lldbinit file. Reviewed by: Jim Ingham Differential Revision: http://reviews.llvm.org/D8562 llvm-svn: 233315
OpenPOWER on IntegriCloud