Commit Graph

2398 Commits

Author SHA1 Message Date
Todd Fiala 6a2f62cbd3 Linux/FreeBSD local debugging: allow redirection to pts for POSIX process.
See http://reviews.llvm.org/D5135 for more details.

Change by Zephyr Zhao.

llvm-svn: 217382
2014-09-08 15:57:14 +00:00
Saleem Abdulrasool a787422158 remove a couple of default cases from switches
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
2014-09-08 14:59:36 +00:00
Todd Fiala cefdbdf2fe Added logging of the POSIX-DYLD rendezvous address (i.e. the info_location address)
llvm-svn: 217287
2014-09-05 22:28:40 +00:00
Todd Fiala c82f650a2b Add more logging to DynamicLoaderPOSIXDYLD, especially around rendezvous 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
2014-09-05 22:01:04 +00:00
Todd Fiala bc5353a83c Properly handle the DYLD attach step for GDB remotes.
Change by Stephane Sezer.

llvm-svn: 217253
2014-09-05 15:06:16 +00:00
Todd Fiala 0cc371c166 Set the process vendor in GDBRemoteCommunicationClient::GetCurrentProcessInfo.
Change by Stephane Sezer.

llvm-svn: 217252
2014-09-05 14:56:13 +00:00
Todd Fiala ebecb38d47 Fix up lldb build for llvm r217172.
Changes reference to 4th element in version_min_command from reserved to sdk.

llvm-svn: 217185
2014-09-04 19:31:52 +00:00
Todd Fiala dbec1ff42a Fix build break on Ubuntu 12.04 with ARM64 changes.
See http://llvm.org/bugs/show_bug.cgi?id=20824 for more details.

Tested:
Ubuntu 12.04 x86_64, gcc-4.9.1-built lldb
Ubuntu 14.04 x86_64, clang-3.5-build lldb

llvm-svn: 217169
2014-09-04 16:08:20 +00:00
Todd Fiala 6ce8fef458 Use the process' ReadCStringFromMemory from 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
2014-09-04 14:16:19 +00:00
Kuba Brecka beed821ffb ASan malloc/free history threads
Reviewed at http://reviews.llvm.org/D4596

llvm-svn: 217116
2014-09-04 01:03:18 +00:00
Jason Molenda 5de2e7cafb RegisterContextLLDB::InitializeNonZerothFrame had a bit of code to
detct unwind loops but there was a code path through there (using
architecture default unwind plans) that didn't do the check, and
could end up with an infinite loop unwind.  Move that code into a
separate method and call it from both places where it is needed.

Also remove the use of ABI::FunctionCallsChangeCFA in that check.
I thought about it a lot and none of the architecutres that we're
supporting today can have a looping CFA.

Since the unwinder isn't using ABI::FunctionCallsChangeCFA() and
ABI::StackUsesFrames(), and the unwinder was the only reason
those methods exists, I removed them from the ABI and all its
plugins.

<rdar://problem/17364005> 

llvm-svn: 216992
2014-09-02 23:04:01 +00:00
Todd Fiala c5c4e3a35b Linux ARM64: add ProcessMonitor-related RegisterContext support.
See http://reviews.llvm.org/D5089 for more details.

Change by Paul Osmialowski.

llvm-svn: 216907
2014-09-02 14:50:01 +00:00
Todd Fiala 4ceced3f59 Consolidate UnixSignals setting/getting in Process.
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
2014-08-29 17:35:57 +00:00
Todd Fiala 34ba426968 Add arbitrary command line flags to llgs/debugserver startup for local debugging.
This patch accepts environment variables of the form:
LLDB_DEBUGSERVER_EXTRA_ARG_n

where n starts with 1, and may continue nearly indefinitely (up through std::numeric_limits<uint32_t>::max()).

The code loops around, starting with 1, until it doesn't find one of the environment variables.  For each one it does find defined, it appends the environment variable's contents to the end of the debugserver/llgs startup command line issued when the stub is started for local debugging.

I am using this to add arbitrary startup commands to the llgs command line for turning on additional logging.  For example:

export LLDB_DEBUGSERVER_EXTRA_ARG_1="-c"
export LLDB_DEBUGSERVER_EXTRA_ARG_2="log enable -f /tmp/llgs_packets.log gdb-remote packets"
export LLDB_DEBUGSERVER_EXTRA_ARG_3="-c"
export LLDB_DEBUGSERVER_EXTRA_ARG_4="log enable -f /tmp/llgs_process.log lldb process"

llvm-svn: 216745
2014-08-29 17:10:31 +00:00
Todd Fiala 33bba9f440 lldb - ELF: add ARM64 relocation jump slot handling in ELFHeader.
See http://reviews.llvm.org/D4579 for more details.

Change by Paul Osmialowski.

llvm-svn: 216739
2014-08-29 16:19:27 +00:00
Todd Fiala b71e89e9af lldb - Register Context Linux ARM64
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
2014-08-29 16:01:35 +00:00
Todd Fiala 281961a821 Added setting: platform.plugin.linux.use-llgs-for-local (boolean), defaults to false
This setting is not yet hooked up to anything.  In preparation for
adding/testing llgs for local Linux debugging.

