Commit Graph

1299 Commits

Author SHA1 Message Date
Chris Bieneman fd2f0cb170 [CMake] Final dependency cleanup patch!
Summary:
This patch removes the over-specified dependencies from LLDBDependencies and instead relies on the dependencies as expressed in each library and tool.

This also removes the library looping in favor of allowing CMake to do its thing. I've tested this patch on Darwin, and found no issues, but since linker semantics vary by system I'll also work on testing it on other platforms too.

Help testing would be greatly appreciated.

Reviewers: labath, zturner

Subscribers: danalbert, srhines, mgorny, jgosnell, lldb-commits

Differential Revision: https://reviews.llvm.org/D29352

llvm-svn: 294515
2017-02-08 21:00:46 +00:00
Pavel Labath e8a7b9841c Remove the verbose category in the gdb-remote channel
replace by LLDB_LOGV

llvm-svn: 294224
2017-02-06 19:31:09 +00:00
Pavel Labath 60199c1a4d Fix darwin build (llvm::once_flag fallout)
llvm-svn: 294221
2017-02-06 19:30:59 +00:00
Kamil Rytarowski c5f28e2a05 Switch std::call_once to llvm::call_once
Summary:
The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms.

This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, emaste, mehdi_amini, clayborg

Reviewed By: labath, clayborg

Subscribers: #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D29288

llvm-svn: 294202
2017-02-06 17:55:02 +00:00
Zachary Turner bf9a77305f Move classes from Core -> Utility.
This moves the following classes from Core -> Utility.

ConstString
Error
RegularExpression
Stream
StreamString

The goal here is to get lldbUtility into a state where it has
no dependendencies except on itself and LLVM, so it can be the
starting point at which to start untangling LLDB's dependencies.
These are all low level and very widely used classes, and
previously lldbUtility had dependencies up to lldbCore in order
to use these classes.  So moving then down to lldbUtility makes
sense from both the short term and long term perspective in
solving this problem.

Differential Revision: https://reviews.llvm.org/D29427

llvm-svn: 293941
2017-02-02 21:39:50 +00:00
Pavel Labath 5569c0b953 [cmake] Remove VERSION property from executable targets
Summary:
Currently, in the default configuration, the "install" target will
install all llvm executables unversioned, except for three lldb tools
which will be installed versioned (with a non-versioned symlink). This
rectifies that situation.

Reviewers: beanz, sylvestre.ledru, mgorny

Subscribers: ki.stfu, lldb-commits

Differential Revision: https://reviews.llvm.org/D29126

llvm-svn: 293803
2017-02-01 19:12:22 +00:00
Kamil Rytarowski b5bc933c29 Do not pass non-POD type variables through variadic function
Summary:
Cannot pass object of non-POD type 'const CMIUtilString' through variadic function.

This behavior is undefined according to C++11 5.2.2/7:

> Passing a potentially-evaluated argument of class type having a non-trivial copy constructor, a non-trivial move contructor, or a non-trivial destructor, with no corresponding parameter, is conditionally-supported with implementation-defined semantics.

Replace SetErrorDescriptionn(errMsg); with SetErrorDescription(errMsg);

Original patch by Tobias Nygren (NetBSD).

Sponsored by <The NetBSD Foundation>


Reviewers: clayborg, labath, emaste, joerg, ki.stfu

Reviewed By: labath, ki.stfu

Subscribers: tnn, ki.stfu, #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D29256

llvm-svn: 293774
2017-02-01 16:02:55 +00:00
Ismail Donmez 79d58a39d1 Fix missing include after r293660
llvm-svn: 293767
2017-02-01 13:33:50 +00:00
Chris Bieneman c4f9920bd4 [CMake] Partial revert of r293686
This change reverts the lldb-server part of r293686, which is having trouble on Linux bots. I'm not sure if I can make lldb-server work correctly until the full dependency graph is fixed.

llvm-svn: 293690
2017-01-31 21:12:52 +00:00
Chris Bieneman 494f277af5 [CMake] Add accurate dependency specifications
Summary:
This patch adds accurate dependency specifications to the mail LLDB libraries and tools.

In all cases except lldb-server, these dependencies are added in addition to existing dependencies (making this low risk), and I performed some code cleanup along the way.

For lldb-server I've cleaned up the LLVM dependencies down to just the minimum actually required. This is more than lldb-server actually directly references, and I've left a todo in the code to clean that up.

Reviewers: labath, zturner

Subscribers: lldb-commits, danalbert, srhines, ki.stfu, mgorny, jgosnell

Differential Revision: https://reviews.llvm.org/D29333

llvm-svn: 293686
2017-01-31 20:43:05 +00:00
Valentina Giusti c0eeee7a78 Add a command to access and manipulate the Intel(R) MPX Boundary Tables.
Summary:
The Boundary Table Entries are stored in the application memory and allow
to store boundary info for all the pointers of the program, also those that
otherwise wouldn't fit in the 4 bound registers provided by the HW.

Here is an example of how it works:
 * mpx-table show <pointer>
        lbound = 0x..., ubound = 0x..., (pointer value = 0x..., metadata = 0x...)
 * mpx-table set <pointer>

Signed-off-by: Valentina Giusti <valentina.giusti@intel.com>

Reviewers: labath, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D29078

llvm-svn: 293660
2017-01-31 18:02:54 +00:00
Sean Callanan 1912d9633f Removed an unneccesary #if now that debugserver-mini links Foundation.
llvm-svn: 293161
2017-01-26 08:51:32 +00:00
Jason Molenda 728c290daf Add Foundation to the debugserver-mini dependencies;
debugserver-mini can use Foundation.

