Commit Graph

662 Commits

Author SHA1 Message Date
Greg Clayton 87e36a7a08 Update the deployment target on MacOSX to be 10.8. The change is mainly to get the REG_ENHANCED stuff in regex.h and shouldn't affect other targets.
llvm-svn: 226607
2015-01-20 20:45:49 +00:00
Greg Clayton ee3626ec16 Added an Xcode target so we build the "lldb-mi" executable as part of the "desktop" and "desktop no xpc" targets.
Include paths were switched to be user include paths, if this breaks the linux build we will need to fix the Makefiles/cmake stuff.

<rdar://problem/19198581> 

llvm-svn: 226530
2015-01-20 00:04:26 +00:00
Vince Harron 5275aaa0cc Moved Args::StringToXIntYZ to StringConvert::ToXIntYZ
The refactor was motivated by some comments that Greg made
http://reviews.llvm.org/D6918

and also to break a dependency cascade that caused functions linking
in string->int conversion functions to pull in most of lldb

llvm-svn: 226199
2015-01-15 20:08:35 +00:00
Oleksiy Vyalov d5f8b6a6ca Extend PipePosix with support for named pipes/timeout-based IO and integrate it with GDBRemoteCommunication / lldb-gdbserver.
http://reviews.llvm.org/D6954

llvm-svn: 225849
2015-01-13 23:19:40 +00:00
Oleksiy Vyalov 1777c12206 Fix XCode build on OSX - add OptionValueChar.cpp
http://reviews.llvm.org/D6941

llvm-svn: 225733
2015-01-12 23:50:51 +00:00
Jason Molenda a05677126d Hoist the RegisterNumber class out of RegisterContextLLDB and make
it more generally available. 

Add checks to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite() so
that it won't try to augment an UnwindPlan that already describes
the function epilogue.

Add a test case for backtracing out of _sigtramp on Darwin systems.
This could probably be adapted to test the same thing on linux/bsd but 
the function names of sigtramp and kill are probably platform
specific and I'm not sure what they should be.

llvm-svn: 225578
2015-01-10 04:01:03 +00:00
Vince Harron 3218c0fb94 Adds UriParser::Parse and unit tests
This can be used to parse URIs passed to 'platform connect'

Differential Revision: http://reviews.llvm.org/D6858

llvm-svn: 225317
2015-01-06 23:38:24 +00:00
Zachary Turner 0b9d3eefdb Enhance the Pipe interface for better portability.
This patch makes a number of improvements to the Pipe interface.

1) An interface (PipeBase) is provided which exposes pure virtual
   methods for any implementation of Pipe to override.  While not
   strictly necessary, this helps catch errors where the interfaces
   are out of sync.

2) All methods return lldb_private::Error instead of returning bool
   or void.  This allows richer error information to be propagated
   up to LLDB.

3) A new ReadWithTimeout() method is exposed in the base class and
   implemented on Windows.

4) Support for both named and anonymous pipes is exposed through the
   base interface and implemented on Windows.  For creating a new
   pipe, both named and anonymous pipes are supported, and for
   opening an existing pipe, only named pipes are supported.

New methods described in points #3 and #4 are stubbed out on posix,
but fully implemented on Windows.  These should be implemented by
someone on the linux / mac / bsd side.

Reviewed by: Greg Clayton, Oleksiy Vyalov
Differential Revision: http://reviews.llvm.org/D6686

llvm-svn: 224442
2014-12-17 18:02:19 +00:00
Jim Ingham 5e09c8c32c Add the ability to tag one or more breakpoints with a name. These
names can then be used in place of breakpoint id's or breakpoint id 
ranges in all the commands that operate on breakpoints.

<rdar://problem/10103959>

llvm-svn: 224392
2014-12-16 23:40:14 +00:00
Jason Molenda e589e7e336 The lldb unwinder can now use the unwind information from the compact-unwind
section for x86_64 and i386 targets on Darwin systems.  Currently only the
compact unwind encoding for normal frame-using functions is supported but it
will be easy handle frameless functions when I have a bit more free time to
test it.  The LSDA and personality routines for functions are also retrieved
correctly for functions from the compact unwind section.

This new code is very fresh -- it passes the lldb testsuite and I've done
by-hand inspection of many functions and am getting correct behavior for all
of them.  There may need to be some bug fixing over the next couple weeks as
I exercise and test it further.  But I think it's fine right now so I'm
committing it.

<rdar://problem/13220837> 

llvm-svn: 223625
2014-12-08 03:09:00 +00:00
Sean Callanan 9998acd004 This is the meat of the code to add Clang modules
support to LLDB.  It includes the following:

- Changed DeclVendor to TypeVendor.
- Made the ObjCLanguageRuntime provide a DeclVendor
  rather than a TypeVendor.
- Changed the consumers of TypeVendors to use
  DeclVendors instead.
