Commit Graph

57 Commits

Author SHA1 Message Date
Greg Clayton cec91ef921 Fix all of the unannotated switch cases to annotate the fall through or do the right thing and break.
llvm-svn: 261950
2016-02-26 01:20:20 +00:00
Pavel Labath 7326c01aaa [linux] Remove all traces of signalfd(2)
Summary:
Signalfd is not used in the code anymore, and given that the same functionality can be achieved
with the new MainLoop class, it's unlikely we will need it in the future. Remove all traces of
it.

Reviewers: tberghammer, ovyalov

Subscribers: tberghammer, danalbert, srhines, lldb-commits

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

llvm-svn: 261631
2016-02-23 12:26:08 +00:00
Tamas Berghammer 2e912ec705 Add new option to lldb-server to display its version
llvm-svn: 260366
2016-02-10 10:35:48 +00:00
Pavel Labath 6698f6f4e5 Have lldb-server log the timestamp in its log messages
llvm-svn: 260078
2016-02-08 09:35:53 +00:00
Pavel Labath 941ca06688 Fix linking of lldb-server with BUILD_SHARED_LIBS
Summary:
The BUILD_SHARED_LIBS branch of lldb-server link flags was hopelessly broken, at least since we
started restricting the symbols exported by liblldb. lldb-server depends on symbols from the
lldb_private namespace, so it cannot link to the public interface of liblldb. Instead I make it
link to the individual libraries constituting liblldb, just like it does in the
!BUILD_SHARED_LIBS case.

This does not make the BUILD_SHARED_LIBS build of lldb fully functional yet, due to the way
liblldb dependencies are managed, but it's a step in that direction.

Reviewers: zturner, tfiala

Subscribers: lldb-commits

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

llvm-svn: 259188
2016-01-29 11:59:57 +00:00
Eugene Zelenko c33088f41e Remove autoconf support from source directories.
Differential revision: http://reviews.llvm.org/D16662

llvm-svn: 259098
2016-01-28 22:05:24 +00:00
Tamas Berghammer ccd6cffba3 Modify "platform connect" to connect to processes as well
The standard remote debugging workflow with gdb is to start the
application on the remote host under gdbserver (e.g.: gdbserver :5039
a.out) and then connect to it with gdb.

The same workflow is supported by debugserver/lldb-gdbserver with a very
similar syntax but to access all features of lldb we need to be
connected also to an lldb-platform instance running on the target.

Before this change this had to be done manually with starting a separate
lldb-platform on the target machine and then connecting to it with lldb
before connecting to the process.

This change modifies the behavior of "platform connect" with
automatically connecting to the process instance if it was started by
the remote platform. With this command replacing gdbserver in a gdb
based worflow is usually as simple as replacing the command to execute
gdbserver with executing lldb-platform.

Differential revision: http://reviews.llvm.org/D14952

llvm-svn: 255016
2015-12-08 14:08:19 +00:00
Bruce Mitchener b5c891908d Add more autotools/gmake NetBSD glue
Summary: This diff approaches building the project natively on NetBSD with the autoconf/gmake framework.

Patch by Kamil Rytarowski. Thanks!

Reviewers: emaste, clayborg

Subscribers: tberghammer, joerg, brucem, lldb-commits

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

llvm-svn: 253153
2015-11-15 02:00:09 +00:00
Oleksiy Vyalov 1485712648 Make lldb-gdbserver to take explicit socket scheme as command line argument.
http://reviews.llvm.org/D14126

llvm-svn: 251547
2015-10-28 19:49:50 +00:00
Oleksiy Vyalov db4d9865b4 Add Socket::Create factory method which uses socket protocol to find an appropriate implementation class.
http://reviews.llvm.org/D14085

llvm-svn: 251417
2015-10-27 17:32:01 +00:00
Bruce Mitchener 64f74da568 Add initial CMake glue for the NetBSD platform
Summary:
These changes aren't everything what is needed for the CMake target, but it's significantly approaching it.

These changes shouldn't effect the build process on other platforms.

Patch by Kamil Rytarowski, thanks!

