Commit Graph

15728 Commits

Author SHA1 Message Date
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
Kamil Rytarowski c9a89f6936 Document that LaunchProcessPosixSpawn is used on NetBSD
No functional change.

Sponsored by <The NetBSD Foundation>

llvm-svn: 293770
2017-02-01 14:35:08 +00:00
Kamil Rytarowski 816ae4b0df Transform ProcessLauncherLinux to ProcessLauncherPosixFork
Summary:
Use ProcessLauncherPosixFork in Linux and NetBSD.

Changes to ProcessLauncherLinux:
 - Limit personality.h and ASLR code to Linux.
 - Reuse portable ptrace(2) PT_TRACE_ME operation available on Linux and BSDs.
 - Limit ETXTBSY error path from execve(2) to Linux.
 - In LaunchProcess declaration change virtual to override.

This code should be readily available for FreeBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, clayborg, labath, emaste

Reviewed By: labath

Subscribers: danalbert, srhines, mgorny, #lldb

Tags: #lldb

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

llvm-svn: 293768
2017-02-01 14:30:40 +00:00
Ismail Donmez 79d58a39d1 Fix missing include after r293660
llvm-svn: 293767
2017-02-01 13:33:50 +00:00
Jason Molenda 9dd2ff4604 When I added the use of the new compression framework (present in
Mac OS X 10.11, El Capitan, released c. Oct 2015) I conditionalized
the use of the framework on "if sdk == macosx 10.11".  But since
macOS 10.12 has shipped this year, the framework was no longer being
built in.  I can either start listing every OS 10.11 and newer, or
remove the version check.

This will break building lldb with xcodebuild / Xcode for people 
running Mac OS X 10.10 or older.  If so, I'll back this change out.
I'm not sure if we have many people working on macs running the
older OSes on their build systems.

<rdar://problem/30159130> 

llvm-svn: 293742
2017-02-01 04:23:15 +00:00
Pavel Labath 23ccc29197 Open ELF core dumps with more than 64K sections
Summary:
Problem:

There are three filelds in the ELF header - e_phnum, e_shnum, and e_shstrndx -
that could be bigger than 64K and therefore do not fit in 16 bits reserved for
them in the header. If this happens, pretty often there is a special section at
index 0 which contains their real values for these fields in the section header
in the fields sh_info, sh_size, and sh_link respectively.

Fix:

- Rename original fields in the header declaration. We want to have them around
just in case.

- Reintroduce these fields as 32-bit members at the end of the header. By default
they are initialized from the header in Parse() method.

- In Parse(), detect the situation when the header might have been extended into
section info #0 and try to read it from the same data source.

- ObjectFileELF::GetModuleSpecifications accesses some of these fields but the
original parse uses too small data source. Re-parse the header if necessary
using bigger data source.

- ProcessElfCore::CreateInstance uses header with potentially sentinel values,
but it does not access these fields, so a comment here is enough.

Reviewers: labath

Reviewed By: labath

Subscribers: davidb, lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D29095
Author: Eugene Birukov <eugenebi@hotmail.com>

llvm-svn: 293714
2017-01-31 23:09:46 +00:00
Chris Bieneman 3173c964da [CMake] [4/4] Update a batch of plugins
This is extending the updates from r293696 to more LLDB plugins.

llvm-svn: 293701
2017-01-31 22:31:38 +00:00
Chris Bieneman 81b8f12b42 [CMake] [3/4] Update a batch of plugins
This is extending the updates from r293696 to more LLDB plugins.

llvm-svn: 293700
2017-01-31 22:29:11 +00:00
Chris Bieneman 66a2d639ab [CMake] [2/4] Update a batch of plugins
This is extending the updates from r293696 to more LLDB plugins.

llvm-svn: 293699
2017-01-31 22:23:49 +00:00
Chris Bieneman 6847a3aba1 [CMake] [1/4] Update a batch of plugins
This is extending the updates from r293696 to more LLDB plugins.

llvm-svn: 293698
2017-01-31 22:21:19 +00:00
Chris Bieneman cee3837eb8 [CMake] Add explicit dependencies to plugins
Summary:
This patch does two things. First it updates all the ABI plugins with accurate dependencies, and second it adds a tracking mechanism for add_lldb_library to denote plugin libraries, allowing us to build up a list of all the configured plugins.

This list of generated plugins will be used during generating liblldb so that we can link all the plugins into the library.

