Commit Graph

16206 Commits

Author SHA1 Message Date
Pavel Labath ca367ce3ad Fix Log unit tests
the llvm function for getting the thread name dropped the _np suffix
during review. Zachary's commit did not reflect that.

llvm-svn: 297013
2017-03-06 15:17:36 +00:00
Zachary Turner 777de77956 Truncate thread names if they're too long.
llvm-svn: 296972
2017-03-04 16:42:25 +00:00
Sean Callanan d1471f1108 Project file fixes after movement of Data* and removal of ThisThread.cpp
llvm-svn: 296963
2017-03-04 08:05:54 +00:00
Sean Callanan 9984624edf Disable the lldb-mi tests on remote platforms.
Currently on remote platforms the lldb-mi tests fail, which means they time out.
Given how many of the lldb-mi tests there are, this means a long wait.

llvm-svn: 296951
2017-03-04 01:48:43 +00:00
Zachary Turner 8cb0a4901d Fix a bug in the dep analysis script.
It wasn't always normalizing slashes correctly, so you'd end
up with the same thing in the map twice.

llvm-svn: 296947
2017-03-04 01:31:29 +00:00
Zachary Turner ed96be99fa Delete LLDB's code for getting / setting thread name.
This is now functionality in LLVM, and all callers have
already been updated to use the LLVM functions.

llvm-svn: 296946
2017-03-04 01:31:06 +00:00
Zachary Turner 382f45e755 Add dependency on DynamicLoaderStatic to Utility.
llvm-svn: 296944
2017-03-04 01:30:38 +00:00
Zachary Turner 666cc0b291 Move DataBuffer / DataExtractor and friends from Core -> Utility.
llvm-svn: 296943
2017-03-04 01:30:05 +00:00
Zachary Turner 0e1d52ae51 Move UUID from Core -> Utility.
llvm-svn: 296941
2017-03-04 01:28:55 +00:00
Jim Ingham c963f20e4c Fix the macOS build all the way after r296909.
llvm-svn: 296938
2017-03-04 01:15:24 +00:00
Zachary Turner 9739a552c2 Fix DataExtractor failures.
Some code that doesn't get compiled on Windows had some references
that needed updating, and I missed those.

llvm-svn: 296930
2017-03-03 23:52:09 +00:00
Tim Hammerquist 80f5f00ec1 Fix Darwin failures introduced in r296909
llvm-svn: 296925
2017-03-03 23:17:29 +00:00
Sean Callanan 56435c91c9 Fixed repo.py to not send git errors to stderr.
Some repos are not git repos, so git is expected 
to fail.  These errors should not go to stderr,
because Xcode interprets them as failures.

llvm-svn: 296924
2017-03-03 23:13:30 +00:00
Zachary Turner 5013eb9e1a Add a script to dump out all project inter-dependencies.
llvm-svn: 296920
2017-03-03 22:40:46 +00:00
Zachary Turner 29cb868aa4 Isolate Target-specific functionality of DataExtractor.
In an effort to move the various DataBuffer / DataExtractor
classes from Core -> Utility, we have to separate the low-level
functionality from the higher level functionality.  Only a
few functions required anything other than reading/writing
raw bytes, so those functions are separated out into a
more appropriate area.  Specifically, Dump() and DumpHexBytes()
are moved into free functions in Core/DumpDataExtractor.cpp,
and GetGNUEHPointer is moved into a static function in the
only file that it's referenced from.

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

llvm-svn: 296910
2017-03-03 20:57:05 +00:00
Zachary Turner 6f9e690199 Move Log from Core -> Utility.
All references to Host and Core have been removed, so this
class can now safely be lowered into Utility.

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

llvm-svn: 296909
2017-03-03 20:56:28 +00:00
Zachary Turner 1e021a162e [Windows] Remove the #include <eh.h> hack.
Prior to MSVC 2015 we had to manually include this header any
time we were going to include <thread> or <future> due to a
bug in MSVC's STL implementation.  This has been fixed in MSVC
for some time now, and we require VS 2015 minimum, so we can
remove this across all subprojects.

llvm-svn: 296906
2017-03-03 20:21:59 +00:00
Pavel Labath 8409cc0ece Android.rules: fix building on mac
realpath is not available as an executable on mac. I give up, I am just
going to leave the path with ..'s in it.

llvm-svn: 296885
2017-03-03 17:03:46 +00:00
Pavel Labath 924ead6fdb Android.rules: fix building on windows
$(realpath), which I guess is a make builtin, gives strange results on
Windows. $(shell realpath) invokes the gnuwin external binary, which
works correctly.

llvm-svn: 296876
2017-03-03 16:29:56 +00:00
Pavel Labath 4438bf7498 test: shorten test trace file names
Make sure we don't generate extremely long file names for test trace log
file, as this can cause path-too-long errors. As the compilers in the
android ndk are deeply nested, it's very easy to trigger these.

I chose to output at most 4 path components -- this should keep the full
path for common cases like /usr/bin/gcc with room to spare, and should
be enough to uniquely identify the compiler for more deeply nested
cases.

llvm-svn: 296870
2017-03-03 13:49:38 +00:00
Pavel Labath bc58f9aa7b testsuite/android: build test executables with the android ndk directly
Summary:
This teaches the test makefiles about the Android NDK, so we are able to
run the tests without first going through the make_standalone_toolchain
script. The motivation for this is the ability to run both libc++ and
libstdc++ tests together, which previously was not possible because
make_standalone_toolchain bakes in the STL to use during toolchain
creation time. The support for this is not present yet -- this change
only make sure we don't regress for existing funcionality (gcc w/
libstdc++). Clang and libc++ support will be added later.

I've checked that the mips android targets compile after this change,
but I have no way of checking whether this breaks anything. If you are
reading this and it broke you, let me know.

Reviewers: tberghammer, danalbert

Subscribers: srhines, lldb-commits

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

llvm-svn: 296869
2017-03-03 13:49:34 +00:00
Pavel Labath 0a0d354ee6 Made GetClangTargetCPU() const.
Summary:
It does not change members or call non-const members.
HostInfo::GetArchitecture() returns a const object ref (maybe others?),
which can't access the non-const function.

Reviewers: labath, eugene

Reviewed By: labath, eugene

Subscribers: lldb-commits

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

llvm-svn: 296868
2017-03-03 13:35:49 +00:00
Zachary Turner 6007b5f713 Remove some dead code in FileSpec.
This in turn triggered some fallout where other files had
been transitively picking up includes that they needed from
FileSpec.h, so I've fixed those up as well.

llvm-svn: 296855
2017-03-03 06:14:38 +00:00
Jim Ingham a35a7cd016 Python commands as first class citizens.
This should be a necessary precursor to adding support 
for any future extension languages.

llvm-svn: 296834
2017-03-02 22:24:01 +00:00
Jim Ingham 0f9f9da3b7 Mention fetching thread lists lazily.
llvm-svn: 296833
2017-03-02 22:13:45 +00:00
Jim Ingham 2876f5cfb9 Forgot about local variable lookup.
Yay for coffee lines.

llvm-svn: 296826
2017-03-02 22:04:05 +00:00
Jim Ingham 9d3e8e505a Add a reference to the projects in the Get involved section.
llvm-svn: 296819
2017-03-02 21:45:39 +00:00
Jim Ingham 4d55b8752a Goals->Projects.
llvm-svn: 296816
2017-03-02 21:42:00 +00:00
Jim Ingham 0a8ada5ef1 Added a list of outstanding projects that would benefit lldb.
This was a list that I've had kicking around for a while, and would 
add to whenever some hallway conversation would bring up another good
idea.  It's not doing any good on my desktop, but it might generate
some inspiration here.  Please add to this if you have any other
good ideas.

I apologize for the formatting, but if I wait to get it looking
nice it would probably stay on my desktop.

llvm-svn: 296814
2017-03-02 21:39:27 +00:00
Pavel Labath ebe25fb845 Fix flakyness in TestGdbRemoteHostInfo
this test was using the VPATH hack to avoid having a copy of the
inferior source code. This makes the test fail if in happens to run
concurrently with a test in the parent folder. Fix that by moving it up
to the parent.

llvm-svn: 296741
2017-03-02 11:36:14 +00:00
Pavel Labath 5d1f711a55 Fix MSVC build
MSVC (at least the version I am using) does not want to implicitly
capture a const bool variable. Move it into the lambda, as it is not
used outside anyway.