llvm-svn: 293140
2017-01-26 02:27:35 +00:00
Jason Molenda 891c777f90 Instead of weak-linking against LoggingSupport framework (which
requires that this private framework be available - and it is not
available earlier than macOS 10.12 - to build lldb), dlopen the
framework binary on demand in debugserver.  We're already using
dlsym() to look up all the symbols so there is no need to use weak
linking here.

<rdar://problem/30158797> 

llvm-svn: 293135
2017-01-26 02:13:43 +00:00
Sean Callanan 9ea2835704 Link debugserver against Foundation to get access to NSProcessInfo.
debugserver-mini can't use Foundation so disable that code there. 

llvm-svn: 293098
2017-01-25 21:32:00 +00:00
Sean Callanan 60370e375a Reverted 292880 to fix a linker error.
<rdar://problem/30180883>

llvm-svn: 293022
2017-01-25 05:39:14 +00:00
Sean Callanan 95a6e6f6a6 Conditionalized OsLogger.cpp on a modern SDK.
llvm-svn: 293020
2017-01-25 05:18:32 +00:00
Jason Molenda 3ca38564cb Fix the last commit; compression was being enabled on mac native
which led to

ERROR: test_auxv_chunked_reads_work_debugserver (tools/lldb-server/TestGdbRemoteAuxvSupport.py)
ERROR: test_auxv_data_is_correct_size_debugserver (tools/lldb-server/TestGdbRemoteAuxvSupport.py)
ERROR: test_auxv_keys_look_valid_debugserver (tools/lldb-server/TestGdbRemoteAuxvSupport.py)
ERROR: test_qSupported_returns_known_stub_features_debugserver (tools/lldb-server/TestLldbGdbServer.py)

failures because debugserver was advertising compression being available, e.g.

send packet: $qSupported:xmlRegisters=i386,arm,mips#12
read packet: $qXfer:features:read+;PacketSize=20000;qEcho+;SupportedCompressions=zlib-deflate;DefaultCompressionMinSize=384#00

maybe these tests should be a little more accepting of additional
features.  but I didn't mean for this to be enabled on mac native.

llvm-svn: 292890
2017-01-24 06:09:06 +00:00
Jason Molenda 5a6826ebc4 Enable compression capability in debugserver for all of ios/watchos/tvos
environments.

<rdar://problem/30159019> 

llvm-svn: 292882
2017-01-24 04:43:40 +00:00
Jason Molenda 4f27ffb138 weak-link debugserver against the LoggingSupport framework;
systems without this framework will not get a link error.

<rdar://problem/30158797> 

llvm-svn: 292880
2017-01-24 04:16:03 +00:00
Pavel Labath 107d9bbd6c Add a more succinct logging syntax
This adds the LLDB_LOG macro, which enables one to write more succinct log
statements.
if (log)
  log->Printf("log something: %d", var);
