Commit Graph

5758 Commits

Author SHA1 Message Date
Greg Clayton 0d8400c89c Change back all paths returns for lldb::PathType enumerations from HostInfo::GetLLDBPath() to return the directories in the FileSpec.m_directory field to match previous implementations. This change previously broke some path stuff in upstream branches.
llvm-svn: 216398
2014-08-25 18:21:06 +00:00
Keno Fischer 5777edf05c Resurect preprocessor definitions that got lost moving to HostInfo
When building without XCode on sytems where these constants are
not in the system header (or I presume with older versions of XCode),
these are needed to make this file compile, since unlike most other
uses of MachO specific constants, these use the system headers
rather than the LLVM-defined ones.

llvm-svn: 216332
2014-08-23 21:40:29 +00:00
Enrico Granata 9f1d33637e I forgot to include the header file for std::find, and that's breaking the Linux build. Push a fix out. Patch suggested by Paul Osmialowski and Randy Smith
llvm-svn: 216323
2014-08-23 18:22:09 +00:00
Sean Callanan 0de7ecd346 Initialize LLVM when LLDB is initialized, and
install a crash handler.

<rdar://problem/18083226>

llvm-svn: 216309
2014-08-23 00:47:22 +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
Enrico Granata 3ee335a762 Fix a couple of potential issues in the lexer where we were ignoring the putback data
llvm-svn: 216304
2014-08-23 00:11:38 +00:00
Zachary Turner cfe910b9d4 Fix a CMake error when using CMake 3.0.1
llvm-svn: 216286
2014-08-22 20:44:55 +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 fb700b58cc Bump the verison number in the xcode project files.
llvm-svn: 216245
2014-08-21 23:27:02 +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 a21fee0ee4 Move the rest of the HostInfo functions over.
This should bring HostInfo up to 99% completion.  The remainder
of code in Host will be split into instantiatable classes
representing host processes, threads, dynamic libraries, and
process launching strategies.

llvm-svn: 216230
2014-08-21 21:49:24 +00:00
Zachary Turner e47ffc3b42 Fix compile error on Linux due to previous commit.
llvm-svn: 216227
2014-08-21 21:02:47 +00:00
Zachary Turner b245ecac79 Move GetUsername and GetGroupname to HostInfoPosix
llvm-svn: 216210
2014-08-21 20:02:17 +00:00
Zachary Turner 673b6e4f3a Convert static constructors to be explicitly initialized at startup
llvm-svn: 216197
2014-08-21 17:57:03 +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 4262828132 Fix on Linux for ReadThread lingering after inferior exits
See this email thread:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140818/012487.html

This patch handles the case where the inferior process exits but leaves the ReadThread in a continuous loop reading from the communication pipe.  On MacOSX, the ReadThread exits when it receives a 0 return value from the read due to EOF.  On Linux the read returns -1 and sets errno to EIO error, this does not currently cause the thread to shutdown so it continues to read from the comm.   In Communication::ReadThread I added a handler for eConnectionStatusError to disconnect and shutdown the thread.

Change by Alex Pepper.

llvm-svn: 216194
2014-08-21 17:16:26 +00:00
Sean Callanan 7050e0b194 Fixed a typo.
<rdar://problem/18084105>

llvm-svn: 216189
2014-08-21 16:47:01 +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
Zachary Turner 75172a9567 Revert "Avoid global contstructors and place static variables
inside classes as static local variables and remove the static
ivars. Subclasses should use the accessor functions."

This change moved global statics to function local statics, but
forgot to make the locals static in the function, breaking all
platforms.  Furthermore, MSVC doesn't support thread-safe function
local statics, so any use of a function local static on non
primitive types is undefined behavior on MSVC.

Reverting due to the fact that it's broken on all platforms, but
would like to have a discussion about the thread-safety issue
before it goes back in.