llvm-svn: 296738
2017-03-02 10:35:53 +00:00
Jason Molenda b8ebcb5197 x86AssemblyInspectionEngine::AugmentUnwindPlanFromCallSite could access
the byte past the end of the buffer it had been given.  ASAN catch.
<rdar://problem/30774863> 

llvm-svn: 296733
2017-03-02 05:08:10 +00:00
Zachary Turner 3bc714b209 Fix various warnings. NFC
llvm-svn: 296717
2017-03-02 00:05:25 +00:00
Jim Ingham f6a4079cf8 Make it clear what you should modify when you copy any of these sample
test cases.

llvm-svn: 296693
2017-03-01 22:23:30 +00:00
Jim Ingham fe03f24f83 Add a test to ensure that SBFrame::Disassemble produces some output.
llvm-svn: 296692
2017-03-01 22:18:37 +00:00
Jim Ingham 96b2530f52 Add a sample_test directory with simple starter
test cases for standard and "inline" tests.

llvm-svn: 296669
2017-03-01 20:25:48 +00:00
Pavel Labath a53823effd Mark TestYMMRegister as no_debug_info_test
We don't need to run this test multiple times to check whether we can
read a register.

llvm-svn: 296611
2017-03-01 11:18:59 +00:00
Pavel Labath e2b2c70bc1 Fix gcc compilation of LogTest.cpp
llvm-svn: 296595
2017-03-01 10:08:51 +00:00
Pavel Labath c5789434ff Switch SBBreakpointLocation to use a weak_ptr
llvm-svn: 296594
2017-03-01 10:08:48 +00:00
Pavel Labath 197b65c7b8 test: pass correct objcopy and ar paths to the test runner
Summary:
The test runner has code to autodetect this, but it's not very smart --
in particular, it fails in the case where we build the test executables
with the just-built clang. Since cmake already has the knowledge about
the right toolchain, we can just have it pass the appropriate flags to
the test runner.

This also removes the "temporary" cache-scrubbing hack added a couple
months ago.

Reviewers: zturner, beanz

Subscribers: mgorny, lldb-commits

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

llvm-svn: 296593
2017-03-01 10:08:44 +00:00
Pavel Labath 5e336903be Modernize Enable/DisableLogChannel interface a bit
Summary:
Use StringRef and ArrayRef where possible. This adds an accessor to the
Args class to get a view of the arguments as ArrayRef<const char *>.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 296592
2017-03-01 10:08:40 +00:00
Jason Molenda 0c9bea4821 Greg Clayton is no longer working at Apple, he will continue to
review patches etc from his clayborg email address.

llvm-svn: 296548
2017-03-01 00:00:45 +00:00
Jason Molenda 659e0eff10 Add additional areas I'm responsible for in the lldb codebase.
llvm-svn: 296531
2017-02-28 22:31:18 +00:00
Zachary Turner 318971880e clang-format the Mangled changes.
llvm-svn: 296517
2017-02-28 20:30:31 +00:00
Zachary Turner 1f6a8d3bdf Wrap the call to UndecorateSymbolName in a mutex.
MSDN documents that this function is not thread-safe, so we
wrap it in a global mutex.

llvm-svn: 296516
2017-02-28 20:29:20 +00:00
Jim Ingham 519b0816c6 Fix a bug in r294611 w.r.t. Darwin Kernel debugging.
<rdar://problem/30735021>

llvm-svn: 296504
2017-02-28 18:57:54 +00:00
Zachary Turner 8b3f2160d5 Fix incorrect logic in StackFrame::Disassemble.
This had broken as the result of some previous cleanup.

llvm-svn: 296495
2017-02-28 17:59:59 +00:00
Pavel Labath 7a1d34bec0 Switch SBWatchpoint to use a weak_ptr to the underlying object
llvm-svn: 296470
2017-02-28 12:32:45 +00:00
Eugene Zemtsov 23847fbefe Add a comment to describe purpose of signal-filtering test
llvm-svn: 296427
2017-02-28 02:40:34 +00:00
Jason Molenda eb0e7cb8de Ah, this was an early exit to leave built products around, it wasn't meant to
be checked in.

llvm-svn: 296412
2017-02-27 23:31:29 +00:00
Tim Hammerquist f54f74660d update pbxproj to match cmake config, broken in r296335
llvm-svn: 296406
2017-02-27 22:56:27 +00:00
Kamil Rytarowski 47e7d7fe85 Support NetBSD Thread ID in lldb-server tests
Summary:
Native Thread ID is retrieved with _lwp_self() on NetBSD.

The returned value is of type int32_t, but for consistency with other Operating Systems cast it to uint64_t.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, labath, clayborg, emaste

Reviewed By: labath, clayborg

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 296360
2017-02-27 17:52:48 +00:00
Pavel Labath 4b2b6bfb97 Merge Linux and FreeBSD arm register contexts
Summary:
These two register contexts were identical, so this shouldn't cause any
regressions, but I'd appreciate it if you can check that this at least compiles.

Reviewers: emaste, sas

Subscribers: aemerson, rengolin, lldb-commits, mgorny

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

llvm-svn: 296335
2017-02-27 13:00:50 +00:00
Pavel Labath c9fbd9a3be Fix MinidumpParserTest on 32-bit arches
load_size should be 64-bit unconditionally to match the underlying API.
This makes sure the MAX value correctly signals to auto-detect the file
size when mmap()ing.

llvm-svn: 296334
2017-02-27 12:21:20 +00:00
Pavel Labath 3474ebc4c5 Remove the callback-based log channel registration mechanism
All the existing channels have beens switched to the new mechanism and
this code is now unused.

llvm-svn: 296333
2017-02-27 12:21:16 +00:00
Pavel Labath 88d081b505 Log: Fix a regression in handling log options
The channel refactor introduced a regression where we were not honoring
the log options passed when enabling the channel. Fix that and add a
test.

llvm-svn: 296329
2017-02-27 11:05:39 +00:00
Pavel Labath 6ac8403430 Switch SBBreakpoint to storing a weak_ptr of the internal breakpoint object
Summary:
There is nothing we can do with the breakpoint once the associated
target becomes deleted. This will make sure we don't hold on to more
resources than we need in this case. In particular, this fixes the case
TestStepOverBreakpoint on windows, where a lingering SBBreakpoint object
causes us to nor unmap the executable file from memory.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 296328
2017-02-27 11:05:34 +00:00
Jason Molenda 6b652bea30 Three LoadLibCxxFormatters formatters were given a regex string to
match but the 'is_regex' argument was not passed as true.  Not sure
this is causing a bug, but noticed it while working on another bug.
These formatters gained a regex in r274489 for NDK but didn't pick
up the is_regex flag at the time.
<rdar://problem/30646077> 

llvm-svn: 296243
2017-02-25 05:43:51 +00:00
Jason Molenda fad62c9554 DataBufferMemoryMap.cpp out, DataBufferLLVM.cpp in. Unbreak the build.
llvm-svn: 296238
2017-02-25 04:06:09 +00:00
Zachary Turner 3f4a4b3681 Delete DataBufferMemoryMap.
After a series of patches on the LLVM side to get the mmaping
code up to compatibility with LLDB's needs, it is now ready
to go, which means LLDB's custom mmapping code is redundant.
So this patch deletes it all and uses LLVM's code instead.

In the future, we could take this one step further and delete
even the lldb DataBuffer base class and rely entirely on
LLVM's facilities, but this is a job for another day.

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

llvm-svn: 296159
2017-02-24 18:56:49 +00:00
Omair Javaid d5ffbad275 Hardware breakpoints for Linux on Arm/AArch64 targets
Please look at below differential link for upstream discussion.

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

llvm-svn: 296119
2017-02-24 13:27:31 +00:00
Pavel Labath 0a51bfb83f Attempt to fix windows unit tests
In LLVM r296049, IPDBSession::getGlobalScope lost its constness. Adjust
the unittest to account for that.

llvm-svn: 296107
2017-02-24 11:17:40 +00:00
Pavel Labath 4a705e7ea0 Implement QPassSignals GDB package in lldb-server
Summary: QPassSignals package allows lldb client to tell lldb-server to ignore certain types of signals and re-inject them back to inferior without stopping execution.

Reviewers: jmajors, labath

Subscribers: danalbert, srhines, emaste, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D30286
Author: Eugene Zemtsov <ezemtsov@google.com>

llvm-svn: 296101
2017-02-24 09:29:14 +00:00
Jason Molenda 1e7ecd3e64 Fix a race condition in FuncUnwinders where the mutex was being
acquired only after checking if the ivar shared pointer was already
filled in.  But when I assign an UnwindPlan object to the shared
pointer, I assign an empty object and then fill it in.  That leaves
a window where another thread could get the shared pointer to the
empty (but quickly being-filled-in) object and lead to a crash.