becomes
LLDB_LOG(log, "log something: {0}, var);

The macro still internally does the "if(log)" dance, so the arguments are only
evaluated if logging is enabled, meaning it has the same overhead as the
previous syntax.

Additionally, the log statements will be automatically prefixed with the file
and function generating the log (if the corresponding new argument to the "log
enable" command is enabled), so one does not need to manually specify this in
the log statement.

It also uses the new llvm formatv syntax, which means we don't have to worry
about PRIx64 macros and similar, and we can log complex object (llvm::StringRef,
lldb_private::Error, ...) more easily.

Differential Revision: https://reviews.llvm.org/D27459

llvm-svn: 292360
2017-01-18 11:00:26 +00:00
Pavel Labath e5cfc67113 [cmake] Make lldb build with the android ndk toolchain file
Summary:
The NDK cmake toolchain file defines CMAKE_SYSTEM_NAME=Android, so switch the
build to use that. I have also updated the in-tree toolchain file to do that
(instead of defining __ANDROID_NDK__), so it can still be used to build.
After migrating the last bits of non-toolchainy bits out of the in-tree
toolchain, I intend to delete it.

Reviewers: tberghammer, danalbert

Subscribers: srhines, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D28775

llvm-svn: 292212
2017-01-17 11:55:00 +00:00
Pavel Labath e92b965bbf [cmake] Fix LLVM_LINK_LLVM_DYLIB build, again
The llvm_config hack for lldb-server is only necessary for !DYLIB builds, as
otherwise we would get unresolved symbols from lldb libraries which do not track
their dependencies correctly (all of them). In a DYLIB build, the so will
already be added to the link dependencies and we can use that to resolve all
missing symbols.

The proper fix for this would be to have each lldb library track its
dependencies correctly.

llvm-svn: 291555
2017-01-10 09:40:38 +00:00
Pavel Labath c523c38fcc Another windows build fix
llvm-svn: 291234
2017-01-06 13:07:09 +00:00
David Blaikie a77ec68e50 Revert part of cleanup to fix a build break
Wasn't sure I could include ErrorHandling.h here, and evidently I wasn't
building this part (must've made the change using sed after getting
tired of fixing each compilation error individually).

llvm-svn: 291204
2017-01-06 01:42:56 +00:00
David Blaikie a322f36cfd Make lldb -Werror clean for -Wstring-conversion
Also found/fixed one bug identified by this warning in
RenderScriptx86ABIFixups.cpp where a string literal was being used in an
effort to provide a name for an instruction/register, but was instead
being passed as the bool 'isVolatile' parameter.

llvm-svn: 291198
2017-01-06 00:38:06 +00:00
Hafiz Abid Qadeer 5e9bfc671b [lldb-mi] Fix implementation for a few mi commands
Summary:
Some of the mi commands implemented in lldb-mi are incomplete/not confirming to the spec.
- `gdb-show` and `gdb-set` doesn't support getting/setting `disassembly-flavor`
- `environment-cd` should also change the working directory for inferior
- debugger CLI output should be printed as console-stream-output record, rather than being dumped directly
to stdout
- `target-select` should provide inner error message in mi response

Related bug report:
- https://llvm.org/bugs/show_bug.cgi?id=28026
- https://llvm.org/bugs/show_bug.cgi?id=28718
- https://llvm.org/bugs/show_bug.cgi?id=30265

Reviewers: ki.stfu, abidh

Subscribers: abidh, ki.stfu, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D24711

llvm-svn: 291104
2017-01-05 13:23:47 +00:00
Greg Clayton 02f74b0861 Quiet a warning where we weren't checking if this was the same and rhs.
llvm-svn: 290687
2016-12-28 21:19:42 +00:00
Jason Molenda 97c96cb4ed Change the timeout in CallBoardSystemServiceOpenApplication to
30 seconds to match the old springboard timeout; the launcher
should time out before that and we will hopefully get back
an informative error message instead of timing out ourselves.

llvm-svn: 290163
2016-12-20 04:54:04 +00:00
Hafiz Abid Qadeer 95cc3456e8 Remove an unused type declaration.
llvm-svn: 289947
2016-12-16 14:44:34 +00:00
Chris Bieneman d69b9414b3 [CMake] Refactor LLDB libraries and tools to be components
In LLVM's CMake we have a convention that components have both a build and an install target. Making LLDB follow this convention will allow LLDB to take advantage of the LLVM_DISTRIBUTION_COMPONENTS build option from LLVM.

llvm-svn: 289879
2016-12-15 22:01:17 +00:00
Hafiz Abid Qadeer f6ee79c926 Fix build for mingw.
Summary: I was building lldb using cross mingw-w64 toolchain on Linux and observed some issues. This is first patch in the series to fix that build. It mostly corrects the case of include files and adjusts some #ifdefs from _MSC_VER to _WIN32 and vice versa. I built lldb on windows with VS after applying this patch to make sure it does not break the build there.

Reviewers: zturner, labath, abidh

Subscribers: ki.stfu, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D27759

llvm-svn: 289821
2016-12-15 15:00:41 +00:00
Jason Molenda b2979d8464 Increase timeout for Frontboard app launch request from 9 to 20 seconds
to match other timeouts.

llvm-svn: 289023
2016-12-08 05:12:45 +00:00
Pavel Labath 7a6252158e Clean up some use of __ANDROID_NDK__ in the cmake files
Rationale:
scripts/Python/modules: android is excluded at a higher level, so no point in
  checking here
tools/lldb-mi: lldb-mi builds fine (with some cosmetic tweaks) on android, and
  there is no reason it shouldn't.
tools/lldb-server: LLDB_DISABLE_LIBEDIT/CURSES already take the platform into
  account, so there is no point in checking again.

I am reasonably confident this should not break the build on any platform, but
I'll keep an eye out on the bots.

llvm-svn: 288661
2016-12-05 11:15:36 +00:00
Pavel Labath e705c8b5e6 Replace __ANDROID_NDK__ with __ANDROID__
Summary:
This replaces all the uses of the __ANDROID_NDK__ define with __ANDROID__. This
is a preparatory step to remove our custom android toolchain file and rely on
the standard android NDK one instead, which does not provide this define.
Instead I rely, on __ANDROID__, which is set by the compiler.

I haven't yet removed the cmake variable with the same name, as we will need to
do something completely different there -- NDK toolchain defines
CMAKE_SYSTEM_NAME to Android, while our current one pretends it's linux.

Reviewers: tberghammer, zturner

Subscribers: danalbert, srhines, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D27305

llvm-svn: 288494
2016-12-02 11:15:15 +00:00
Pavel Labath 6d2497d48f Remove a spurious reference to ProcessElfCore
We were referencing a the process class from a register context, which seems
intuitively wrong. Also, the comment above that code is now definitely incorrect,
as ProcessElfCore now does support floating point registers. Also, the code
wasn't really doing anything, as it was just skipping a zero-initialization of a
field that was most likely zero-initialized anyway. Linux elf core FPR test still
passes after this.

llvm-svn: 288237
2016-11-30 10:25:02 +00:00
Pavel Labath 79fcd41418 Add back some of the previous lldb-server dependencies
It seems a debug build of lldb-server will not complete without these, as the
linker is not able to strip out code that aggressively. Add those back until I
can figure out how to break the dependency chains.

llvm-svn: 288181
2016-11-29 18:38:09 +00:00
Pavel Labath 14ae501e6e Remove some OS-specific plugins from lldb-server dependencies
I don't believe the code in those plugins could be in any way useful for
lldb-server, but I can't be sure if this will break some transitive dependencies.
Builtbots should be able to tell us that.

llvm-svn: 288169
2016-11-29 17:45:25 +00:00
Pavel Labath 16ff4b630d Remove assorted other plugins which are not needed by lldb-server
language runtime, structured data, sanitizers, process plugins.

llvm-svn: 288166
2016-11-29 17:21:18 +00:00
Pavel Labath 2dfeb6e3c2 Remove dynamic loader, platform and ABI plugins from lldb-server dependencies
These packages are not used on the server.

llvm-svn: 288164
2016-11-29 17:06:26 +00:00
Pavel Labath 393982ef0c Specify the dependencies of lldb-server manually
Summary:
This basically just inlines the LLDBDependencies.cmake file into lldb-server
CMakeLists.txt. The reason is that most of these dependencies are not actually
necessary for lldb-server (some of them can't be removed because of
cross-dependencies, but most of the plugins can). I intend to start cleaning
these up in follow-up commits, but I want to do this first, so the subsequent
ones can be easily reverted if they don't build in some configurations.

When I cleaned these up locally, I was able to get a 30%--50% improvement in
lldb-server size.

Reviewers: zturner, beanz, tfiala

Subscribers: danalbert, srhines, lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D26975

llvm-svn: 288159
2016-11-29 16:40:57 +00:00
Pavel Labath 1eff73c324 Introduce chrono to more gdb-remote functions
Summary:
This replaces the usage of raw integers with duration classes in the gdb-remote
packet management functions. The values are still converted back to integers once
they go into the generic Communication class -- that I am leaving to a separate
change.

The changes are mostly straight-forward (*), the only tricky part was
representation of infinite timeouts.

Currently, we use UINT32_MAX to denote infinite timeout. This is not well suited
for duration classes, as they tend to do arithmetic on the values, and the
identity of the MAX value can easily get lost (e.g.
microseconds(seconds(UINT32_MAX)).count() != UINT32_MAX). We cannot use zero to
represent infinity (as Listener classes do) because we already use it to do
non-blocking polling reads. For this reason, I chose to have an explicit value
for infinity.

The way I achieved that is via llvm::Optional, and I think it reads quite
natural. Passing llvm::None as "timeout" means "no timeout", while passing zero
means "poll". The only tricky part is this breaks implicit conversions (seconds
are implicitly convertible to microseconds, but Optional<seconds> cannot be
easily converted into Optional<microseconds>). For this reason I added a special
class Timeout, inheriting from Optional, and enabling the necessary conversions
one would normally expect.

(*) The other tricky part was GDBRemoteCommunication::PopPacketFromQueue, which
was needlessly complicated. I've simplified it, but that one is only used in
non-stop mode, and so is untested.

Reviewers: clayborg, zturner, jingham

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D26971

llvm-svn: 287864
2016-11-24 10:54:49 +00:00
Omair Javaid 6a44ea8c0a Fix remote-linux regression due to stringRef changes
This is to fix a regression in remote-linux lldb-server connections.

We were wrongly passing a copy of uri and expecting a stringRef back.

llvm-svn: 287542
2016-11-21 15:18:58 +00:00
Zachary Turner f2e0d384e1 Fix one more build error with lldb-server.
llvm-svn: 287212
2016-11-17 06:13:54 +00:00
Zachary Turner c156427ded Don't allow direct access to StreamString's internal buffer.
This is a large API change that removes the two functions from
StreamString that return a std::string& and a const std::string&,
and instead provide one function which returns a StringRef.

Direct access to the underlying buffer violates the concept of
a "stream" which is intended to provide forward only access,
and makes porting to llvm::raw_ostream more difficult in the
future.

Differential Revision: https://reviews.llvm.org/D26698

llvm-svn: 287152
2016-11-16 21:15:24 +00:00
Mehdi Amini c1edf566b9 Prevent at compile time converting from Error::success() to Expected<T>
This would trigger an assertion at runtime otherwise.

Differential Revision: https://reviews.llvm.org/D26482

llvm-svn: 286562
2016-11-11 04:29:25 +00:00
Mehdi Amini 41af43092c Make the Error class constructor protected
This is forcing to use Error::success(), which is in a wide majority
of cases a lot more readable.

Differential Revision: https://reviews.llvm.org/D26481

llvm-svn: 286561
2016-11-11 04:28:40 +00:00
Pavel Labath 3aa330f98a Link lldb-mi only to the llvm components it uses
Summary:
liblldb does not re-export the llvm library contained within, so lldb-mi needs to
manage its own dependencies. Right now it only uses the llvm support library.

Reviewers: beanz, zturner, tfiala, clayborg, abidh

Subscribers: ki.stfu, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D26190

llvm-svn: 285894
2016-11-03 10:52:17 +00:00
Malcolm Parsons 771ef6d4f1 Fix Clang-tidy readability-redundant-string-cstr warnings
Reviewers: zturner, labath

Subscribers: tberghammer, danalbert, lldb-commits
    
Differential Revision: https://reviews.llvm.org/D26233

llvm-svn: 285855
2016-11-02 20:34:10 +00:00
Chris Bieneman 91967bd301 [CMake] Rename lldb-launcher to darwin-debug
Summary: This tool is only built on Darwin, and the name darwin-debug matches the Xcode project. We should have this in sync unless there is a good reason not to.

Reviewers: zturner, tfiala, labath

Subscribers: labath, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D25745

llvm-svn: 285356
2016-10-27 22:51:41 +00:00
Pavel Labath 3318642466 Fixup r284466 - try to unbreak NetBSD
NetBSD does not have getopt as well - we need to apply the workaround there too.
FreeBSD seems to be fine though.

llvm-svn: 284469
2016-10-18 10:46:45 +00:00
Pavel Labath 01a955a341 [cmake] Make dependencies of lldb libraries private, take 2
Summary:
The dependencies of our libraries (only liblldb, really) we marked as public, which caused all
their dependencies to be repeated when linking any executables to them. This is a problem because
then all the .a files could end up being linked twice, once to liblldb and once
again to to the executable linking against liblldb (lldb, lldb-mi). As it turns out,
our build actually depends on this behavior:
- on windows, lldb does not have getopt, so it pulls it from inside liblldb, even
  though getopt is not a part of the exported interface of liblldb (maybe some of
  the bsd variants have this problem as well)
- lldb-mi uses llvm, which again is not exported by liblldb

This change does not actually fix these problems (that is going to be a hard
one), but it does make them explicit by moving this magic from add_lldb_library
to the places the executable targets are defined. That way, I can link the
additional .a files only on targets that really need it, and the other targets
can build cleanly and make sure we don't regress further. It also fixes the
LLVM_LINK_LLVM_DYLIB build on linux.

Reviewers: zturner, beanz

Subscribers: ki.stfu, lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D25680

llvm-svn: 284466
2016-10-18 10:26:57 +00:00
Vadim Macagon 4b7bb3cc96 [LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class
Summary:
Placeholder c-strings don't need to be instance variables.

Reviewers: ki.stfu, abidh

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D25592

llvm-svn: 284231
2016-10-14 12:58:02 +00:00
Zachary Turner 5a8ad4591b Make lldb -Werror clean on Windows.
Differential Revision: https://reviews.llvm.org/D25247

llvm-svn: 283344
2016-10-05 17:07:34 +00:00
Greg Clayton 7ae1a67ed9 Add the ability for the task port to change when a process execs.
<rdar://problem/28476369>

llvm-svn: 282632
2016-09-28 21:07:34 +00:00
Ilia K a3174853b7 Fix parsing expressions to evaluate with spaces and optional args (MI)
Summary:
When extracting options for long options (starting with `--`), the use of
`MIUtilString::SplitConsiderQuotes` to split all the arguments was being
conditioned on the option type to be expected. This was wrong as this caused
other options to be parsed incorrectly since it was not taking into account the
presence of quotes.

Patch by Ed Munoz <edmunoz@microsoft.com>

Reviewers: edmunoz, ki.stfu

Subscribers: ki.stfu, lldb-commits

Projects: #lldb

Differential Revision: https://reviews.llvm.org/D24202

llvm-svn: 282135
2016-09-22 05:08:41 +00:00
Ed Maste 2ce823d0d8 Fix typo in lldb --help
Patch by Yacine Belkadi

Differential Revision:	https://reviews.llvm.org/D12158

llvm-svn: 282123
2016-09-21 23:30:36 +00:00
Chris Bieneman d3199f5ed2 [CMake] Initial support for LLDB.framework
Summary:
This patch adds a CMake option LLDB_BUILD_FRAMEWORK, which builds libLLDB as a macOS framework instead of as a *nix shared library.

With this patch any LLDB executable that has the INCLUDE_IN_FRAMEWORK option set will be built into the Framework's resources directory, and a symlink to the exeuctable will be placed under the build directory's bin folder. Creating the symlinks allows users to run commands from the build directory without altering the workflow.

The framework generated by this patch passes the LLDB test suite, but has not been tested beyond that. It is not expected to be fully ready to ship, but it is a first step.

With this patch binaries that are placed inside the framework aren't being properly installed. Fixing that would increase the patch size significantly, so I'd like to do that in a follow-up.

Reviewers: zturner, tfiala

Subscribers: beanz, lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D24749

llvm-svn: 282110
2016-09-21 21:02:16 +00:00
Pavel Labath df91b2fea8 Remove MIUtilParse (no longer used)
Summary: follow-up to https://reviews.llvm.org/D23882

Reviewers: dawn, krytarowski, labath, ki.stfu

Subscribers: beanz, mgorny, labath, ki.stfu, lldb-commits

Differential Revision: https://reviews.llvm.org/D23883
Author: Michał Górny <mgorny@gentoo.org>

llvm-svn: 281317
2016-09-13 10:39:12 +00:00
Todd Fiala d207c678d7 fix Xcode build after r281226
llvm-svn: 281243
2016-09-12 18:49:22 +00:00
Pavel Labath 72090c2162 Move StdStringExtractor to tools/debugserver
The class is only used in the debugserver. The rest of lldb has the StringExtractor class.

Xcode project will need to be updated after this.

llvm-svn: 281226
2016-09-12 16:13:05 +00:00
Ilia K 94df34f72d Add MiSyntaxTestCase.test_lldbmi_output_grammar test (MI)
Summary: This patch adds a new test and fixes extra new-line before exit

Reviewers: abidh

Subscribers: ki.stfu, dawn, lldb-commits, abidh

Differential Revision: https://reviews.llvm.org/D9740

llvm-svn: 281199
2016-09-12 07:14:51 +00:00
Kate Stone b9c1b51e45 *** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style.  This kind of mass change has
*** two obvious implications:

Firstly, merging this particular commit into a downstream fork may be a huge
effort.  Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit.  The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):

    find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
    find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;

The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.

Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit.  There are alternatives available that will attempt
to look through this change and find the appropriate prior commit.  YMMV.

llvm-svn: 280751
2016-09-06 20:57:50 +00:00
Pavel Labath 305229bd72 Replace uses of MIUtilParse::CRegexParser with llvm::Regex
Summary:
Replace uses of the local MIUtilParse::CRegexParser class with the LLVM support class llvm::Regex. This reduces duplication of code, and makes it possible to remove the MIUtilParse::CRegexParser class that requires LLVM internal implementation headers.

Bug: https://llvm.org/bugs/show_bug.cgi?id=29138

Reviewers: dawn, abidh, ki.stfu

Subscribers: labath, ki.stfu, lldb-commits

Differential Revision: https://reviews.llvm.org/D23882
Author:	Michał Górny <mgorny@gentoo.org>

llvm-svn: 280662
2016-09-05 15:15:12 +00:00
Todd Fiala e77fce0a50 [NFC] Darwin llgs support from Week of Code
This code represents the Week of Code work I did on bringing up
lldb-server LLGS support for Darwin.  It does not include the
Xcode project changes needed, as we don't want to throw that switch
until more support is implemented (i.e. this change is inert, no
build systems use it yet.  I've verified on Ubuntu 16.04, macOS
Xcode and macOS cmake builds).

This change does some minimal refactoring of code that is shared
with the Linux LLGS portion, moving it from NativeProcessLinux into
NativeProcessProtocol.  That code is also used by NativeProcessDarwin.

Current state on Darwin:
* Process launching is implemented.  (Attach is not).
  Launching on devices has not yet been tested (FBS/BKS might
  need a bit of work).
* Inferior waitpid monitoring and communication of exit status
  via MainLoop callback is implemented.
* Memory read/write, breakpoints, thread register context, etc.
  are not yet implemented.  This impacts process stop/resume, as
  the initial launch suspended immediately starts the process
  up and running because it doesn't know it is supposed to remain
  stopped.
* I implemented the equivalent of MachThreadList as
  NativeThreadListDarwin, in anticipation that we might want to
  factor out common parts into NativeThreadList{Protocol} and share
  some code here.  After writing it, though, the fallout from merging
  Mach Task/Process into a single concept plus some other minor
  changes makes the whole NativeThreadListDarwin concept nothing more
  than dead weight.  I am likely going to get rid of this class and
  just manage it directly in NativeProcessDarwin, much like I did
  for NativeProcessLinux.
* There is a stub-out call for starting a STDIO thread.  That will
  go away and adopt the MainLoop pselect-based IOObject reading.

I am developing the fully-integrated changes in the following repo,
which contains the necessary Xcode bits and the glue that enables
lldb-debugserver on a macOS system:

  https://github.com/tfiala/lldb/tree/llgs-darwin

This change also breaks out a few of the lldb-server tests into
their own directory, and adds some $qHostInfo tests (not sure why
I didn't write those tests back when I initially implemented that
on the Linux side).

llvm-svn: 280604
2016-09-04 00:18:56 +00:00
Pavel Labath fdc628f721 Fix darwin cmake build for r279997
llvm-svn: 280087
2016-08-30 13:18:46 +00:00
Jason Molenda 455d3569d8 Update debugserver project to pull in StdStringExtractor.cpp instead of the new
llvm-using StringExtractor.cpp in the xcode project file settings.

llvm-svn: 280039
2016-08-30 00:58:23 +00:00
Zachary Turner 44c35e80b1 Copy StringExtractor to StdStringExtractor.
I have some improvements to make to StringExtractor that require
using LLVM.  debugserver can't take a dependency on LLVM but uses
this file, so I'm forking it off into StdStringExtractor and
StringExtractor, so that StringExtractor can take advantage of
some performance improvements and readability improvements that
LLVM can provide.

llvm-svn: 279997
2016-08-29 19:45:59 +00:00
Pavel Labath c1566308aa Fix warnings preventing copy elision.
Summary:
Moving a temporary object prevents copy elision, which is exactly
what clang points out by warning about this pattern.

The fix is simply removal of std::move applied to temporary objects.

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D23825
Author: Taras Tsugrii <ttsugrii@fb.com>

llvm-svn: 279724
2016-08-25 08:22:14 +00:00
Todd Fiala 759300192a Add StructuredData plugin type; showcase with new DarwinLog feature
Take 2, with missing cmake line fixed.  Build tested on
Ubuntu 14.04 with clang-3.6.

See docs/structured_data/StructuredDataPlugins.md for details.

differential review: https://reviews.llvm.org/D22976

reviewers: clayborg, jingham
llvm-svn: 279202
2016-08-19 04:21:48 +00:00
Todd Fiala a07e4a8352 Revert "Add StructuredData plugin type; showcase with new DarwinLog feature"
This reverts commit 1d885845d1451e7b232f53fba2e36be67aadabd8.

llvm-svn: 279200
2016-08-19 03:03:58 +00:00
Todd Fiala aef7de8492 Add StructuredData plugin type; showcase with new DarwinLog feature
See docs/structured_data/StructuredDataPlugins.md for details.

differential review: https://reviews.llvm.org/D22976

reviewers: clayborg, jingham
llvm-svn: 279198
2016-08-19 02:52:07 +00:00
Greg Clayton c6c420fca1 Switch over to using socketpair for local debugserver connections as they are twice as fast as TCP sockets (on macOS at least).
This change opens a socket pair and passes the second socket pair file descriptor down to the debugserver binary using a new option: "--fd=N" where N is the file descriptor. This file descriptor gets passed via posix_spawn() so that there is no need to do any bind/listen or bind/accept calls and eliminates the hanshake unix socket that is used to pass the result of the actual port that ends up being used so it can save time on launch as well as being faster.

This is currently only enabled on __APPLE__ builds. Other OSs should try modifying the #define from ProcessGDBRemote.cpp but the first person will need to port the --fd option over to lldb-server. Any OSs that enable USE_SOCKETPAIR_FOR_LOCAL_CONNECTION in their native builds can use the socket pair stuff. The #define is Apple only right now, but looks like:

#if defined (__APPLE__)
#define USE_SOCKETPAIR_FOR_LOCAL_CONNECTION 1
#endif

<rdar://problem/27814880> 

llvm-svn: 278524
2016-08-12 16:46:18 +00:00
Todd Fiala abd6186216 Undo usage of LLVM macros in debugserver
We don't take a dependency on LLVM in debugserver.
This was failing to compile before.

llvm-svn: 278190
2016-08-10 00:53:21 +00:00
Zachary Turner f343968f5d Delete Host/windows/win32.h
It's always hard to remember when to include this file, and
when you do include it it's hard to remember what preprocessor
check it needs to be behind, and then you further have to remember
whether it's windows.h or win32.h which you need to include.

This patch changes the name to PosixApi.h, which is more appropriately
named, and makes it independent of any preprocessor setting.

There's still the issue of people not knowing when to include this,
because there's not a well-defined set of things it exposes other
than "whatever is missing on Windows", but at least this should
make it less painful to fix when problems arise.

This patch depends on LLVM revision r278170.

llvm-svn: 278177
2016-08-09 23:06:08 +00:00
Enrico Granata 85449e8517 Remove CFData from the xcodeproj as well
llvm-svn: 278158
2016-08-09 20:32:42 +00:00
Vedant Kumar 08b1dce670 [debugserver] Delete CFData.{h,cpp}, since they appear to be dead (NFCI)
Differential Revision: https://reviews.llvm.org/D23070

llvm-svn: 278142
2016-08-09 17:42:11 +00:00
Pavel Labath 1eb0d42a1b Remove Android.h
It only contained a reimplementation of std::to_string, which I have replaced with usages of
pre-existing llvm::to_string (also, injecting members into the std namespace is evil).

llvm-svn: 278000
2016-08-08 12:54:36 +00:00
Vedant Kumar 431368a9e6 [lldb] Delete dead, infinitely-recursive code (NFC)
Differential Revision: https://reviews.llvm.org/D22985

llvm-svn: 277351
2016-08-01 16:37:42 +00:00
Ilia K 5659a2850f Fix -break-insert not working when using absolute paths (MI)
Summary:
When trying to parse the -break-insert arguments as a named location, the string parsing was not configured to allow directory paths. This patch adds a constructor to allow the parsing of string as directory path along with the other parameters.

This fixes https://llvm.org/bugs/show_bug.cgi?id=28709

Patch from malaperle@gmail.com
Reviewers: clayborg, ki.stfu
Subscribers: lldb-commits, ki.stfu
Differential Revision: https://reviews.llvm.org/D22902

llvm-svn: 277117
2016-07-29 06:01:20 +00:00
Jason Molenda 9ab5dc2417 Add a new DynamicLoader plugin that uses SPI that are in development
for the fall (northern hemisphere) 2016 Darwin platforms to learn
about loaded images, instead of reading dyld internal data structures.
These new SPI don't exist on older releases, and new packets are
needed from debugserver to use them (those changes are already committed).

I had to change the minimum deployment target for debugserver in the xcode
project file to macOS 10.10 so that debugserver will use the 
[[NSProcessInfo processInfo] operatingSystemVersion]
call in MachProcess::GetOSVersionNumbers to get the operarting system
version # -- this API is only available in macOS 10.10 and newer
("OS X Yosemite", released Oct 2014).  If we have many people building
llvm.org lldb on older systems still, we can back off on this for the
llvm.org sources.

There should be no change in behavior with this commit, either to
older darwin systems or newer darwin systems.

For now the new DynamicLoader plugin is never activated - I'm forcing
the old plugin to be used in DynamicLoaderDarwin::UseDYLDSPI.
I'll remove that unconditional use of the old plugin soon, so the
newer plugin is used on the newest Darwin platforms.

<rdar://problem/25251243> 

llvm-svn: 276254
2016-07-21 08:30:55 +00:00
Ed Maste 75500e72bb Typo corrections identified by codespell
Submitted by giffunip@yahoo.com; I fixed a couple of nearby errors and
incorrect changes in the patch.

llvm.org/pr27634

llvm-svn: 275983
2016-07-19 15:28:02 +00:00
Ilia K beb1aa907d Fix -break-enable/-break-disable commands (MI)
* Previously -break-enable mistakenly set BP's enabled flag to false.
* These commands print fake =breakpoint-modified messages, what's not
  needed anymore because that events are come in normal way.
* Add tests for -break-enable/-break-disable commands

Initial patch from xuefangliang@hotmail.com. The test case was improved by me.

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

llvm-svn: 275381
2016-07-14 07:43:14 +00:00
Tamas Berghammer 130802b339 Try to fix the OSX build with old SDK after r274725
llvm-svn: 274743
2016-07-07 10:38:05 +00:00
Jason Molenda df8aef434d debugserver will now report the minimum version load command
os name and version # from the mach-o binary as it scans the
header/load commands from memory and sends the details back
in the jGetLoadedDynamicLibrariesInfos response.  lldb isn't
using these fields yet but I have a suspicion I'm going to 
need them soon.

<rdar://problem/25251243> 

llvm-svn: 274725
2016-07-07 03:12:01 +00:00
Jason Molenda a2992311a2 Add support to debugserver for some new ways to interact with dyld
to find the solibs loaded in a process.  Support two new ways of
sending the jGetLoadedDynamicLibrariesInfos packet to debugserver
and add a new jGetSharedCacheInfo packet.  Update the documentation
for these packets as well.  The changes to lldb to use these will
be a separate commit.

<rdar://problem/25251243> 

llvm-svn: 274718
2016-07-07 01:09:23 +00:00
Pavel Labath 140b8d1ecd Remove SIGPIPE handler in LLGS
It is sufficient to set the handeler to SIG_IGN, to get the desired behaviour. Also, the handler
calling a lot of signal-unsafe functions.

llvm-svn: 274499
2016-07-04 13:07:35 +00:00
Pavel Labath f17635375a Remove platform plugins from lldb-server
Summary:
This removes the last usage of Platform plugins in lldb-server -- it was used for launching child
processes, where it can be trivially replaced by Host::LaunchProces (as lldb-server is always
running on the host).

Removing platform plugins enables us to remove a lot of other unused code, which was pulled in as
a transitive dependency, and it reduces lldb-server size by 4%--9% (depending on build type and
architecture).

Reviewers: clayborg

Subscribers: tberghammer, danalbert, srhines, lldb-commits

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

llvm-svn: 274125
2016-06-29 13:58:27 +00:00
Greg Clayton d781d2c9b7 64-bit LEB values are not always correctly decoded due to a casting issue, now they are.
<rdar://problem/27002247> 

llvm-svn: 274037
2016-06-28 17:14:18 +00:00
Greg Clayton 05b094e0ae Fix the "Release" build on MacOSX for debugserver. Extra bad include paths were making things not build due to header file issues with stdio.h.
llvm-svn: 273306
2016-06-21 19:57:58 +00:00
Jason Molenda 7039ae9d25 Change the "debugserver-mini" target (a version of debugserver
which doesn't like against all the extra UI frameworks on ios)
so it now generates a binary called "debugserver-nonui" and puts
it in /usr/local/bin instead of /Developer/usr/bin.

Add some cruft to RNBDefs.h to get the version number (provided
by Xcode at build time) with either the name "debugserver" or
"debugserver_nonui" as appropriate.

Add the "debugserver-mini" target to the top level "ios" target
in lldb xcode project file, so this nonui debugserver will be
built along with the normal lldb / debugserver.

<rdar://problem/24730789> 

llvm-svn: 273236
2016-06-21 03:39:39 +00:00
Jason Molenda c7afda5a09 Add support for using armv7 compact unwind information
as an asynchronous unwind plan source.

Two small fixes to the compact unwind dumper tool for
armv7 encodings.

A change to DWARFCallFrameInfo to strip the 0th bit on
addresses in eh_frame sections when armv7.  In the 
clang generated examples I have, the 0th bit is set for
thumb functions and that's causing the unwinder to pick
the wrong function for eh_frame info.

llvm-svn: 271970
2016-06-07 02:19:54 +00:00
Jason Molenda 159ccb49b3 Add armv7 compact unwind printing to the compact-unwind-dumper.c tool
as a prototype for adding armv7 compact unwind reading to lldb.

llvm-svn: 271774
2016-06-04 04:10:15 +00:00
Pavel Labath 23ef3695d4 [cmake] Add ability to customize (and skip) debugserver codesign
Summary:
This adds the ability to customize the debugserver codesign process via cmake cache variable. The
user can set the codesign indentity (with the default being the customary lldb_codesign), and if
the identity is set to a empty string, the codesign step is skipped completely.

We needed the last feature to enable building lldb on buildservers which do not have the right
certificates installed.

Reviewers: sas, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 270832
2016-05-26 08:38:10 +00:00
Jason Molenda b667c20222 Add support for arm64 compact unwind tables, used on darwin arm64
systems (ios, tvos, watchos).  It's a simple format to use now that
I have i386/x86_64 supported already.

The unwind instructions are only valid at call sites -- that is,
when lldb is unwinding a frame in the middle of the stack.  It
cannot be used for the currently executing frame; it has no information
about prologues/epilogues/etc.

<rdar://problem/12062336> 

llvm-svn: 270658
2016-05-25 04:20:28 +00:00
Jason Molenda 1fec404da0 Check that __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is defined
before comparing the value of it.
<rdar://problem/26333564> 

llvm-svn: 270015
2016-05-19 02:16:41 +00:00
Enrico Granata 109dd2e2a2 Fix an issue where debugserver would not properly vend OS version information on iOS devices
The __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED macro is only defined on OS X, so the check as written compiled the code out for iOS
The right thing to do is compile the code out for older OSX versions, but leave iOS alone

rdar://26333564

llvm-svn: 270004
2016-05-18 23:59:24 +00:00
Greg Clayton 1059a067f9 Don't crash when a process' task port goes bad.
<rdar://problem/26256049>

llvm-svn: 269373
2016-05-12 22:36:47 +00:00
Saleem Abdulrasool d97dd11f2f debugserver; fix -Wunused-local-typedef, -Wunused-variable warnings
Remove the typedef and local structure which was unused.  Fixes last of the new
clang warnings in the debugserver build.  NFC.

llvm-svn: 268759
2016-05-06 17:33:13 +00:00
Saleem Abdulrasool 247731d4d3 debugserver: fix a couple of -Wmissing-field-initializers warnings
Explicitly provide an initializer for the std::vector in the constructed type.
Addresses -Wmissing-field-initializers warnings from clang.  NFC.

llvm-svn: 268758
2016-05-06 17:33:09 +00:00