llvm-svn: 216690
2014-08-28 22:17:54 +00:00
Todd Fiala a9882cee50 llgs: add proper exec support for Linux.
This change:
* properly captures execs in NativeProcessLinux.
* clears out all non-main-thread thread metadata in NativeProcessLinux on exec.
* adds a DidExec() method to the NativeProcessProtocol delegate.
* clears out the auxv data cache when we exec (on Linux).

This is a small part of the llgs for local Linux debugging work going on here:
https://github.com/tfiala/lldb/tree/dev-llgs-local

I'm breaking it into small patches.

llvm-svn: 216670
2014-08-28 15:46:54 +00:00
Todd Fiala 22972a7c59 NativeThreadLinux: remove translation of some Linux signals to gdb signals.
I copied this originally based on what debugserver was doing.  This appears to
be incorrect and unncessary for Linux.  The LinuxSignals on the lldb side
don't look for these and therefore they get handled incorrectly.

Leaving the hook in place since I think darwin will continue to need to
translate those signal numbers.

llvm-svn: 216564
2014-08-27 17:11:56 +00:00
Todd Fiala 1d6082ff17 lldb Missing ARM64 breakpoint opcode for ProcessPOSIX added.
See http://reviews.llvm.org/D5078.

Change by Paul Osmialowski.

llvm-svn: 216559
2014-08-27 16:32:02 +00:00
Todd Fiala 8b55cce84c lldb Missing break statement added.
See http://reviews.llvm.org/D5069.

Change by Paul Osmialowski.

llvm-svn: 216554
2014-08-27 16:12:35 +00:00
Todd Fiala 4207968d33 Add Linux support for get thread area on ARM64 using ProcessMonitor debugging.
See http://reviews.llvm.org/D5073.

Change by Paul Osmialowski.

llvm-svn: 216553
2014-08-27 16:05:26 +00:00
Matthew Gardiner 5f67579f69 Add support for kalimba architecture variants 3, 4 and 5.
Add entries to core_definitions and elf_arch_entries for
those variants. Select the subtype for the variant by parsing
the e_flags field of the elf header.

llvm-svn: 216541
2014-08-27 12:09:39 +00:00
Jason Molenda f37b7c79a3 Don't have ProcessMachCore::CanDebug use the Target's arch when
creating the ModuleSpec to load the core file - we won't have a fat
core file and we can end up with cpu subtype mismatches if the core
file header isn't written out completely accurately.  We need to
be a little loose in this particular case.
<rdar://problem/17843388>

llvm-svn: 216498
2014-08-26 22:39:03 +00:00
Todd Fiala c540dd0daf Fix llgs to send triple for non-Apple platforms and lldb to interpret correctly.
This change addresses this bug:
http://llvm.org/bugs/show_bug.cgi?id=20755

This change:
* Modifies llgs to send triple instead of cputype and cpusubtype when not on Apple platforms in qProcessInfo.
* Modifies lldb's GDBRemoteCommunicationClient to handle the triple returned from qProcessInfo if given.
  When given, it will prefer to use triple over cputype and cpusubtype.
* Adds gdb-remote protocol tests to verify that cputype and cpusubtype are specified on darwin, and that triple is specified on Linux.

llvm-svn: 216470
2014-08-26 18:21:02 +00:00
Matthew Gardiner e81df3bbc9 Remove the hostname part from compilation directories, if supplied by
DWARF2/3 compliant producers.

llvm-svn: 216440
2014-08-26 06:57:23 +00:00
Jason Molenda 7b967f1477 Remove trailing whitespace from lines in UnwindAssembly-x86.cpp. No other changes.
llvm-svn: 216420
2014-08-25 23:46:06 +00:00
Jason Molenda 31e7191513 Clean up the coding conventions in UnwindAssembly-x86.cpp a little bit.
I wrote this originally as a part of an unwind library that was using
a different coding convention and some of that old style remained after
its integration into lldb.

llvm-svn: 216419
2014-08-25 23:45:24 +00:00
Jason Molenda 1786ebf3d4 Have augment_unwind_plan_from_call_site update the UnwindPlan
name/from-compiler settings to indicate that it was augmented
by assembly profiling.

llvm-svn: 216412
2014-08-25 22:16:23 +00:00
Todd Fiala 0562524b45 On x86 & x86_64, try to use eh_frame for frame 0.
We decided to use assmbly profiler instead of eh_frame for frame 0 because for compiler generated code, eh_frame is usually synchronous(a.k.a. only valid at call site); and we have no way to tell if it's asynchronous or not.
But for x86 & x86_64 compiler generated code:
1. clang & GCC describes all prologue instructions in eh_frame;
2. mid-function stack pointer altering instructions can be easily detected.
So we can grab eh_frame, and use assembly profiler to augment it into asynchronous unwind table.
This change also benefits hand-written assembly; eh_frame for hand-written assembly is often asynchronous,so we have a much better chance to successfully unwind through them.