Reviewers: joerg, brucem

Subscribers: lldb-commits

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

llvm-svn: 251164
2015-10-24 00:27:04 +00:00
Oleksiy Vyalov 9dfde98d27 Fix lldb-server - write null terminating symbol along with port number.
llvm-svn: 250953
2015-10-21 21:58:22 +00:00
Oleksiy Vyalov 9fe526c2e7 Add domain socket support to gdb-remote protocol and lldb-server.
http://reviews.llvm.org/D13881

llvm-svn: 250933
2015-10-21 19:34:26 +00:00
Oleksiy Vyalov e98628cecb Split Socket class into Tcp/Udp/DomainSocket subclasses.
http://reviews.llvm.org/D13754

llvm-svn: 250474
2015-10-15 23:54:09 +00:00
Bruce Mitchener 6ec5d61bda Fix handling of LLDB_VERS_GENERATED_FILE.
Summary:
This is Darwin only.

The symbol defined by ${LLDB_VERS_GENERATED_FILE} is used by
source/lldb.cpp, so anything that uses lldb.cpp (which is in
lldbBase) should also have the generated symbol. This means
that the entire process can be centralized within source/CMakeLists.txt
where lldbBase is constructed.

Additionally, the custom command should have dependencies on the
project file as well as the generation script so that if either
changes, the version file is correctly re-generated and everything
is re-linked appropriately.

* cmake/LLDBDependencies.cmake: Remove everything related to
  the generated version file from here.

* source/CMakeLists.txt: On Darwin, add the generated version
  file to the sources that make up lldbBase.  Also, create a
  custom target and make lldbBase depend on it to re-generate
  the generated file as needed.

* source/API/CMakeLists.txt: Don't need to build the generated
  version file here or use it to control linking against swig_wrapper.

* tools/lldb-server/CMakeLists.txt: Likewise.

Reviewers: dawn, sas, clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 249806
2015-10-09 03:40:55 +00:00
Dawn Perchik b751bfb9bd [cmake] Fix cmake build on OSX after r249434.
Reviewed by: zturner
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13535

llvm-svn: 249684
2015-10-08 12:35:21 +00:00
Bruce Mitchener c32c277b84 Include platform agnostic <HostGetOpt.h> in the place of <getopt.h>
Summary: Problem caught on NetBSD with missing getopt_long_only(3).

Change by Kamil Rytarowski <n54@gmx.com>

Reviewers: joerg, brucem

Subscribers: brucem, lldb-commits

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

llvm-svn: 248990
2015-10-01 07:45:58 +00:00
Daniel Sanders 7d8e7bd7b5 [lldb-server] No need to add pthread twice.
Summary:
Following on from r247991:
pthread is in LLDB_SYSTEM_LIBS so there's no need to explicitly add it to the link.

Reviewers: labath

Subscribers: lldb-commits, labath, krytarowski

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

llvm-svn: 248177
2015-09-21 17:23:22 +00:00
Pavel Labath ded4e756b2 Fix link failures when BUILD_SHARED_LIBS=ON.
patch by Daniel Sanders.

Reviewers: labath, krytarowski

Subscribers: krytarowski, labath, lldb-commits

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

llvm-svn: 247991
2015-09-18 14:22:45 +00:00
Tamas Berghammer bb97321003 Fix crash in lldb-server caused by an API change in LLVM
llvm-svn: 247267
2015-09-10 11:08:41 +00:00
Bruce Mitchener 3921fc7de7 Only export public symbols with the cmake build.
Summary:
This also moves the xcode support files to be near or the same
as the ones used for cmake.

The source/API/liblldb.xcodes.exports differs from the
source/API/liblldb.exports in that one contains the actual
symbol names (_ prefixed) while the other contains the symbol
names as they are in the code. The liblldb.exports file is
preprocessed by the cmake scripts into the correct per-platform
file needed (like a linker script on Linux).

This is not enabled on Windows as Windows doesn't use the same
name mangling and so it won't be valid there. Also, this is handled
already in a different way on Windows (via dll exports).

Reviewers: emaste, clayborg, labath, chaoren