llvm-svn: 216123
2014-08-20 20:53:05 +00:00
Greg Clayton b0cc53cf97 If an executable file is specified with no architecture and it contains more 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
2014-08-20 18:13:03 +00:00
Greg Clayton 051fd7cc10 Avoid global contstructors and place static variables inside classes as static local variables and remove the static ivars. Subclasses should use the accessor functions.
llvm-svn: 216080
2014-08-20 17:00:21 +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 a3c8f042cd Add an accessor to ValueObject that determines if the object represents a base class, and also returns the depth of base-class-ness. For instance if one has class C : public B {} class B : public A {}, the value for A nested in B nested in C would be a base class of depth 2
llvm-svn: 216032
2014-08-19 22:29:08 +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
Enrico Granata ecd02bc136 Refactor the hardcoded formatters facility to use sequences of lambdas - still no feature change as none are present now, but this feels cleaner. Also, hardcoded formatters do not need to be per-type, so disable caching thereof
llvm-svn: 216004
2014-08-19 18:47:58 +00:00
Zachary Turner c4a4110deb Add includes needed for FreeBSD.
llvm-svn: 216000
2014-08-19 18:38:53 +00:00
Todd Fiala 5163792b7b Adjust process launch --disable-aslr to take true/false value.
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
2014-08-19 17:40:43 +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
Sylvestre Ledru 802a353065 Buffer not null terminated CID 1094354
llvm-svn: 215976
2014-08-19 12:13:14 +00:00
Rafael Espindola 7c03d95725 Update for llvm api change.
llvm-svn: 215969
2014-08-19 04:27:03 +00:00
Greg Clayton 994740fb1a Don't search for module resources at all if the setting is set to "false".
llvm-svn: 215936
2014-08-18 21:08:44 +00:00
Zachary Turner 3ffabc2bce Fix an issue with source file groupings in the CMake build.
llvm-svn: 215901
2014-08-18 16:47:33 +00:00
Sylvestre Ledru 1c9e0646b9 add missing break. Fix CID 1229446 & 1203680
llvm-svn: 215894
2014-08-18 14:53:42 +00:00
Sylvestre Ledru 75f11ebfb3 Fix the missleading indentation. Fix CID 1096332
llvm-svn: 215893
2014-08-18 14:50:34 +00:00
Sylvestre Ledru ca902e81ed Fix the missleading indentation. Fix CID 1096300
llvm-svn: 215892
2014-08-18 14:48:24 +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 781a7b04f2 Enable the data formatter for std::vector<bool> on libc++ again. In recent clang builds, we are vended a different typename, which the formatter needs to match against.
llvm-svn: 215801
2014-08-16 01:02:36 +00:00
Enrico Granata e4a4f5d5ba When attempting to print function names with arguments in frame formatting, attempt to detect templated functions, and replace the argument list with values outside the template marking. Turns C::f<(this=0x00007fff5fbffb70, x=2, y=1)0>(int, int) into C::f<(C::V)0>(this=0x00007fff5fbffb70, x=2, y=1), which definitely looks more like the real thing. Fixes rdar://14882237
llvm-svn: 215800
2014-08-16 00:56:04 +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 4ec5d0d0e1 In the CMake build, convert lldbHost to be a single static library.
Previously lldbHost was built as multiple static libraries such as
lldbHostCommon, lldbHostLinux, etc.  With this patch, the CMake
build produces only a single static library, lldbHost, whose file
set is dynamically created based on the platform.

llvm-svn: 215792
2014-08-15 23:50:36 +00:00
Enrico Granata e8bf749653 Add functions to ClangASTContext to get integer types of a given byte size
llvm-svn: 215783
2014-08-15 23:00:02 +00:00
Zachary Turner 3c19a6ac48 Try to fix the Make build
llvm-svn: 215782
2014-08-15 22:50:48 +00:00
Eric Christopher 29ebb01201 Remove another of the llvm given warnings from the list of
warnings we compile with because of SWIG generated code.

llvm-svn: 215778
2014-08-15 22:23:40 +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