- Provided a few convenience functions on
  ClangASTContext to make that easier.

llvm-svn: 223433
2014-12-05 01:21:59 +00:00
Enrico Granata e2068207be The register keyword is deprecated in C++11, so clang complains strongly about swig generating register declarations. Abuse the preprocessor to define the keyword away
llvm-svn: 223084
2014-12-01 22:51:03 +00:00
Greg Clayton e3a73eb30f Fix the iOS build after recent inherited OTHER_LDFLAGS.
llvm-svn: 221797
2014-11-12 18:05:32 +00:00
Jason Molenda 968abb448a Update xcode project file to build new ppc files.
llvm-svn: 220947
2014-10-31 03:39:11 +00:00
Enrico Granata ca6c8ee23b Start adopting the StringPrinter API. The StringPrinter API is the new blessed way of printing strings that supports escaping non-printables, and has better handling of different UTF encodings
llvm-svn: 220894
2014-10-30 01:45:39 +00:00
Greg Clayton dc574df04f Make sure OTHER_CFLAGS and OTHER_LDFLAGS are inherited from the Xcode project so you can easily add to the flags of all targets.
llvm-svn: 220720
2014-10-27 21:14:34 +00:00
Enrico Granata e85fe3a4d1 Reorganize some of the data formatters code to simplify CXXFormattersFunction.h. Also, add a synthetic child provider for libc++'s version of std::initializer_list<T>
llvm-svn: 220421
2014-10-22 20:34:38 +00:00
Jason Molenda ecafcb867a Xcode recommended these changes to the project file. It recommended
a number of warnings to be enabled.  The one making the most noise
across the code base right now is CLANG_WARN_UNREACHABLE_CODE = YES.

llvm-svn: 219910
2014-10-16 08:04:28 +00:00
Enrico Granata 5510a5762c Add synthetic children support for NSIndexPath
llvm-svn: 219852
2014-10-15 21:38:32 +00:00
Jim Ingham ffc9f1de34 This adds a "batch mode" to lldb kinda like the gdb batch mode. It will 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
2014-10-14 01:20:07 +00:00
Kuba Brecka afdf842b3f LLDB AddressSanitizer instrumentation runtime plugin, breakpint on error and 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
2014-10-10 23:43:03 +00:00
Todd Fiala c85d6f741c Fix MacOSX Xcode build for Pipe changes.
Also cleans up the lldb Xcode project's Source > Host > posix directory
to use group-relative file naming.  Also alphabetizes file entries.

llvm-svn: 219373
2014-10-09 00:52:05 +00:00
Jason Molenda 02ad9378d7 Update xcode project file to match zach's move of connetionfiledescriptor in r219143.
llvm-svn: 219151
2014-10-06 22:15:29 +00:00
Jason Molenda 44b63298a9 Add SBExecutionContext.h to the list of headers to copy into the LLDB framework.
llvm-svn: 218850
2014-10-02 04:34:44 +00:00
Enrico Granata e85e84a769 Add a new SBExecutionContext class that wraps an ExecutionContextRef. This class is a convenient way at the API level to package a target,process,thread and frame all together - or just a subset of those
llvm-svn: 218808
2014-10-01 20:43:45 +00:00
Jim Ingham 2bdbfd50d2 This checkin is the first step in making the lldb thread stepping mechanism 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
2014-09-29 23:17:18 +00:00
Todd Fiala b3185e710e Fixup gtest layout, add Linux ThreadStateCoordinator.cpp.
This change does the following:
* Remove test/c++/...
* Add gtest.
* Add gtest/unittest directory for unittesting individual classes.
* Add an initial Plugins/Process?linux/ThreadStateCoordinatorTest.cpp.
  - currently failing a test (intentional).
  - added a bare-bones ThreadStateCoordinator.cpp to Plugins/Process/Linux,
    more soon. Just enough to prove out running gtest on Ubuntu and MacOSX.
* Added recursive make machinery so that doing a 'make' in gtest/ is
  sufficient to kick off the existing test several directories down.
  - Caveat - I currently short circuit from gtest/unittest/Makefile directly to
    the one and only gtest/unittest/Plugins/Process/Linux directory.  We'll need
    to add the intervening layers.  I haven't done this yet since to fix the
    Xcode test failure correspondence, I may need to add a python layer which
    might just handle the directory crawling.
* Added an Xcode project to the lldb workspace for gtest.
  - Runs the recursive make system in gtest/Makefile.
  - Default target is 'test'.  test and clean are supported.
  - Currently does not support test failure file/line correspondence.
    Requires a bit of text transformation to hook that up.

