Commit Graph

9627 Commits

Author SHA1 Message Date
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
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 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
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
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
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 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
Pavel Labath 1d5855b107 Replace getcwd with the llvm equivalent
Summary:
getcwd() is not available (well.. um.. deprecated?) on windows, and the way
PosixApi.h is providing it causes strange compile errors when it's included in
the wrong order. The best way to avoid that is to just not use chdir.

This replaces all uses of getcwd in generic code. There are still a couple of
more uses, but these are in platform-specific code.

chdir() is causing a similar problem, but for that there is no llvm equivalent
for that (yet).

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 292795
2017-01-23 15:56:45 +00:00
Jason Molenda 777fcecf8f Add a catch-all line for detecting dyld in the inferior process
shlibs so we don't miss dyld.
<rdar://problem/30128580> 

llvm-svn: 292696
2017-01-21 01:17:36 +00:00
Pavel Labath e0a5b575a6 Prevent client from querying each thread's PC at each stop.
Summary:
The server was no longer sending the thread PCs the way the client
expected them.
I changed the server to send them back as a threadstop info field,
similar to the Apple version of the server.
I also changed the client to look for them there, before querying the
server.
I added a test to ensure the server doesn't stop sending them.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D28880
Author: Jason Majors

llvm-svn: 292611
2017-01-20 14:17:16 +00:00
Hafiz Abid Qadeer b1554311d3 Fix more unused variable warnings when asserts are disabled.
llvm-svn: 292598
2017-01-20 10:24:03 +00:00
Hafiz Abid Qadeer 4687db0e09 Provide a substitute to load command of gdb.
For bare-metal targets, lldb was missing a command like 'load' in gdb
which can be used to create executable image on the target. This was
discussed in
http://lists.llvm.org/pipermail/lldb-dev/2016-December/011752.html

This commits adds an option to "target module load" command to provide
that functionality. It does not set the PC to entry address which will
be done separately.

Reviewed in https://reviews.llvm.org/D28804

llvm-svn: 292499
2017-01-19 17:32:50 +00:00
Pavel Labath a6321a8e95 Refactor logging in NativeProcessLinux
Use the LLDB_LOG macro instead of the more verbose if(log) ... syntax.

I have also consolidated the log channels (everything now goes to the posix
channel, instead of a mixture of posix and lldb), and cleaned up some of the
more convoluted log statements.

llvm-svn: 292489
2017-01-19 15:26:04 +00:00
Hafiz Abid Qadeer 05008cac15 Avoid unused variable warning when assert is disabled.
llvm-svn: 292488
2017-01-19 15:11:01 +00:00
Jason Molenda 848c7be02a Fix a problem with the new dyld interface code -- when a new process
starts up, we need to clear the target's image list and only add
the binaries into the target that are actually present in this
process run.

<rdar://problem/29857613> 

llvm-svn: 292454
2017-01-19 00:20:29 +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 238169db60 Fix windows unit tests
The unit test I added in the previous commit discovered a bug in
PrependPathComponent on windows -- it was calling SetFile with the host native
path syntax, whereas it should be explicitly specifying the path syntax (as
AppendPathComponent does). This fixes it.

llvm-svn: 292106
2017-01-16 12:15:42 +00:00
Pavel Labath 59d725cabf FileSpec: Fix PrependPathComponent("/")
Summary:
PrependPathComponent was unconditionally inserting path separators between the
path components. This is not correct if the prepended path is "/", which caused
problems down the line. Fix the function to use the same algorithm as
AppendPathComponent and add a test. This fixes one part of llvm.org/pr31611.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 292100
2017-01-16 10:07:02 +00:00
Pavel Labath 0cfd7dc9ea Remove a couple of Stream flags
Summary:
I came across this while trying to understand what Log::Debug does. It turns out
it does not do anything, as there is no instance of someone setting a debug flag
on a stream. The same is true for the Verbose and AddPrefix flags. Removing
these will enable some cleanups in the Logging class, and it brings us closer
towards the long term goal of standardizing on llvm stream classes.

I have removed these flags and all code the code which tested for their
presence -- there wasn't much of it, mostly in SymbolFileDWARF, which is
probably going away at some point anyway.

The eBinary flag still has some users, so I am letting it life for the time
being.

Reviewers: clayborg, zturner

Subscribers: aprantl, beanz, lldb-commits

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

llvm-svn: 291895
2017-01-13 10:41:59 +00:00
Omair Javaid eaed600a21 Fix log typo in ABISysV_arm64.cpp
This commit fixes a typo in ABISysV_arm64.cpp.
Log was reporting a call to ABISysV_x86_64::PrepareTrivialCall.

llvm-svn: 291889
2017-01-13 09:06:58 +00:00
Pavel Labath 4294de3aa0 Fix build for clang r291753
llvm-svn: 291756
2017-01-12 10:44:16 +00:00
Richard Smith 2245293541 Update to match clang r291737.
llvm-svn: 291738
2017-01-12 02:37:54 +00:00
Tamas Berghammer 556b1611cd Improve Type::GetTypeScopeAndBasenameHelper and add unit tests
Previously it failed to handle nested types inside templated classes
making it impossible to look up these types using the fully qualified
name.

Differential revision: https://reviews.llvm.org/D28466

llvm-svn: 291559
2017-01-10 11:13:59 +00:00
Kuba Mracek 89c3170d61 Stop limiting the number of TSan backtrace size to 8
We currently limit the length of TSan returned backtraces to 8, which is not necessary (and a bug, most likely). Let's remove this.

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

llvm-svn: 291522
2017-01-10 01:14:52 +00:00
Tamas Berghammer 1c62e0356d Fix dereferencing of pointers to empty classes
llvm-svn: 291350
2017-01-07 16:39:07 +00:00
Tamas Berghammer 7850602f0a Remove an incorrect byte size calculation in DWARFASTParserClang
llvm-svn: 291349
2017-01-07 16:39:02 +00:00
David Blaikie 8fda2b3c91 Reapply "Fixes for Clang API changes to use std::shared_ptr"
Aleksey Shlyapnikov found the memory leak I introduced, recommitted the
Clang change with a fix for this.

This reapplies r291200 reverted in r291250

llvm-svn: 291271
2017-01-06 19:49:05 +00:00
David Blaikie 64fb405836 Revert "Fixes for Clang API changes to use std::shared_ptr"
The original Clang change caused a memory leak detected by asan.
Reverting while I investigate.

This reverts commit r291200.

llvm-svn: 291250
2017-01-06 17:47:15 +00:00
Pavel Labath bda6fb7389 Attempt to fix windows build for r291198
llvm-svn: 291233
2017-01-06 12:41:15 +00:00
Pavel Labath 684c2c9394 Fix clang build for r291198
Older clangs (<=3.6) complain about a redefinition when we try to specialize a
templace function declared with = delete. Instead, I just don't define the
function body, which will trigger a linker error  if someone tries to use an
unknown function.

llvm-svn: 291226
2017-01-06 10:20:32 +00:00
Pavel Labath 927ec4b5ac Consolidate file handle usage in Editline.cpp
Summary:
To implement wide character reading, editline was mixing FILE*-based access with
a Connection-based one (plus it did some selects on the raw FD), which is very
fragile. Here, I replace it with one which uses only a Connection-based reads.
The code is somewhat longer as I had to read characters one by one to detect the
end of the multibyte sequence.

I've verified that international characters still work in lldb command line on
OSX.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 291220
2017-01-06 09:27:38 +00:00
David Blaikie e9c678cfca Fixes for Clang API changes to use std::shared_ptr
llvm-svn: 291200
2017-01-06 00:38:12 +00:00
David Blaikie 73902cc0ac Fix -Wunused-function warning by preprocessor conditionalizing the function the same way as the caller
llvm-svn: 291199
2017-01-06 00:38:10 +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
Pavel Labath 763f1c453b Fix jModulesInfo handling for cross-path syntax debugging
We were sending paths with the host path separator, which meant the remote
target did not understand our packets correctly.

llvm-svn: 291103
2017-01-05 13:18:46 +00:00
Pavel Labath f31c9d27a4 Silence some -Wstring-conversion warnings
lldbassert(!"foo") -> lldbassert(0 && "foo")

In one case, this actually detected a logic error in the assertion (missing !).

llvm-svn: 291102
2017-01-05 13:18:42 +00:00
Luke Drummond 47d6416189 Add a debuginfo version check for RenderScript modules
Added an extra field parser to the `RSModuleDescriptor` class enabling us to
check whether the versions of LLVM used to generated the debug symbols match
across the RenderScript compiler frontend (llvm-rs-cc) and backend (bcc); if
they do not, we warn the user that the debugging experience may be suboptimal
as LLVM IR debug information has no compatibility guarantees.

llvm-svn: 290957
2017-01-04 12:11:04 +00:00
Tamas Berghammer a6f5795ae2 Improve the performance of jModulesInfo in lldb-server
Previously it parsed /proc/<pid>/maps for every module separately
resulting in a very slow response time. This CL add some caching and
optimizes the implementation to improve the code from O(n*m) to O(n+m)
where n is the number of modules requested and m is the number of
files mapped into memory.