Also two changes from Greg for correctness on the TestMultipleDebuggers
test case.

<rdar://problem/30564102> 

llvm-svn: 296084
2017-02-24 03:35:46 +00:00
Kamil Rytarowski 7a8ac3a639 Introduce support for Debug Registers in RegisterContextNetBSD_x86_64
Summary:
NetBSD 7.99.62 introduced Debug Registers interface similar to the FreeBSD one.
This interface will land NetBSD-8.0.

Introduce support for this interface in Register Context NetBSD x86_64 unconditionally as older versions of NetBSD will not be supported.

This change allows to reduce diff with other ports and remove local copy of the RegisterInfos_x86_64.h content.

NetBSD Register Context for 32-bit x86 support will be added later.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, emaste, clayborg

Reviewed By: labath, clayborg

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 296071
2017-02-24 01:53:45 +00:00
Kamil Rytarowski 8fbf3b04ae Switch NetBSD from paccept(2) to accept4(2)
Summary:
NetBSD 8.0 will ship with accept4(2) in libc wrapping paccept(2).

This change reduces needless difference with other platforms.

Older versions of NetBSD will not be supported.

No functional change.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, emaste, labath, clayborg

Reviewed By: emaste, labath, clayborg

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 296070
2017-02-24 01:51:38 +00:00
Pavel Labath 3cc0e33ea2 Switch "windows" log channel to the new registration mechanism
llvm-svn: 295968
2017-02-23 13:10:38 +00:00
Pavel Labath c29f7ff334 Switch "posix" to the new log channel registration mechanism
Summary:
This also removes magic rename code, which caused the channel to be
called "linux" when built on a linux machine, and "freebsd" when built
on a freebsd one, which seems unnecessary - registering a new channel is
sufficiently simple now that if we wish to log something extremely
os-specific, we can just create a new channel. None of the current
categories seem very specific to one OS or another.

Reviewers: emaste, krytarowski

Subscribers: lldb-commits

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

llvm-svn: 295954
2017-02-23 10:33:16 +00:00
Pavel Labath c7ce4fef20 Finish the reformatting of the lldb-server test executables
This also reformats the executables in subfolders of lldb-server tests.

llvm-svn: 295952
2017-02-23 10:00:33 +00:00
Pavel Labath de4c1c0ee7 Reformat inferior's main.cpp in lldb-server test
Summary: main.cpp is complete mess of tabs and spaces. This change brings it to compliance with LLVM coding style.

Reviewers: jmajors, labath

Reviewed By: jmajors, labath

Subscribers: krytarowski, jingham, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D30234
Author: Eugene Zemtsov <ezemtsov@google.com>

llvm-svn: 295950
2017-02-23 09:46:33 +00:00
Howard Hellyer 8cfa056662 Ensure lldb-server waits for child debug servers to start up when passing them a port number to listen on.
Summary:
When lldb-server is started with the -P <port> or -m/-M <min/max port> options to specify which ports are available for remote connections the child debug server is told what port it should listen on. In those cases lldb-server needs to wait for the child to report it’s port number as otherwise it can tell the lldb client that the child is up and listening before it is actually listening on that port. lldb-server already waits in the cases where a port wasn’t specified by waiting until the child reports the port it is using. It was skipping this synchronisation step when passed a port numbers as it knew what the port would be however it does need to ensure the child process has had time to open that port and waiting until the child reports the port number makes sure this has happened.

This patch just removes the one case where a child was spawned and lldb-server did not wait for it to report it’s port number before telling the client lldb process the child is ready to connect to.

This issue was discussed on lldb-dev in a thread here:
http://lists.llvm.org/pipermail/lldb-dev/2017-February/012002.html

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 295947
2017-02-23 08:49:49 +00:00
Sean Callanan efe5d5fe9d Changed builld-llvm.py to use .json files
LLDB has many branches in a variety of repositories.
The build-script.py file is subtly different for each set.
This is unnecessary and causes merge headaches.

This patch makes build-llvm.py consult a directory full 
of .json files, each one of which matches a particular
branch using a regular expression.

This update to the patch introduces a FALLBACK file
whose contents take precedence if the current branch
could not be identified.  If the current branch could be
identified, FALLBACK is updated, allowing the user to
e.g. cut branches off of known branches and still have
the automatic checkout mechanism work.

It also documents all of this.

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

llvm-svn: 295922
2017-02-23 02:21:34 +00:00
Sean Callanan 3b7c7e1d64 Reverted 295897 pending refinements and fixes for green-dragon.
llvm-svn: 295915
2017-02-23 00:46:30 +00:00
Greg Clayton 98f9bcc1c9 Fixed errors in AllocatedBlock:
- Allow zero byte size request for memory and ensure it gets a unique address
- Exit the free block loop when we find an appropriate free block

<rdar://problem/30644888>

llvm-svn: 295907
2017-02-22 23:42:55 +00:00
Sean Callanan ff1fb7f846 Changed builld-llvm.py to use .json files
LLDB has many branches in a variety of repositories.
The build-script.py file is subtly different for each set.
This is unnecessary and causes merge headaches.

This patch makes build-llvm.py consult a directory full 
of .json files, each one of which matches a particular
branch using a regular expression.

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

llvm-svn: 295897
2017-02-22 22:57:59 +00:00
Greg Clayton 69b75d4b19 Fix header documentation.
llvm-svn: 295882
2017-02-22 21:32:48 +00:00
Greg Clayton e85e9a2f01 Fix header documentation.
llvm-svn: 295881
2017-02-22 21:32:16 +00:00
Pavel Labath a2fc1e0cc8 Switch "lldb" log channel to the new registration mechanism
llvm-svn: 295823
2017-02-22 11:51:12 +00:00
Pavel Labath a385d2c1b6 Replace WINLOG_*** macros with LLDB_LOG
Summary:
The main difference here is that in the WINLOG macros you can specify
log categories per call, whereas here you have to go the usual lldb
route of getting a Log* variable first. While this means you have to
write at least two statements, it usually means that each statement will
fit on a single line, whereas fitting the WINLOG invocation on a single
line was almost impossible. So the total size of code does not increase
even in functions with a single log statement, and functions with more
logging get shorter.

The downside here is reduced flexibility in specifying the log
categories, which a couple of functions used quite heavily (e.g.
RefreshStateAfterStop). For these I chose a single category used most
prominently and put everything into that, although a solution with
multiple log variables is definitely possible.

Reviewers: zturner, amccarth

Subscribers: lldb-commits

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

llvm-svn: 295822
2017-02-22 10:38:02 +00:00
Pavel Labath 048b3ece1d Add format_provider for the MemoryRegionInfo::OptionalBool enum
llvm-svn: 295821
2017-02-22 10:37:57 +00:00
Jason Molenda 38bd8cd04f Mark TestDarwinLogBasic.py as an xfail because the logging is
not being picked up; filed <rdar://problem/30645203> to track
the work to investigate this.

llvm-svn: 295804
2017-02-22 02:10:00 +00:00
Pavel Labath ba95a28c18 Log: Fix race in accessing the stream variable
Summary:
The code was attempting to copy the shared pointer member in order to
guarantee atomicity, but this is not enough. Instead, protect the
pointer with a proper read-write mutex.

This bug was present here for a long time, but my recent refactors must
have altered the timings slightly, such that now this fails fairly often
when running the tests: the test runner runs the "log disable" command
just as the thread monitoring the lldb-server child is about to report
that the server has exited.

I add a test case for this. It's not possible to reproduce the race
deterministically in normal circumstances, but I have verified that
before the fix, the test failed when run under tsan, and was running
fine afterwards.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 295712
2017-02-21 09:58:23 +00:00
Jason Molenda 599558e69e Fix spelling mistake.
llvm-svn: 295694
2017-02-21 05:09:26 +00:00
Pavel Labath c4a3395103 Fix a couple of corner cases in NameMatches
Summary:
I originally set out to move the NameMatches closer to the relevant
function and add some unit tests. However, in the process I've found a
couple of bugs in the implementation:
- the early exits where not always correct:
  - (test==pattern) does not mean the match will always suceed because
    of regular expressions
  - pattern.empty() does not mean the match will fail because the "" is
    a valid prefix of any string

So I cleaned up those and added some tests. The only tricky part here
was that regcomp() implementation on darwin did not recognise the empty
string as a regular expression and returned an REG_EMPTY error instead.
The simples fix here seemed to be to replace the empty expression with
an equivalent non-empty one.