llvm-svn: 218460
2014-09-25 19:25:07 +00:00
Enrico Granata 2267ad442a Change the ClangASTMap implementation to use a thread-safe wrapper over llvm::DenseMap. This helps avoid a certain class of spins per <rdar://problem/18160764>
llvm-svn: 217888
2014-09-16 17:28:40 +00:00
Enrico Granata 13460a59fd Add a ProcessStructReader utility class to LLDB
The purpose of a ProcessStructReader is to allow intelligent reading of data from the underlying process
Traditionally, the way this has been handled is to have a load_address and shuffle it around, and use Process::ReadMemory()-kind APIs

With a ProcessStructReader one can define a clang type that matches exactly the definition of the thing they are trying to ingest from the inferior process, and then just point LLDB at where the data is
Since this work is done in terms of clang types, one can honor packed/aligned attributes, sizes of types on the inferior architecture, and similar tricky caveats without having to hardcode them

llvm-svn: 217644
2014-09-11 23:09:55 +00:00
Zachary Turner f5e4f37cb6 Update HostProcess to use the same facade pattern as HostThread.
llvm-svn: 217632
2014-09-11 22:22:16 +00:00
Jim Ingham 77fd738f58 Rework how resetting breakpoints in changed modules works. Try to match up old
locations with new ones if possible.

Next up some test cases...

llvm-svn: 217551
2014-09-10 21:40:47 +00:00
Zachary Turner 39de311071 Create a HostThread abstraction.
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
2014-09-09 20:54:56 +00:00
Kuba Brecka a5ea1e2b6c Expose ThreadCollection in SB API
Reviewed at
http://reviews.llvm.org/D5218
and
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140901/012828.html

llvm-svn: 217296
2014-09-06 01:21:19 +00:00
Enrico Granata c582713ce6 Introduce the notion of a "type validator" formatter
Type Validators have the purpose of looking at a ValueObject, and making sure that there is nothing semantically wrong about the object's contents
For instance, if you have a class that represents a speed, the validator might trigger if the speed value is greater than the speed of light

This first patch hooks up the moving parts in the formatters subsystem, but does not link ValueObjects to TypeValidators, nor lets the SB API be exposed to validators
It also lacks the notion of Python validators

llvm-svn: 217277
2014-09-05 20:45:07 +00:00
Kuba Brecka e4d4801c3a [lldb] Abstract a superclass for a generic thread container.
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
2014-09-05 19:13:15 +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
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
Zachary Turner 58a559c07e Update LLDB to use LLVM's DynamicLibrary.
LLDB had implemented its own DynamicLibrary class for plugin
support.  LLVM has an equivalent mechanism, so this patch deletes
the duplicated code in LLDB and updates LLDB to reference the
mechanism provided by LLVM.

llvm-svn: 216606
2014-08-27 20:15:09 +00:00
Sean Callanan 62e9fb9727 Fixed a problem where IOObject was wrongly
capitalized.

llvm-svn: 216308
2014-08-23 00:46:02 +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
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
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
Jason Molenda f0e4c5e32b Fix dependency ordering for the xpc file installs.
llvm-svn: 215771
2014-08-15 21:38:13 +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
Han Ming Ong 70d8170711 <rdar://problem/18001677>
Use the right mechanism to put the XPC services now that Xcode supports the workflow.

llvm-svn: 215596
2014-08-13 22:44:37 +00:00
Enrico Granata a02d625513 Add a StringLexer utility class that can be used when you have string data that needs to be parsed - I don't think such a general purpose facility is part of LLVM, and I am going to need this, so just add it to lldb_utility
llvm-svn: 215133
2014-08-07 19:22:14 +00:00
Zachary Turner 98688922b7 Creates a socket host object.
This patch moves the logic of many common socket operations into
its own class lldb_private::Socket.  It then modifies the
ConnectionFileDescriptor class, and a few users of that class,
to use this new Socket class instead of hardcoding socket logic
directly.

Finally, this patch creates a common interface called IOObject for
any objects that support reading and writing, so that endpoints
such as sockets and files can be treated the same.

Differential Revision: http://reviews.llvm.org/D4641

Reviewed by: Todd Fiala, Greg Clayton

llvm-svn: 214984
2014-08-06 18:16:26 +00:00
Kate Stone e2b2186652 Dramatically improves C++ demangling performance by introducing a new implementation that is much faster than the existing demangler. While not yet complete, the new demangler will fail gracefully when it encounters symbols it isn’t prepared to deal with. In these cases LLDB will fall back to using the full demangler to prevent a loss in functionality. On sizable code bases the fast path succeeds 95% of the time, providing a significant net win.
The new implementation is located in source/Core/FastDemangle.cpp.  It’s fairly straightforward C code with a few basic C++ extensions.  It should compile with little or no change on a variety of platforms, but of course it is still only useful for symbols that comply with the Itanium ABI mangling spec (plus a few Clang extensions.)

<rdar://problem/15397553> <rdar://problem/15794867>

llvm-svn: 213671
2014-07-22 17:03:38 +00:00