summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
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
* llgs: fixes to PTY/gdb-remote inferior stdout/stderr handling, logging addtions.Todd Fiala2014-10-112-5/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add a IsInstrumentationRuntimePresent SB APIKuba Brecka2014-10-111-0/+13
| | | | | | | | | | 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
* Rework the way we pass "run multiple command" options to the various API's thatJim Ingham2014-10-111-12/+11
| | | | | | | | | | | | | | | 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
* LLDB AddressSanitizer instrumentation runtime plugin, breakpint on error and ↵Kuba Brecka2014-10-106-12/+125
| | | | | | | | | | | | | | | | | | | | | | | | | 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-102-2/+8
| | | | | | | | | | | | | | | | | | | | | 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
* Reverse out r219169 related to quote handling.Todd Fiala2014-10-101-16/+0
| | | | | | | | | 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-101-0/+22
| | | | | | | | | | | | | | | | | | | 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
* logging: added more logging to the Target/Platform launch & attach sequence.Todd Fiala2014-10-092-3/+59
| | | | llvm-svn: 219377
* 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
* 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-061-0/+16
| | | | | | | | | | | | | 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
* Move ConnectionFileDescriptor to platform-specific Host directory.Zachary Turner2014-10-061-3/+3
| | | | | | | | | | | | 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
* 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
* Not all processes have a Dynamic Loader. Be sure to check that it exists ↵Jim Ingham2014-09-301-1/+4
| | | | | | | | before using it. <rdar://problem/18491391> llvm-svn: 218699
* Fix cmake build for new thread plan files.Todd Fiala2014-09-301-0/+1
| | | | llvm-svn: 218679
* This checkin is the first step in making the lldb thread stepping mechanism ↵Jim Ingham2014-09-296-67/+398
| | | | | | | | | | | | more accessible from the user level. It adds the ability to invent new stepping modes implemented by python classes, and to view the current thread plan stack and to some extent alter it. I haven't gotten to documentation or tests yet. But this should not cause any behavior changes if you don't use it, so its safe to check it in now and work on it incrementally. llvm-svn: 218642
* Enable llgs to build against experimental Android AOSP ↵Todd Fiala2014-09-272-5/+1
| | | | | | | | | | | | 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
* Change inline-breakpoint-strategy setting to default to ↵Todd Fiala2014-09-241-3/+4
| | | | | | | | | | | | | | | eInlineBreakpointsAlways strategy. See thread started here for motivation: http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-September/005225.html This change enables the ability to set breakpoints in ccache-based and executables that make use of preprocessed source files. This ability existed in lldb before, but was off by default. Change by Doug Snyder. llvm-svn: 218405
* Fix up the HostThread interface, making the interface simpler.Zachary Turner2014-09-231-3/+3
| | | | | | | Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D5417 llvm-svn: 218325
* Test suite runs better again after recent fixes that would select a platform ↵Greg Clayton2014-09-192-84/+124
| | | | | | | | | | | | | 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
* If a new platform is created/selected for an architecture, make it the ↵Greg Clayton2014-09-171-0/+8
| | | | | | | | | | | selected platform so you can do things like: % lldb ios-executable (lldb) platform connect connect://localhost:11111 Prior to this fix, the host platform would be selected even though the target was using the ios-remote platform. llvm-svn: 217963
* Clean-up warnings on Linux/GCCDavid Majnemer2014-09-162-5/+12
| | | | llvm-svn: 217862
* use std::atomic<> to protect variables being accessed by multiple threadsTodd Fiala2014-09-151-5/+15
| | | | | | | | | | There are several places where multiple threads are accessing the same variables simultaneously without any kind of protection. I propose using std::atomic<> to make it safer. I did a special build of lldb, using the google tool 'thread sanitizer' which identified many cases of multiple threads accessing the same memory. std::atomic is low overhead and does not use any locks for simple types such as int/bool. See http://reviews.llvm.org/D5302 for more details. Change by Shawn Best. llvm-svn: 217818
* Fix incorrect initializer list style.Zachary Turner2014-09-121-13/+13
| | | | llvm-svn: 217721
* Make ProcessLaunchInfo copyable.Zachary Turner2014-09-121-16/+16
| | | | llvm-svn: 217714
* Fix the ctor ivar initialization formatting for Debugger,Jason Molenda2014-09-122-18/+18
| | | | | | | TypeValidatorImpl, FileAction, and ProcessLaunchInfo to match the lldb coding convention. llvm-svn: 217653
* Create a HostThread abstraction.Zachary Turner2014-09-091-22/+26
| | | | | | | | | | | | | 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
* remove a couple of default cases from switchesSaleem Abdulrasool2014-09-081-1/+0
| | | | | | | | | This cleans up a couple of warnings [-Wcovered-switch-default] from the build by removing the default case from a couple of switches which are fully covered. This is generally better as it will help identify when a new item is added to the enumeration but the use sites are not updated. llvm-svn: 217376
* Implement ASan history threads in SB APIKuba Brecka2014-09-061-0/+17
| | | | | | | | | Reviewed at http://reviews.llvm.org/D5219 and http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140901/012809.html llvm-svn: 217300
* Fix CMake configurationReid Kleckner2014-09-051-0/+1
| | | | llvm-svn: 217273
* [lldb] Abstract a superclass for a generic thread container.Kuba Brecka2014-09-052-21/+64
| | | | | | | | | Reviewed at http://reviews.llvm.org/D5200 and http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140901/012799.html llvm-svn: 217269
* ASan malloc/free history threadsKuba Brecka2014-09-042-0/+29
| | | | | | Reviewed at http://reviews.llvm.org/D4596 llvm-svn: 217116
* Add a new target.process.memory-cache-line-size to change the size ofJason Molenda2014-09-033-2/+17
| | | | | | | | | | | lldb's internal memory cache chunks that are read from the remote system. For a remote connection that is especially slow, a user may need to reduce it; reading a 512 byte chunk of memory whenever a 4-byte region is requested may not be the right decision in these kinds of environments. <rdar://problem/18175117> llvm-svn: 217083
* Consolidate UnixSignals setting/getting in Process.Todd Fiala2014-08-291-1/+13
| | | | | | | | | | | | | | | | See http://reviews.llvm.org/D5108 for details. This change does the following: * eliminates the Process::GetUnixSignals() virtual method and replaces with a fixed getter. * replaces the Process UnixSignals storage with a shared pointer. * adds a Process constructor variant that can be passed the UnixSignalsSP. When the constructor without the UnixSignalsSP is specified, the Host's default UnixSignals is used. * adds a host-specific version of GetUnixSignals() that is used when we need the host's appropriate UnixSignals variant. * replaces GetUnixSignals() overrides in PlatformElfCore, ProcessGDBRemote, ProcessFreeBSD and ProcessLinux with code that appropriately sets the Process::UnixSignals for the process. This change also enables some future patches that will enable llgs to be used for local Linux debugging. llvm-svn: 216748
* Add some logging around Process attaching and inferior exec handling.Todd Fiala2014-08-271-1/+73
| | | | llvm-svn: 216630
* [dwarf] Add new language enumerations.Bruce Mitchener2014-08-261-0/+3
| | | | | | | This updates the DWARF language identifiers to include recent additions to the DWARF 5 specification (draft). llvm-svn: 216486
* Move GetUsername and GetGroupname to HostInfoPosixZachary Turner2014-08-211-2/+6
| | | | llvm-svn: 216210
* If an executable file is specified with no architecture and it contains more ↵Greg Clayton2014-08-201-26/+98
| | | | | | | | | | than one architecture select a compatible platform if all architectures match the same platform. This helps us "do the right thing" when loading a file without having to specify an architecture. <rdar://problem/18021558> llvm-svn: 216115
* Move Host::GetArchitecture to HostInfo::GetArchitecture.Zachary Turner2014-08-201-1/+1
| | | | | | | | As a side effect, this patch also eliminates all of the preprocessor conditionals previously used to implement GetArchitecture(). llvm-svn: 216074
* This is a fairly bulky patch, but a lot of it involves rearranging existing codeEnrico Granata2014-08-191-0/+23
| | | | | | | | | | | | | | | | | | | | What it does: - it introduces a concept of EncodingToType to the ObjCLanguageRuntime The ObjC runtime has a "type encoding" feature that describes types as strings The EncodingToType is a decoder for that format, making types out of type encoding strings This feature already existed in some shape as we were using it to create method signatures out of the runtime, but this checkin extends the parser to support the full syntax, and moves things so that more parts of LLDB have access to this decoder - it splits the ClassDescriptorV2 object to its own file, it was starting to grow too large - it adds to the ClassDescriptor mechanism a notion of ivar storage; the ObjC runtime vends ivar information as well as method information While ivar information is not ready for prime type (i.e. we don't want to add it to the runtime generated types for expression evaluator usage), there are potentially useful scenarios in which realizing ivar types could be useful. For now, the ClassDescriptor is going to hold ivar information directly. Existing code already allows describing ivars, this patch hooks those moving parts up so that one can actually ask a ClassDescriptor about ivars for the class it represents and as a couple minor niceties: - it makes it possible to retrieve the LLDB ClangASTContext that is associated to a clang::ASTContext - it extends the ValueObject-to-ClassDescriptor API in the language runtime to deal correctly with base-class hierarchies llvm-svn: 216026
* Adjust process launch --disable-aslr to take true/false value.Todd Fiala2014-08-191-5/+12
| | | | | | This change modifies the 'process launch' --disable-aslr option to take a boolean argument. If the user directly specifies --disable-aslr {true,false}, that setting will control whether the process is launched with ASLR disabled accordingly. In the event that the setting is not explicitly made on the process launch command line, then the value is retrieved from the target.disable-aslr setting (i.e. settings show target.disable-aslr). llvm-svn: 215996
* Move some Host logic into HostInfo class.Zachary Turner2014-08-192-8/+18
| | | | | | | | | | | | | | | | | | This patch creates a HostInfo class, a static class used to answer basic queries about the host platform. As part of this change, some functionality is moved from Host to HostInfo, and relevant fixups are performed in the rest of the codebase. This is part of a larger effort to isolate more code in the Host layer into platform-specific groups, to make it easier to make platform specific changes for a particular Host without breaking other hosts. Reviewed by: Greg Clayton Differential Revision: http://reviews.llvm.org/D4963 llvm-svn: 215992
* In order for the debug script filename to be valid as a module name, LLDB ↵Enrico Granata2014-08-162-4/+4
| | | | | | does some textual replacements. However, if one were unaware of this, they might name their script using the 'untampered' file name and they would get no feedback about it. Add logic to LLDB to make sure we tell people about those changes if it turns out they might need to know. Fixes rdar://14310572 llvm-svn: 215798
* Move FileSystem functions out of Host and into their own classes.Zachary Turner2014-08-154-58/+65
| | | | | | | | | | | | | | | | More specifically, this change can be summarized as follows: 1) Makes an lldbHostPosix library which contains code common to all posix platforms. 2) Creates Host/FileSystem.h which defines a common FileSystem interface. 3) Implements FileSystem.h in Host/windows and Host/posix. 4) Creates Host/FileCache.h, implemented in Host/common, which defines a class useful for storing handles to open files needed by the debugger. Differential Revision: http://reviews.llvm.org/D4889 llvm-svn: 215775
* Fix a thinko in the process list formatting.Jim Ingham2014-08-151-6/+15
| | | | | | | | Made Process::Attach list the matching processes if there is more than one match. <rdar://problem/18023352> llvm-svn: 215730
* Refactor FileAction out of ProcessLaunchInfo.Zachary Turner2014-08-144-171/+97
| | | | | | | | | | | | | FileAction was previously a nested class in ProcessLaunchInfo. This led to some unfortunate style consequences, such as requiring the AddPosixSpawnFileAction() funciton to be defined in the Target layer, instead of the more appropriate Host layer. This patch makes FileAction its own independent class in the Target layer, and then moves AddPosixSpawnFileAction() into Host as a result. Differential Revision: http://reviews.llvm.org/D4877 llvm-svn: 215649
* Fixed launching in shell on haswell enabled Macs to work more than once when ↵Greg Clayton2014-08-121-1/+3
| | | | | | | | | | | | | | | | you do: % lldb -x /bin/ls (lldb) r (lldb) r Prior to this fix the first time it would run /usr/bin/arch with "-arch x86_64" the first time and succeed, and fail the second when the target had updated its architecture to x86_64h. We can't specify x86_64h to /usr/bin/arch, it doesn't handle it. Also fixed it so /usr/bin/arch is only used for Apple triples. <rdar://problem/17951312> llvm-svn: 215475
* Fix iohandler prompt race condition.Todd Fiala2014-08-122-1/+37
| | | | | | | | | | | | | | | | | This issue caused the lldb prompt to not show up in certain cases, very noticeable on Linux systems. See details on this review: http://reviews.llvm.org/D4863 And on this lldb-commits thread: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140811/012306.html Change by Shawn Best. (Much useful help and testing by the rest of the community, thanks all!) llvm-svn: 215446
OpenPOWER on IntegriCloud