Reviewers: clayborg, zturner

Subscribers: mgorny, lldb-commits

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

llvm-svn: 295651
2017-02-20 11:35:33 +00:00
Michal Gorny caf810e3e4 [test] Fix finding LLDB tools when building stand-alone
Use both LLDB- and LLVM-specific tool/library directories when LLDB is
being built stand-alone. This ensures that the freshly-built tools
(and libraries) are used correctly.

Without this patch, the test suite uses LLVM_TOOLS_DIR and LLVM_LIBS_DIR
to locate lldb, and set PATH and LD_LIBRARY_PATH. When doing
a stand-alone build, these variables represent the installed LLVM.
As a result, tests either fail due to missing lldb executable
or use an earlier installed LLDB version rather than the one being
built.

To solve this, additional LLDB_TOOLS_DIR and LLDB_LIBS_DIR variables
are added and populated using LLVM_*_OUTPUT_INTDIR. Those variables
contain directories used to output built executables and libraries.
In stand-alone builds, they represent the build-tree directories
used by LLDB. In integrated builds, they have the same values as
LLVM_*_DIR and therefore using them does not harm.

The new variables are prepended to PATH and LD_LIBRARY_PATH to ensure
that freshly built binaries are preferred over potentially earlier
installed ones. Furthermore, paths used to locate various tools are
updated to match appropriate locations.

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

llvm-svn: 295621
2017-02-19 22:11:38 +00:00
Jason Molenda c4ebb6402a Update the location of ModuleCacheTest.cpp from
unittest/Utility to unittest/Target so the unit
tests can be run from xcode again.

The diff is enormous - I think zachary might have
put windows line endings or something with his last
commit?  didn't look too closely but his commit & this
commit have every line being different.

llvm-svn: 295530
2017-02-18 01:51:11 +00:00
Sean Callanan 62a6b8b2bf Updated the results formatter to eliminate redundant data.
The testsuite's results formatter maintains a result_status_counts
structure solely for the purpose of setting the return status code
after the testsuite has run.  This data is redundant with the
result_events structure that contains the results of individual
tests.

There are subtle bugs arising from this redundancy that make some
builds report no errors but a nonzero status.  Rather than try to
make sure these two are always in agreement, I've just rewritten
the code that used to use the counts to now use the per-test
results.

<rdar://problem/30496966>

llvm-svn: 295522
2017-02-18 01:07:51 +00:00
Pavel Labath 28096200a8 NPL: Fix an incorrect logging formatv call
llvm-svn: 295457
2017-02-17 16:09:10 +00:00
Pavel Labath 39addef292 Switch GDBRemoteLog to the new registration mechanism
llvm-svn: 295455
2017-02-17 16:09:06 +00:00
Pavel Labath 7b35b78160 Switch ProcessKDPLog to the new channel registration mechanism
llvm-svn: 295450
2017-02-17 15:08:08 +00:00
Pavel Labath 4f19fce2d6 Fix compiler warnings for missing switch cases in lldb.
Summary:
There have been a few new values added to a few LLVM enums
this change makes sure that LLDB code handles them correctly.

Reviewers: labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D30005
Author: Eugene Zemtsov <ezemtsov@google.com>

llvm-svn: 295445
2017-02-17 13:39:50 +00:00
Pavel Labath 6673afb2dc Fix VASprintfTest on darwin
The way of injecting an error into the printf call was not working on
darwin - the C library still happily format the character. It only
returns an error after we use a wide character that does not fit into a
single byte, so switch the test to use that.

llvm-svn: 295443
2017-02-17 13:27:50 +00:00
Pavel Labath fb0d22d645 Reapply "Refactor log channel registration mechanism"
Changes wrt. previous version:
- add #include <atomic>: fix build on windows
- add extra {} around the string literals used to initialize
  llvm::StringLiteral: fix gcc build

llvm-svn: 295442
2017-02-17 13:27:42 +00:00
Pavel Labath a37bbbd432 NPL: Fix one more bug in the single step workaround
In the case we are stepping over the thread creation instruction, we
will end up calling Thread::SingleStep back-to-back twice (because of
the intermediate PTRACE_EVENT_CLONE stop). This will cause the cpu mask
to be set inappropriately (because the old SingleStepCheck object will
be destroyed after we create the new one), and the single-step will
fail.

Before the refactor the code was still incorrect in this case, but in a
different way (the thread was left with the incorrect mask after the
stepping was complete), so this was not easy to spot.

This fixes TestCreateDuringInstructionStep on the affected devices.

llvm-svn: 295440
2017-02-17 11:48:34 +00:00
Pavel Labath a272fa8fff Fix breakage caused by r295368
Also move the ErrorTest into the Utility package, to follow the class it
is testing.

llvm-svn: 295436
2017-02-17 10:19:46 +00:00
Kamil Rytarowski f5dadfa73d Add myself to CODE_OWNERS.txt for NetBSD
llvm-svn: 295400
2017-02-17 01:58:30 +00:00
Zachary Turner d9c0e15f4b Fix build
llvm-svn: 295369
2017-02-16 20:15:26 +00:00
Zachary Turner 24ae6294a4 Finish breaking the dependency from Utility.
Differential Revision: https://reviews.llvm.org/D29964

llvm-svn: 295368
2017-02-16 19:38:21 +00:00
Sylvestre Ledru b9b41a280d Reindent the code to avoid an error with gcc:
error: this ‘else’ clause does not guard... [-Werror=misleading-indentation]

llvm-svn: 295352
2017-02-16 18:45:27 +00:00
Pavel Labath 7278496ccf NPL: Fix single step workaround
While refactoring the code in r293046 I made a very basic error -
relying on destructor side-effects of a copyable object. Fix that and
make the object non-copyable.

This fixes the tests on the platforms that need this workaround, but
unfortunately we don't have a way to make a more platform-agnostic test
right now.

llvm-svn: 295345
2017-02-16 18:12:04 +00:00
Kuba Mracek 4569fee0c6 [lldb] Add support for "external" reports in ThreadSanitizer LLDB plugin
TSan now has the ability to report races on "external" object, i.e. any library class/object that has read-shared write-exclusive threading semantics. The detection and reporting work almost out of the box, but TSan can now provide the type of the object (as a string). This patch implements this into LLDB.

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

llvm-svn: 295342
2017-02-16 17:42:33 +00:00
Pavel Labath 7dc6e51ef5 Fix build due to clang r295311
BuiltinType::Kind::OCLNDRange was removed.

llvm-svn: 295328
2017-02-16 15:32:19 +00:00
Jason Molenda a1a864631a Fix a bug introduced in r235737 where code with important side
effects was passed as an expression to assert() calls.  If lldb is
built without asserts, the expression was eliminated and we lost
the side effects -- these methods stopped working.  

<rdar://problem/30342959> 

llvm-svn: 295271
2017-02-16 02:08:33 +00:00
Greg Clayton 4197b7f4ae Fix Xcode project.
llvm-svn: 295212
2017-02-15 18:24:44 +00:00
Pavel Labath ae11b64db6 Skip TestStepOverBreakpoint on windows
llvm-svn: 295211
2017-02-15 18:04:50 +00:00
Pavel Labath f0713996b2 Revert "Refactor log channel registration mechanism"
The change breaks on Windows and NetBSD bots. Revert while I
investigate.

llvm-svn: 295201
2017-02-15 17:13:19 +00:00
Pavel Labath 5fb8af40df Refactor log channel registration mechanism
Summary:
We currently have two log channel registration mechanisms. One uses a
set of function pointers and the other one is based on the
PluginManager.

The PluginManager dependency is unfortunate, as logging
is also used in lldb-server, and the PluginManager pulls in a lot of
classes which are not used in lldb-server.

Both approach have the problem that they leave too much to do for the
user, and so the individual log channels end up reimplementing command
line argument parsing, category listing, etc.

Here, I replace the PluginManager-based approach with a one. The new API
is more declarative, so the user only needs to specify the list of list
of channels, their descriptions, etc., and all the common tasks like
enabling/disabling categories are hadled by common code. I migrate the
LogChannelDWARF (only user of the PluginManager method) to the new API.

In the follow-up commits I'll replace the other channels with something
similar.

Reviewers: clayborg, zturner, beanz

Subscribers: aprantl, lldb-commits

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