If this patch looks good I will update all the other plugins in subsequent patches.

Reviewers: labath, zturner

Subscribers: nemanjai, mgorny, lldb-commits, jgosnell

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

llvm-svn: 293696
2017-01-31 22:12:59 +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 987401bbfe [CMake] Fix broken NetBSD bots
http://lab.llvm.org:8011/builders/lldb-amd64-ninja-netbsd7/builds/4558/steps/cmake%20local/logs/stdio

llvm-svn: 293687
2017-01-31 20:52:41 +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
Jim Ingham 8e3e944cd1 Move the stop point to somewhere before the final use of the
variable we are inspecting.

llvm-svn: 293666
2017-01-31 18:26:20 +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
Chris Bieneman 62b83ede84 [CMake] Add LINK_LIBS and LINK_COMPONENTS options
This patch adds CMake options to add_lldb_library and add_lldb_executable for specifying LLVM components and direct library links.

This patch is NFC, but it is a small separable bit of a series of much larger patches that I'll be landing over the next day or two.

llvm-svn: 293647
2017-01-31 16:59:46 +00:00
Chris Bieneman 5c79313563 NFC. Remove unused header include.
llvm-svn: 293646
2017-01-31 16:48:20 +00:00
Kamil Rytarowski e5c6a32163 Add NetBSD support in Host::GetCurrentThreadID
Summary:
To retrieve the native thread ID there must be called _lwp_self().

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, clayborg, emaste, labath

Reviewed By: joerg, clayborg, labath

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 293625
2017-01-31 13:38:42 +00:00
Kamil Rytarowski 3caaaa94c6 Switch HostInfoNetBSD::GetProgramFileSpec to sysctl(7)
Summary:
Remove dependency on the proc (/proc) filesystem, which is optional.

KERN_PROC_PATHNAME is available in NetBSD-current and will land NetBSD 8.0.
Older stable versions of NetBSD will not be supported.

Sponsored by <The NetBSD Foundation>

Reviewers: emaste, joerg, labath, clayborg

Reviewed By: clayborg

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 293392
2017-01-28 20:04:53 +00:00
Kamil Rytarowski a89218d603 Recognize Real-Time Signals on NetBSD
Summary:
Real-Time Signals are available in NetBSD-current and will land NetBSD 8.0.
Older stable versions of NetBSD will not be supported.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, clayborg, emaste

Reviewed By: labath, clayborg, emaste

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 293391
2017-01-28 20:01:53 +00:00
Jason Molenda 270e822844 One of the changes Jim made in r286288 (cleaning up the stop print
header line, backtrace output) was to remove the current pc value
from frames where we have source level information.  We've been
discussing this for the past week and based on input from a group
of low level users, I believe this is the wrong default behavior
for the command line lldb tool.

lldb's backtrace will include the pc value for all stack frames
regardless of whether they have source level debug information or
not.  

A related part of r286288 removes the byte offset printing for
functions with source level information (e.g. "main + 22 sourcefile.c:10"
is printed as "main sourcefile.c:10").  I don't see a compelling
case for changing this part of 286288 so I'm leaving that as-is
(in addition to the rest of 286288 which is clearly better than
the previous output style).

<rdar://problem/30083904> 

llvm-svn: 293366
2017-01-28 02:54:10 +00:00
Adrian McCarthy 9d0eb9960c NFC: Improve comments in SymbolFilePDB.cpp
Mostly this just fixes bad wrapping caused by the reformat, with tiny
changes sprinkled here and there.

llvm-svn: 293336
2017-01-27 21:42:28 +00:00
Pavel Labath 095d6b8f99 Address post-commit review remarks
Tamas pointed out that the macro name I used in r293282 was too vague.
Rename it to better reflect what it is used for.

llvm-svn: 293287
2017-01-27 15:19:03 +00:00
Pavel Labath 810055ee23 Fix android-i386 build broken by previous commit
I foolishly thought I could simplify the condition to cover all android
targets. I was wrong - i386 headers don't define __NR_accept.

Revert back to enabling the workaround on arm an mips only.

llvm-svn: 293282
2017-01-27 12:58:23 +00:00
Pavel Labath ef97630fd2 Refactor the android accept hack
This moves the accept hack from the android toolchain file into
LLDBConfig.cmake. This allows successful lldb android compilation
without relying on our custom toolchain file.