Subscribers: lldb-commits

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

llvm-svn: 246822
2015-09-04 00:00:41 +00:00
Bruce Mitchener db25a7a245 [cmake] Remove LLVM_NO_RTTI.
Summary:
This doesn't exist in other LLVM projects any longer and doesn't
do anything.

Reviewers: chaoren, labath

Subscribers: emaste, tberghammer, lldb-commits, danalbert

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

llvm-svn: 246749
2015-09-03 08:46:55 +00:00
Pavel Labath 4a0d7bcaa7 Fix liblldb linking on RHEL 6 (bug #24140)
Patch by Eugene Zelenko.

llvm-svn: 242525
2015-07-17 15:26:27 +00:00
Oleksiy Vyalov df62ed3f8b Fix temp port file path generation in lldb-platform.
http://reviews.llvm.org/D11152

llvm-svn: 242182
2015-07-14 18:54:52 +00:00
Pavel Labath 77dc9569c6 Introduce a MainLoop class and switch llgs to use it
Summary:
This is the first part of our effort to make llgs single threaded. Currently, llgs consists of
about three threads and the synchronisation between them is a major source of latency when
debugging linux and android applications.

In order to be able to go single threaded, we must have the ability to listen for events from
multiple sources (primarily, client commands coming over the network and debug events from the
inferior) and perform necessary actions. For this reason I introduce the concept of a MainLoop.
A main loop has the ability to register callback's which will be invoked upon receipt of certain
events. MainLoopPosix has the ability to listen for file descriptors and signals.

For the moment, I have merely made the GDBRemoteCommunicationServerLLGS class use MainLoop
instead of waiting on the network socket directly, but the other threads still remain. In the
followup patches I indend to migrate NativeProcessLinux to this class and remove the remaining
threads.

Reviewers: ovyalov, clayborg, amccarth, zturner, emaste

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 242018
2015-07-13 10:44:55 +00:00
Oleksiy Vyalov 298be46e3f Add --port-file flag to lldb-platform to store port number which platform is listening.
http://reviews.llvm.org/D10886

llvm-svn: 241479
2015-07-06 18:05:19 +00:00
Keno Fischer 121c1c54bf Add -lpthread to LLDB shared lib link line unconditionally
Usually -lpthread is included due to LLVM link options,
but when LLVM threading is disabled, this does not happen.
pthread is still needed however because LLDB uses threading
regardless of whether LLVM is built with threading support or not.

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

llvm-svn: 241006
2015-06-29 21:52:45 +00:00
Pavel Labath 17cace6475 fix lldb-server linking on RHEL 6 (bug #23774)
Patch by: Eugene Zelenko

llvm-svn: 240933
2015-06-29 10:30:06 +00:00
Keno Fischer c847e7e543 Don't link ObjCARCOpts twice. Fixes PR22543
ObjCARCOpts is already included by ClangCodeGen. Linking it again causes the error in PR22543.

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

llvm-svn: 240104
2015-06-18 23:45:51 +00:00
Bruce Mitchener 58ef391f3e Fix a variety of typos.
No functional change.

llvm-svn: 239995
2015-06-18 05:27:05 +00:00
Andrew Wilkins 7175f16cdb [lldb] Enable building with Cmake/BUILD_SHARED_LIBS
Summary:
Several changes to fix CMake builds of LLDB with the
BUILD_SHARED_LIBS setting on.

- Force all internal libraries to be built STATIC.
- Add additional library dependencies (pthread, dl,
  runtimedyld).
- modify finalisation of SWIG wrapper to symlink the
  "lib" dir into python/site-packages, so _lldb.so's
  RPATH resolves.

Test Plan: Verified one test case with "dotest.py".

Reviewers: sylvestre.ledru, zturner

Reviewed By: zturner

Subscribers: zturner, ted, tberghammer, emaste, lldb-commits

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

llvm-svn: 239007
2015-06-04 03:12:37 +00:00
Zachary Turner 1124045ac7 Don't #include "lldb-python.h" from anywhere.
Since interaction with the python interpreter is moving towards
being more isolated, we won't be able to include this header from
normal files anymore, all includes of it should be localized to
the python library which will live under source/bindings/API/Python
after a future patch.

None of the files that were including this header actually depended
on it anyway, so it was just a dead include in every single instance.

llvm-svn: 238581
2015-05-29 17:41:47 +00:00
Tamas Berghammer 9c9ecce077 Make log options uniform betwwen lldb-platform and lldb-gdbserver
This change also get rid of an unused Debugger instance in
GDBRemoteCommunicationServerLLGS and the command interpreter from
lldb-platform what was used only for enabling logging.

Differential revision: http://reviews.llvm.org/D9876

llvm-svn: 238319
2015-05-27 13:34:04 +00:00
Vince Harron 218353d847 Print port number that lldb-server binds to in platform mode
If binding to port 0 is selected, the actual port is printed.

This improves the reliability of platform startup by ensuring that
a free port can be found.

TEST PLAN
./lldb-server platform --listen *:0

Listening for a connection from <port-number>...

Will appear on stdout (with other stuff potentially)

llvm-svn: 238173
2015-05-26 03:08:05 +00:00
Chaoren Lin 9afad0e954 Fix lldb-platform usage string.
llvm-svn: 237966
2015-05-21 22:43:43 +00:00
Vince Harron 9753dd98b3 Add support for ./dotest.py --channel and --log-success
Summary:
New dotest options that allow arbitrary log channels and
categories to be enabled.  Also enables logging for locally run
debug servers.
    
Log messages are separated into separate files per test case.
(this makes it possible to log in dosep runs)
    
These new log files are stored side-by-side with trace files in the
session directory.
    
These files are deleted by default if the test run is successful.
    
If --log-success is specified, even successful logs are retained.
    
--log-success is useful for creating reference log files.
    
Test Plan:
add '--channel "lldb all" --channel "gdb-remote packets" --log-success'
to your dotest options

Tested on OSX and Linux
    
Differential Revision: http://reviews.llvm.org/D9594

llvm-svn: 236956
2015-05-10 15:22:09 +00:00
Chaoren Lin ec53482aef PosixPipes should not be copyable but should be movable.
Summary: This addresses Oleksiy's comment in D9307.

Reviewers: clayborg, ovyalov

Reviewed By: clayborg, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 236320
2015-05-01 16:49:23 +00:00
Chaoren Lin 4dc65069a1 lldb-gdbserver should not use unnamed pipes on Windows.
llvm-svn: 236138
2015-04-29 19:01:43 +00:00
Chaoren Lin a52f48412d Add file descriptor constructor for PipePosix.
llvm-svn: 236133
2015-04-29 17:36:58 +00:00
Chaoren Lin 368c9f6e9b Add an unnamed pipe fail-safe to launching lldb-gdbserver.
Summary:
Currently, launching lldb-gdbserver from platform on Android requires root for
mkfifo() and an explicit TMPDIR variable. This should remove both requirements.

Test Plan: Successfully launched lldb-gdbserver on a non-rooted Android device.

Reviewers: tberghammer, vharron, clayborg

Reviewed By: clayborg

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 235940
2015-04-27 23:20:30 +00:00
Pavel Labath 1107b5a597 Use non-blocking waitpid in NativeProcessLinux
Summary:
This is the first phase of the merging of Monitor and Operation threads in NativeProcessLinux
(which is necessary since the two threads race inside Linux kernel). Here, I reimplement the
Monitor thread do use non-blocking waitpid calls, which enables later addition of code from the
operation thread.

Test Plan: Ran the test suite a couple of times, no regressions detected.

Reviewers: vharron, ovyalov, tberghammer

Subscribers: lldb-commits

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

llvm-svn: 235193
2015-04-17 14:07:49 +00:00
Sylvestre Ledru 5a1a7ebe53 Force the inclusion of the LLVMSupport lib. Otherwise, the build (might?) fails with an undefined reference to 'llvm::llvm_is_multithreaded()'
llvm-svn: 234407
2015-04-08 14:09:36 +00:00
Zachary Turner e6e2bb3842 Rework LLDB system initialization.
In an effort to reduce binary size for components not wishing to
link against all of LLDB, as well as a parallel effort to reduce
link dependencies on Python, this patch splits out the notion of
LLDB initialization into "full" and "common" initialization.

All code related to initializing the full LLDB suite lives directly
in API now.  Previously it was only referenced from API, but because
it was defined in lldbCore, it would get implicitly linked against
by everything including lldb-server, causing a considerable
increase in binary size.

By moving this to the API layer, it also creates a better layering
for the ongoing effort to make the embedded interpreter replacable
with one from a different language (or even be completely removeable).

One semantic change necessary to get this all working was to remove
the notion of a shared debugger refcount.  The debugger is either
initialized or uninitialized now, and calling Initialize() multiple
times will simply have no effect, while the first Terminate() will
now shut it down no matter how many times Initialize() was called.
This behaves nicely with all of our supported usage patterns though,
and allows us to fix a number of nasty hacks from before.

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

llvm-svn: 233758
2015-03-31 21:03:22 +00:00
Tamas Berghammer db264a6d09 Move several plugin to its own namespace
Affected paths:
* Plugins/Platform/Android/*
* Plugins/Platform/Linux/*
* Plugins/Platform/gdb-server/*
* Plugins/Process/Linux/*
* Plugins/Process/gdb-remote/*

Differential revision: http://reviews.llvm.org/D8654

llvm-svn: 233679
2015-03-31 09:52:22 +00:00
Vince Harron 33aea9001a Increate backlog of lldb-platform's listener socket
lldb-platform's listener socket only had a backlog of one connection.
That means that if more than one client connected simultaneously, the
connection would be refused. The test suite can be run remotely with
dozens of threads connecting simultaneously. Raised this limit to 100
to effectively eliminate lost connections.

Test Plan:
run tests against a remote target

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

llvm-svn: 233652
2015-03-31 00:27:10 +00:00
Vince Harron f1e6999cec Fix socket leak in lldb-server platform
lldb-server server process was holding on to a connection to every
client that connected. This continued until the process hit it's
file limit and exited.

lldb-server p --listen *:5432 --server

run remote tests against that server more than 1000 times

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

llvm-svn: 233651
2015-03-31 00:24:51 +00:00
Robert Flack a0e70cd4b6 Allow multiple simultaneous connections to platform.
Adds the --server argument to lldb-server platform which when specified will allow multiple simultaneous connections by forking off to handle each individual connection. This will allow us to run the remote tests in parallel.

Test Plan:
Run: lldb-server platform --listen *:1234 --server
Connect from multiple lldb clients simultaneously.
I will also test running the test suite remotely with multiple simultaneous jobs.

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

llvm-svn: 233185
2015-03-25 12:51:31 +00:00
Zachary Turner 3a00691f3d Move LLDB initialization/shutdown to Initialization.
This creates a new top-level folder called Initialization which
is intended to hold code specific to LLDB system initialization.
Currently this holds the Initialize() and Terminate() functions,
as well as the fatal error handler.

This provides a means to break the massive dependency cycle which
is caused by the fact that Debugger depends on Initialize and
Terminate which then depends on the entire LLDB project.  With
this structure, it will be possible for applications to invoke
lldb_private::Initialize() directly, and have that invoke
Debugger::Initialize.

llvm-svn: 232768
2015-03-19 22:00:21 +00:00
Zachary Turner 3294de270e Move lldb-log.cpp to core/Logging.cpp
So that we don't have to update every single #include in the entire
codebase to #include this new header (which used to get included by
lldb-private-log.h, we automatically #include "Logging.h" from
within "Log.h".

llvm-svn: 232653
2015-03-18 18:20:42 +00:00
Robert Flack 5f4b6c7c9e Initialize ProcessGDBRemoteLog for LLGS to fix remote platform logging
This was previously initialized by ProcessGDBRemote::Initialize but lldb-server does not contain ProcessGDBRemote anymore so this needs to be initialized directly.

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

llvm-svn: 231966
2015-03-11 21:14:22 +00:00