Commit Graph

16248 Commits

Author SHA1 Message Date
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
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