Differential revision: https://reviews.llvm.org/D28233

llvm-svn: 290895
2017-01-03 16:29:43 +00:00
Howard Hellyer 9434690ab7 Simplify reading of Linux notes to correctly handle endianess.
Summary:
This patch changes and simplifies the way notes are read from Linux Elf cores.
The current implementation copies the bytes from the notes directly over the lldb structure for 64 bit cores and reads field by field for 32 bit cores. Reading the bytes directly only works if the endianess of the core dump and the platform that lldb are running on matches. The case statements for s390x and x86_64 would would only work on big endian systems and little endian systems respectively. That meant that x86_64 generally worked but s390x didn't unless you were on s390x or another big endian platform.
This patch just reads field by field on all platform and updates the field by field version to allow for those fields which are word size instead of fixed size. It should also slightly simplify adding support for a new Linux platform.

This patch also re-enables the s390x test case in TestLinuxCore.py on all non-s390x platforms as it now passes.

Reviewers: uweigand, clayborg

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

llvm-svn: 290874
2017-01-03 11:03:14 +00:00
Greg Clayton 8369b28da0 Fix the variable view in the "gui" curses mode so that variables whose children change will update correctly. Previously the variable view would update the children once and not change. If you were stepping through code where the dynamic type of a variable would change the value and its children, or a synthetic type (like say for a std::vector<int>), the variable view wouldn't update. Now it caches the children and uses the process stop ID to tell when the children need to be updated.
llvm-svn: 290688
2016-12-28 21:22:37 +00:00
Luke Drummond 63dea59104 Fix a couple of incorrect format string warnings
This patch fixes use of incorrect `%zi` to format a plain `int`, and using
`%llu` to format a `uint64_t`. The fix is to use the new typesafe
`llvm::Formatv` based API.

Differential Revision: https://reviews.llvm.org/D28028
Subscribers: lldb-commits

llvm-svn: 290359
2016-12-22 19:15:07 +00:00
Boris Ulasevich 9cc1e19603 Rollback my commit r290168 to fix linux tests failure. I'll be back!
llvm-svn: 290197
2016-12-20 20:00:58 +00:00
Boris Ulasevich 881989cb69 Bug 30863 - Step doesn't stop with coditional breakpoint on the next line
Fixed by additional completed plans detection, and applying them on breakpoint condition fail.
Thread::GetStopInfo reworked. New test added.
Review https://reviews.llvm.org/D26497
Many thanks to Jim