llvm-svn: 295190
2017-02-15 16:11:59 +00:00
Pavel Labath cf8af0ad61 Fix debug build of unit tests
Summary:
It turns out listing each library twice is not enough to resolve all
references in a debug build on linux - a number of executables fails to
link with random symbols missing. Increasing the number to three seems
to be enough. The choice of lldbCore to set the multiplicity on is
somewhat arbitrary, but it seems fitting, as it is the biggest layering
transgressor.

Reviewers: beanz

Subscribers: mgorny, lldb-commits

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

llvm-svn: 295189
2017-02-15 16:11:51 +00:00
Pavel Labath 46d78f754a Fix unittests after r295088
This resurrects TestModule.so which got lost during the move and is
needed for the ModuleCache test.

llvm-svn: 295171
2017-02-15 12:27:19 +00:00
Pavel Labath d875aae9c0 Fix TestNameLookup for GCC
Summary:
GCC emits also symbols for the __PRETTY_FUNCTION__ virtual variable,
which we accidentaly pick up when looking for functions for with
"unique_function_name" in the name. This makes the target.FindFunctions
call fail, as that symbol is not a function.

I also strenghten the test a bit to make sure we actually find all the
functions we are interested in. I've put a check that we find at least 6
functions, but maybe this should be *exactly* 6 ?

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 295170
2017-02-15 12:27:16 +00:00
Boris Ulasevich 86aaa8a28d 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)
  https://reviews.llvm.org/D29909 (fix for TestCallThatThrows test fail)

llvm-svn: 295168
2017-02-15 11:42:47 +00:00
Zachary Turner 70049b7cab Use StringRef and APFloat instead of lldb/StringConvert.h
llvm-svn: 295091
2017-02-14 19:07:01 +00:00
Zachary Turner 01c3243fc1 Remove dependencies from Utility to Core and Target.
With this patch, the only dependency left is from Utility
to Host.  After this is broken, Utility will finally be
standalone.

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

llvm-svn: 295088
2017-02-14 19:06:07 +00:00
Pavel Labath 810b34ab8c XFAIL TestNameLookup for GCC
I think I have a fix for this, but it needs review. This should keep the
bots happy until then.

llvm-svn: 295047
2017-02-14 12:06:54 +00:00
Jason Molenda be227955e2 Before returning a pc value for a stack frame,
run it through the ABI's FixCodeAddress method.
<rdar://problem/29711506> 

llvm-svn: 295025
2017-02-14 04:55:03 +00:00
Greg Clayton 6d325cb5cb Fix buildbots.
llvm-svn: 294991
2017-02-13 22:04:02 +00:00
Greg Clayton 5d0c114630 FindFunctions now works again with mangled names.
<rdar://problem/28147057> 

llvm-svn: 294990
2017-02-13 21:34:58 +00:00
Chris Bieneman 752f73b680 [CMake] Adding API dependency on Utility
Utility is directly referenced from Breakpoint.

llvm-svn: 294987
2017-02-13 21:19:53 +00:00
Chris Bieneman aa2f4bf686 [CMake] Adding API dependency on Utility
Utility is directly referenced from API.

llvm-svn: 294986
2017-02-13 21:16:01 +00:00
Pavel Labath 45889a28e2 Try to fix windows build (broken by r294939)
log->Debug is gone, switch to using log->Verbose

llvm-svn: 294944
2017-02-13 11:56:19 +00:00
Pavel Labath 18eeccabf2 Remove some dead code from ProcessPOSIXLog
llvm-svn: 294940
2017-02-13 11:03:24 +00:00
Pavel Labath 6302bf6a26 Clean up debug logging
Summary:
We've had two ways to print a "debug" log message.
- Log::GetDebug() was testing a Stream flag which was never set.
- Log::Debug() was checking for the presence of "log enable --debug"
flag.

Given that these two were used very rarely and we already have a
different way to specify "I want a more verbose log", I propose to remove
these two functions and migrate the callers to LLDB_LOGV. This commit
does that.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 294939
2017-02-13 11:03:17 +00:00
Greg Clayton b663010f4d Fix the lldb_private::Function::GetDescription to print out the name and mangled name correctly. Previously this was getting the function type's name which was not correct.
This info appears in the output of "image lookup --verbose --address ADDRESS".

llvm-svn: 294804
2017-02-10 23:32:06 +00:00
Chris Bieneman 8c31ea917a Fix another build issue with shared libraries on Linux
In r294767, I added these dependencies in the wrong place.

llvm-svn: 294768
2017-02-10 18:39:26 +00:00
Chris Bieneman ba170c2ad8 Fix another build issue with shared libraries on Linux
llvm-svn: 294767
2017-02-10 18:37:02 +00:00
Chris Bieneman 8909b6804c Fix build issue with shared libraries reported via email
llvm-svn: 294763
2017-02-10 17:47:55 +00:00
Pavel Labath 38e2d58594 Really fix windows build
this time I have actually tried that it compiles on windows.

llvm-svn: 294744
2017-02-10 13:04:32 +00:00
Pavel Labath edfbda4984 Fix darwin and windows builds broken by r294736
Update the platform-specific log classes to match the new interface.

llvm-svn: 294743
2017-02-10 12:32:43 +00:00
Pavel Labath 5f7e583b33 UriParser cleanup
- move the header file to the include folder
- enclose the class in the proper namespace

llvm-svn: 294741
2017-02-10 12:21:22 +00:00
Pavel Labath 2f7cfaf4ad Switch TestPacketSpeedJSON to use the llvm chrono formatter
llvm-svn: 294739
2017-02-10 11:49:40 +00:00
Pavel Labath d02b1c83df Add a format_provider for the Timeout class
and use it in the appropriate log statements.

Formatting of chrono types in log messages was very clunky. This should
make it much nicer to use and give better output. For details of the
formatting options see the chrono formatter in llvm.

llvm-svn: 294738
2017-02-10 11:49:33 +00:00
Pavel Labath ae91babf2d Improve asserts in TestWatchpointIgnoreCount
This test is flaky on the windows->android bot. Change assertTrue to
assertEqual in the hope better error messages will direct us to the
problem.

llvm-svn: 294737
2017-02-10 11:49:25 +00:00
Pavel Labath 5fae71c51c Convert Log class to llvm streams
Summary:
This converts LLDB's logging to use llvm streams instead of
lldb_private::Stream and friends. The changes are mostly
straight-forward and amount to s/lldb_private::Stream/llvm::raw_ostream.

The part worth calling out is the rewrite of the StreamCallback class.
Previously this class contained a per-thread buffer of data written. I
assume this had something to do with it trying to make sure each log
line is delivered as a single event, instead of multiple (possibly
interleaved) events. However, this is no longer relevant as the Log
class already writes things to a temporary buffer and then delivers the
message as a single "write", so I have just removed the code in
question.

Reviewers: zturner, clayborg

Subscribers: emaste, lldb-commits, mgorny

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

llvm-svn: 294736
2017-02-10 11:49:21 +00:00
Greg Clayton 29eeea00e1 Make sure we only load the OS plug-in once.
<rdar://problem/27580297> 

llvm-svn: 294611
2017-02-09 18:55:41 +00:00
Greg Clayton 21b4b2ea94 Fix build bots.
llvm-svn: 294603
2017-02-09 18:21:04 +00:00
Greg Clayton ac7c2ef580 Fixed an issue where AllocatedBlock::ReserveRange does a linear search through reserved ranges.
After many expressions are evaluated we were spending time looking for open blocks on memory in the one or more AllocatedBlock objects and it would slow down expression evaluation.

I implemented a fixed size blocks implementation that maintains a sorted free list to fix the issue.

<rdar://problem/17962974> 

llvm-svn: 294600
2017-02-09 17:56:55 +00:00
Greg Clayton 7bcf46e29d Fixed documentation bug found by Ramana who sent a patch to the lldb-dev list.
llvm-svn: 294597
2017-02-09 17:16:19 +00:00
Ismail Donmez 75dcfe8449 Revert r294580 , it didn't fix the shared build
llvm-svn: 294583
2017-02-09 12:30:09 +00:00
Ismail Donmez 4200948c5a Fix shared library build
llvm-svn: 294580
2017-02-09 10:59:33 +00:00
Pavel Labath a9e67df2f9 [cmake] add missing dependency lldbCommands->lldbBase
CommandObjectVersion.cpp calls lldb_private::GetVersion (present in lldbBase).

This should fix the unittest link on windows. I am not sure why is this not
present on other platforms -- my guess is that there lldbBase is included in
the link through some other dependency chain.

llvm-svn: 294549
2017-02-09 01:17:34 +00:00
Chris Bieneman a14fbe0cf3 [CMake] Add dependency on Mips target if it is available
The Mips plugins conditionally link the Mips backend, so we need to conditionally add the target as a dependency.

