Commit Graph

16288 Commits

Author SHA1 Message Date
Greg Clayton 70a9f511c2 Increase the packet timeout for the jModulesInfo since it can take longer than the default 1 second timeout on some linux versions when many shared libraries are involved.
llvm-svn: 300342
2017-04-14 17:10:04 +00:00
Greg Clayton db1550ab66 Fixed to disassemble new packets and fixed the dumping of the 'x' packets.
llvm-svn: 300341
2017-04-14 17:05:21 +00:00
Jason Molenda 3f60829455 Don't use uuid_clear(), non-darwin platforms include
Utility/UuidCompatibility.h which gets you a definiton
of uuid_t but none of the functions that operate on it.

llvm-svn: 300162
2017-04-13 02:12:32 +00:00
Jason Molenda 9b7fcdcb57 Use two LC_NOTE load commands for identifying the main binary that
lldb should use when given a corefile.

This uses an LC_NOTE "main bin spec" or an LC_NOTE "kern ver str"
if they are present in a Mach-O core file.

Core files may have multiple different binaries -- different kernels,
or a mix of user process and kernel binaries -- and it can be
difficult for lldb to detect the correct one to use simply by looking
at the pages of memory.  These two new LC_NOTE load commands allow
for the correct binary to be recorded unambiguously.

<rdar://problem/20878266> 

llvm-svn: 300138
2017-04-12 23:33:30 +00:00
Chris Bieneman a4f532e0ac [NFC] Adding a new wrapper for getaddrinfo
Summary: This patch adds a new wrapper for getaddrinfo which returns a std::vector of SocketAddresses. While this patch doesn't add any uses of the new function, I have two separable patches that are dependent on this, so I put it in its own patch.

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 300112
2017-04-12 21:56:33 +00:00
Chris Bieneman efd065e6a0 Support Unit Testing debugserver
Summary:
This patch refactors the CMake build system's support for building debugserver to allow us to build the majority of debugserver's sources into the debugserverCommon library which can then be reused by unit tests.

The first unit test I've written tests debug server's ability to accept incoming connections from LLDB. The test forks the process, and one side creates a listening socket using debugserver's socket API, the other side creates a transmitting socket using LLDB's TCPSocket class.

I have no clue where to even start getting this connected into the LLDB Xcode project, so for now these tests are CMake-only.

Reviewers: zturner, labath, jasonmolenda

Subscribers: lldb-commits, mgorny

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

llvm-svn: 300111
2017-04-12 21:56:29 +00:00
Pavel Labath f0565cc84a Add libc++ category to the remaining libc++ data formatters
llvm-svn: 300054
2017-04-12 12:32:58 +00:00
Pavel Labath da7b15df70 Fix TestCppIncompleteTypes for android/clang
LDFLAGS contains some .a files. If it is specified before the relevant
object files, undefined symbol errors occur.