llvm-svn: 290168
2016-12-20 08:09:50 +00:00
Luke Drummond f5bb1d6c4e Expression evaluation for overloaded C functions (redux)
This is a redux of [Ewan's patch](https://reviews.llvm.org/D17957) , refactored
to properly substitute primitive  types using a hook in the itanium demangler,
and updated after the previous patch went stale

The new `SubsPrimitiveParmItanium` function takes a symbol name and replacement
primitive type parameter as before but parses it using the FastDemangler, which
has been modified to be able to notify clients of parse events (primitive types
at this point).

Additionally, we now use a `set` of `ConstStrings` instead of a `vector` so
that we don't try and resolve the same invalid candidate multiple times.

Differential Revision: https://reviews.llvm.org/D27223
Subscribers: lldb-commits

llvm-svn: 290117
2016-12-19 17:22:44 +00:00
Zachary Turner 91ad7a9b69 Fix compiler warning.
llvm-svn: 289994
2016-12-16 21:35:12 +00:00
Zachary Turner 827d5d74a5 Add methods to enable using formatv syntax in LLDB.
This adds formatv-backed formatting functions in various
places in LLDB such as StreamString, logging, constructing
error messages, etc.  A couple of callsites are changed
from Printf style syntax to formatv style syntax to
illustrate its usage.  Additionally, a FileSpec formatter
is introduced so that FileSpecs can be formatted natively.

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

llvm-svn: 289922
2016-12-16 04:27:00 +00:00
Jason Molenda 3826727453 Fix a bug when using a StructuredData darwin-log plugin
where we would insert a breakpoint into a system library
but never remove it, so the second time we ran the binary
there would be two breakpoints and the debugger would
stop there.

<rdar://problem/29654974> 

llvm-svn: 289913
2016-12-16 02:48:39 +00:00
Chris Bieneman 679d02f2a1 [CMake] Only support LLDB_BUILD_FRAMEWORK on CMake 3.7 and later
CMake's framework target generation was unable to generate POST_BUILD steps (see: https://gitlab.kitware.com/cmake/cmake/issues/16363).

It turns out working around this is really not reasonable. The more reasonable solution to me is just to not support LLDB.framework unless you are on CMake 3.7 or newer.

Since CMake 3.7.1 is released that's how I'm going to handle this.

llvm-svn: 289841
2016-12-15 18:18:47 +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
Pavel Labath 1f2c1b6ccd Remove linux/personality.h wrapper
This code is currently unused.

Removing it should make porting of the linux plugin to NetBSD easier, and we can
always add it later if needed.

llvm-svn: 289801
2016-12-15 10:47:40 +00:00
Jim Ingham 8f7db52d9d Fix incorrectly named variables.
llvm-svn: 289746
2016-12-15 00:30:30 +00:00
Sean Callanan 237c3ed95e Adopt PrettyStackTrace in LLDB
LLDB needs some minor changes to adopt PrettyStackTrace after https://reviews.llvm.org/D27683.
We remove our own SetCrashDescription() function and use LLVM-provided RAII objects instead.
We also make sure LLDB doesn't define __crashtracer_info__ which would collide with LLVM's definition.

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

llvm-svn: 289711
2016-12-14 21:31:31 +00:00
Stephan Bergmann 17c7f70362 Replace APFloatBase static fltSemantics data members with getter functions
At least the plugin used by the LibreOffice build
(<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly
uses those members (through inline functions in LLVM/Clang include files in turn
using them), but they are not exported by utils/extract_symbols.py on Windows,
and accessing data across DLL/EXE boundaries on Windows is generally
problematic.

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

llvm-svn: 289647
2016-12-14 11:57:17 +00:00
Greg Clayton 8f61811789 Fix i386 being able to show member variables correctly by not returning empty objective C types from the runtime.
We don't parse ObjC v1 types from the runtime metadata like we do for ObjC v2, but doing so by creating empty types was ruining the i386 v1 debugging experience.

<rdar://problem/24093343>

llvm-svn: 289233
2016-12-09 17:54:59 +00:00
Nitesh Jain 0546e845c0 [LLDB][MIPS] Fix TestWatchpointIter failure
Reviewers: jingham

Subscribers: jaydeep, bhushan, slthakur, lldb-commits

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

llvm-svn: 289211
2016-12-09 13:54:47 +00:00
Zachary Turner 2c84f908af Remove some more uses of Args::GetArgumentAtIndex.
llvm-svn: 289188
2016-12-09 05:46:41 +00:00
Greg Clayton 7904046c33 Calling SBDebugger::CeeateTarget being called on multiple threads was crashing LLDB.
I found the race condition in:

ScriptInterpreter *CommandInterpreter::GetScriptInterpreter(bool can_create);

More than one "ScriptInterpreter *" was being returned due to the race which caused any clients with the first one to now be pointing to freed memory and we would quickly crash.

Added a test to catch this so we don't regress.

<rdar://problem/28356584> 

llvm-svn: 289169
2016-12-09 01:21:14 +00:00
Zachary Turner 867e7d1765 Fix some occurrences of passing StringRef to Printf.
Hopefully these will all disappear in the future once we move
to formatv.

llvm-svn: 289168
2016-12-09 01:20:58 +00:00
Zachary Turner 14f6b2c035 Modernize the Args access pattern in a few more commands.
llvm-svn: 289164
2016-12-09 01:08:29 +00:00
Greg Clayton b5cd6e7b7e Fixed a crasher that has been borking out heap for a long time.
ThreadList had an assignment operator that didn't lock the "rhs" thread list object. This means a thread list can be mutated while it is being copied.

The copy constructor calls the assignment operator as well. So this fixes the unsafe threaded access to ThreadList which we believe is responsible for a lot of crashes.

<rdar://problem/28075793>

llvm-svn: 289100
2016-12-08 20:38:19 +00:00
Jason Molenda b3a3cd1f4e When we interrupt a process, it was possible or the thread names
to not be set by Process::WillPublicStop() so the driver won't get
access to them.  The fix is straightforward, moving the call to
WillPublicStop above the early return for the interrupt case.  (the
interrupt case does an early return because the rest of the function
is concerned with running stop hooks etc and those are not applicable
when we've interrupted the process).

Also added a test case for it.  The test case is a little complicated
because I needed to drive lldb asynchronously to give the program
a chance to get up and running before I interrupt it.  Running to
a breakpoint was not sufficient to catch this bug.

<rdar://problem/22693778> 

llvm-svn: 289026
2016-12-08 06:27:29 +00:00
Jason Molenda 49034417da Set the address size based on the target's arch instead
of using the address of the all_image_infos struct.
<rdar://problem/29547847> 

llvm-svn: 289016
2016-12-08 02:02:45 +00:00
Zachary Turner f965cc8632 Convert CommandObjectFrame to entry-based Args access.
In the process, discovered a bug related to the use of an
uninitialized-pointer, and fixed as suggested by Enrico
in an lldb-dev mailing list thread.

llvm-svn: 289015
2016-12-08 02:02:09 +00:00
Zachary Turner 4574a89051 Convert CommandObjectCommands to entry-based Args access.
llvm-svn: 289012
2016-12-08 01:31:04 +00:00
Greg Clayton 962364c605 Fix an unannotated fallthrough that was causing a warning.
llvm-svn: 289000
2016-12-07 23:52:27 +00:00
Greg Clayton 3ce7e99680 Fixed DoConnectRemote issues where ProcessKDP wasn't switched over to use the version that needed a StringRef as the URL, and also updated all virtual functions to say "override" to make sure this doesn't happen again.
llvm-svn: 288999
2016-12-07 23:51:49 +00:00
Pavel Labath 43d354182f Use Timeout<> in EvaluateExpressionOptions class
llvm-svn: 288797
2016-12-06 11:24:51 +00:00
Alexander Shaposhnikov a08ba42f1a [lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions
This diff
1. Adds a comment to ObjectFileELF.cpp about the current
approach to determining the OS.
2. Replaces the check in SymbolFileDWARF.cpp with a more robust one.

Test plan:
Built (on Linux) a test binary linked to a c++ shared library
which contains just an implementation of a function TestFunction,
the library (the binary itself) doesn't contain ELF notes 
and EI_OSABI is set to System V.
Checked in lldb that now "p TestFunction()" works fine 
(and doesn't work without this patch).

Differential revision: https://reviews.llvm.org/D27380

llvm-svn: 288687
2016-12-05 18:42:21 +00:00
Pavel Labath bfd6a75861 Remove superfluous android include
This file is not in the include path when building with a non-standalone
toolchain. In does not seem to be necessary anyway.

llvm-svn: 288674
2016-12-05 14:57:23 +00:00
Kuba Mracek 9ee6003146 Support more report types in AddressSanitizerRuntime.cpp, re-word existing ones.
In r288065, we added more report types into ASan that will be reported via the debugging API. This patch in LLDB provides human-friendly bug descriptions. This also improves wording on existing bug descriptions.

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

llvm-svn: 288535
2016-12-02 21:00:32 +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
Sean Callanan 0134152cb4 Handle empty strings when looking for a CFString's encoding.
Should fix the bots.

llvm-svn: 288403
2016-12-01 19:14:55 +00:00
Sean Callanan cd1eb72bab Handle UTF-16 and UTF-32 constant CFStrings
We have a longstanding issue where the expression parser does not handle wide CFStrings (e.g., @"凸凹") correctly, producing the useless error message

Internal error [IRForTarget]: An Objective-C constant string's string initializer is not an array
error: warning: expression result unused
error: The expression could not be prepared to run in the target

This is just a side effect of the fact that we don't handle wide string constants when converting these to CFStringCreateWithBytes. That function takes the string's encoding as an argument, so I made it work and added a testcase.

https://reviews.llvm.org/D27291
<rdar://problem/13190557>

llvm-svn: 288386
2016-12-01 17:46:51 +00:00
Pavel Labath 2ce2216469 Use Timeout<> in Process::RunThreadPlan
Summary:
Since the function is way too big already, I tried at least to factor out the
timeout computation stuff into a separate function. I've tried to make the new
code semantically equivalent, and it also makes sense when I look at it as a done
deal.

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 288326
2016-12-01 10:57:30 +00:00
Jason Molenda 61a8e53bf3 Add another address to look for the kernel load addr in
DynamicLoaderDarwinKernel::SearchForKernelWithDebugHints
on 32-bit devices.

<rdar://problem/29423290> 

llvm-svn: 288284
2016-11-30 23:00:52 +00:00
Pavel Labath e6e7e6c348 Fix handling of consecutive slashes in FileSpec::GetNormalizedPath()
The core of the function was actually handling them correctly. However, the
early exit was being too optimistic and did not give the function a chance to
fire if the path did not contain dots as well.

Fix that and add a couple of unit tests.

llvm-svn: 288247
2016-11-30 16:08:45 +00:00
Pavel Labath e3e21cfc0c Convert most of the Process class to Timeout<>
This changes most of the class to use the new Timeout class. The one function
left is RunThreadPlan, which I left for a separate change as the function is
massive. A couple of things to call out:
- I've renamed the affected functions to match the listener interface names. This
  should also help catch any places I did not convert at compile time.
- I've deleted the WaitForState function as it was unused.

llvm-svn: 288241
2016-11-30 11:56:32 +00:00
Pavel Labath fafff0c569 Fix OSX build for r288238
llvm-svn: 288239
2016-11-30 11:09:47 +00:00
Pavel Labath d35031e1e5 Use Timeout<> in the Listener class
Summary:
Communication classes use the Timeout<> class to specify the timeout. Listener
class was converted to chrono some time ago, but it used a different meaning for
a timeout of zero (Listener: infinite wait, Communication: no wait). Instead,
Listener provided separate functions which performed a non-blocking event read.

This converts the Listener class to the new Timeout class, to improve
consistency. It also allows us to get merge the different GetNextEvent*** and
WaitForEvent*** functions into one. No functional change intended.

Reviewers: jingham, clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 288238
2016-11-30 10:41:42 +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 27469faaa7 Remove an x86-ism from RegisterInfoInterface
Summary:
While adding FPR support to x86 elf core files (D26300), we ended up adding a
very x86-specific function to the general RegisterInfoInterface class, which I
didn't catch in review. This removes that function. The only reason we needed
it was to find the offset of the FXSAVE area. This is the same as the offset of
the first register within that area, so we might as well use that.

Reviewers: clayborg, dvlahovski

Subscribers: lldb-commits

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

llvm-svn: 288236
2016-11-30 10:17:58 +00:00
Pavel Labath 91c1fc2994 Remove ConnectionSharedMemory
This class is unused.

llvm-svn: 288122
2016-11-29 09:42:35 +00:00
Hafiz Abid Qadeer 65abfb1102 Fix a typo.
llvm-svn: 288118
2016-11-29 09:31:57 +00:00
Pavel Labath b514504eea Remove ConnectionMachPort
Summary:
This class is unused, and since the StringRef refactor, it does not even
implement the Connection interface.

Reviewers: clayborg, jingham

Subscribers: mgorny, lldb-commits

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

llvm-svn: 288117
2016-11-29 09:23:05 +00:00
Alexander Shaposhnikov 3666e9c54b [lldb] Fix compilation of SymbolFileDWARF.cpp with ENABLE_DEBUG_PRINTF set
This diff adds missing semicolon in SymbolFileDWARF.cpp

Differential revision: https://reviews.llvm.org/D27177

llvm-svn: 288094
2016-11-29 00:40:13 +00:00
Pavel Labath 6ec13991f5 Fix floating point register reads x86_64 linux on targets with no AVX support
Summary:
On for 64-bit targets, the correct register set to read the fxsave are is
NT_PRFPREG (only 32-bit targets need NT_PRXFPREG, presumably for historic
reasons). Reference:
<https://github.com/torvalds/linux/blob/v4.8/arch/x86/kernel/ptrace.c#L1261>.

Reviewers: tberghammer, valentinagiusti

Subscribers: lldb-commits

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

llvm-svn: 288038
2016-11-28 15:51:47 +00:00
Pavel Labath 4fd5754234 Fix a crash in ProcessPOSIXLog
We are getting a null pointer for the list of categories here (presumably due to
the args refactor).

llvm-svn: 288026
2016-11-28 11:47:14 +00:00
Alexander Shaposhnikov 696bd63550 [lldb] Fix typos in file headers
This diff fixes typos in file headers (incorrect file names).

Test plan:

Under llvm/tools/lldb/source:
find ./* -type f | grep -e '\(cpp\|h\)$' | while read F; do B=$(basename $F); echo $F head -n 1 $F | grep -v $B | wc -l ; done

Differential revision: https://reviews.llvm.org/D27115

llvm-svn: 287966
2016-11-26 05:23:44 +00:00
Pavel Labath ce8d6d9c6c Fix builds Windows and OSX builds after Connection refactor in r287922
Switch various bits of platform-specific code to chrono that I did not notice
when doing a linux build. This exposed a bug that ConnectionGenericFileWindows
did not handle the magic UINT32_MAX timeout value (instead it waited for about an
hour, which is close enough I guess). Fix that as well.

llvm-svn: 287927
2016-11-25 14:43:37 +00:00
Pavel Labath 2f159a5f93 Introduce Chrono to the Connection class. NFCI.
llvm-svn: 287922
2016-11-25 12:22:32 +00:00
Pavel Labath 3043fd8ff0 Fix FreeBSD build error in r287920
The conditional expression is ambiguous there, so help it by explicitly casting.
This will go away once we use chrono all the way down.

llvm-svn: 287921
2016-11-25 12:15:17 +00:00
Pavel Labath c4063eee0d Introduce chrono to the Communication class
This replaces the raw integer timeout parameters in the class with their
chrono-based equivalents.  To achieve this, I have moved the Timeout class to a
more generic place and added a quick unit test for it.

llvm-svn: 287920
2016-11-25 11:58:44 +00:00
Johan Engelen 0479957d1a Use Clang for D language support.
Differential revision: https://reviews.llvm.org/D24794

llvm-svn: 287917
2016-11-25 11:01:12 +00:00
Pavel Labath 3f8c78168e Merge Linux and FreeBSD arm64 register contexts
Summary:
This is a test-the-water change about possibilities of reducing duplication in
the register context definitions.

I've named the new class RegisterInfoPOSIX, as RegisterContextPOSIX was already
taken :(.  The two files were identical except for a fix by Tamas in D12636,
which was applied to the Linux version only, which fixed a discrepancy between
the definitions of fpsr and fpcr on one hand, and all other floating point
register definitions on the other.

Linux test suite still passes after this change. For freebsd, make the floating
point register behavior consistent, but I don't know whether it will be
consistently fixed, or consistently broken. By eyeballing the code, I have a
feeling that a similar fix to D12636 will be required in
RegisterContextPOSIXProcessMonitor_arm64::ReadRegister, but I can't be sure as I
have no way to test it (the assert in that function should fire upon accessing
the registers if it is wrong though).

Reviewers: emaste, clayborg

Subscribers: aemerson, rengolin, beanz, mgorny, modocache, dmikulin, lldb-commits

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

llvm-svn: 287916
2016-11-25 10:28:09 +00:00
Pavel Labath ce255ff26a Use more chrono in AdbClient
This refactors AdbClient interface in terms of std::chrono.

llvm-svn: 287880
2016-11-24 14:11:47 +00:00
Pavel Labath 818dd516da Use chrono in AdbClient
This refactors the class implementations to use chrono. I'll follow this up with
a refactor of the class interface.

llvm-svn: 287879
2016-11-24 14:03:57 +00:00
Pavel Labath 11b63cd309 Attempt to fix freebsd build after r287864
the chrono library there uses long long as the underlying chrono type, but
defines int64_t as long (or the other way around, I am not sure). In any case,
this caused the implicit conversion to not trigger. This should address that.

Also fix up the relevant unit test.

llvm-svn: 287867
2016-11-24 11:22:43 +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
Adrian Kuegel ecd760ca6e Remove \x13 (^S) character that was likely added by mistake.
r287386 added a \x13 character inside a string literal. Most likely this
was by mistake, so remove it.

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

llvm-svn: 287862
2016-11-24 10:01:34 +00:00
Howard Hellyer 1a2ac9bda5 Patch for lldb bug 26322 “core load hangs”
Summary:
This patch changes the way ProcessElfCore.cpp handles signal information.
The patch changes ProcessElfCore.cpp to use the signal from si_signo in SIGINFO notes in preference to the value of cursig in PRSTATUS notes. The value from SIGINFO seems to be more thread specific. The value from PRSTATUS is usually the same for all threads even if only one thread received a signal.
If it cannot find any SIGINFO blocks it reverts to the old behaviour and uses the value from cursig in PRSTATUS. If after that no thread appears to have been stopped it forces the status of the first thread to be SIGSTOP to prevent lldb hanging waiting for any thread from the core file to change state.

The order is:
- If one or more threads have a non-zero si_signo in SIGINFO that will be used.
- If no threads had a SIGINFO block with a non-zero si_signo set all threads signals to the value in cursig in their PRSTATUS notes.
- If no thread has a signal set to a non-zero value set the signal for only the first thread to SIGSTOP.


This resolves two issues. The first was identified in bug 26322, the second became apparent while investigating this problem and looking at the signal values reported for each thread via “thread list”.

Firstly lldb is able to load core dumps generated by gcore where each thread has a SIGINFO note containing a signal number but cursig in the PRSTATUS block for each thread is 0.

Secondly if a SIGINFO note was found the “thread list” command will no longer show the same signal number for all threads. At the moment if a process crashes, for example with SIGILL, all threads will show “stop reason = signal SIGILL”. With this patch only the thread that executed the illegal instruction shows that stop reason. The other threads show “stop reason = signal 0”.

Reviewers: jingham, clayborg

Subscribers: sas, labath, lldb-commits

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

llvm-svn: 287858
2016-11-24 08:56:37 +00:00
Taras Tsugrii 0ca1dde560 Fix a comparison of integers of different signs warning.
source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:403:21: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
  for (int i = 0; i < llvm::array_lengthof (magicks); i++)
                  ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

llvm-svn: 287848
2016-11-24 01:34:43 +00:00
Adrian McCarthy 4ad5def9b0 Refactor LLDB's Windows process plugin (NFC)
The Windows process plugin was broken up into multiple pieces a while back in
order to share code between debugging live processes and minidumps
(postmortem) debugging. The minidump portion was replaced by a cross-platform
solution. This left the plugin split into a formerly "common" base classes and
the derived classes for live debugging. This extra layer made the code harder
to understand and work with.

This patch simplifies these class hierarchies by rolling the live debugging
concrete classes up to the base classes. Last week I posted my intent to make
this change to lldb-dev, and I didn't hear any objections.

This involved moving code and changing references to classes like
ProcessWindowsLive to ProcessWindows. It still builds for both 32- and 64-bit,
and the tests still pass on 32-bit. (Tests on 64-bit weren't passing before
this refactor for unrelated reasons.)

llvm-svn: 287770
2016-11-23 16:26:37 +00:00
Zachary Turner d6a2475787 Re-add "demonstrate new Args API"
This fixes the build breakage due to the use of C++14.

llvm-svn: 287647
2016-11-22 17:10:15 +00:00
Sam McCall 30621391bc Improve detection of global vs local variables
Summary:
Improve detection of global vs local variables.

Currently when a global variable is optimized out or otherwise has an unknown
location (DW_AT_location is empty) it gets reported as local.

I added two new heuristics:
 - if a mangled name is present, the variable is global (or static)
 - if DW_AT_location is present but invalid, the variable is global (or static)

Subscribers: lldb-commits

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

llvm-svn: 287636
2016-11-22 11:40:25 +00:00
Omair Javaid 99a318e112 Fix build failure on Linux and BSD by reverting r287597
Linux and BSD builds failing after this changes from rev 287597.

llvm-svn: 287631
2016-11-22 09:47:00 +00:00
Zachary Turner 7edc3a6ed3 Fix a bug caught by adding LLVM_NODISCARD to StringRef.
llvm-svn: 287598
2016-11-21 23:18:13 +00:00
Zachary Turner 1c55c9b5bf Add the new Args / entry-access API.
The long-term goal here is to get rid of the functions
GetArgumentAtIndex() and GetQuoteCharAtIndex(), instead
replacing them with operator based access and range-based for
enumeration.  There are a lot of callsites, though, so the
changes will be done incrementally, starting with this one.

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

llvm-svn: 287597
2016-11-21 23:18:07 +00:00
Dimitar Vlahovski a228c46c2a ELF core: Adding parsing of the floating-point and SSE registers on x86 32/64 bit elf core files
Summary:
The floating-point and SSE registers could be present in the elf-core
file in the note NT_FPREGSET for 64 bit ones, and in the note
NT_PRXFPREG for 32 bit ones.

The entire note is a binary blob matching the layout of the x87 save
area that gets generated by the FXSAVE instruction (see Intel developers
manual for more information).

This CL mainly modifies the RegisterRead function in
RegisterContextPOSIXCore_x86_64 for it to return the correct data both
for GPR and FPR/SSE registers, and return false (meaning "this register
is not available") for other registers.

I added a test to TestElfCore.py that tests reading FPR/SSE registers
both from a 32 and 64 bit elf-core file and I have inluded the source
which I used to generate the core files.

I tried to also add support for the AVX registers, because this info could
also be present in the elf-core file (note NT_X86_XSTATE - that is the result of
the newer XSAVE instruction). Parsing the contents from the file is
easy. The problem is that the ymm registers are split into two halves
and they are in different places in the note. For making this work one
would either make a "hacky" approach, because there won't be
any other way with the current state of the register contexts - they
assume that "this register is of size N and at offset M" and
don't have the notion of discontinuos registers.

Reviewers: labath

Subscribers: emaste, lldb-commits

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

llvm-svn: 287506
2016-11-20 21:24:49 +00:00
Zachary Turner 72f4997cbf Fix some accidental Prints of StringRefs that snuck in.
llvm-svn: 287412
2016-11-19 00:50:29 +00:00
Zachary Turner eb4a0cb16b Fix some build errors.
llvm-svn: 287409
2016-11-18 23:32:37 +00:00
Chris Bieneman b653c4957d [CMake] NFC. Updating CMake dependency specifications
This patch updates a bunch of places where add_dependencies was being explicitly called to add dependencies on intrinsics_gen to instead use the DEPENDS named parameter. This cleanup is needed for a patch I'm working on to add a dependency debugging mode to the build system.

llvm-svn: 287408
2016-11-18 23:31:53 +00:00
Zachary Turner 53877afcb0 Convert CommandHistory functions to StringRef.
llvm-svn: 287401
2016-11-18 23:22:42 +00:00
Jim Ingham 9ac82603d5 Fix "thread step until" handling of multiple line inputs.
Also document that it handles same, and add some tests.

llvm-svn: 287386
2016-11-18 22:06:10 +00:00
Zachary Turner a47464b273 Change CreateTarget and dependents to accept StringRef.
llvm-svn: 287376
2016-11-18 20:44:46 +00:00
Zachary Turner 2a3d10ae61 Re-add the StringRef interface changes for Variable.
This concludes the changes I originally tried to make and then
had to back out.  This way if anything is still broken, it
should be easier to bisect it back to a more specific changeset.

llvm-svn: 287367
2016-11-18 19:23:39 +00:00
Zachary Turner d2daca770b Resubmit "Remove an output-parameter from Variable function".
The scanning algorithm had a few little subtleties that I
overlooked, but this patch should fix everything.

I still haven't changed the function to take a StringRef since
that has some trickle down effect and is mostly mechanical,
I just wanted to get the tricky part as isolated as possible.

llvm-svn: 287354
2016-11-18 17:55:04 +00:00
Zachary Turner 655c452534 Revert "Remove an out param from ValueObject::GetValueForExpressionPath."
This reverts commit r287315, as it introduces a bug that breaks
many things.

llvm-svn: 287320
2016-11-18 06:34:45 +00:00
Zachary Turner 82d760879f Remove an out param from ValueObject::GetValueForExpressionPath.
This argument was only used in one place in the codebase, and
it was in a non-critical log statement and can be easily
substituted for an equally meaningful field instead.  The
payoff of computing this value is not worth the added
complexity.

llvm-svn: 287315
2016-11-18 05:45:41 +00:00
Zachary Turner 70a38092fd Delete more dead code in ValueObject.
Apparently these two enormous functions were dead.  Which is
good, since one was largely a copy of another function with
only a few minor tweaks.

llvm-svn: 287308
2016-11-18 04:30:47 +00:00
Zachary Turner c2d5558b21 Remove some dead code in ValueObject.
Originally I converted this entire function and all dependents
to use StringRef, but there were some test failures that
were tricky to track down, as this is a complicated function.
So I'm starting over, this time in smaller increments.

llvm-svn: 287307
2016-11-18 03:51:19 +00:00
Zachary Turner ac96f66add Resubmit "Change RegisterValue getters / setters to use StringRef."
This resubmits r287279 with a fix for the original issue, which
was a trivial typo.

llvm-svn: 287282
2016-11-17 23:47:31 +00:00
Zachary Turner 8df8046bd9 Revert "Change RegisterValue getters / setters to use StringRef."
This reverts commit r287279, which breaks some register
tests on Linux.

llvm-svn: 287281
2016-11-17 23:32:26 +00:00
Zachary Turner b379d7df12 Change RegisterValue getters / setters to use StringRef.
In the process, found some functions that were duplicates of
existing StringRef member functions.  So deleted those functions
and used the StringRef functions instead.

llvm-svn: 287279
2016-11-17 23:05:28 +00:00
Sam McCall 592fa122c2 Fix step-over when SymbolContext.function is missing and symbol is present.
Summary:
Fix step-over when SymbolContext.function is missing and symbol is present.

With targets from our build configuration,
ThreadPlanStepOverRange::IsEquivalentContext fails to fire for relevant frames,
leading to ShouldStop() returning true prematurely.

The frame's SymbolContext, and m_addr_context have:
  - comp_unit set and matching
  - function = nullptr
  - symbol set and matching (but this is never checked)
My naive guess is that the context should be equivalent in this case :-)

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 287274
2016-11-17 22:29:31 +00:00
Zachary Turner e00e64caa7 Make GetRegisterByName() take a StringRef.
This one is fairly trivial and only really involves changing
function signatures and a few simple call-sites.

llvm-svn: 287266
2016-11-17 21:54:37 +00:00
Zachary Turner 3165945a41 Convert Platform, Process, and Connection functions to StringRef.
All tests pass on Linux and Windows.

llvm-svn: 287259
2016-11-17 21:15:14 +00:00
Zachary Turner 31d97a5c8a Rewrite all Property related functions in terms of StringRef.
This was a bit tricky, especially for things like
OptionValueArray and OptionValueDictionary since they do some
funky string parsing.  Rather than try to re-write line-by-line
I tried to make the StringRef usage idiomatic, even though
it meant often re-writing from scratch large blocks of code
in a different way while keeping true to the original intent.

The finished code is a big improvement though, and often much
shorter than the original code.  All tests and unit tests
pass on Windows and Linux.

llvm-svn: 287242
2016-11-17 18:08:12 +00:00
Zachary Turner 0eb31a1d96 Fix warnings and errors introduced with UUID changes.
llvm-svn: 287208
2016-11-17 05:14:32 +00:00
Zachary Turner 245f7fdcfa Convert UriParser to use StringRef.
llvm-svn: 287190
2016-11-17 01:38:02 +00:00
Zachary Turner 24bd317871 Make GetValueForVariableExpression use StringRef.
Also significantly reduced the indentation level by use of
early returns, and simplified some of the logic by using
StringRef functions such as consumeInteger() and getAsInteger()
instead of strtoll, etc.

llvm-svn: 287189
2016-11-17 01:37:52 +00:00
Zachary Turner 4aa8753c81 Convert AutoComplete related code to StringRef.
Differential Revision: https://reviews.llvm.org/D26721

llvm-svn: 287188
2016-11-17 01:37:42 +00:00
Zachary Turner 067d1db139 Make Apropos functions accept StringRefs.
llvm-svn: 287157
2016-11-16 21:45:04 +00:00
Zachary Turner a49c2019f1 Update GenerateAdditionalHelpAvenues to take StringRef.
llvm-svn: 287155
2016-11-16 21:34:22 +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
Adrian McCarthy 1ca677f4c4 Remove Windows-specific minidump plugin
With the cross-platform minidump plugin working, the Windows-specific one is no longer needed. This eliminates the unnecessary code.

This does not eliminate the Windows-specific tests, as they hit a few cases the general tests don't. (The Windows-specific tests are currently passing.) I'll look into a separate patch to make sure we're not doing too much duplicate testing.

After that I might do a little re-org in the Windows plugin, as there was some factoring there (Common & Live) that probably isn't necessary anymore.

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

llvm-svn: 287113
2016-11-16 16:04:14 +00:00
Pavel Labath 8cb1cd9b7b Remove TimeValue class
Summary:
All usages have been replaced by appropriate std::chrono funcionality, and the
class is now unused. The only used part of the cpp file is the DumpTimePoint
function, which I have moved into the only caller (CommandObjectTarget.cpp).

Reviewers: clayborg, zturner

Subscribers: mgorny, lldb-commits

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

llvm-svn: 287096
2016-11-16 10:54:22 +00:00
Zachary Turner e6f6d4c2f2 Change Property::GetName() and GetDescription() to return StringRef.
llvm-svn: 287055
2016-11-15 23:36:43 +00:00
Zachary Turner 2dd214a1cb Make some code not manipulate the underlying string of a StreamString.
Differential Revision: https://reviews.llvm.org/D26618

llvm-svn: 287017
2016-11-15 20:13:14 +00:00
Zachary Turner 32b1c7f7f1 One more fix for Printf. Apparently I fail at incremental builds.
llvm-svn: 287016
2016-11-15 20:11:01 +00:00
Sam McCall 6f43d9df61 Fix uninitialized members.
Summary: Fix uninitialized members.

Reviewers: jingham

Subscribers: jingham, lldb-commits

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

llvm-svn: 286947
2016-11-15 10:58:16 +00:00
Jason Molenda 2b0a7be96e Change the kernel searching code to not go through the
memory cache subsystem so we're reading only the 4 bytes
needed to check for the magic word at the start of a mach-o
binary instead of the default 512 block.  It can be a small
performance help to reduce the size of memory reads from 
possibly unmapped memory.

<rdar://problem/29256385> 

llvm-svn: 286926
2016-11-15 01:41:27 +00:00
Zachary Turner 0fe35b158f Fix some more Printf warnings.
llvm-svn: 286916
2016-11-15 00:45:23 +00:00
Zachary Turner 1e8016b2ea Fix some more StringRef printf warnings.
llvm-svn: 286915
2016-11-15 00:45:18 +00:00
Greg Clayton 7b26dbb125 Fix a deadlock issue that would happen when loading an AppleTV or watchOS binary.
This was a regression that was caused by svn revision 269877:

commit 1ded4a2a25d60dd2c81bd432bcf63b6ded58e5d6
Author: Saleem Abdulrasool <compnerd@compnerd.org>
Date:   Wed May 18 01:59:10 2016 +0000

    remove use of Mutex in favour of std::{,recursive_}mutex
    
    This is a pretty straightforward first pass over removing a number of uses of
    Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there
    are interfaces which take Mutex::Locker & to lock internal locks. This patch
    cleans up most of the easy cases. The only non-trivial change is in
    CommandObjectTarget.cpp where a Mutex::Locker was split into two.
    
    git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@269877 91177308-0d34-0410-b5e6-96231b3b80d8

This change actually changed the Platform::m_mutex to be non-recursive which caused the regression.

<rdar://problem/29094384>

llvm-svn: 286908
2016-11-14 23:45:50 +00:00
Zachary Turner 03c9f3642a Fix some StringRef Printf warnings.
llvm-svn: 286906
2016-11-14 23:23:31 +00:00
Chris Bieneman bd3d0263f8 One more cleanup to lldb version printing
With this patch LLDB_VERSION_STRING replaces "lldb version x.x.x" if it is set. This allows builds to not display the open source version numbers if the people making the distribution overrides the LLDB_VERSION_STRING.

Since LLDB_VERSION_STRING is always overridden on Darwin, this means the first line of lldb -version on Darwin is:

lldb-360.99.0 (<repo path> revision <revision>)

llvm-svn: 286899
2016-11-14 22:43:08 +00:00
Zachary Turner e706c1d9d9 Make OptionParser::Parse() take StringRef.
llvm-svn: 286747
2016-11-13 04:24:38 +00:00
Zachary Turner 8927f23abd Fix some use-after-frees that my last CL introduced.
llvm-svn: 286745
2016-11-13 03:36:01 +00:00
Zachary Turner aa5611f56d Change ValueObject creation functions to take StringRefs.
llvm-svn: 286744
2016-11-13 03:29:46 +00:00
Zachary Turner 7a120c8b3d Change IOHandlerConfirm to use StringRefs.
llvm-svn: 286743
2016-11-13 03:05:58 +00:00
Zachary Turner 988968394d Change some more CommandObject functions to StringRef.
llvm-svn: 286742
2016-11-13 02:50:32 +00:00
Zachary Turner e0038717b9 Change ArgumentHelpCallbackFunction to return a StringRef.
llvm-svn: 286740
2016-11-13 02:08:22 +00:00
Zachary Turner 442f6530d2 Make CommandObject help getters/setters use StringRef.
llvm-svn: 286731
2016-11-12 20:41:02 +00:00
Zachary Turner e2411fabda Make DiagnosticsManager functions take StringRefs.
llvm-svn: 286730
2016-11-12 19:12:56 +00:00
Zachary Turner 0b172c0c0d Make CommandReturnObject methods accept StringRefs.
llvm-svn: 286728
2016-11-12 18:47:11 +00:00
Zachary Turner 22a2628f18 Make ValueObjectMemory::Create accept StringRefs.
llvm-svn: 286726
2016-11-12 18:17:36 +00:00
Zachary Turner fe11483b57 Make Options::SetOptionValue take a StringRef.
llvm-svn: 286723
2016-11-12 16:56:47 +00:00
Todd Fiala 653e3f4e19 Remove weak-linked symbols for SBBreakpointListImpl
Summary:
Similar to SBStructuredData's Impl class, SBBreakpointListImpl was
getting weak-link exported in the lldb namespace. This change list fixes
that by moving out of the lldb public namespace, which removes it from
public export visibility.

Fixes:
rdar://28960344

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 286631
2016-11-11 21:06:40 +00:00
Mehdi Amini 665be50e37 Revert unwanted changes in lldb when updating llvm::Error()
My script updated lldb::Errors, and I failed to fix it entirely
before pushing. This restore everything in lldb as it was before
r286561.

llvm-svn: 286565
2016-11-11 05:07:57 +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
Chris Bieneman 1c9da8bc55 [CMake] Fixing CMake to append source properties instead of overwrite them.
This is a small fix to the version output.

llvm-svn: 286528
2016-11-10 23:56:32 +00:00
Chris Bieneman 1778f69f44 Fixing the Xcode build that I broke in r286479
Since Xcode can't seem to handle quotes in preprocessor definitions, I've changed the build to assume that the define is unquoted. This should fix the failing Darwin bots.

llvm-svn: 286504
2016-11-10 21:30:16 +00:00
Chris Bieneman b92cfe6804 Unify Darwin and Non-Darwin printing of version output
Summary:
This change unifies and simplifies the code paths between the Darwin and non-Darwin code to print the LLDB version information.

It also introduces a new variable in CMake LLDB_VERSION_STRING which can be used to specify custom version information. On Darwin this value is implicitly set based on the resource/LLDB-Info.plist file.

With the LLDB_VERSION_STRING variable set to lldb-360.99.0, the -version output is:

> ./bin/lldb -version
lldb version 4.0.0 (lldb-360.99.0)
  clang revision 286264
  llvm revision 286265

This behavior is unified across all target platforms.

Reviewers: lldb-commits

Subscribers: mgorny, tfiala

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

llvm-svn: 286479
2016-11-10 17:33:19 +00:00
Todd Fiala 2ef442c639 Fix weak symbol linkage in SBStructuredData, update docs.
Summary:
This change fixes an issue where I was leaking a weakly-linked symbol in
the SBAPI. It also updates the docs to call out what I did wrong.

Fixes:
rdar://28882483

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 286413
2016-11-09 23:21:04 +00:00
Luke Drummond 81fc84fa07 [RenderScript] Fix reduction argument printing
When placing function name breakpoints on RenderScript Reduction kernel
functions, we were not skipping over the function prologue meaning that
inspection of the arguments could be garbled as the function was not finished
setting up the stack/registers.

In
[122fe8f](122fe8f472)
Aidan added the `SkipPrologue` function that allows us to trivially fix up the
kernel's functions' resolved addresses, falling gracefully back to the old
behaviour if we don't know how to handle the prologue or can't resolve its
size.

llvm-svn: 286387
2016-11-09 19:20:39 +00:00
Pavel Labath dfa7af1edd Remove TimeValue usage from lldb/Target
It was only used for declaring unused variables. :)

llvm-svn: 286374
2016-11-09 15:05:48 +00:00
Pavel Labath 5cc7967880 Remove TimeValue usage from ObjectContainerBSDArchive
llvm-svn: 286373
2016-11-09 15:05:45 +00:00
Pavel Labath f03b2dc4c8 Remove unused TimeValue include
llvm-svn: 286372
2016-11-09 14:53:37 +00:00
Pavel Labath 88d0cbe06d Remove TimeValue usage from lldb/Host
llvm-svn: 286371
2016-11-09 14:53:32 +00:00
Pavel Labath e877baa854 Remove TimeValue usage from lldb/Interpreter
llvm-svn: 286369
2016-11-09 14:33:22 +00:00
Pavel Labath 3dc342eb0c Remove TimeValue usage from lldb/Core. NFC.
llvm-svn: 286366
2016-11-09 14:04:08 +00:00
Pavel Labath 833e3d109b Display the pointer value in the libstdc++ unique_ptr summary
Summary:
r284830 added a summary provider for unique_ptr in libstdc++, whose value printed
the value of the pointee. This is a bit unintuitive as it becomes unobvious that
the value actually is a pointer, and we lose the way to actually obtain the
pointer value.

Change that to print the pointer value instead. The pointee value can still be
obtained through the synthetic children.

Reviewers: tberghammer, granata.enrico

Subscribers: lldb-commits

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

llvm-svn: 286355
2016-11-09 10:42:29 +00:00
Pavel Labath 222fd13e3f Disable windows-only minidump plugin
Summary:
This commit disables the windows-only minidump plugin and enables the new
cross-platform plugin for windows minidump files. Test decorators are adjusted to
reflect that: windows minidump tests can now run  on all platforms. The exception
is the tests that create minidump files, as that functionality is not available
yet.  I've checked that this works on windows and linux.

Reviewers: amccarth, zturner

Subscribers: dvlahovski, lldb-commits

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

llvm-svn: 286352
2016-11-09 10:16:11 +00:00
Pavel Labath 7e2cfbf0b7 Remove TimeValue usage from Core/Module
Summary:
The only interesting part here is that TimePoint and TimeValue have different
natural string representations, which affects "target modules list" output. It
is now "2016-07-09 04:02:21.000000000", whereas previously in was
"Sat Jul  9 04:02:21 2016". I wanted to check if we're OK with that.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 286349
2016-11-09 09:59:18 +00:00
Jason Molenda 73184de2d3 When deciding whether to use the source remapping dictionary from
a dSYM per-uuid plist, only use it when the DBGVersion key has a
value of 2 or greater.

<rdar://problem/28889578> 
<rdar://problem/29131339> 

llvm-svn: 286335
2016-11-09 03:42:12 +00:00
Jim Ingham 4f243e8d93 "thread backtrace" should use the thread-stop-format.
<rdar://problem/28273697>

llvm-svn: 286312
2016-11-08 23:43:36 +00:00
Zachary Turner cb3c9f6c74 Fix some cases where we were printf'ing StringRefs.
llvm-svn: 286303
2016-11-08 22:23:50 +00:00
Jim Ingham 6a9767c7e6 Clean up the stop printing header lines.
I added a "thread-stop-format" to distinguish between the form
that is just the thread info (since the stop printing immediately prints
the frame info) and one with more frame 0 info - which is useful for
"thread list" and the like.

I also added a frame.no-debug boolean to the format entities so you can
print frame information differently between frames with source info and those
without.

This closes https://reviews.llvm.org/D26383.
<rdar://problem/28273697>

llvm-svn: 286288
2016-11-08 20:36:40 +00:00
Zachary Turner c5d7df9035 Convert some Expression parser functions to StringRef.
llvm-svn: 286208
2016-11-08 04:52:16 +00:00
Zachary Turner 0ac5f9846b Rewrite OutputFormattedHelpText in terms of StringRef.
This makes the logic easier to follow and also propagates
StringRef up to the API boundary, which is necessary for
making higher up StringRef API changes.

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

llvm-svn: 286204
2016-11-08 04:12:42 +00:00
Enrico Granata 65d86e4fa5 Simplify the PrintableRepresentationSpecialCases code; we never used the ePrintableRepresentationSpecialCasesOnly value and with enum classes the names doesn't need to be that long
llvm-svn: 286176
2016-11-07 23:32:20 +00:00
Jim Ingham 0298082541 UserExpression::Evaluate only returns a non-empty ValueObjectSP
if it returns eExpressionCompleted.  Don't try to get the error
from the ValueObjectSP if that's not true.

I just have a report of this from the field, I don't know how
to make it fail yet.

<rdar://problem/29113004>

llvm-svn: 286170
2016-11-07 22:47:01 +00:00
Enrico Granata 3949cb61a5 Fix an issue where LLDB would hang trying to launch tvOS simulator binaries
llvm-svn: 286116
2016-11-07 16:25:01 +00:00
Vedant Kumar 6ba1db9f78 [lldb] Fix -Waggressive-loop-optimizations warning
We shouldn't access past the end of an array, even if we think that the
layout of the struct containing the array is always what we expect. The
compiler is free to optimize away the stores as undefined behavior, and
in fact, GCC 6.2.1 claims it will do exactly this.

llvm-svn: 286093
2016-11-07 02:39:37 +00:00
Zachary Turner 6560d2c2d5 Convert some helper functions to use StringRef.
I will probably submit a lot of small trivial changes
like this over the coming weeks.  The end goal is to
convert Options::SetOptionValue to take the option arg
as a StringRef, but doing so in one pass would be a huge
mess of disparate changes just to satisfy the compiler,
and with a high risk of breaking.  So I'm going to do
this in small pieces, changing seemingly random things
here and there until the final change to the signature
of Options::SetOptionValue() can be done trivially.

llvm-svn: 286088
2016-11-07 00:07:25 +00:00
Enrico Granata 9ac0dac1a6 Preliminary plumbing work to make 'parray' able to take offset and stride options
llvm-svn: 286003
2016-11-04 18:15:39 +00:00
Pavel Labath 2fd9a1e0d9 Fix GDBRemoteCommunicationClientTest.TestPacketSpeedJSON
The mock server was listening for only one packet (I forgot to put a loop around
it), which caused the client to stall in debug builds, as the timeout there is
1000 seconds. In case of a release builds the test would just silently succeed as
the tested function does not check or report errors (which should be fixed).

This fixes the test by adding the server loop. Since the test was taking quite a
long time now (8s), I have added a parameter to control the amount of data sent
(default 4MB), and call it with a smaller value in the test, to make the test run
faster.

llvm-svn: 285992
2016-11-04 11:49:06 +00:00
Jim Ingham 225621596b Don't access the process in expressions w/o checking that
the process exists.

I also added some tests that crash before this fix, and work correctly after.

<rdar://problem/29083321>

llvm-svn: 285974
2016-11-03 23:42:09 +00:00
Enrico Granata 7700de8c30 Add support to the ObjC type scavenger for finding types via debug info
llvm-svn: 285941
2016-11-03 17:25:27 +00:00
Aidan Dodds 21fed052e0 [Renderscript] Add commands for scriptgroup interaction.
This commit hooks the nofity function that signals script group
compilation.  By tracking scriptgroups compiled at runtine, users
are able to place breakpoints by script group name.  Breakpoints
will be placed on the kernels forming the group.

llvm-svn: 285902
2016-11-03 13:20:37 +00:00
Pavel Labath bfa601f6b8 Remove TimeSpecTimeout class
the class is unused.

llvm-svn: 285891
2016-11-03 09:29:56 +00:00
Pavel Labath 96a3c91e66 Refactor Timer class
Summary:
While removing TimeValue from this class I noticed a lot of room for small
simplifications here. Main are:
  - instead of complicated start-stop dances to compute own time, each Timer
    just starts the timer once, and keeps track of the durations of child
    timers. Then the own time can be computed at the end by subtracting the two
    values.
  - remove double accounting in TimerStack - the stack object already knows the
    number of timers.
The interface does not lend itself well to unit testing, but I have added a
couple of tests which can (and did) catch any obvious errors.

Reviewers: tberghammer, clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 285890
2016-11-03 09:14:09 +00:00
Dawn Perchik 49df3895e7 Fix typo which broke debugging on older OSX systems after r285172.
Reviewed by: jasonmolenda
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D26260

llvm-svn: 285858
2016-11-02 20:57:34 +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
Pavel Labath ad90734caf Remove KQueue.cpp
Summary:
This class is unused.

Reviewers: clayborg

Subscribers: mgorny, modocache, lldb-commits

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

llvm-svn: 285847
2016-11-02 18:06:17 +00:00
Zachary Turner 046bbafdf2 Fix crash in PseudoTerminal on Windows.
Patch by Rudy Pons
Differential Revision: https://reviews.llvm.org/D25681

llvm-svn: 285843
2016-11-02 17:42:12 +00:00
Chris Bieneman 5f15a30bb1 Find clang resource directory via *nix-style lookup
Summary:
This patch allows the Darwin build to fall back to to Posix-style lookups for the clang resource directory if the debugger library isn't inside a framework.

The patch also includes a bit of refactoring and cleanup around the *nix resolution of the binary and lib directories to reuse the code instead of duplicating it.

With this patch Darwin builds that don't build a framework only have 3 failing tests on my system (TestExec.py).

Reviewers: zturner, labath, spyffe, tfiala

Subscribers: lldb-commits

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

llvm-svn: 285838
2016-11-02 17:19:23 +00:00
Zachary Turner e9da8a8ec0 Fix some warnings compiling with clang-cl on Windows.
llvm-svn: 285834
2016-11-02 16:59:42 +00:00
Pavel Labath 774103c831 Remove TimeValue usage from two files
llvm-svn: 285801
2016-11-02 12:18:42 +00:00
Pavel Labath eaa419cf5e Fix printf errors in ProcessMinidump
llvm-svn: 285798
2016-11-02 10:29:47 +00:00
Pavel Labath 766fd11597 Remove TimeValue from UnwindLLDB.cpp
Really NFC, as the code is #ifdefed out, but I did make sure it compiles if I enable it.

llvm-svn: 285797
2016-11-02 10:27:54 +00:00
Pavel Labath 5cddd608cd Remove TimeValue usages from MacOSX-Kernel process plugin. NFC
llvm-svn: 285795
2016-11-02 10:13:54 +00:00
Jim Ingham c76c3f2f91 Fix SBWatchpoint::SetEnabled to send an event.
We really shouldn't be sending events for SB API's, dunno when we started
doing that.  We don't do it for other things.  But first restore the status quo.

llvm-svn: 285781
2016-11-02 01:06:42 +00:00
Jim Ingham 306b62b4ae Switch SBWatchpoint::SetEnabled over to using Process::{Enable,Disable}Watchpoint.
We don't have a good story for what happens to watchpoints when you don't
have a process, or if your process exits.  Clearing that up will instruct 
how to fix this for real.

Also added a test to make sure disable->enable works as well.
This resolves llvm.org/pr30789.

llvm-svn: 285742
2016-11-01 20:37:02 +00:00
Enrico Granata f60216733f Add helpers for the notion of a type scavenger that is "either this or that" source, and one that is "both this and that" source
Use the helper to rewrite the ObjC type lookup logic (first modules, then runtime) in terms of an either scavenger

llvm-svn: 285736
2016-11-01 20:17:14 +00:00
Enrico Granata 63db2395f6 Implement a general type scavenger that can dig types from debug info + a filtering mechanism to accept/reject results thusly obtained
Implement the C++ type lookup support in terms of this general scavenger

The idea is that we may want other languages to do debug info based search (exclusively, or as an add-on to runtime/module based searching) and it makes sense to avoid duplicating this functionality

llvm-svn: 285727
2016-11-01 18:50:49 +00:00
Eugene Zelenko a0b67bbed9 Fix RHEL 6 build with missing cerrno and some other Include What You Use warnings.
Differential revision: https://reviews.llvm.org/D26171

llvm-svn: 285710
2016-11-01 17:11:10 +00:00
Pavel Labath 1408bf7231 Remove TimeValue usage from FileSpec.h
Summary:
The only usage there was in GetModificationTime(). I also took the opportunity
to move this function from FileSpec to the FileSystem class - since we are
using FileSpecs to also represent remote files for which we cannot (easily)
retrieve modification time, it makes sense to make the decision to get the
modification time more explicit.

The new function returns a llvm::sys::TimePoint<>. To aid the transition
from TimeValue, I have added a constructor to it which enables implicit
conversion from a time_point.

Reviewers: zturner, clayborg

Subscribers: mehdi_amini, tberghammer, danalbert, beanz, mgorny, lldb-commits

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

llvm-svn: 285702
2016-11-01 16:11:14 +00:00
Dimitar Vlahovski 5a19c0cc50 Minidump plugin: Fix flaky test
Summary:
One of the tests was flaky, because similarly to
https://reviews.llvm.org/D18697 (rL265391) - if there is a process running
which is with the same PID as in the core file, the minidump
core file debugging will fail, because we get some information from the
running process.
The fix is routing the ProcessInfo requests through the Process class
and overriding it in ProcessMinidump to return correct data.

Reviewers: labath

Subscribers: lldb-commits, beanz

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

llvm-svn: 285698
2016-11-01 15:48:24 +00:00
Jason Molenda e322332a09 Fix a bug where the EmulateInstructionARM64 handling of STP/LDP instructions
for floating point registers was not recording them correctly.  I needed to
change the EmulateInstructionARM64 unwind plans from using the DWARF 
register numbering scheme to using the LLDB register numbering scheme
(because dwarf doesn't define register numbers for the 64-bit "d" registers).
Updated the EmulateInstructionARM64 unit tests to work with the LLDB
register numbering scheme and added a unit test to check the floating
point register spills & restores are correctly recorded.

https://reviews.llvm.org/D25864
<rdar://problem/28745483> 

llvm-svn: 285662
2016-11-01 01:26:54 +00:00
Stephane Sezer 8004a57d79 Remove executable bit on a source file
llvm-svn: 285658
2016-11-01 00:21:57 +00:00
Chris Bieneman b9fc4727cc [CMake] Populate the build directory's framework
This ensures that the Resources and clang headers are properly symlinked in LLDB's framework. This should fix the modules-related tests when building on Darwin with CMake if you are building a framework.

I have another fix coming which gets them working on Darwin if you're building liblldb instead of a framework.

llvm-svn: 285651
2016-10-31 22:31:07 +00:00
Pavel Labath 3aa049102f Remove usages of TimeValue from gdb-remote process plugin
Summary:
Most of the changes are very straight-forward, the only tricky part was the
"packet speed-test" function, which is very time-heavy. As the function was
completely untested, I added a quick unit smoke test for it.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 285602
2016-10-31 17:19:42 +00:00
Enrico Granata 5b6198d369 Remove a couple of old TODOs and don't make a new ConstString each time; none of this is super-critical since it applies to older versions of macOS (or OSX, I guess?) but still..
llvm-svn: 285599
2016-10-31 17:12:16 +00:00
Pavel Labath 218770b827 Improve ".." handling in FileSpec normalization
Summary:
.. handling for windows path was completely broken because the function was
expecting \ as path separators, but we were passing it normalized file paths,
where these have been replaced by forward slashes. Apart from this, the function
was incorrect for posix paths as well in some corner cases, as well as being
generally hard to follow.

The corner cases were:
- /../bar -> should be same as /bar
- /bar/.. -> should be same as / (slightly dodgy as the former depends on /bar actually
  existing, but since we're doing it in an abstract way, I think the
  transformation is reasonable)

I rewrite the function to fix these corner cases and handle windows paths more
correctly. The function should now handle the posix paths (modulo symlinks, but
we cannot really do anything about that without a real filesystem). For windows
paths, there are a couple of corner cases left, mostly to do with drive letter
handling, which cannot be fixed until the rest of the class understands drive
letters better.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 285593
2016-10-31 16:22:07 +00:00
Dimitar Vlahovski 7b18dd4f77 Minidump plugin: Adding ProcessMinidump, ThreadMinidump and register the plugin in SystemInitializerFull
Summary:
This plugin resembles the already existing Windows-only Minidump plugin.
The WinMinidumpPlugin uses the Windows API for parsing Minidumps
while this plugin is cross-platform because it includes a Minidump
parser (which is already commited)

It is able to produce a backtrace, to read the general puprose regiters,
inspect local variables, show image list, do memory reads, etc.

For now the only arches that this supports are x86_32 and x86_64.
This is because I have only written register contexts for those.
Others will come in next CLs.

I copied the WinMinidump tests and adapted them a little bit for them to
work with the new plugin (and they pass)
I will add more tests, aiming for better code coverage.

There is still functionality to be added, see TODOs in code.

Reviewers: labath, zturner

Subscribers: beanz, mgorny, modocache, lldb-commits, amccarth

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

llvm-svn: 285587
2016-10-31 15:35:18 +00:00
Dimitar Vlahovski a7eebeb156 Minidump plugin: Adding x86_32 register context converter
Summary:
This, like the x86_64 case, reads the register values from the minidump
file, and emits a binary buffer that is ordered using the offsets from
the RegisterInfoInterface argument. That way we can reuse an existing
register context.
Added unit tests.

Reviewers: labath, zturner

Subscribers: beanz, mgorny, modocache, amccarth, lldb-commits

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

llvm-svn: 285584
2016-10-31 15:26:44 +00:00
Pavel Labath 6b91e405e3 Use the right dwarf attributes for parsing location list entries (fixup for r285441)
Note that the parsing code here is still incorrect wrt. the new draft of the
dwarf 5 spec (seconds arguments to DW_LLE_startx_length should be uleb128, not
u32). Once we have compilers actually emitting dwarf conformant with the new
spec, we'll need to revisit this and figure out the proper behavior there.

This should unbreak the linux bot.

llvm-svn: 285562
2016-10-31 11:53:13 +00:00
Todd Fiala fe68f09975 Limit LLDB_EXPORT_ALL_SYMBOLS to lldb symbols
LLDB_EXPORT_ALL_SYMBOLS used to instruct the build to export all
the symbols in liblldb on CMake builds.  This change limits the
CMake define to only add in the lldb_private namespace to the
symbols that normally get exported, such that we export all the
symbols in the public lldb namespace and the lldb_private namespace.

This is a fix for:
https://llvm.org/bugs/show_bug.cgi?id=30822

Reviewers: labath, beanz

Subscribers: lldb-commits

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

llvm-svn: 285484
2016-10-29 00:29:15 +00:00
Adrian Prantl e704506c93 Rename DWARF 5 constants to adapt to change in LLVM
llvm-svn: 285441
2016-10-28 20:11:27 +00:00
Adrian Prantl 1c0bf1baca Rename DWARF 5 constants to adapt to change in LLVM
llvm-svn: 285424
2016-10-28 18:14:43 +00:00
Jason Molenda ed2977fabe Check that we got back an object from MakeFunctionCaller
before we call through it.  

<rdar://problem/28979705> 

llvm-svn: 285369
2016-10-27 23:52:46 +00:00
Enrico Granata c046497bf0 Add support for "type lookup" to find C and C++ types
This is an important first step in closing the functionality gap between "type lookup" and "images lookup -t"

rdar://28971388

llvm-svn: 285332
2016-10-27 18:44:45 +00:00
Enrico Granata 73418dfe61 Fix an issue where frame variable -s <varname> would not show the scope even though the user asked for it
Part of rdar://28434047

llvm-svn: 285226
2016-10-26 19:17:49 +00:00
Pavel Labath 42eb6908e0 Don't set a software stepping breakpoint at 0 on arm or mips.
Summary:
Check whether the setting the breakpoint failed during instruction emulation. If
it did, the next pc is likely in unmapped memory, and the inferior will crash
anyway after the next instruction. Do not return an error in this case, but just
continue stepping.
Reenabled the crash during step test for android/linux.

Reviewers: labath

Subscribers: aemerson, rengolin, tberghammer, danalbert, srhines, lldb-commits

Differential Revision: https://reviews.llvm.org/D25926
Author: Jason Majors <jmajors@google.com>

llvm-svn: 285187
2016-10-26 11:13:56 +00:00
Jason Molenda a3b7527ccb Enable the use of the new dyld SPI on the current
generation macosx/ios/tvos/watchos.

llvm-svn: 285172
2016-10-26 04:48:41 +00:00
Jim Ingham 209a77d8d9 Fix a race condition between the "ephemeral watchpoint disabling" and commands the continue the process.
This closes https://reviews.llvm.org/D25875.

llvm-svn: 285114
2016-10-25 20:34:32 +00:00
Pavel Labath e7dd397209 Revert "Improve the libstdc++ smart pointer formatters"
This reverts commit r284828, as it causes an infinite loop in
TestPrintStackTraces (funnily enough, only when logging is enabled).

llvm-svn: 285068
2016-10-25 13:24:53 +00:00
Pavel Labath 7a8ba4ffbe Fix arm64 sub-register definitions
The "value regs" field was filled incorrectly. It is supposed to list the
registers that *this* register is a sub-register of, not the other way around.
This manifested itself in "register read" showing only the smaller sub-registers
(and a bunch of tests not passing). I am not sure if the "invalidates" field is
correct either, but it's usage seems to be inconsistent, so I'll leave that as-is
for now.

llvm-svn: 284981
2016-10-24 14:57:50 +00:00
Pavel Labath 183098ca47 Reformat RegisterInfos_arm64 into a table. NFC
llvm-svn: 284976
2016-10-24 14:01:52 +00:00