summaryrefslogtreecommitdiffstats
path: root/lldb/source
Commit message (Collapse)AuthorAgeFilesLines
* Fixed stdio redirection within LLDB to "do the right thing" in all cases.Greg Clayton2014-10-141-7/+19
| | | | | | | | | | The main issue was if you didn't specify all three (stdin/out/err), you would get file actions added to the launch that would always use the pseudo terminal. This is now fixed. Also fixed the test suite test that handles IO to test redirecting things individually and all together and in other combinations to make sure we don't regress. <rdar://problem/18638226> llvm-svn: 219711
* Use PARALLEL_DIRS instead of DIRS in the MakefileEric Christopher2014-10-143-21/+21
| | | | | | | | based build since the subdirectories all appear to have no inter-directory dependencies. This speeds up parallel makefile builds greatly. llvm-svn: 219660
* This adds a "batch mode" to lldb kinda like the gdb batch mode. It will ↵Jim Ingham2014-10-144-4/+173
| | | | | | | | | | | | | | | | quit the debugger after all the commands have been executed except if one of the commands was an execution control command that stopped because of a signal or exception. Also adds a variant of SBCommandInterpreter::HandleCommand that takes an SBExecutionContext. That way you can run an lldb command targeted at a particular target, thread or process w/o having to select same before running the command. Also exposes CommandInterpreter::HandleCommandsFromFile to the SBCommandInterpreter API, since that seemed generally useful. llvm-svn: 219654
* Resolve non-pointer isas for metaclasses.Sean Callanan2014-10-136-9/+65
| | | | | | | Patch by Enrico Granata. <rdar://problem/18618298> llvm-svn: 219641
* Don't lock the IOHandlerList::m_mutex in Debugger::RunIOHandler(...) since ↵Greg Clayton2014-10-131-1/+0
| | | | | | | | if a process is resumed or halted, it will try to push/pop the process IOHandler and it will deadlock. <rdar://problem/18610852> llvm-svn: 219620
* llgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.Todd Fiala2014-10-117-137/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, both local-process llgs and remote-target llgs stdout/stderr handling from inferior work correctly. Several log lines have been added around PTY and stdout/stderr redirection logic on the lldb client side. Regarding remote llgs execution, see the following: With these changes, remote llgs with $O now works properly: $ lldb (lldb) platform select remote-linux (lldb) target create ~/some/inferior/exe (lldb) gdb-remote {some-target}:{port} (lldb) run The sequence above will correctly redirect stdout/stderr over gdb-remote $O, as is needed for remote debugging. That sequence assumes there is a lldb-gdbserver exe running on the target with {some-host}:{port}. You can replace the gdb-remote command with a '(lldb) platform connect connect://{target-ip}:{target-port}'. If you do this and have a lldb-platform running on the remote end, it will go ahead and launch llgs for lldb for each target instance that is run/attached. For local debugging with llgs, the following sequence also works, and uses local PTYs instead to avoid $O and extra gdb-remote messages: $ lldb (lldb) settings set platform.plugin.linux.use-llgs true (lldb) target create ~/some/inferior/exe (lldb) run The above will run the inferior using llgs on the local host, and will use PTYs rather than $O redirection. This change also removes the logging that happened after the fork but before the exec when llgs is launching a new inferior process. Some aspect of the file handling during that portion of code would not do the right thing with log handling. We might want to go back later and have that communicate over a pipe from the child to parent to pass along any messages that previously were logged in that section of code. llvm-svn: 219578
* Fix cmake build for PluginInstrumentationRuntimeAddressSanitizer.Todd Fiala2014-10-111-0/+1
| | | | llvm-svn: 219576
* Add a IsInstrumentationRuntimePresent SB APIKuba Brecka2014-10-112-0/+28
| | | | | | | | | | Reviewed at http://reviews.llvm.org/D5738 This adds an SB API into SBProcess: bool SBProcess::IsInstrumentationRuntimePresent(InstrumentationRuntimeType type); which simply tells whether a particular InstrumentationRuntime (read "ASan") plugin is present and active. llvm-svn: 219560
* Fix the build after the recent plugin additions forEric Christopher2014-10-112-2/+5
| | | | | | AddressSanitizer by adding dependencies and definitions. llvm-svn: 219554
* Rework the way we pass "run multiple command" options to the various API's thatJim Ingham2014-10-118-79/+209
| | | | | | | | | | | | | | | do that (RunCommandInterpreter, HandleCommands, HandleCommandsFromFile) to gather the options into an options class. Also expose that to the SB API's. Change the way the "-o" options to the lldb driver are processed so: 1) They are run synchronously - didn't really make any sense to run the asynchronously. 2) The stop on error 3) "quit" in one of the -o commands will not quit lldb - not the command interpreter that was running the -o commands. I added an entry to the run options to stop-on-crash, but I haven't implemented that yet. llvm-svn: 219553
* Reinstate setting addr_width to the result of the computation,Eric Christopher2014-10-111-1/+1
| | | | | | but in the conditional rather than at initialization time. llvm-svn: 219549
* Remove default case from a fully covered switch.Eric Christopher2014-10-111-1/+0
| | | | llvm-svn: 219548
* Fix unused variable warning from r219544.Eric Christopher2014-10-101-1/+0
| | | | llvm-svn: 219547
* LLDB AddressSanitizer instrumentation runtime plugin, breakpint on error and ↵Kuba Brecka2014-10-1016-17/+688
| | | | | | | | | | | | | | | | | | | | | | | | | report data extraction Reviewed at http://reviews.llvm.org/D5592 This patch gives LLDB some ability to interact with AddressSanitizer runtime library, on top of what we already have (historical memory stack traces provided by ASan). Namely, that's the ability to stop on an error caught by ASan, and access the report information that are associated with it. The report information is also exposed into SB API. More precisely this patch... adds a new plugin type, InstrumentationRuntime, which should serve as a generic superclass for other instrumentation runtime libraries, these plugins get notified when modules are loaded, so they get a chance to "activate" when a specific dynamic library is loaded an instance of this plugin type, AddressSanitizerRuntime, which activates itself when it sees the ASan dynamic library or founds ASan statically linked in the executable adds a collection of these plugins into the Process class AddressSanitizerRuntime sets an internal breakpoint on __asan::AsanDie(), and when this breakpoint gets hit, it retrieves the report information from ASan this breakpoint is then exposed as a new StopReason, eStopReasonInstrumentation, with a new StopInfo subclass, InstrumentationRuntimeStopInfo the StopInfo superclass is extended with a m_extended_info field (it's a StructuredData::ObjectSP), that can hold arbitrary JSON-like data, which is the way the new plugin provides the report data the "thread info" command now accepts a "-s" flag that prints out the JSON data of a stop reason (same way the "-j" flag works now) SBThread has a new API, GetStopReasonExtendedInfoAsJSON, which dumps the JSON string into a SBStream adds a test case for all of this I plan to also get rid of the original ASan plugin (memory history stack traces) and use an instance of AddressSanitizerRuntime for that purpose. Kuba llvm-svn: 219546
* Add a new disassembly-format specification so that the disassemblerJason Molenda2014-10-1016-66/+342
| | | | | | | | | | | | | | | | | | | | | output style can be customized. Change the built-in default to be more similar to gdb's disassembly formatting. The disassembly-format for a gdb-like output is ${addr-file-or-load} <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>: The disassembly-format for the lldb style output is {${function.initial-function}{${module.file.basename}`}{${function.name-without-args}}:\n}{${function.changed}\n{${module.file.basename}`}{${function.name-without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}: The two backticks in the lldb style formatter triggers the sub-expression evaluation in CommandInterpreter::PreprocessCommand() so you can't use that one as-is ... changing to use ' characters instead of ` would work around that. <rdar://problem/9885398> llvm-svn: 219544
* When parsing ObjC types from encoded strings (and disallowing any-type), the ↵Enrico Granata2014-10-101-6/+17
| | | | | | | | | ^? combination gets resolved to no type, while we could resolve it to void* I don't think on any of the platforms where ObjC matters sizeof(T*) depends on T, so even if we never figured out the pointee type, the pointer type should still be sane This might also allow some limited inspection where previously none was possible, so a win llvm-svn: 219540
* 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
* Reverse out r219169 related to quote handling.Todd Fiala2014-10-106-74/+4
| | | | | | | | | Addresses pr/21190 (http://llvm.org/bugs/show_bug.cgi?id=21190). r219169 implemented this change list: http://reviews.llvm.org/D5472 for more details. llvm-svn: 219461
* Enable local llgs debugging on Linux when the use-llgs-for-local setting is ↵Todd Fiala2014-10-108-173/+376
| | | | | | | | | | | | | | | | | | | enabled. See http://reviews.llvm.org/D5695 for details. This change does the following: Enable lldb-gdbserver (llgs) usage for local-process Linux debugging. To turn on local llgs debugging support, which is disabled by default, enable this setting: (lldb) settings set platform.plugin.linux.use-llgs-for-local true Adds a stream-based Dump() function to FileAction. Pushes some platform methods that Linux (and FreeBSD) will want to share with MacOSX from PlatformDarwin into PlatformPOSIX. Reviewed by Greg Clayton. llvm-svn: 219457
* In cases where you'd use an expression to get a value to insert in a ↵Enrico Granata2014-10-092-7/+12
| | | | | | command, be ready to use synthetic children if they are there. Those are now a source of values, so worth checking for llvm-svn: 219452
* Enhance the libc++ list data formatter so that it does not start looking for ↵Enrico Granata2014-10-091-7/+11
| | | | | | loops until asked to actually fetch children. Also, if you're going to read child X, only look for a loop in the first X nodes. Loops further down the road won't really matter. This should speed things up for large lists and fix rdar://18583790 llvm-svn: 219447
* Correctly fix ScriptInterpreterPython::ExecuteOneLine for windows.Zachary Turner2014-10-091-1/+1
| | | | llvm-svn: 219435
* If a ValueObject has a child that vends synthetic children, but only does so ↵Enrico Granata2014-10-092-5/+15
| | | | | | to generate a value for itself, that's not a disqualifier from one-line printing. Also, fetch synthetic values if available and requested for children as well while printing them llvm-svn: 219427
* Add an API on ValueObject to retrieve the desired dynamic/synthetic ↵Enrico Granata2014-10-091-0/+50
| | | | | | combination all at once, if available, working somewhat hard to avoid returning an invalid ValueObject in the process llvm-svn: 219423
* thread state coordinator: fixed bug in thread running state book-keeping.Todd Fiala2014-10-091-0/+3
| | | | | | | | | | Adds a test to verify that a thread resume request marks the thread as running after doing the resume callback. This test fails without the corresponding ThreadStateCoordinator.cpp change. Fixes the code where that state was not maintained. llvm-svn: 219412
* logging: added more logging to the Target/Platform launch & attach sequence.Todd Fiala2014-10-092-3/+59
| | | | llvm-svn: 219377
* Added a bit of logging around ↵Todd Fiala2014-10-091-0/+5
| | | | | | GDBRemoteCommunicationClient::SendGDBStoppointTypePacket. llvm-svn: 219374
* 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
* Fix deadlock in Python one-line execution.Zachary Turner2014-10-085-33/+261
| | | | | | | | | | | | | | | | | Python one-line execution was using ConnectionFileDescriptor to do a non-blocking read against a pipe. This won't work on Windows, as CFD is implemented using select(), and select() only works with sockets on Windows. The solution is to use ConnectionGenericFile on Windows, which uses the native API to do overlapped I/O on the pipe. This in turn requires re-implementing Host::Pipe on Windows using native OS handles instead of the more portable _pipe CRT api. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5679 llvm-svn: 219339
* Extend synthetic children to produce synthetic values (as in, those that ↵Enrico Granata2014-10-0811-25/+124
| | | | | | | | | | | | | | | | | GetValueAsUnsigned(), GetValueAsCString() would return) The way to do this is to write a synthetic child provider for your type, and have it vend the (optional) get_value function. If get_value is defined, and it returns a valid SBValue, that SBValue's value (as in lldb_private::Value) will be used as the synthetic ValueObject's Value The rationale for doing things this way is twofold: - there are many possible ways to define a "value" (SBData, a Python number, ...) but SBValue seems general enough as a thing that stores a "value", so we just trade values that way and that keeps our currency trivial - we could introduce a new level of layering (ValueObjectSyntheticValue), a new kind of formatter (synthetic value producer), but that would complicate the model (can I have a dynamic with no synthetic children but synthetic value? synthetic value with synthetic children but no dynamic?), and I really couldn't see much benefit to be reaped from this added complexity in the matrix On the other hand, just defining a synthetic child provider with a get_value but returning no actual children is easy enough that it's not a significant road-block to adoption of this feature Comes with a test case llvm-svn: 219330
* llgs: add logging to Native*Protocol breakpoints around byte values replaced ↵Todd Fiala2014-10-081-1/+18
| | | | | | | | and restored. Useful for verifying what bytes a software breakpoint clobbers/restores. llvm-svn: 219318
* Minor comment change to test out svn accessShawn Best2014-10-081-1/+1
| | | | llvm-svn: 219269
* Fix stepping over the inserted breakpoint trap when the NEXT instructionJim Ingham2014-10-082-22/+51
| | | | | | | | also contains a breakpoint. <rdar://problem/18519712> llvm-svn: 219263
* When we detect a stack unwind loop, before we abortJason Molenda2014-10-071-6/+14
| | | | | | | | the backtrace, try falling back to the architecture default unwind plan and see if we can backtrace a little further. <rdar://problem/18556719> llvm-svn: 219247
* The type category enable * was implemented assuming a previous disable * had ↵Enrico Granata2014-10-071-2/+17
| | | | | | happened. While that will most likely be true in practice, the consequences of this not being the case will be a crash. I fix the crash by doing two things: 1) don't let already-enabled categories be enabled anyway; 2) if a category were disabled but with a bogus last-enabled position - highly highly unlikely - just put it in the first empty slot. I am not so sure 2) is bulletproof perfect, but I also don't think 2) will practically ever happen llvm-svn: 219245
* Fix compile error on Windows.Zachary Turner2014-10-071-1/+1
| | | | llvm-svn: 219232
* Fix spurious output to command line when launching a process on Linux.Todd Fiala2014-10-071-4/+8
| | | | | | | | See http://reviews.llvm.org/D5632 for details. Change by Shawn Best. llvm-svn: 219213
* Add "target.expr-parser-compiler-args" setting.Todd Fiala2014-10-066-4/+74
| | | | | | | | | | | | | This setting contains the following: A list containing all the arguments to be passed to the expression parser compiler. This change also ensures quoted arguments are handled appropriately. See http://reviews.llvm.org/D5472 for more details. Change by Tong Shen. llvm-svn: 219169
* 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
* Create a ConnectionGenericFile class for Windows.Zachary Turner2014-10-064-1/+355
| | | | | | | | | | | | | This is the first step in getting ConnectionFileDescriptor ported to Windows. It implements a connection against a disk file for windows. This supports connection strings of the form file://PATH which are currently supported only on posix platforms in ConnectionFileDescriptor. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5608 llvm-svn: 219145
* Move ConnectionFileDescriptor to platform-specific Host directory.Zachary Turner2014-10-0614-248/+219
| | | | | | | | | | | | As part of getting ConnectionFileDescriptor working on Windows, there is going to be alot of platform specific work to be done. As a result, the implementation is moving into Host. This patch performs the code move and fixes up call-sites appropriately. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5548 llvm-svn: 219143
* Fix a problem where LLDB was constructing a TypeImpl marking the dynamic ↵Enrico Granata2014-10-062-2/+2
| | | | | | type as the static type. Instead use the TypeImpl() constructor correctly llvm-svn: 219142
* Revert r219102 as it caused significant buildbot breakageEd Maste2014-10-061-4/+0
| | | | llvm-svn: 219120
* Call SBDebugger::Initialize/Terminate from within Create/Destroy.Matthew Gardiner2014-10-061-0/+4
| | | | | | | The above change permits developers using the lldb C++ API to code applications in a more logical manner. llvm-svn: 219102
* Stop enabling the std::vector<bool> data formatter for libstdc++, and for ↵Enrico Granata2014-10-031-7/+0
| | | | | | that matter, also skip running the test on Darwin. libstdc++ is more relevant on non-Apple platforms llvm-svn: 218952
* Issuing a "type category disable *" command followed by a "type category ↵Enrico Granata2014-10-034-26/+41
| | | | | | | | | | enable *" command does not honor the order in which categories were previously enabled While we didn't really promise it would, it seems like it should This checkin enables just that, and fixes rdar://18527468 llvm-svn: 218949
* thread state coordinator: add tests and impl to error on creation/death issues.Todd Fiala2014-10-022-7/+29
| | | | | | | | Added tests and impl to make sure the following errors are reported: * Notifying a created thread that we are already tracking. * Notifying a thread death for a thread we don't know about. llvm-svn: 218900
* thread state coordinator: added simpler deferred stop notification method.Todd Fiala2014-10-022-33/+114
| | | | | | | | | | | | | | | Now that ThreadStateCoordinator errors out on threads in unexpected states, it has enough information to know which threads need stop requests fired when we want to do a deferred callback on a thread's behalf. This change adds a new method, CallAfterRunningThreadsStop(...), which no longer takes a set of thread ids that require stop requests. It's much harder to misuse this method and (with newer error logic) it's harder to correctly use the original method. Expect the original method that takes the set of thread ids to stop to disappear in the near future. Adds several tests for CallAfterRunningThreadsStop(). llvm-svn: 218897
* thread state coordinator: requesting resume now signals error appropriately.Todd Fiala2014-10-021-5/+12
| | | | | | | | | | Added tests to verify that the coordinator signals an error if the given thread to resume is unknown, and if the thread is through to be running already. Modified resume handling code to match tests. llvm-svn: 218872
* Add a mutex lock to StackFrame to protect race conditions forJason Molenda2014-10-021-3/+20
| | | | | | | | | updating its ivars. We've had a lot of crash reports and careful analysis shows that we've got multiple threads operating on the same StackFrame objects, changing their m_sc and m_flags ivars. <rdar://problem/18406111> llvm-svn: 218845
OpenPOWER on IntegriCloud