llvm-svn: 300048
2017-04-12 10:59:34 +00:00
Pavel Labath d3656a03ab Fix libc++ vector<bool> data formatter (bug #32553)
Summary:
The iteration list through the available data formatters was undefined,
which meant that the vector<bool> formatter kicked in only in cases
where it happened to be queried before the general vector formatter. To
fix this, I merge the two data formatter entries into one, and select
which implementation to use in the factory function.

Reviewers: jasonmolenda, tberghammer, EricWF

Subscribers: lldb-commits

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

llvm-svn: 300047
2017-04-12 10:59:24 +00:00
Pavel Labath 74207ad7ba Fix TestGuessLanguage for gcc
gcc emits DW_LANG_C89 even if we specify -std=c99 during compilation.
Since this isn't an lldb bug, but just the way the compiler happens to
be implemented, I teach the test to expect this situation correctly.

llvm-svn: 300046
2017-04-12 10:13:50 +00:00
Pavel Labath efe4e412ad Android.rules: setup correct objcopy path
This fixes a couple of tests when using android clang as a compiler.

llvm-svn: 300045
2017-04-12 10:13:47 +00:00
Jim Ingham bdbdd22937 Teach SBFrame how to guess its language.
<rdar://problem/31411646>

llvm-svn: 300012
2017-04-12 00:19:54 +00:00
Pavel Labath 0df645dda4 Add missing annotation to TestDataFormatterUnordered
llvm-svn: 299934
2017-04-11 12:26:33 +00:00
Pavel Labath f0a6d8ada3 Remove Plugins/Process/POSIX from include_directories
Summary:
The files there can always be referred to using their full path, which
is what most of the code has been doing already, so this makes the
situation more consistent. Also fix the the code in the FreeBSD plugin
to use the new paths.

Reviewers: eugene, emaste

Subscribers: lldb-commits, kettenis, mgorny, krytarowski

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

llvm-svn: 299933
2017-04-11 12:26:25 +00:00
Matt Arsenault 75696ffa25 Update for alloca construction changes
llvm-svn: 299898
2017-04-10 23:27:53 +00:00
Shoaib Meenai 96e541a7cf [lldb] Fix ninja URL
The old URL is a 404 now. Pointed out by Smirftsch1 on IRC.

llvm-svn: 299845
2017-04-10 15:41:15 +00:00
Jason Molenda 969230a702 Mark this test as XFAIL on all platforms, it's happening everywhere.
llvm.org/pr32553 and <rdar://problem/30646077> are tracking this.

llvm-svn: 299807
2017-04-07 23:20:22 +00:00
Kamil Rytarowski 426e864182 Correct environ parsing on NetBSD
Summary:
This replaces old code in Host::GetEnvironment for NetBSD
with the version from Linux. This makes parsing environment
variables correctly. It also fixes programs that depend on the
variables like curses(3) applications.

Long term this function should be moved to Process Plugin,
as currently env variables are not available with remote
debugging.

Other BSDs might want to catch up after this change.

Tested with NetBSD top(1).

Sponsored by <The NetBSD Foundation>

Reviewers: emaste, labath, joerg, kettenis

Reviewed By: emaste

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 299783
2017-04-07 16:45:36 +00:00
Ed Maste 70a26e93a9 Correct environ parsing on FreeBSD
Sync Host:GetEnvironment with Linux and Kamil Rytarowski's forthcoming
NetBSD change in review D31784.

llvm-svn: 299781
2017-04-07 16:40:25 +00:00
Eugene Zemtsov 5753710248 Add more tests for ExtractContextAndIdentifier
llvm-svn: 299729
2017-04-06 23:12:43 +00:00
Eugene Zemtsov a633ee6e4a New C++ function name parsing logic (Resubmit)
Current implementation of CPlusPlusLanguage::MethodName::Parse() doesn't
get anywhere close to covering full extent of possible function declarations.
It causes incorrect behavior in avoid-stepping and sometimes messes
printing of thread backtrace.

This change implements more methodical parsing logic based on clang
lexer and simple recursive parser.

Examples:
void std::vector<Class, std::allocator<Class>>::_M_emplace_back_aux<Class const&>(Class const&)
void (*&std::_Any_data::_M_access<void (*)()>())()

Previous version of this change (D31451) was rolled back due to an issue
with Objective-C selectors being incorrectly recognized as a C++ identifier.

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

llvm-svn: 299721
2017-04-06 22:36:02 +00:00
Zachary Turner 813de71329 Try to fix FreeBSD build after IWYU changes.
llvm-svn: 299719
2017-04-06 22:18:59 +00:00
Zachary Turner 720bd7af62 Fix build failure in unit test.
llvm-svn: 299718
2017-04-06 21:57:39 +00:00
Zachary Turner 2f3df6137a iwyu fixes for lldbCore.
This adjusts header file includes for headers and source files
in Core.  In doing so, one dependency cycle is eliminated
because all the includes from Core to that project were dead
includes anyway.  In places where some files in other projects
were only compiling due to a transitive include from another
header, fixups have been made so that those files also include
the header they need.  Tested on Windows and Linux, and plan
to address failures on OSX and FreeBSD after watching the
bots.

llvm-svn: 299714
2017-04-06 21:28:29 +00:00
Zachary Turner 8d4e2768be Try to fix FreeBSD build after iwyu changes.
llvm-svn: 299705
2017-04-06 20:51:22 +00:00
Tamas Berghammer 95776ad5b8 XFAIL TestDataFormatterLibcxxVBool on Linux & Android
The skipping logic for the test have been fixed recently but the test is
very flakey on the buildbot.

llvm-svn: 299677
2017-04-06 18:15:43 +00:00
Zachary Turner 4479ac15c9 iwyu fixes on lldbUtility.
This patch makes adjustments to header file includes in
lldbUtility based on recommendations by the iwyu tool
(include-what-you-use).  The goal here is to make sure that
all files include the exact set of headers which are needed
for that file only, to eliminate cases of dead includes (e.g.
someone deleted some code but forgot to delete the header
includes that that code necessitated), and to eliminate the
case where header includes are picked up transitively.

llvm-svn: 299676
2017-04-06 18:12:24 +00:00
Jason Molenda 30169d5ef2 Update unittests/Host/SocketTest.cpp to also use the new
one-socket API.

llvm-svn: 299613
2017-04-06 03:16:44 +00:00
Jason Molenda 3533cec58b Some old mach-o core files have an LC_IDENT load command
and there's a string in there that can be helpful in locating
the kernel binary.  Use it.
<rdar://problem/31444711> 

llvm-svn: 299612
2017-04-06 01:50:11 +00:00
Jim Ingham bef72b77fa getAsInteger is not a equivalent replacement for strtol
work around that fact for CommandObjectMemoryWrite.

<rdar://problem/31457148>

llvm-svn: 299609
2017-04-06 01:33:38 +00:00
Jason Molenda 90dce06f24 Change how UDP sockets are set up -- use the same one socket for
both sending and receiving information, instead of using one socket
to send and another to receive.  The two socket arrangement fails over
when a firewall is between the two systems.
<rdar://problem/31286757> 

llvm-svn: 299608
2017-04-06 01:21:44 +00:00
Pavel Labath 46f1d4a12c Annotate some more libc++ tests with the new category
This makes sure we are able to run them properly on android.

llvm-svn: 299588
2017-04-05 20:34:26 +00:00
Sean Callanan 894c147104 The darwin_log tests are very fragile and currently do not properly assess the state of that functionality.
I have put them all in their own category, and made that category disabled by default.

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

llvm-svn: 299587
2017-04-05 20:33:39 +00:00
Nitesh Jain d5be88ecf8 Fix a typo introduce in r299200.
llvm-svn: 299527
2017-04-05 09:31:43 +00:00
Jim Ingham 9645a6290a Reverting r299374 & r299402 due to testsuite failure.
This caused a failure in the test case:

  functionalities/breakpoint/objc/TestObjCBreakpoints.py

When we are parsing up names we stick interesting parts of the names
in various buckets, one of which is the ObjC selector bucket.  The new
C++ name parser must be interfering with this process somehow.

<rdar://problem/31439305>

llvm-svn: 299489
2017-04-05 00:08:21 +00:00
Jim Ingham 61cc47ad30 Tone down the "lldb types" log a bit.
Change the get shared class info function to only
dump its results to the inferior stdout when the
log is verbose.  This matches the lldb side of the
same process, which only logs what it found if the
log is on verbose.

llvm-svn: 299451
2017-04-04 17:48:21 +00:00
Ilia K a97973ab4e Enable lldm-mi commands -stack-list-locals -stack-list-variables and -var-create to work only with variables in scope
Patch by ayuckhulk

Reviewers: abidh, lldb-commits, ki.stfu

Reviewed By: ki.stfu

Tags: #lldb

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

llvm-svn: 299417
2017-04-04 08:00:28 +00:00
Jason Molenda 498ff61e2d Skip three test cases that are asserting on macosx as of r299199. A quick
look showed that the target's arch has no core / byte order and so when
AuxVector::AuxVector calls into a dataextractor and sets the byte size to 0,
it asserts.  e.g.

  m_arch = {
    m_triple = (Data = "x86_64--linux", Arch = x86_64, SubArch = NoSubArch, Vendor = UnknownVendor, OS = Linux, Environment = UnknownEnvironment, ObjectFormat = ELF)
    m_core = kCore_invalid
    m_byte_order = eByteOrderInvalid
    m_flags = 0x00000000
    m_distribution_id = <no value available>
  }

<rdar://problem/31380097> 

llvm-svn: 299408
2017-04-04 01:09:20 +00:00
Sean Callanan 48a15fd9f1 Add CPlusPlusNameParser to the xcodeproj
llvm-svn: 299402
2017-04-03 23:56:41 +00:00
Jason Molenda a4039a024c The LIBLLDB_LOG_TEMPORARY channel got lost at some point where
Logging.cpp was being changed in the past.  Re-add it.

llvm-svn: 299394
2017-04-03 22:23:01 +00:00
Eugene Zemtsov 699a748893 New C++ function name parsing logic
Current implementation of CPlusPlusLanguage::MethodName::Parse() doesn't
get anywhere close to covering full extent of possible function declarations.
It causes incorrect behavior in avoid-stepping and sometimes messes
printing of thread backtrace.

This change implements more methodical parsing logic based on clang
lexer and simple recursive parser.

Examples:
void std::vector<Class, std::allocator<Class>>::_M_emplace_back_aux<Class const&>(Class const&)
void (*&std::_Any_data::_M_access<void (*)()>())()

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

llvm-svn: 299374
2017-04-03 18:59:34 +00:00
Jason Molenda e20648595b Back out temporary masking of EXC_SYSCALL mach exceptions.
<rdar://problem/31359720> 

llvm-svn: 299345
2017-04-03 00:59:47 +00:00
Jim Ingham 99d1e28aef DisassembleRange can return an empty DisassemblerSP
check for it.

<rdar://problem/31379799>

llvm-svn: 299276
2017-03-31 22:39:55 +00:00
Tim Hammerquist 3bccaed574 add more RegisterContext files to xcode project
llvm-svn: 299261
2017-03-31 21:03:58 +00:00
Tamas Berghammer 4fbb55b7b1 Stop calling ValueObject::SetName from synthetic child providers
Summary:
Calling ValueObject::SetName from a sythetic child provider would change
the underying value object used for the non-synthetic child as well what
is clearly unintentional.

Reviewers: jingham, labath

Subscribers: lldb-commits

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

llvm-svn: 299259
2017-03-31 20:48:00 +00:00
Tamas Berghammer 4c08fe2841 Add support for sythetic operator dereference
Summary:
After this change a sythetic child provider can generate a special child
named "$$dereference$$" what if present is used when "operator*" or
"operator->" used on a ValueObject. The goal of the change is to make
expressions like "up->foo" work inside the "frame variable" command.

Reviewers: labath, jingham

Subscribers: lldb-commits

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

llvm-svn: 299251
2017-03-31 20:23:22 +00:00
Tamas Berghammer af8953a025 Do not dereference std::unique_ptr by default
Summary:
Displaying the object pointed by the unique_ptr can cause an infinite
recursion when we have a pointer loop so this change stops that
behavior. Additionally it makes the unique_ptr act more like a class
containing a pointer (what is the underlying truth) instead of some
"magic" class.

Reviewers: labath, jingham

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

llvm-svn: 299249
2017-03-31 20:07:20 +00:00
Stephane Sezer 48d1427c30 Verify memory address range validity in GDBRemoteCommunicationClient
Summary:
This aims to verify the validity of the response from the debugging
server in GDBRemoteCommunicationClient::GetMemoryRegionInfo. I was
working with ds2 (https://github.com/facebook/ds2) and encountered a bug
that caused the server's response to have a 'size' value of 0, which
caused lldb to behave incorrectly.

Reviewers: k8stone, labath, clayborg

Reviewed By: labath, clayborg

Subscribers: clayborg, sas, lldb-commits

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

Change by Alex Langford <apl@fb.com>

llvm-svn: 299239
2017-03-31 18:00:48 +00:00
Nitesh Jain b8dbd32375 [LLDB][MIPS] Core Dump Support.
Reviewers: labath, emaste

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299200
2017-03-31 11:14:02 +00:00
Nitesh Jain 706c520558 [LLDB][MIPS] Fix Core file Architecture and OS information.
Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299199
2017-03-31 11:06:25 +00:00
Nitesh Jain 5ba3d85ccb [LLDB][MIPS] Check if memory_info.GetName() is empty before finding corresponding module.
Reviewers: labath, clayborg

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 299196
2017-03-31 10:55:55 +00:00
Jim Ingham b9923589aa Don't add a newline if the object description already has one.
<rdar://problem/25755431>

llvm-svn: 299147
2017-03-31 01:32:57 +00:00
Tim Hammerquist 265a7c71d0 add NetBSD files to Xcode project to resolve failure from r299109
llvm-svn: 299116
2017-03-30 21:27:51 +00:00
Kamil Rytarowski 3eef2b5e96 Battery of NetBSD support improvements
Summary:
Include initial support for:
 - single step mode (PT_STEP)
 - single step trap handling (TRAP_TRACE)
 - exec() trap (TRAP_EXEC)
 - add placeholder interfaces for FPR
 - initial code for NetBSD core(5) files
 - minor tweaks

While there improve style of altered elf-core/ files.

This code raises the number of passing tests on NetBSD to around 50% (600+/1200+).

The introduced code is subject to improve afterwards for additional features and bug fixes.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, emaste, kettenis

Reviewed By: labath

Subscribers: srhines, #lldb

Tags: #lldb

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

llvm-svn: 299109
2017-03-30 20:25:29 +00:00
Michal Gorny 1052b72361 Revert r298776 - Expression: add missing linkage to RuntimeDyld ...
This needs to be addressed within LLVM itself.

llvm-svn: 299095
2017-03-30 18:24:07 +00:00
Jason Molenda 2ccbac3fee Mask out EXC_SYSCALL exceptions as well.
<rdar://problem/31335814> 

llvm-svn: 299040
2017-03-30 00:23:46 +00:00
Pavel Labath 01a28ca7f8 Centralize libc++ test skipping logic
Summary:
This aims to replace the different decorators we've had on each libc++
test with a single solution. Each libc++ will be assigned to the
"libc++" category and a single central piece of code will decide whether
we are actually able to run libc++ test in the given configuration by
enabling or disabling the category (while giving the user the
opportunity to override this).

I started this effort because I wanted to get libc++ tests running on
android, and none of the existing decorators worked for this use case:
 - skipIfGcc - incorrect, we can build libc++ executables on android
 with gcc (in fact, after this, we can now do it on linux as well)
 - lldbutil.skip_if_library_missing - this checks whether libc++.so is
 loaded in the proces, which fails in case of a statically linked
 libc++ (this makes copying executables to the remote target easier to
 manage).

To make this work I needed to split out the pseudo_barrier code from the
force-included file, as libc++'s atomic does not play well with gcc on
linux, and this made every test fail, even though we need the code only
in the threading tests.

So far, I am only annotating one of the tests with this category. If
this does not break anything, I'll proceed to update the rest.

Reviewers: jingham, zturner, EricWF

Subscribers: srhines, lldb-commits

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

llvm-svn: 299028
2017-03-29 21:01:14 +00:00
Kamil Rytarowski 6420a2f9c6 Add NetBSD path for Debugging Information in Separate Files
Summary:
NetBSD stores debug information files in the `/usr/libdata/debug` path.

This change fixes debugging distribution executables, e.g. `look`(1):

```
$ lldb /usr/bin/look                                                                                                                                
(lldb) target create "/usr/bin/look"
Current executable set to '/usr/bin/look' (x86_64).
(lldb) b main
Breakpoint 1: where = look`main + 22 at look.c:107, address = 0x0000000000000da6
(lldb) r
Process 23473 launched: '/usr/bin/look' (x86_64)
Process 23473 stopped
* thread #1, stop reason = breakpoint 1.1
    frame #0: 0x0000000186600da6 look`main(argc=1, argv=0x00007f7fffc7c488) at look.c:107
   104  
   105          string = NULL;
   106          file = _PATH_WORDS;
-> 107          termchar = '\0';
   108          while ((ch = getopt(argc, argv, "dft:")) != -1)
   109                  switch(ch) {
   110                  case 'd':
(lldb)
```

There is no `/usr/lib/debug` path on NeBSD, so remove it from search.

Sponsored by <The NetBSD Foundation>

Reviewers: jingham, emaste, kettenis, labath, joerg

Reviewed By: labath

Subscribers: aprantl, #lldb

Tags: #lldb

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

llvm-svn: 299023
2017-03-29 19:52:24 +00:00
Sean Callanan d53048c479 Move the definition of SBListener::GetSP() to SBListener.cpp.
This is the requirement for all functions in the public API,
to eliminate weak symbol definitions.

llvm-svn: 299020
2017-03-29 19:32:59 +00:00
Kamil Rytarowski 75ed5c45af Remove dead include <sys/user.h> from the NetBSD code.
llvm-svn: 298970
2017-03-29 01:10:21 +00:00
Jim Ingham 9f44d460d9 Print the error if dsymForUUID sometimes produces bad plists.
Not much we can do about it but at least we can print the bad
plist and the error.

llvm-svn: 298958
2017-03-28 23:25:34 +00:00
Kamil Rytarowski f07a9995e8 Add support for tracing hello-world application on NetBSD
Summary:
This patch is a stripped down from features a NetBSD process
code (patch is kept under 2k LOC). This code has assumption that
there is only one thread within a debugged process. The only
debugger trap supported is software breakpoint (TRAP_BRKPT).
The generic platform code requires to add dummy function for
watchpoints etc. These functions are currently empty.
This code is not the final platform support as is and it's treated as
a base to extend, refactor and address issues afterwards.

Supported features:
 - handle software breakpoints,
 - correctly attach to a tracee,
 - support NetBSD specific ptrace(2),
 - monitor process termination,
 - monitor SIGTRAP events,
 - monitor SIGSTOP events,
 - monitor other signals events,
 - resume the whole process,
 - get memory region info perms,
 - read memory from tracee,
 - write memory to tracee,
 - read ELF AUXV,
 - x86_64 GPR read and write code

For the generic framework include:
 - halt,
 - detach,
 - signal,
 - kill,
 - allocatememory,
 - deallocatememory,
 - update threads,
 - getarchitecture,
 - getfileloadaddress,
 - and others.

This code has preliminary AddThread code.

Out of interest in this patch:
 - exec() traps,
 - hardware debug register traps,
 - single step trap,
 - thread creation/termination trap,
 - process fork(2), vfork(2) and vfork(2) done traps,
 - syscall entry and exit trap,
 - threads,
 - FPR registers,
 - retrieving tracee's thread name,
 - non x86_64 support.

This code can be used to start a hello world application and trace it.

This code can be used by other BSD systems as a starting point to get similar
capabilities.

Sponsored by <The NetBSD Foundation>

Reviewers: emaste, joerg, kettenis, labath

Subscribers: mgorny, #lldb

Tags: #lldb

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

llvm-svn: 298953
2017-03-28 22:43:17 +00:00
Jim Ingham 97e4f472c3 In FileSpec::Equal, short-cut GetNormalizedPath.
GetNormalizedPath seems to be slow, so it's worth
shortcutting it if possible.  This change does so
when the filenames and not equal and we can tell
GetNormalizedPath would not make them equal.

Also added a test for "." final component since that
was missing.

llvm-svn: 298876
2017-03-27 19:12:25 +00:00
Jim Ingham 9381bdf3f5 Fix the Xcode project for OpenBSD additions.
llvm-svn: 298874
2017-03-27 19:03:11 +00:00
Kamil Rytarowski 12801f1e0f [LLDB] OpenBSD support
Summary:
Add basic OpenBSD support. This is enough to be able to analyze core dumps for OpenBSD/amd64, OpenBSD/arm, OpenBSD/arm64 and OpenBSD/i386.

Note that part of the changes to source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp fix a bug that probably affects other platforms as well.  The GetProgramHeaderByIndex() interface use 1-based indices, but in some case when looping over the headers the, the loop starts at 0 and misses the last header.  This caused problems on OpenBSD since OpenBSD core dumps have the PT_NOTE segment as the last program header.


Reviewers: joerg, labath, krytarowski

Reviewed By: krytarowski

Subscribers: aemerson, emaste, rengolin, srhines, krytarowski, mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 298810
2017-03-26 15:34:57 +00:00
Michal Gorny c4e42d2c66 PluginUnwindAssemblyX86: add missing linkage to MCDisasm
Add missing linkage of the lldbPluginUnwindAssemblyX86 to LLVMMCDisasm
library. This fixes the following build failure when linking against
shared libraries:

    lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function lldb_private::x86AssemblyInspectionEngine::instruction_length(unsigned char*, int&): error: undefined reference to 'LLVMDisasmInstruction'
    lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function lldb_private::x86AssemblyInspectionEngine::~x86AssemblyInspectionEngine(): error: undefined reference to 'LLVMDisasmDispose'
    lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function lldb_private::x86AssemblyInspectionEngine::x86AssemblyInspectionEngine(lldb_private::ArchSpec const&): error: undefined reference to 'LLVMCreateDisasm'

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

llvm-svn: 298777
2017-03-25 18:51:37 +00:00
Michal Gorny a32fc333d2 Expression: add missing linkage to RuntimeDyld component
Add missing linkage from lldbExpression library to LLVMRuntimeDyld.
Otherwise the build against shared LLVM libraries fails with:

    lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):IRExecutionUnit.cpp:function llvm::RTDyldMemoryManager::deregisterEHFrames(unsigned char*, unsigned long, unsigned long): error: undefined reference to 'llvm::RTDyldMemoryManager::deregisterEHFramesInProcess(unsigned char*, unsigned long)'

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

llvm-svn: 298776
2017-03-25 18:51:29 +00:00
Jason Molenda 0387364c4c The expression text in AppleObjCRuntimeV1::CreateObjectChecker
was formatted into a string inside an assert() expression.
Which is elided when lldb is built with asserts disabled;
the result is that all expressions will fail when debugging
programs using the objective-c v1 runtime.

<rdar://problem/30353271> 

llvm-svn: 298694
2017-03-24 08:01:16 +00:00
Bruce Mitchener ef4536c389 Fix warnings from clang build on macOS.
Reviewers: lldb-commits

Subscribers: lldb-commits

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

llvm-svn: 298585
2017-03-23 09:52:26 +00:00
Zachary Turner 3eb2b44d31 Delete some more dead includes.
This breaks the cycle between Target and PluginLanguageC++, reducing
the overall cycle count from 43 to 42.

llvm-svn: 298561
2017-03-22 23:33:16 +00:00
Tim Hammerquist 6b2c9ac888 Merge r298536 changes to Xcode
rdar://problem/31202813

llvm-svn: 298547
2017-03-22 20:21:52 +00:00
Zachary Turner 4c103f1f61 Remove dead include from GoASTContext.cpp.
This #include was the cause of a dependency from Symbol ->
DataFormatters.  However, nothing from the header was being
used anyway, so we can just remove it with no adverse effects.

This reduces the overall cycle count from 44 to 43.

llvm-svn: 298541
2017-03-22 19:24:17 +00:00
Zachary Turner 5713a05b5b Move FileSpec from Host -> Utility.
llvm-svn: 298536
2017-03-22 18:40:07 +00:00
Zachary Turner bbd17224d8 [analyze deps] Show incoming and outgoing counts on island members.
llvm-svn: 298535
2017-03-22 18:23:14 +00:00
Zachary Turner 84a6218fbe [analyze deps] Also show cycle islands.
We currently display a list of all minimal cycles, but it's
useful to be able to see the big picture impact of these cycles
by merging them all together into groups of interconnected
components.

Because the cycle discovery algorithm only considers "minimal"
cycles, it discards all information for dependencies which are
not considered part of the minimal cycle.  So all we know is that
the components of each island definitely all depend on each other
but it's still possible that there are hidden dependencies due
to transitive includes.

The cycle list should still be the authoritative reference for
deciding where the easiest places to break cycles are, though.

llvm-svn: 298530
2017-03-22 18:04:20 +00:00
Zachary Turner 8d48cd6009 Resubmit "Delete the remainder of platform specific code in FileSpec."
This was causing a test failure in one of LLDB's tests which
specifically dealt with a limitation in LLVM's implementation
of home_directory() that LLDB's own implementation had worked
around.

This limitation has been addressed in r298513 on the LLVM side,
so the failing test (which is now unnecessary as the limitation
no longer exists) was removed in r298519, allowing this patch to
be re-submitted without modification.

llvm-svn: 298526
2017-03-22 17:33:23 +00:00
Kamil Rytarowski 26b09b27e5 Reuse appropriate Launch and Attach on NetBSD
Summary:
NetBSD ships with NativeProcessNetBSD  inherited from NativeProcessProtocol.

Link Plugins/Process/gdb-remote with lldbPluginProcessNetBSD in order to resolve
correctly the linking to Launch and Attach from the NetBSD plugin.

Sponsored by <The NetBSD Foundation>

Reviewers: kettenis, labath, emaste, joerg

Reviewed By: labath, emaste

Subscribers: mgorny, #lldb

Tags: #lldb

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

llvm-svn: 298524
2017-03-22 17:24:37 +00:00
Zachary Turner d0410b6f34 Delete TestLLVM.py
This was added to workaround a limitation in LLVM's implementation
of getting the current user's home directory, since it would
only look at the value of $HOME, but we did not want to rely
on that being set so we would also look in the password database.

Adding the ability to look in the password database to LLVM was
a straightforward patch that was submitted in r298513, so since
that is done this test is no longer needed.

llvm-svn: 298519
2017-03-22 17:08:25 +00:00
Tim Hammerquist 17e228f309 Merge changes from r298466 into Xcode project
rdar://problem/31197116

llvm-svn: 298517
2017-03-22 16:47:14 +00:00
Pavel Labath ed00beba12 Revert "Delete the remainder of platform specific code in FileSpec."
This reverts commit r298465 as it breaks
TestLLVM.TestHomeDirectory.test_tilde_home_directory.

llvm-svn: 298509
2017-03-22 14:04:43 +00:00
Zachary Turner 90bf36f949 Break the cycle between Host and PluginProcessUtility.
There are only two users of NativeRegisterContextRegisterInfo,
and both are in process plugins.  Moving this code from Host
to Plugins/Process/Utility thus makes sense, and as it is the
only dependency from Host -> PluginProcessUtility, it also
breaks this cycle, reducing LLDB's overall cycle count from
45 to 44.

llvm-svn: 298466
2017-03-22 00:27:54 +00:00
Zachary Turner aaedf89101 Delete the remainder of platform specific code in FileSpec.
Differential Revision: https://reviews.llvm.org/D31129

llvm-svn: 298465
2017-03-22 00:27:24 +00:00
Zachary Turner 4dbf9fa0d4 [deps script] Sort cycles by the difficulty of breaking.
When passing --discover-cycles and --show-counts, it displays
the number of dependencies between each hop of the cycle,
and sorts by the sum.  Dependencies at the top of the list
should be the easiest to break.

llvm-svn: 298455
2017-03-21 22:46:46 +00:00
Tim Hammerquist 74a3c07da6 Mirror CMake changes from r298412 to Xcode project
<rdar://problem/31181635>
M    lldb.xcodeproj/project.pbxproj

llvm-svn: 298451
2017-03-21 22:08:16 +00:00
Zachary Turner ed44af6c61 Fix build broken by StringList move.
llvm-svn: 298419
2017-03-21 18:45:42 +00:00
Zachary Turner 573ab909d3 Move StringList from Core -> Utility.
llvm-svn: 298412
2017-03-21 18:25:04 +00:00
Kamil Rytarowski a1e3d08666 Create instance of DynamicLoaderPOSIXDYLD on NetBSD
Summary:
NetBSD is a modern ELF UNIX-like system.

There is requires DynamicLoaderPOSIXDYLD e.g. for ELF AUXV reading from the client.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, kettenis

Reviewed By: labath

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 298409
2017-03-21 17:39:15 +00:00
Kamil Rytarowski 1a3d19dd25 Add stub for PluginProcessNetBSD
Summary:
This is the base for introduction of further features to support Process Tracing on NetBSD, in local and remote setup.

This code is also a starting point to synchronize the development with other BSDs. Currently NetBSD is ahead and other systems can catch up.

Sponsored by <The NetBSD Foundation>

Reviewers: emaste, joerg, kettenis, labath

Reviewed By: labath

Subscribers: mgorny, #lldb

Tags: #lldb

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

llvm-svn: 298408
2017-03-21 17:30:47 +00:00
Kamil Rytarowski c93408a6ab Enable AUXV and QPassSignals in gdb-remote for NetBSD
Summary:
NetBSD is an ELF platform and it uses Elf Auxiliary Vector like Linux and other modern BSDs.

While there enable QPassSignals for the NetBSD port as well.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, kettenis, joerg, emaste

Reviewed By: labath

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 298407
2017-03-21 17:27:59 +00:00
Kamil Rytarowski a87101d6a7 Enable ProcessPOSIXLog on NetBSD
Summary:
NetBSD can share the same logging functionality with Linux and FreeBSD.

Sponsored by <The NetBSD Foundation>


Reviewers: labath, emaste, joerg, kettenis

Reviewed By: labath, emaste

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 298406
2017-03-21 17:26:55 +00:00
Kamil Rytarowski 750228a6a7 Add NetBSD case in Entry::Type::ThreadID
Summary:
NetBSD native threads are printed as 64-bit unsigned integers.

The underlying system type of a thread identity is lwpid_t of type int32_t. For consistency with Linux and FreeBSD share the 64-bit unsigned integer type.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, kettenis, joerg, emaste

Reviewed By: labath, emaste

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 298405
2017-03-21 17:25:47 +00:00
Reid Kleckner f76a8ac5a9 Remove stray paren that got in while attempting to fix the build for AttributeList
llvm-svn: 298402
2017-03-21 17:15:50 +00:00
Reid Kleckner a3e3715c3e Update for LLVM API rename of AttributeSet -> AttributeList
llvm-svn: 298399
2017-03-21 17:09:20 +00:00
Pavel Labath e3ad2e2e73 Replace std::ofstream with llvm::raw_fd_ostream
Summary:
ofstream does not handle paths with non-ascii characters correctly on
windows, so I am switching these to llvm streams to fix that.

Reviewers: zturner, eugene

Subscribers: lldb-commits

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

llvm-svn: 298375
2017-03-21 13:49:50 +00:00
Pavel Labath 1593086232 Remove ProcFileReader
This removes the last usage of ProcFileReader from NativeProcessLinux
and then deletes the class itself.

llvm-svn: 298374
2017-03-21 13:49:45 +00:00
Zachary Turner 07db3f7e3f Resubmit r298334 after fixing OSX build errors.
Hopefully this works, I can't test since I don't have Mac
hardware, however.

llvm-svn: 298340
2017-03-21 05:47:57 +00:00
Jason Molenda 2eb3227f97 Revert r298334 until Zachary has a chance to fix the buildbot failure
on macosx.

llvm-svn: 298338
2017-03-21 04:45:10 +00:00
Jason Molenda 3724ae4e70 Fix two places where an arm instruction emulation method
can dereference misaligned memory.  
<rdar://problem/31106315>, <rdar://problem/31106337>

llvm-svn: 298337
2017-03-21 04:34:17 +00:00
Zachary Turner d9b368526b Delete some dead code in HostInfo.
llvm-svn: 298335
2017-03-21 04:01:59 +00:00
Zachary Turner bfe8bcbc43 Delete various lldb FileSystem functions.
Use LLVM's equivalent versions instead.

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

llvm-svn: 298334
2017-03-21 04:01:04 +00:00
Jason Molenda ab2dae0a9c Initialize m_allow_cxx, m_allow_objc. These ivars in the base class are not
initialized in the ctor and they're only initialized to 'true' in ClangUserExpression.cpp
when specific languages are detected so we can use uninitialized values.  This
bug has been present since the ivars were added in r144042.
<rdar://problem/31105864> 

llvm-svn: 298333
2017-03-21 02:59:15 +00:00
Jim Ingham 9a4bce70fa FindTypes should find "struct TypeName" as well as "TypeName".
This fixes a bug introduced by r291559.  The Module's FindType was 
passing the original name not the basename in the case where it didn't
find any separators.  I also added a testcase for this.

<rdar://problem/31159173>

llvm-svn: 298331
2017-03-21 02:13:50 +00:00
Zachary Turner 5821a3bf36 [Support] Fill the file_status struct with link count.
Differential Revision: https://reviews.llvm.org/D31110

llvm-svn: 298326
2017-03-20 23:55:20 +00:00
Zachary Turner 076a259938 Delete LLDB's MD5 code. Use LLVM instead.
Differential Revision: https://reviews.llvm.org/D31108

llvm-svn: 298325
2017-03-20 23:54:54 +00:00
Zachary Turner 7e3050ca1a [analyze-project-deps.py] Add the ability to list all cycles.
This analyzes the dependency graph and computes all minimal
cycles.  Equivalent cycles that differ only by rotation are
excluded, as are cycles that are "super-cycles" of other
smaller cycles.  For example, if we discover the cycle
A -> C -> A, and then later A -> B -> C -> D -> A, this latter
cycle is not considered.  Thus, it is possible that after
eliminating some cycles, new ones will appear.  However,
this is the only way to make the algorithm terminate in
a reasonable amount of time.

llvm-svn: 298324
2017-03-20 23:54:26 +00:00
Zachary Turner 82a0c97b32 Add a function to MD5 a file's contents.
In doing so, clean up the MD5 interface a little.  Most
existing users only care about the lower 8 bytes of an MD5,
but for some users that care about the upper and lower,
there wasn't a good interface.  Furthermore, consumers
of the MD5 checksum were required to handle endianness
details on their own, so it seems reasonable to abstract
this into a nicer interface that just gives you the right
value.

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

llvm-svn: 298322
2017-03-20 23:33:18 +00:00
Jim Ingham 1aa0ed4e0d Get ObjectFileMachO to handle @executable_path
Only do this when we are debugging an executable, since we
don't have a good way to trace from an ObjectFile back to its
containing executable.  Detecting pre-run libs before running
is "best effort" in lldb, but this one is pretty easy.

llvm-svn: 298290
2017-03-20 19:21:31 +00:00
Jim Ingham 2dc4a3e91b Fix a problem with line tables & .o files that start with code with no line table entries.
If you have code before the first line table entry when debugging with .o files on macOS, the 
LineTable entry search code was assigning all that code to the first line table entry. Don't do that.

<rdar://problem/31095765>

llvm-svn: 298289
2017-03-20 19:19:03 +00:00
Pavel Labath 6b42b3b7a3 Fix remote test suite directory creation
r298203 make SBPlatform::MakeDirectory less recursive, which breaks the
test suite creation of test directory hierarchy creation on the remote
target. Since the function was never fully recursive, and the name does
not imply recursiveness, I fix the problem by modifying the test runner
to do the recursion manually.

I also make the runner complain more loudly when it fails to create the
directory -- previously it just printed the error to stdout and caused
most of the tests to hang, which is not very helpful in diagnosing the
problem.

llvm-svn: 298261
2017-03-20 16:07:17 +00:00
Zachary Turner 6c8255e831 Fix syntax error when building with editline support.
llvm-svn: 298206
2017-03-19 06:00:31 +00:00
Zachary Turner 6934e0aaa7 Remove FileSystem::Get/SetFilePermissions
Differential Revision: https://reviews.llvm.org/D31089

llvm-svn: 298205
2017-03-19 05:49:43 +00:00
Zachary Turner d3d95fd66a Remove FileSystem::MakeDirectory.
Have callers use llvm::sys::fs::create_directory() instead.

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

llvm-svn: 298203
2017-03-19 05:48:47 +00:00
Zachary Turner c8c9f97258 Fix unit test compilation failure.
llvm-svn: 298202
2017-03-19 05:48:01 +00:00
Tamas Berghammer e4e17b8ce4 Remove some dead code from DumpValueObjectOptions::PointerDepth
llvm-svn: 298189
2017-03-18 17:33:00 +00:00
Tim Hammerquist f73c6c7e84 allow for specification of compiler/lldb executables basename
llvm-svn: 298123
2017-03-17 21:00:35 +00:00
Tim Hammerquist 848582181e executables should be validated before spawning subprocesses
dotest.py script doesn't validate executables passed on the command line
before spawning dozens of subprocesses, all of which fail silently,
leaving an empty results file.

We should validate the lldb and compiler executables on
configuration, aborting when given invalid paths, to prevent numerous,
cryptic, and spurious failures.

<rdar://problem/31117272>

llvm-svn: 298111
2017-03-17 18:10:58 +00:00
Zachary Turner f98dec1c53 CMake requires normalized paths when appending.
Patch by Hugh Bellamy
Differential Revision: https://reviews.llvm.org/D30927

llvm-svn: 298100
2017-03-17 16:33:37 +00:00
Zachary Turner e28558f0b0 Fix some signed/unsigned comparison warnings.
Patch by Hugh Bellamy
Differential Revision: https://reviews.llvm.org/D30926

llvm-svn: 298099
2017-03-17 16:32:43 +00:00
Pavel Labath 5b116232ef Fix FreeBSD build broken by r298066
llvm-svn: 298069
2017-03-17 11:33:57 +00:00
Pavel Labath b7f0f45ffe Move GetAuxvData from Host to relevant process plugins
Summary:
GetAuxvData was causing dependencies from host to target and linux
process modules. It also does not fit netbsd use case, as there we can
only read the auxiliary vector with ptrace, which is better done in the
process plugin, with the other ptrace calls.

I resolve these issues by moving the freebsd and linux versions into the
relevant process plugins. In case of linux, this required adding an
interface in NativeProcessProtocol. The empty definitions on other
platforms can simply be removed.

To get the code compiling I had to add ProcessGdbRemote -> ProcessLinux
dependency, which was not caught before because we depended on it
transitively.

Reviewers: zturner, emaste

Subscribers: srhines, mgorny, lldb-commits

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

llvm-svn: 298066
2017-03-17 11:08:40 +00:00
Pavel Labath 1495663bc4 One more attempt to fix FreeBSD
It seems sysctl.h is not self-contained, as I get missing symbols in the
header itself now. I am going to include all files that the file I moved
this from included, and hope that is enough.

llvm-svn: 298063
2017-03-17 10:30:42 +00:00
Pavel Labath 872305e95c Speculative build fix for FreeBSD
broken by r298058.

llvm-svn: 298061
2017-03-17 10:09:56 +00:00
Pavel Labath 225b79524d Remove HostThreadLinux/Free/NetBSD
Summary:
These classes existed only because of the GetName() static function,
which can be moved to a more natural place anyway. I move the linux
version to NativeProcessLinux (and get rid of ProcFileReader), the
freebsd version to ProcessFreeBSD (and fix a bug where it was using the
current process ID, instead of the inferior pid), and remove the NetBSD
version (which was probably incorrect anyway, as it assumes the current
process instead of the inferior.

I also add an llgs test to that verifies thread names are read
correctly.

Reviewers: zturner, krytarowski, emaste

Subscribers: lldb-commits, mgorny

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

llvm-svn: 298058
2017-03-17 09:51:23 +00:00
Reid Kleckner 20670ba52c Update for LLVM API removal of Function::getArgumentList()
llvm-svn: 298011
2017-03-16 23:13:49 +00:00
Zachary Turner 5c5091fcb7 [Support] Support both Windows and Posix paths on both platforms.
Previously which path syntax we supported dependend on what
platform we were compiling LLVM on.  While this is normally
desirable, there are situations where we need to be able to
handle a path that we know was generated on a remote host.
Remote debugging, for example, or parsing debug info.

99% of the code in LLVM for handling paths was platform
agnostic and literally just a few branches were gated behind
pre-processor checks, so this changes those sites to use
runtime checks instead, and adds a flag to every path
API that allows one to override the host native syntax.

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

llvm-svn: 298004
2017-03-16 22:28:04 +00:00
Chris Bieneman 1936585789 [debugserver] NFC. One more small cleanup to DNBArchImplX86_64::SetFPUState
This is another similar cleanup to other changes I've been making to simplify the AVX code in debugserver.

llvm-svn: 297880
2017-03-15 19:52:57 +00:00
Pavel Labath 7e437f8f39 Remove some ProcFileReader occurences
Summary:
ProcFileReader is the cause of the dependency from Host to ProcessLinux
module. Since it's interface is also obsolete (ReadIntoDataBuffer is
trivially replaceable by llvm::MemoryBuffer functions and
ProcessLineByLine is trivially implementable with StringRefs), instead
of moving it around I'm planning to obliterate it. This is the first
step, where I remove a couple of occurences in linux/Host.cpp, and
modernize some code around that.

I have introduced linux/Support.h, which holds two utility functions
now, whose resposibility is to construct the appropriate proc file names
-- the only useful feature of ProcFileReader.

I add a couple of tests for these functions, and for
Host::GetProcessInfo. It's worth noting that these are the first
host-specific unit tests in lldb.

Reviewers: zturner, eugene

Subscribers: srhines, lldb-commits, mgorny

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

llvm-svn: 297843
2017-03-15 15:08:49 +00:00
Pavel Labath 2aaab29574 Fix TestMoveNearest for remote targets
Launching a process with shared libraries on remote targets requires a
special dance, which I forgot to do in r297830.

llvm-svn: 297834
2017-03-15 13:32:17 +00:00
Pavel Labath 32a8b7c3a7 Fix TestMoveNearest breakage on darwin
It seems that on darwin we are not able to resolve breakpoints in the
test shared library until the process has started. That seems
unfortunate, but it is not the purpose of this test, so work around that
by starting the process before doing the rest of our checks.

llvm-svn: 297830
2017-03-15 12:32:18 +00:00
Pavel Labath c179662807 Fix windows&darwin builds broken by r297812
llvm-svn: 297819
2017-03-15 10:02:20 +00:00
Pavel Labath 8793554185 Delete empty file ProcessLauncherLinux.h
llvm-svn: 297818
2017-03-15 10:02:16 +00:00
Pavel Labath bf37a037d0 BreakpointResolverFileLine: Restrict move-to-nearest-code from moving across function boundaries
Summary:
This fixes the case where a user tries to set a breakpoint on a source
line outside of any function (e.g. because that code is #ifdefed out, or
the compiler did not emit code for the function, etc.) and we would
silently move the breakpoint to the next function.

Now we check whether the line range of the resolved symbol context
function matches the original line number. We reject any breakpoint
locations that appear to move the breakpoint into a new function. This
filtering only happens if we have full debug info available (e.g. in
case of -gline-tables-only compilation, we still set the breakpoint on
the nearest source line).

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 297817
2017-03-15 09:53:10 +00:00
Pavel Labath 775588c0c3 Remove lldb streams from the Log class completely
Summary:
previously we switched to llvm streams for log output, this completes
the switch for the error streams.

I also clean up the includes and remove the unused argument from
DisableAllLogChannels().

This required adding a bit of boiler plate to convert the output in the
command interpreter, but that should go away when we switch command
results to use llvm streams as well.

Reviewers: zturner, eugene

Subscribers: lldb-commits, emaste

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

llvm-svn: 297812
2017-03-15 09:06:58 +00:00
Pavel Labath 6de25ec61a dotest.py: remove the ability to specify different architectures/compilers in a single invocation
Summary:
This has been broken at least since the new test result framework was
added, which was over a year ago. It looks like nobody has missed it
since.

Removing this makes the gmodules handling code saner, as it already did
not know how to handle the multiple-compilers case.

My motivation for this is libc++ data formatters support on android -- I
am trying make a central way of determining whether libc++ tests can be
run, and without this, I would have to resort to similar hacks as the
gmodules code.

Reviewers: jingham, zturner

Subscribers: danalbert, tfiala, lldb-commits

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

llvm-svn: 297811
2017-03-15 08:51:59 +00:00
Chris Bieneman 8baba08b64 [debugserver] NFC. Cleanup Get/Set Register Value/Context
This patch modifies the Get/Set Register Value/Context functions for Intel to not duplicate code for reading non-AVX registers. This is similar to other transformations I've been making to the AVX register handling code.

llvm-svn: 297787
2017-03-14 22:24:36 +00:00
Chris Bieneman 265ca535ab [CMake] Override debugserver to use the build tree on Darwin
This patch adds support to the test suite for overriding the path to debugserver, and uses the override to point to the build tree's debugserver on Darwin.

llvm-svn: 297776
2017-03-14 20:04:46 +00:00
Chris Bieneman 5bd77e02f7 [debugserver] Fixing a small logic error from r297685
I had mixed up the logic during patch review. This resolves the test failure reading YMM registers on Darwin.

llvm-svn: 297774
2017-03-14 20:01:24 +00:00
Pavel Labath bb114f84e7 Fix flakyness in TestCompletion
One of the file name templates was occasionally generating the name
"fooa***", which conflicted with the one of the tests expectation that
there is only one item beginning with "fooa".

There doesn't seem to be a good reason for using random file templates
here, so just switch to a fixed set of files to increase
reproducibility.

llvm-svn: 297743
2017-03-14 14:58:31 +00:00
Jason Molenda b9d9ac49eb update.
llvm-svn: 297701
2017-03-14 03:28:27 +00:00
Chris Bieneman c934e928cd [debugserver] NFC. Missed one bit of cleanup in r297688
I did this cleanup in the x86_64, but missed it in the i386 code. This just simplifies the calls to thread_get_state.

llvm-svn: 297691
2017-03-13 23:46:50 +00:00
Chris Bieneman b3c780875d [debugserver] NFC. Cleanup DNBArchImpl*::GetFPUState()
This patch consolidates the DEBUG_FPU_REGS code for i386 and x86_64 to take advantage of the fact that the non-AVX members of the avx register state structure overlap with the standard fpu register state structure.

This reduces the amount of code required to set debug values into the register state structures because the register state structures are stored in a union.

llvm-svn: 297688
2017-03-13 23:27:58 +00:00
Chris Bieneman 1899e8d9e8 [debugserver] This is a small cleanup patch to AVX support detection
Summary:
The first Sandybridge iMacs with AVX support shipped in Spring 2011 with Snow Leopard as their OS. Unfortunately due to a kernel bug debugging AVX code was not really possible until 10.7.4.

The old code here checked the kernel build number to determine when to support AVX, but that code was incorrect. It verified that the kernel build number was greater than xnu-2020, which is the build of the kernel that had the fix for 10.8. The fix was also back ported to 10.7.4. Which means all publicly available OS builds 10.7.4 and later have working AVX support.

This new patch verifies that the host OS is greater than or equal to 10.7.4 by checking that the build number is greater than or equal to 11Exx.

The patch also removes the HasAVX assembly blob in favor of querying the kernel via sysctl for the hardware features.

Using sysctl is slower, however since the code is executed once and the result cached it is a better approach because it is possible for the kernel to disable AVX support on hardware that supports it, so listening to the kernel is a better approach for the debugger to take.

Reviewers: jasonmolenda, spyffe

Subscribers: lldb-commits, mgorny

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

llvm-svn: 297685
2017-03-13 23:19:04 +00:00
Zachary Turner 4eb8449d6c Fix up some enumerate() callsites in LLDB.
llvm-svn: 297640
2017-03-13 17:12:12 +00:00
Zachary Turner db6310c632 Fix another occurrence of needing to use member accessors.
llvm-svn: 297637
2017-03-13 16:39:00 +00:00
Jonathan Roelofs 083b727da9 Delete dead code. NFC
Also has the side-effect of fixing the build on systems with glibc < 2.12

https://reviews.llvm.org/D30844

llvm-svn: 297626
2017-03-13 15:25:01 +00:00
Pavel Labath 7163ecb429 Android.rules: Add libc++ support
Summary:
This adds support for building libc++ tests when targetting android. The
tests are still not passing due to several other problems, but this way
we can at least build them.

Reviewers: eugene, EricWF, danalbert

Subscribers: srhines, lldb-commits

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

llvm-svn: 297616
2017-03-13 12:07:48 +00:00
Pavel Labath 6a3b059fb7 Fix windows build broken by r297612
I have got my boolean logic incorrect. Sorry about the spam.

llvm-svn: 297615
2017-03-13 11:23:59 +00:00
Pavel Labath 5b35d1980c Fix android build
getpwent is not available on android until API level 21, and even then
it is only available when doing a non-static link. Since android's
concept of users is very different from linux, it's doubtful the home
directory resolution would be useful, so I approximate this state by
just not using getpwent on android.

We've had another getpwent occurance in FileSpec for a while -- it
wasn't causing problems because it was stripped out by the linker, but I
disable that also, for consistency's sake.

llvm-svn: 297612
2017-03-13 10:59:23 +00:00
Pavel Labath 9bd69ad9b8 Fix Linux build for the FileSpec changes
Propagate changes that were made during review, and fix a couple of
warnings while I'm in there.

llvm-svn: 297609
2017-03-13 09:46:15 +00:00
Zachary Turner 1f8753479e Use LLVM for file / directory enumeration.
FileSpec::EnumerateDirectory has a bunch of platform-specific
gunk in it for posix and non-posix platforms. We can get rid
of all this by using LLVM's easy-to-use directory iterators.

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

llvm-svn: 297598
2017-03-13 02:44:39 +00:00
Zachary Turner 2cc5a18dc2 Resubmit "Make file / directory completion work properly on Windows."
This fixes the compilation failures with the original patch.

llvm-svn: 297597
2017-03-13 00:41:01 +00:00
Zachary Turner 0734e6a525 Revert "Make file / directory completion work properly on Windows."
This reverts commit a6a29374662716710f80c8ece96629751697841e.

It has a few compilation failures that I don't have time to fix
at the moment.

llvm-svn: 297589
2017-03-12 20:01:37 +00:00
Zachary Turner d5bd3a1e6a Make file / directory completion work properly on Windows.
There were a couple of problems with this function on Windows. Different
separators and differences in how tilde expressions are resolved for
starters, but in addition there was no clear indication of what the
function's inputs or outputs were supposed to be, and there were no tests
to demonstrate its use.

To more easily paper over the differences between Windows paths,
non-Windows paths, and tilde expressions, I've ported this function to use
LLVM-based directory iteration (in fact, I would like to eliminate all of
LLDB's directory iteration code entirely since LLVM's is cleaner / more
efficient (i.e. it invokes fewer stat calls)). and llvm's portable path
manipulation library.

Since file and directory completion assumes you are referring to files and
directories on your local machine, it's safe to assume the path syntax
properties of the host in doing so, so LLVM's APIs are perfect for this.

I've also added a fairly robust set of unit tests. Since you can't really
predict what users will be on your machine, or what their home directories
will be, I added an interface called TildeExpressionResolver, and in the
unit test I've mocked up a fake implementation that acts like a unix
password database. This allows us to configure some fake users and home
directories in the test, so we can exercise all of those hard-to-test
codepaths that normally otherwise depend on the host.

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

llvm-svn: 297585
2017-03-12 18:18:50 +00:00
Tim Hammerquist e4885f8999 fix xunit attribute parsing
llvm-svn: 297538
2017-03-11 00:58:41 +00:00
Jason Molenda 19cf689a9e Simplify & correct the patch I wrote in r297441, after thinking
about this more I realized I could make the change isolated to
whether we decide an empty accelerator table is valid or not.
<rdar://problem/30867462>

llvm-svn: 297496
2017-03-10 19:31:54 +00:00
Jason Molenda bc3a47f31d Add a distinction in an apple accelerator table between IsValid and
HasContent.  If we have a valid accelerator table which has no
content, we want to depend on that (empty) table as the authoritative
source instead of reading through all the debug info for lookups.
<rdar://problem/30867462> 

llvm-svn: 297441
2017-03-10 06:38:19 +00:00
Jason Molenda 73b76ce563 Mark this as skipped for now. There is a race condition with
SectionLoadList exposed by this test.  Greg tried to chase it down
& got pretty far but the isn't correct so we'll disable this test
for now until I can figure that out.

<rdar://problem/30899227> 

llvm-svn: 297440
2017-03-10 05:33:27 +00:00
Zachary Turner 30fdb05ddb Make the LLDB test suite work with MSVC 2017 on Windows.
llvm-svn: 297405
2017-03-09 19:54:23 +00:00
Pavel Labath 49b112fcce cmake: Increase LINK_INTERFACE_MULTIPLICITY of lldbCore
This is necessary to get debug builds of unit tests working on linux.

I think we are at a point where removing dependencies does not prevent
us from depending on the whole world yet. What it does do though, is
make the dependency chains longer as the dependency graph gets sparser,
which means we need to repeat the libraries more times to get the thing
to link.

llvm-svn: 297369
2017-03-09 10:16:15 +00:00
Pavel Labath f5aaa999b9 Fix remaining threading issues in Log.h
Summary:
This fixes two threading issues in the logging code. The access to the
mask and options flags had data races when we were trying to
enable/disable logging while another thread was writing to the log.
Since we can log from almost any context, and we want it to be fast, so
I avoided locking primitives and used atomic variables instead. I have
also removed the (unused) setters for the mask and flags to make sure
that the only way to set them is through the enable/disable channel
functions.

I also add tests, which when run under tsan, verify that the use cases
like "doing an LLDB_LOGV while another thread disables logging" are
data-race-free.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

llvm-svn: 297368
2017-03-09 10:16:07 +00:00
Zachary Turner d82067f83a Remove LLDB's recursive directory deletion function.
LLVM now has such a function, so we use that instead.

llvm-svn: 297360
2017-03-09 05:12:36 +00:00
Zachary Turner 7d86ee5ab0 Resubmit FileSystem changes.
This was originall reverted due to some test failures in
ModuleCache and TestCompDirSymlink.  These issues have all
been resolved and the code now passes all tests.

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

llvm-svn: 297300
2017-03-08 17:56:08 +00:00
Pavel Labath 9ef5778038 Android.rules: fix computation of gcc toolchain directory on arm
The toolchain directory for arm android targets was computed
incorrectly. The architecture part should be arm, and the environment
part androideabi. This fixes that.

llvm-svn: 297279
2017-03-08 14:57:15 +00:00
Jason Molenda cfbdbe4a76 Back to xfailing this. For some reason on our buildbots
it fails, but it works on the local workstations.  I'll
need to figure out what the difference is between these.
<rdar://problem/30915340> 

llvm-svn: 297259
2017-03-08 06:45:34 +00:00
Jason Molenda 07d4e7632e TestQueues should be passing again, remove the expected fail.
llvm-svn: 297258
2017-03-08 05:51:00 +00:00
Eugene Zemtsov 7993cc5eed Make LLDB skip server-client roundtrip for signals that don't require any actions
If QPassSignals packaet is supported by lldb-server, lldb-client will
utilize it and ask the server to ignore signals that don't require stops
or notifications.
Such signals will be immediately re-injected into inferior to continue
normal execution.

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

llvm-svn: 297231
2017-03-07 21:34:40 +00:00
Tim Hammerquist a64fafc7b6 fix format specifier warnings
llvm-svn: 297228
2017-03-07 21:26:04 +00:00
Pavel Labath 8faf9b750a Android.rules: add support for clang compiler
Summary:
building executables with the NDK clang requires -target and
-gcc-toolchain arguments.

Reviewers: eugene, danalbert

Subscribers: srhines, lldb-commits

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

llvm-svn: 297145
2017-03-07 14:57:37 +00:00
Pavel Labath 30e6cbfcfc Revert "Use LLVM for all stat-related functionality."
this reverts r297116 because it breaks the unittests and
TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but
the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat
functionality is not a drop-in replacement for lldb's. The former is
based on stat(2) (which does symlink resolution), while the latter is
based on lstat(2) (which does not).

This also reverts subsequent build fixes (r297128, r297120, 297117) and
r297119 (Remove FileSpec dependency on FileSystem) which builds on top
of this.

llvm-svn: 297139
2017-03-07 13:19:15 +00:00
Sean Callanan 8f0a62a999 Fixed a missing brace.
llvm-svn: 297128
2017-03-07 08:31:41 +00:00
Zachary Turner b3c6541c2c Fix FreeBSD build.
llvm-svn: 297120
2017-03-07 04:58:53 +00:00
Zachary Turner 3a6b091c23 Remove FileSpec dependency on FileSystem.
llvm-svn: 297119
2017-03-07 04:58:06 +00:00
Zachary Turner e7a172a140 Fix linux build.
llvm-svn: 297117
2017-03-07 03:58:59 +00:00
Zachary Turner 990e3cd8e2 Use LLVM for all stat-related functionality.
This deletes LLDB's FileType enumeration and replaces all
users, and all calls to functions that check whether a file
exists etc with corresponding calls to LLVM.

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

llvm-svn: 297116
2017-03-07 03:43:17 +00:00
Jason Molenda b677688546 cleanup.
llvm-svn: 297104
2017-03-07 00:00:35 +00:00
Zachary Turner 4af068ea55 Add missing include in FileSpec.
llvm-svn: 297102
2017-03-06 23:52:57 +00:00
Zachary Turner 8c6b546dfd Remove dependency from FileSpec to ArchSpec.
All it really needs is the llvm::Triple, so make FileSpec take
the Triple directly instead of the ArchSpec.

llvm-svn: 297096
2017-03-06 23:42:44 +00:00
Zachary Turner 7f6a7a3752 Remove FileSpec::ReadFileContents.
This functionality is subsumed by DataBufferLLVM, which is
also more efficient since it will try to mmap.  However, we
don't yet support mmaping writable private sections, and in
some cases we were using ReadFileContents and then modifying
the buffer.  To address that I've added a flag to the
DataBufferLLVM methods that allow you to map privately, which
disables the mmaping path entirely.  Eventually we should teach
DataBufferLLVM to use mmap with writable private, but that is
orthogonal to this effort.

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

llvm-svn: 297095
2017-03-06 23:42:14 +00:00
Pavel Labath a96eac62d6 Update log_options unit test
it was accessing the details of the Log class directly. Let it go
through the channel class instead.

This also discovered a bug when we were setting but not clearing the log
options when enabling a channel.

llvm-svn: 297053
2017-03-06 19:10:19 +00:00
Zachary Turner fb1a0a0d2f Move many other files from Core -> Utility.
llvm-svn: 297043
2017-03-06 18:34:25 +00:00
Zachary Turner 1d752974c1 A few improvements to deps analysis scripts.
1) Looks in Plugins and clang
2) Adds a mode to display the deps sorted by the number of times
   the deps occurs in a particular project

llvm-svn: 297036
2017-03-06 17:41:00 +00:00
Zachary Turner e030d10b62 Fix line endings of deps analysis script.
llvm-svn: 297035
2017-03-06 17:40:36 +00:00
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