llvm-svn: 293281
2017-01-27 12:23:51 +00:00
Boris Ulasevich 67346ca9ef Unroll r292930 due to TestCallThatThrows test fail is not fixed in reasonable time.
llvm-svn: 293269
2017-01-27 07:51:43 +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
Greg Clayton 896b4513e1 Fix SBData::SetData() so that it always sets the address byte size correctly and added a test.
llvm-svn: 293102
2017-01-25 21:50:28 +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
Pavel Labath 46897a46ee include Host/Time.h in Cocoa.cpp
Time.h contains the necessary magic to enable timegm on all android
targets.

llvm-svn: 293047
2017-01-25 11:19:49 +00:00
Pavel Labath 8abd34f015 NPL: Compartmentalize arm64 single step workaround better
The main motivation for me doing this is being able to build an arm
android lldb-server against api level 9 headers, but it seems like a
good cleanup nonetheless.

The entirety of the cpu_set_t dance now resides in SingleStepCheck.cpp,
which is only built on arm64.

llvm-svn: 293046
2017-01-25 11:19:45 +00:00
Pavel Labath 2d0c5b0297 Replace chdir() usage with the llvm equivalent.
This removes a hack in PosixApi.h, which tends to produce strange
compile errors when it's included in the wrong order.

llvm-svn: 293045
2017-01-25 11:10:52 +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 a1609ff658 Jim unintentionally had the gdb-format specifiers falling through
after r276132 so that 'x/4b' would print out a series of 4 8-byte
quantities.  Fix that, add a test case.

<rdar://problem/29930833> 

llvm-svn: 293002
2017-01-25 01:41:48 +00:00
Hafiz Abid Qadeer b10fb96541 Provide option to set pc of the file loaded in memory.
Summary: This commit adds an option to set PC to the entry point of the file loaded using "target module load" command. In D28804, Greg asked me to separate this part under a different option.

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 292989
2017-01-24 23:07:27 +00:00
Hafiz Abid Qadeer 68d7f37d26 Fix a bug where lldb does not respect the packet size.
Summary: LLDB was using packet size advertised by the target as the max memory size to write in one go. It is wrong because packets have other overhead apart from memory payload. Also memory transferred through 'm' and 'M' packets needs 2 bytes in packet to transfer 1 of memory.

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 292987
2017-01-24 22:55:36 +00:00
Pavel Labath 68de04e2d2 Fix android build for r292935 (personality.h)
It turns out things are not as simple as I hoped. sys/personality.h
exists on all androids but it does not define the required symbols on
all platform levels.

Add a compile check for platform level to compile against both new and
old android headers.

llvm-svn: 292939
2017-01-24 15:35:53 +00:00
Ed Maste 31f018032f FreeBSD ARM support for software single step
Implementation of software single step for FreeBSD on ARM. The code is
largely based on the Linux implementation of the same functionality.

Patch by Dmitry Mikulin!

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

llvm-svn: 292937
2017-01-24 14:34:49 +00:00
Pavel Labath b699c548c6 android-mips: define PTRACE_GETREGSET in headers don't do it
PTRACE_GETREGSET is only defined on mips only since api level 21. Define
it ourselves, so we can compile with older platform headers.

llvm-svn: 292936
2017-01-24 14:27:51 +00:00
Pavel Labath e9862b607e include linux/personality.h on android
sys/personality.h is present only since android platform level 21. The
linux/ version is present everywhere.

llvm-svn: 292935
2017-01-24 14:24:31 +00:00
Pavel Labath b8ad01559f Include termios.h for definition of struct winsize
On android API level 9 the header does not get included transitively.
Include it directly.

As far as I can see, all non-windows platforms should have this header.
If that turns out to be incorrect, we can add some ifdefs around that.

llvm-svn: 292931
2017-01-24 14:05:23 +00:00
Boris Ulasevich 29a8eba974 Bug 30863 - Step doesn't stop with conditional breakpoint on the next line
Differential Revisions:
  https://reviews.llvm.org/D26497 (committed r290168, temporary reverted r290197)
  https://reviews.llvm.org/D28945 (fix for Ubuntu tests fail)

llvm-svn: 292930
2017-01-24 13:15:19 +00:00
Pavel Labath 8198db30f3 Add format_provider for lldb::StateType
Reviewers: clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 292920
2017-01-24 11:48:25 +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 73039d2cac Prefer lzfse if it is an available compression method (this was
defaulting to zlib previously).
<rdar://problem/30159130> 

llvm-svn: 292884
2017-01-24 05:06:14 +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