Change by Tong Shen.

llvm-svn: 216406
2014-08-25 20:29:09 +00:00
Enrico Granata e3eface17a Extend the encoding parser to support the @typeName syntax for Objective-C object types
llvm-svn: 216305
2014-08-23 00:20:33 +00:00
Jason Molenda 05a09c67da When adding a dSYM to an existing ObjectFile, we can have a situation
with binaries in the dyld shared cache (esp on iOS) where the file
address for the executable binary (maybe from memory, maybe from
an expanded copy of the dyld shared cache) is different from the
file address in the dSYM.  In that case, ObjectFileMachO replaces
the file addresses from the original binary with the dSYM file
addresses (usually 0-based) -- lldb doesn't have a notion of two
file addresses for a given module so they need to agree.

There was a cache of file addresses over in the Symtab so I added
a method to the Module and the objects within to clear any file address
caches if they exist, and added an implementation in the Symtab
module to do that.
<rdar://problem/16929569> 

llvm-svn: 216258
2014-08-22 02:46:46 +00:00
Zachary Turner c25146b67b Fixes a few more places where we were manually setting the filename.
llvm-svn: 216247
2014-08-21 23:56:55 +00:00
Jason Molenda 6fd86771f2 Two small fixes to get Mac native + debugserver working after the
HostInfo et al changes from Zachary.  Changes suggested by Zachary
- fixes the problems I was seeing.

llvm-svn: 216243
2014-08-21 23:22:33 +00:00
Zachary Turner b245ecac79 Move GetUsername and GetGroupname to HostInfoPosix
llvm-svn: 216210
2014-08-21 20:02:17 +00:00
Zachary Turner 42ff0ad882 Move Host::GetLLDBPath to HostInfo.
This continues the effort to get Host code moved over to HostInfo,
and removes many more instances of preprocessor defines along the
way.

llvm-svn: 216195
2014-08-21 17:29:12 +00:00
Todd Fiala 2afc596667 Add software breakpoint support for Linux aarch64.
See http://reviews.llvm.org/D4969 for details.

Change by Paul Osmialowski.

llvm-svn: 216188
2014-08-21 16:42:31 +00:00
Todd Fiala 6ac1be4b6d Enable more Linux aarch64 PTRACE support for local and remote debugging.
See http://reviews.llvm.org/D4803 for more details.

Change by Paul Osmialowski.

llvm-svn: 216185
2014-08-21 16:34:03 +00:00
Greg Clayton b6fd112b76 Fix warnings about overloaded virtual functions.
llvm-svn: 216077
2014-08-20 16:54:11 +00:00
Zachary Turner 13b1826104 Move Host::GetArchitecture to HostInfo::GetArchitecture.
As a side effect, this patch also eliminates all of the
preprocessor conditionals previously used to implement
GetArchitecture().

llvm-svn: 216074
2014-08-20 16:42:51 +00:00
Zachary Turner e5c1e31d2c Changes uint to uint32_t.
This fixes the build broken as a result of r216026.

llvm-svn: 216034
2014-08-19 23:28:11 +00:00
Enrico Granata 73f97e24c0 Attempt to keep the Linux build happy in face of my changes. Non-Apple folks, can you confirm that this is good enough to keep things building for you?
llvm-svn: 216028
2014-08-19 21:48:27 +00:00
Enrico Granata 5d84a69731 This is a fairly bulky patch, but a lot of it involves rearranging existing code
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
2014-08-19 21:46:37 +00:00
Zachary Turner 97a14e60b2 Move some Host logic into HostInfo class.
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
2014-08-19 17:18:29 +00:00
Todd Fiala 0bce1b67a3 Fix Linux to respect ASLR settings when launching processes to debug locally and remotely.
See the following links for details:
http://llvm.org/bugs/show_bug.cgi?id=20658
See http://reviews.llvm.org/D4941

llvm-svn: 215822
2014-08-17 00:10:50 +00:00
Enrico Granata fe7295dcf5 In order for the debug script filename to be valid as a module name, LLDB 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
2014-08-16 00:32:58 +00:00
Zachary Turner c00cf4a068 Move FileSystem functions out of Host and into their own classes.
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
2014-08-15 22:04:21 +00:00
Greg Clayton 39945dcc0b Missed a few places where we need to report unreadable executables.
<rdar://problem/17727734>

llvm-svn: 215743
2014-08-15 18:03:30 +00:00
Greg Clayton 5acc12550f Don't crash when specifying a core file that isn't readable.
Fixes include:
1 - added new FileSpec method: bool FileSpec::Readable()
2 - detect when an executable is not readable and give an appropriate error for:
    (lldb) file /tmp/unreadablefile
3 - detect when a core file is not readable and give an appropriate error
4 - detect when a specified core file doesn't exist and give an appropriate error
    
<rdar://problem/17727734>

llvm-svn: 215741
2014-08-15 18:00:45 +00:00
Zachary Turner 696b52878f Refactor FileAction out of ProcessLaunchInfo.
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
2014-08-14 16:01:25 +00:00