This resolves a bot failure from r294515.

http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/4606/steps/build%20android/logs/stdio

llvm-svn: 294521
2017-02-08 21:24:51 +00:00
Chris Bieneman fd2f0cb170 [CMake] Final dependency cleanup patch!
Summary:
This patch removes the over-specified dependencies from LLDBDependencies and instead relies on the dependencies as expressed in each library and tool.

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

Help testing would be greatly appreciated.

Reviewers: labath, zturner

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

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

llvm-svn: 294515
2017-02-08 21:00:46 +00:00
Nitesh Jain 8493e6a889 [LLDB][MIPS] Fix TestMiExec and TestMiData failures
Subscribers: jaydeep, bhushan, lldb-commits, slthakur
llvm-svn: 294418
2017-02-08 07:42:56 +00:00
Nitesh Jain c12d82ba2d [LLDB][MIPS] Fix TestMiniDumpNew
Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 294415
2017-02-08 07:29:24 +00:00
Chris Bieneman bc9d0cd925 [CMake] Add explicit dependencies for ObjectFileELF tests
llvm-svn: 294372
2017-02-07 23:33:58 +00:00
Ed Maste b285deab93 Synchronize PlatformFreeBSD with Linux
Inspired by r294145 for NetBSD, this reduces diffs between the FreeBSD
and Linux/NetBSD Platform implementations. Further diff reduction will
occur once FreeBSD switches to using the remote process plugin.

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

llvm-svn: 294340
2017-02-07 19:29:10 +00:00
Pavel Labath 250858a01e Remove verbose category in the kdp channel
llvm-svn: 294244
2017-02-06 21:46:22 +00:00
Pavel Labath 0e92fbb59c Switch PlatformLinux to LLDB_LOG
llvm-svn: 294243
2017-02-06 21:30:44 +00:00
Pavel Labath e8a7b9841c Remove the verbose category in the gdb-remote channel
replace by LLDB_LOGV

llvm-svn: 294224
2017-02-06 19:31:09 +00:00
Pavel Labath aafe053c53 Remove the verbose category in the posix channel
replace by LLDB_LOGV

llvm-svn: 294223
2017-02-06 19:31:05 +00:00
Pavel Labath 2f8d5739b5 Fix darwin build (error.PutToLog fallout)
llvm-svn: 294222
2017-02-06 19:31:02 +00:00
Pavel Labath 60199c1a4d Fix darwin build (llvm::once_flag fallout)
llvm-svn: 294221
2017-02-06 19:30:59 +00:00
Pavel Labath 62c3545e25 Remove the verbose category in the dwarf channel
llvm-svn: 294219
2017-02-06 19:19:30 +00:00
Pavel Labath 0c7687b106 Really fix build on non-windows platforms :)
llvm-svn: 294215
2017-02-06 18:56:34 +00:00
Zachary Turner 0fceb359ad Try to fix build on non-Windows platforms.
llvm-svn: 294213
2017-02-06 18:49:16 +00:00
Pavel Labath 4ee1c95216 Fix missing include in NativeProcessLinux
llvm-svn: 294211
2017-02-06 18:36:58 +00:00
Zachary Turner 33aba3c290 Get rid of Error::PutToLog().
Instead just rely on LLDB_LOG().

This is part of an effort to sort out dependency hell in LLDB.
Error is in Utility, but Log is in Core.  Core can depend on
Utility, but not vice versa.  So this patch moves the knowledge
about how to log Errors from the Error class to the Log file.

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

llvm-svn: 294210
2017-02-06 18:31:44 +00:00
Greg Clayton b24f7f3d6d Fix Xcode project.
llvm-svn: 294206
2017-02-06 18:10:39 +00:00
Kamil Rytarowski c5f28e2a05 Switch std::call_once to llvm::call_once
Summary:
The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms.

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

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, emaste, mehdi_amini, clayborg

Reviewed By: labath, clayborg

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 294202
2017-02-06 17:55:02 +00:00
Kamil Rytarowski 3202ce6fe0 Synchronize PlatformNetBSD with Linux
Summary:
Update the code to the new world code.

These changes are needed for remote process plugin.

Sponsored by <The NetBSD Foundation>

Reviewers: emaste, clayborg, joerg, labath

Reviewed By: clayborg, labath

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 294145
2017-02-05 21:32:38 +00:00
Pavel Labath d65ac229f5 Clean up PlatformLinux code
don't create a platform.linux setting category, as it contains no
actual settings, and I don't forsee adding any soon. Also remove some
unused includes while I'm in there.

llvm-svn: 294114
2017-02-05 01:04:10 +00:00
Pavel Labath 3b7e1981b2 Remove LIBLLDB_LOG_VERBOSE category
Summary:
Per discussion in D28616, having two ways two request logging (log
enable lldb XXX verbose && log enable -v lldb XXX) is confusing. This
removes the first option and standardizes all code to use the second
one.

I've added a LLDB_LOGV macro as a shorthand for if(log &&
log->GetVerbose()) and switched most of the affected log statements to
use that (I've only left a couple of cases that were doing complex
computations in an if(log) block).

Reviewers: jingham, zturner

Subscribers: lldb-commits

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

llvm-svn: 294113
2017-02-05 00:44:54 +00:00
Kamil Rytarowski 4791532830 Install six.py conditionally
Summary:
The current version of LLDB installs six.py into global python library directory. This approach produces conflicts downstream with distribution's py-six copy.

Introduce new configure option LLDB_USE_SYSTEM_SIX (disabled by default). Once specified as TRUE, six.py won't be installed to Python's directory.

Add new option in finishSwigWrapperClasses.py, namely --useSystemSix.

Sponsored by <The NetBSD Foundation>

Reviewers: mgorny, emaste, clayborg, joerg, labath

Reviewed By: labath

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 294071
2017-02-04 00:20:24 +00:00
Pavel Labath 90505a0a2a Add a missing break statement
llvm-svn: 294036
2017-02-03 20:26:57 +00:00
Pavel Labath 05d382c5f7 Fix incorrect logging in ThreadPlan::ShouldReportStop
it used printf with formatv style specifications. Also, switch to
LLDB_LOG.

llvm-svn: 294024
2017-02-03 18:50:45 +00:00
Pavel Labath ea1b6b17dc Use LLDB_LOG in NativeRegisterContextLinux*** files
llvm-svn: 294023
2017-02-03 18:50:41 +00:00
Pavel Labath ec9bc8ccd4 Push down more common code into PlatformPOSIX
Summary:
- GetFileWithUUID: All platforms except PlatformDarwin had this.
However, I see no reason why this code would not apply there as well.

- GetProcessInfo, FindProcesses: The implementation was the same in all classes.

- GetFullNameForDylib: This code should apply to all non-darwin
platforms. I've kept the PlatformDarwin override as the situation is
different there.

Reviewers: clayborg, krytarowski, emaste

Subscribers: lldb-commits

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

llvm-svn: 294019
2017-02-03 17:42:04 +00:00
Pavel Labath 0972183581 Fix mac build breakage due to StringStream move
llvm-svn: 293948
2017-02-02 22:38:12 +00:00
Zachary Turner bf9a77305f Move classes from Core -> Utility.
This moves the following classes from Core -> Utility.

ConstString
Error
RegularExpression
Stream
StreamString

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

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

llvm-svn: 293941
2017-02-02 21:39:50 +00:00
Pavel Labath 86b03cf086 Fix windows build after r293821
We started passing the list of libraries to link to the
add_lldb_unittest macro, but that macro wasn't actually doing anything
with them. Fix that.

llvm-svn: 293913
2017-02-02 18:14:04 +00:00
Pavel Labath fc89bbcc71 Unify PlatformPOSIX::ResolveExecutable
Summary:
various platforms very using nearly identical code for this method. As far as I
can tell there was nothing platform-specific about the differences, but rather
it looked like it was caused by tiny tweaks being made to individual copies
without affecting the overall functionality. I have taken the superset of all
these tweaks and put it into one method in the base class (incidentaly, nobody
was using the base class implementation of the method, as all classes were
overriding it). From the darwin class I took the slightly improved error
reporting (checking whether the file is readable) and the
ResolveExecutableInBundle call (which has no effect elsewhere as the function
is already a no-op on non-darwin platforms). From the linux class I took the
set-the-triple-vendor-to-host-if-unspecified tweak (present in PlatformKalimba
as well).

PlatformWindows has an identical copy as well. We could resolve that by pushing
this code further down into Platform class, that that would require pushing the
m_remote_platform_sp member as well, which seems like a bad design choice.

Reviewers: clayborg, emaste, krytarowski

Subscribers: lldb-commits

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

llvm-svn: 293910
2017-02-02 17:50:03 +00:00
Kamil Rytarowski ea89913839 Fix multi-process-driver.cpp build on NetBSD
Summary:
Include <string.h> for strcmp(3) and memset(3).

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, clayborg, emaste, labath

Reviewed By: clayborg

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 293895
2017-02-02 15:05:56 +00:00
Jason Molenda 753e13c0eb Add logging to SBThread::GetInfoItemByPathAsString to
print the path being requested.

Change the GetInfoItemByPathAsString docuemtnation in 
the .i file to use docstring instead of autodoc so
the function signature is included in the python
help.
<rdar://problem/29999567> 

llvm-svn: 293858
2017-02-02 03:02:51 +00:00
Jason Molenda 35c5b86737 Update xcodeproj to track ConvertEnum.cpp et al being removed.
llvm-svn: 293831
2017-02-01 22:41:38 +00:00
Chris Bieneman 1751311a87 [CMake] Update unit tests with accurate dependencies
This is extending the updates from r293696 to the LLDB unit tests.

llvm-svn: 293821
2017-02-01 22:17:00 +00:00
Zachary Turner df44988b87 Break some dependencies in lldbUtility.
Differential Revision: https://reviews.llvm.org/D29359

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

Reviewers: beanz, sylvestre.ledru, mgorny

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 293803
2017-02-01 19:12:22 +00:00
Pavel Labath 3eb8b1ade1 Fix android build of the new process launcher
Android does not define the "cross-platform" symbol PT_TRACE_ME. Define
it ourselves, so we can keep the rest of the code generic.

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

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

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

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

Original patch by Tobias Nygren (NetBSD).

Sponsored by <The NetBSD Foundation>


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

Reviewed By: labath, ki.stfu

Subscribers: tnn, ki.stfu, #lldb

Tags: #lldb

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

llvm-svn: 293774
2017-02-01 16:02:55 +00:00
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
Jason Molenda 4f27ffb138 weak-link debugserver against the LoggingSupport framework;
systems without this framework will not get a link error.

<rdar://problem/30158797> 

llvm-svn: 292880
2017-01-24 04:16:03 +00:00
Pavel Labath 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 c69d0a203b Fix new Log unit test
the test was flaky because I specified the format string for the process id
incorrectly. This should fix it.

llvm-svn: 292414
2017-01-18 17:31:55 +00:00
Pavel Labath a92d6230da Fix windows build for previous commit
We get an error about a redefinition of getcwd(). This seems to fix it.

llvm-svn: 292364
2017-01-18 12:29:51 +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
Omair Javaid 56e70dd8cf Fix TestRegisterVariables for linux arm/arm64 gcc ver > 5
We are going to turn off buffer overflow introduced by gcc by turning off
FORTIFY_SOURCE.

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

llvm-svn: 291949
2017-01-13 19:28:42 +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
Chris Bieneman 095f633b74 [CMake] Fix finding LLDBWrapPython.cpp in Framework build
The framework build was constructing the path to LLDBWrapPython incorrectly. It is apparently always in the scripts directory.

llvm-svn: 291788
2017-01-12 18:45:59 +00:00
Pavel Labath eff6e83f23 Fix gcc build for r291756
I have accidentally added extra llvm:: namespace qualification.

llvm-svn: 291763
2017-01-12 11:36:56 +00:00
Pavel Labath 3284684dd1 Add format_provider for the Error class
Summary:
The formatter supports the same options as the string-like classes, i.e. the
ability to truncate the displayed string. I don't anticipate it would be much
used, but it seems consistent.

Reviewers: zturner, clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 291759
2017-01-12 11:13:24 +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
Pavel Labath 00b3f3c11b XFAIL TestRegisterVariables on gcc-4.8-x86_64
I have previously enabled this test for this configuration. However, it turns
out it only passes for gcc-4.9.

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

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

llvm-svn: 291555
2017-01-10 09:40:38 +00:00
Nitesh Jain f440244d67 [LLDB][MIPS] Fix TestLldbGdbServer failure for MIPS
Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 291554
2017-01-10 09:33:43 +00:00
Nitesh Jain 2ee6762b55 [LLDB][MIPS] Revert TestLldbGdbServer failure for MIPS
llvm-svn: 291553
2017-01-10 09:18:56 +00:00
Nitesh Jain f468b5d32f [LLDB][MIPS] Fix TestLldbGdbServer failure for MIPS
Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 291549
2017-01-10 08:20:01 +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
Michal Gorny eb200b2ccf [cmake] Obtain LLVM_CMAKE_PATH from llvm-config
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config instead of reconstructing it locally.

llvm-svn: 291500
2017-01-09 23:12:37 +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
Zachary Turner 5a4167fbd3 Install lldb Python module on Windows.
Patch by Vadim Chugunov
Differential Revision: https://reviews.llvm.org/D27476

llvm-svn: 291291
2017-01-06 22:05:35 +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 c523c38fcc Another windows build fix
llvm-svn: 291234
2017-01-06 13:07:09 +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 a284b76d9e Revert "XFAIL an lldb-mi test"
The clang bug is fixed now. This reverts commit r291100.

llvm-svn: 291225
2017-01-06 10:20:29 +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 a77ec68e50 Revert part of cleanup to fix a build break
Wasn't sure I could include ErrorHandling.h here, and evidently I wasn't
building this part (must've made the change using sed after getting
tired of fixing each compilation error individually).

llvm-svn: 291204
2017-01-06 01:42:56 +00:00
David Blaikie 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
Hafiz Abid Qadeer 66c007d507 Skip a test on darwin.
My earlier commit today seem to cause a failure on a darwin buildbot.
I am skipping the test while I investigate the failure.

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

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

Reviewers: ki.stfu, abidh

Subscribers: abidh, ki.stfu, lldb-commits

Tags: #lldb

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

llvm-svn: 291104
2017-01-05 13:23:47 +00:00
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
Pavel Labath b982b6db51 XFAIL an lldb-mi test
the test fails due to a bug in ToT clang

llvm-svn: 291100
2017-01-05 12:03:49 +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
Chris Bieneman 5f0793b36c [CMake] Fix install rules for tools included in the framework
The logic for install rules was wrong for tools included in the framework if the framework build is disabled.

llvm-svn: 290934
2017-01-04 03:36:35 +00:00
Jason Molenda 0da64d8503 Remove SymbolFilePDBTests.cpp from the list of tests to include in the
lldb-gtest binary that xcode builds for -scheme lldb-gtest; these tests
won't run on macosx systems.  Fixes testsuite failures we started
seeing after 290819.

<rdar://problem/29853778> 

llvm-svn: 290917
2017-01-04 00:01:25 +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
Pavel Labath 0ecce2300a Fix-up TestLinuxCore for r290874
r290874 enabled the s390x test, which caused the rest of the tests to start
misbehaving. This is because this test switches the selected platform and the
change persists.

This fixes it by explicitly resetting the platform in a similar way to the gcore
tests do. Potentially we should consider re-setting the platform globally
between each test run to better protect tests from each other.

llvm-svn: 290890
2017-01-03 13:18:12 +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
Omair Javaid 999266abc7 XFail TestNoreturnUnwind for arm targets
TestNoreturnUnwind fails on arm/aarch32 linux targets.

Bug is already described for x86_64 android targets in llvm.org/pr31192.

llvm-svn: 290821
2017-01-02 18:40:20 +00:00
Michal Gorny 95e2629216 [unittests] Split DWARF tests out of PDB, fix standalone build
Split the PDB tests into DWARF test and actual PDB tests, the latter
requiring DIA SDK. Use the new LLVMConfig.cmake LLVM_ENABLE_DIA_SDK
symbol to enable the PDB tests rather than relying on
llvm/Config/config.h private include file that is not available when
building standalone.

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

llvm-svn: 290819
2017-01-02 18:20:33 +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
Greg Clayton 02f74b0861 Quiet a warning where we weren't checking if this was the same and rhs.
llvm-svn: 290687
2016-12-28 21:19:42 +00:00
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
Sean Callanan 756cb33b6a specify -DNDEBUG for BNI builds of all targets in the Xcode build
llvm-svn: 290282
2016-12-21 23:21:11 +00:00
Chris Bieneman e9ce09b89f [CMake] Support distribution install for LLDB.framework
This patch adds the last bit of support to get LLVM_DISTRIBUTION_COMPONENTS working with libLLDB when built as a framework.

This patch adds dummy install targets for binaries built into the framework's Resources directory, and makes the framework's install target depend on all the binaries that get installed with the framework.

llvm-svn: 290273
2016-12-21 21:23:27 +00:00
Jim Ingham df1e4b697e Ignore SIGPIPE in the mini-driver used by these tests.
We're seeing some very occasional failures in these tests where the
mini-driver dies with a SIGPIPE.  We don't use SIGPIPE for anything, and
the main lldb driver program already ignores SIGPIPE, so ignoring it in
the mini-driver is a good way to remove these spurious failures.

<rdar://problem/29740488>

llvm-svn: 290216
2016-12-21 00:12:54 +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
Chris Bieneman 11da40b775 [CMake] [PR31433] Fix LLDB tool installation
This resolves PR 31433.

llvm-svn: 290180
2016-12-20 16:28:18 +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
Jason Molenda 97c96cb4ed Change the timeout in CallBoardSystemServiceOpenApplication to
30 seconds to match the old springboard timeout; the launcher
should time out before that and we will hopefully get back
an informative error message instead of timing out ourselves.

llvm-svn: 290163
2016-12-20 04:54:04 +00:00
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
Sylvestre Ledru 521d7b45ba Fix the cmake declaration syntax
llvm-svn: 290045
2016-12-17 13:04:35 +00:00
Sylvestre Ledru 47b071deff Support of lldb on Kfreebsd
Summary: Patch by Pino Toscano. Reported in http://bugs.debian.org/835665

Reviewers: tfiala, emaste

Subscribers: beanz, mgorny, emaste, krytarowski, brucem, tberghammer, danalbert, srhines, #lldb

Tags: #lldb

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

llvm-svn: 290044
2016-12-17 12:48:06 +00:00
Zachary Turner 91ad7a9b69 Fix compiler warning.
llvm-svn: 289994
2016-12-16 21:35:12 +00:00
Luke Drummond c3d0165c49 Fix broken escaping of commands in the build
A combination of broken escaping in CMake and in the python swig
generation scripts meant that the swig generation step would fail
whenever there were spaces or special characters in parameters passed to
swig.

The fix for this in CMakeLists is to use the VERBATIM option on all
COMMAND-based custom builders relying on CMake to properly escape each
argument in the generated file.

Within the python swig scripts, the fix is to call subprocess.Popen with
a list of raw argument strings rather than ones that are incorrectly
manually escaped, then passed to a shell subprocess via
subprocess.Popen(' '.join(params)). This also prevents nasty things
happening such as accidental command-injection.

This allows us to have the swig / python executables in paths containing
special chars and spaces, (or on shared storage on Win32, e.g
\\some\path or C:\Program Files\swig\swig.exe).

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

llvm-svn: 289956
2016-12-16 16:38:25 +00:00
Hafiz Abid Qadeer 95cc3456e8 Remove an unused type declaration.
llvm-svn: 289947
2016-12-16 14:44:34 +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 d69b9414b3 [CMake] Refactor LLDB libraries and tools to be components
In LLVM's CMake we have a convention that components have both a build and an install target. Making LLDB follow this convention will allow LLDB to take advantage of the LLVM_DISTRIBUTION_COMPONENTS build option from LLVM.

llvm-svn: 289879
2016-12-15 22:01:17 +00:00
Chris Bieneman 1662da2832 [CMake] Ensure Python files are inside the LLDB framework bundle
When building the LLDB Framework we need to ensure that the Python files get put into the Framework before the Framework's install target can be invoked.

All files inside the Framework's Resources bundle will get copied over during the install action.

llvm-svn: 289842
2016-12-15 18:19:10 +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
Jim Ingham 09558cb8a4 Test num locations >= 1 not == 1.
llvm-svn: 289695
2016-12-14 19:35:56 +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
Hafiz Abid Qadeer e00b96ecbd Remove code needed for supporting old VS versions.
Summary: This code was probably needed to support VS2013 and is not needed now. I have built it with VS and mingw. Ok to remove it?

Reviewers: zturner, abidh

Subscribers: lldb-commits

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

llvm-svn: 289644
2016-12-14 11:13:03 +00:00
Jason Molenda 6546b9a209 Small tweaks to the markup in StructuredDataPlugins.
llvm-svn: 289520
2016-12-13 05:59:24 +00:00
Jason Molenda 30011bf4a8 Touch-up the markup of the DarwinLog.md documentation.
llvm-svn: 289518
2016-12-13 05:54:17 +00:00
Todd Fiala 4e62292b11 Removing myself from code ownership file
I'm transitioning away from my current employer, and I do not foresee myself
spending much time on LLDB in the near future. Ideally somebody on the Google
Android team takes over the gdb-remote protocol tests, and somebody with decent
familiarity with the test suite infrastructure takes over the parallel test
runner and test event stream portions of the Python test suite.

llvm-svn: 289479
2016-12-12 22:42:00 +00:00
Pavel Labath d2396b6425 Remove some annotations from TestMultipleTargets
The test passes on linux. The i386 case is already handled by
skipIfHostIncompatibleWithRemote.

llvm-svn: 289427
2016-12-12 11:37:42 +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
Greg Clayton 461ba656a5 Fix buildbots that are failing due to this test by adding all expected fails that TestMultipleDebuggers.py has.
llvm-svn: 289223
2016-12-09 16:25:13 +00:00
Greg Clayton 1c4d4d61cb Rename multiple target test so it is unique.
llvm-svn: 289222
2016-12-09 16:22:10 +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
Nitesh Jain e51a967d89 [LLDB][MIPS] Fix TestMultipleHits for MIPS
Reviewers: clayborg, labath, zturner

Subscribers: jaydeep, bhushan, slthakur, lldb-commits

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

llvm-svn: 289210
2016-12-09 13:44:15 +00:00
Nitesh Jain de5923a70a [LLDB][MIPS] Fix some test case failures due to elf_abi field of qprocessInfo packet.
Reviewers: jaydeep, bhushan, clayborg

Subscribers: slthakur, lldb-commits

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

llvm-svn: 289209
2016-12-09 13:37:14 +00:00
Pavel Labath 73ee5c2fc4 Fix TestMultipleTargets for on x86_64 architectures
This test links against liblldb, so it can only run when the target arch is the
same arch as liblldb. We already have a decorator for that, so apply it.

While I'm in there, also mark the test as debug-info independent.

llvm-svn: 289199
2016-12-09 10:05:07 +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
Jason Molenda 74e8de063e Clean up the new TestInterruptThreadNames test a bit.
llvm-svn: 289155
2016-12-08 23:34:56 +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 b2979d8464 Increase timeout for Frontboard app launch request from 9 to 20 seconds
to match other timeouts.

llvm-svn: 289023
2016-12-08 05:12:45 +00:00
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
Zachary Turner 7fb5e3434b Work around a bogus warning on MSVC.
llvm-svn: 289009
2016-12-08 00:54:24 +00:00
Greg Clayton e04e5b954a Improve crashlog.py so it can handle more iOS crashlog files.
<rdar://problem/29191857>

llvm-svn: 289006
2016-12-08 00:22:45 +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
Chris Bieneman 07522bb187 [CMake] Don't add gtest if it is already there
LLVM build trees export the gtest library through a special export set. If you're building against a build tree you shouldn't need to re-add gtest, but if you're building against an installed LLVM you do.

llvm-svn: 288691
2016-12-05 19:40:34 +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
Pavel Labath 3d9941588f Remove one more if(__ANDROID_NDK__) I missed
llvm-svn: 288673
2016-12-05 14:57:19 +00:00
Pavel Labath 7a6252158e Clean up some use of __ANDROID_NDK__ in the cmake files
Rationale:
scripts/Python/modules: android is excluded at a higher level, so no point in
  checking here
tools/lldb-mi: lldb-mi builds fine (with some cosmetic tweaks) on android, and
  there is no reason it shouldn't.
tools/lldb-server: LLDB_DISABLE_LIBEDIT/CURSES already take the platform into
  account, so there is no point in checking again.

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

llvm-svn: 288661
2016-12-05 11:15:36 +00:00
Chris Bieneman c5882a73a0 [CMake] Use add_llvm_tool_symlink's OUTPUT_DIR option
This is updating to take r288632 into account.

llvm-svn: 288633
2016-12-05 03:29:10 +00:00
Kuba Mracek 9757a934a2 Update test expectations after AddressSanitizer text descriptions changed in r288535.
llvm-svn: 288542
2016-12-02 22:11:26 +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