Commit Graph

14154 Commits

Author SHA1 Message Date
Stephane Sezer f81049184a Fix deadlock due to thread list locking in 'bt all' with obj-c
Summary:
The gdb-remote async thread cannot modify thread state while the main thread
holds a lock on the state. Don't use locking thread iteration for bt all.

Specifically, the deadlock manifests when lldb attempts to JIT code to
symbolicate objective c while backtracing. As part of this code path,
SetPrivateState() is called on an async thread. This async thread will
block waiting for the thread_list lock held by the main thread in
CommandObjectIterateOverThreads. The main thread will also block on the
async thread during DoResume (although with a timeout), leading to a
deadlock. Due to the timeout, the deadlock is not immediately apparent,
but the inferior will be left in an invalid state after the bt all completes,
and objective-c symbols will not be successfully resolved in the backtrace.

Reviewers: andrew.w.kaylor, jingham, clayborg

Subscribers: sas, lldb-commits

Differential Revision: http://reviews.llvm.org/D18075

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 263735
2016-03-17 18:52:41 +00:00
Pavel Labath 4d4e5512b5 Fix null pointer "dereference" in DomainSocket
offsetof is the official way to get the offset of a field in a structure.

llvm-svn: 263637
2016-03-16 14:03:20 +00:00
Pavel Labath d3fe3aa57f Switch from unittest2.expectedFailure to our own decorator on TestSTL
the main reason is that our decorator contains extra fluff to "expect" crashes (which seem to
happen occasionaly on the android buildbot).

llvm-svn: 263633
2016-03-16 10:39:33 +00:00
Pavel Labath beb4676118 Mark an LLGS test as flaky
cause: Async output arrival over pty
llvm-svn: 263631
2016-03-16 09:58:34 +00:00
Pavel Labath 78fc483980 [test] Persist packets between expect_gdbremote_sequence invocations
Summary:
Some tests (Hc_then_Csignal_signals_correct_thread, at least) were sending a "continue" packet in
one expect_gdbremote_sequence invocation, and "expecting" the stop-reply in another call. This
posed a problem, because the were packets were not persisted between the two invocations, and if
the stub was exceptionally fast to respond, the packet would be received in the first invocation
(where it would be ignored) and then the second invocation would fail because it could not find
the packet.

Since doing matching in two invocations seems like a reasonable use of the packet pump, instead
of fixing the test, I make sure the packet_pump supports this usage by making the list of
captured packets persistent.

Reviewers: tfiala

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D18140

llvm-svn: 263629
2016-03-16 09:44:49 +00:00
Pavel Labath 39aab4d606 Fix thread/process ID reading from linux core files
Summary:
This also adds a basic smoke test for linux core file reading. I'm checking in the core files as
well, so that the tests can run on all platforms. With some tricks I was able to produce
reasonably-sized core files (~40K).

This fixes the first part of pr26322.

Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D18176

llvm-svn: 263628
2016-03-16 09:19:57 +00:00
Pavel Labath a7760cb550 Move OperatingSystem plugins to SystemInitializerFull
Summary: These are not needed in lldb-server. Removing them shrinks the server size by about 1.5%.

Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D18188

llvm-svn: 263625
2016-03-16 08:48:56 +00:00
Enrico Granata ab2b0cb992 On some platforms, the compiler is allowed to assume that BOOL == bool. On others, BOOL == signed char.
This can cause differences in which bit patterns end up meaning YES or NO. In general, however, 0 == NO and 1 == YES.

To keep it simple, LLDB will now show "YES" and "NO" only for 1 and 0 respectively, and format other values as the plain numeric value instead.

Fixes rdar://24809994

llvm-svn: 263604
2016-03-15 23:38:04 +00:00
Enrico Granata 35f94bb72c Make it so that the data formatter for NSError can see through a variable of type NSError**. Fixes rdar://25060684
llvm-svn: 263603
2016-03-15 23:20:10 +00:00
Greg Clayton 2591fe1985 Only try to load the OS plug-in after a shared library load if we don't already have one.
<rdar://problem/24162686>

llvm-svn: 263602
2016-03-15 22:44:07 +00:00
Greg Clayton 0a5f805410 Fix ClangASTContext::GetFunctionArgumentAtIndex() to not water down the type to the canonical type before handing the type out for the function type.
llvm-svn: 263601
2016-03-15 22:43:26 +00:00
Greg Clayton 00df42459e Don't crash if the TypeSP is empty.
llvm-svn: 263593
2016-03-15 21:58:28 +00:00
Enrico Granata 592afe73ad Improve the 'type lookup' command such that it guesses to use the current's frame language as the one to start searching from.
llvm-svn: 263592
2016-03-15 21:50:51 +00:00
Jim Ingham 9d9b46bf74 Remove unnecessary <limits> includes.
llvm-svn: 263588
2016-03-15 21:11:02 +00:00
Ewan Crawford fae4363265 Add regression test for expressions calling functions taking anonymous struct typedef arguments
This CL adds a regression test for the bug listed at https://llvm.org/bugs/show_bug.cgi?id=26790
Functionality was implemented in commit r263544

Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D17777

llvm-svn: 263547
2016-03-15 13:02:11 +00:00
Ewan Crawford 27fc7a7b47 Fix expression evaluation for resolving anonymous aggregrate types with a typedefed name
This fixes a recently reported a bug(https://llvm.org/bugs/show_bug.cgi?id=26790) relating to the clang expression evaluator no longer being able to resolve calls to
functions with arguments to typedefed anonymous structs, unions, or enums after a cleanup to the expression parsing code in r260768

This fixes the issue by attaching the tagged name to the original clang::TagDecl object when generating the typedef in lldb::ClangAstContext::CreateTypeDef.

This also fixes the issue for anonymous typedefs for non-struct types (unions and enums) where we have a tag name.


Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D18099

llvm-svn: 263544
2016-03-15 09:50:16 +00:00
Jason Molenda e2a35c728c Bump the lldb version # in the xcode project files from
350.99.0 to 360.99.0.

llvm-svn: 263529
2016-03-15 04:36:11 +00:00
Enrico Granata ee88b61500 Workaround the fact that "b" is now a separate command object from "_regexp-break", and thus "help b" doesn't show the possible syntaxes
It would be nice to have a longer-term plan for how to handle help for regular expression commands, since their syntax is highly irregular. I can see a few options (*), but for now this is a reasonable stop-gag measure for the most blatant regression.

(*) the simplest is, of course, to detect a regex command and inherit the syntax for any aliases thereof; it would be nice if this also didn't show the underlying regex command name when the alias is used

llvm-svn: 263523
2016-03-15 01:57:10 +00:00
Enrico Granata cdbac99551 Add some test coverage for the changes in alias help
llvm-svn: 263520
2016-03-15 01:43:00 +00:00
Enrico Granata dbe8d4f339 Improve the way we decide whether an alias is a dashdash alias
llvm-svn: 263519
2016-03-15 01:42:34 +00:00
Enrico Granata 4ebb8a4761 This was printing arguments twice in dash-dash aliases; don't do that
llvm-svn: 263517
2016-03-15 01:17:32 +00:00
Enrico Granata bef55ac8f5 Lots of progress on the CommandAlias refactoring
This cleans things up such CommandAlias essentially can work as its own object; the aliases still live in a separate map, but are now just full-fledged CommandObjectSPs
This patch also cleans up help generation for aliases, allows aliases to vend their own help, and adds a tweak such that "dash-dash aliases", such as po, don't show the list of options for their underlying command, since those can't be provided anyway

I plan to fix up a few more things here, and then add a test case and proclaim victory

llvm-svn: 263499
2016-03-14 22:17:04 +00:00
Ed Maste 7d1eb1de74 Shuffle an #undef to avoid a warning on FreeBSD
On FreeBSD _LIBCPP_EXTERN_TEMPLATE is being defined from something
included by lldb/lldb-private.h. Undefine it after the #include to avoid
the redefinition warning.

Differential Revision:     http://reviews.llvm.org/D17402

llvm-svn: 263486
2016-03-14 20:39:08 +00:00
Enrico Granata 3e271af415 More of the alias refactoring work! CommandAlias is now a CommandObject
llvm-svn: 263468
2016-03-14 19:00:21 +00:00
Ed Maste 5af4d20372 Enable expectedFailure for all Clang versions in TestRegisterVariables
In r262970 this was changed from xfail Clang < 3.5 to > 3.5, but it
still fails on FreeBSD 10's system Clang 3.4.1 so assume it fails on
all versions.

llvm.org/pr26937

llvm-svn: 263467
2016-03-14 18:59:44 +00:00
Pavel Labath 56673749d2 [test] Correctly retry connections on android targets
Summary:
Normally, when the remote stub is not ready, we will get ECONNREFUSED during the connect()
attempt. However, due to the way how ADB forwarding works, on android targets the connect() will
always be successful, but the connection will be immediately dropped if ADB could not connect on
the remote side. This commit tries to detect this situation, and report it as "connection
refused" so that the upper test layers attempt the connection again.

Reviewers: tfiala, tberghammer

Subscribers: tberghammer, danalbert, srhines, lldb-commits

Differential Revision: http://reviews.llvm.org/D18146

llvm-svn: 263439
2016-03-14 15:33:25 +00:00
Ed Maste 81955f8048 Allow any build-id length between 4 and 20 bytes inclusive
Build-id support is being added to lld and by default it may produce a
64-bit build-id.

Prior to this change lldb would reject such a build-id. However, it then
falls back to a 4-byte crc32, which is a poorer quality identifier.

Differential Revision:	http://reviews.llvm.org/D18096

llvm-svn: 263432
2016-03-14 14:06:00 +00:00
Pavel Labath 392408cfc8 Extend XFlaky in TestProcessIO to linux as well
The test sometimes fails on local linux as well. The cause is the same.

llvm-svn: 263421
2016-03-14 11:19:39 +00:00
Jim Ingham 190636bcc1 Let's not convert from UINT32_MAX to the std::numeric_limits version.
llvm-svn: 263333
2016-03-12 03:33:36 +00:00
Jim Ingham 8d94ba0fb1 This change introduces a "ExpressionExecutionThread" to the ThreadList.
Turns out that most of the code that runs expressions (e.g. the ObjC runtime grubber) on
behalf of the expression parser was using the currently selected thread.  But sometimes,
e.g. when we are evaluating breakpoint conditions/commands, we don't select the thread
we're running on, we instead set the context for the interpreter, and explicitly pass
that to other callers.  That wasn't getting communicated to these utility expressions, so
they would run on some other thread instead, and that could cause a variety of subtle and
hard to reproduce problems.  

I also went through the commands and cleaned up the use of GetSelectedThread.  All those
uses should have been trying the thread in the m_exe_ctx belonging to the command object
first.  It would actually have been pretty hard to get misbehavior in these cases, but for
correctness sake it is good to make this usage consistent.

<rdar://problem/24978569>

llvm-svn: 263326
2016-03-12 02:45:34 +00:00
Eugene Zelenko 0e28a19683 Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 263312
2016-03-12 00:31:13 +00:00
Eugene Zelenko 8918372dd3 Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 263300
2016-03-11 21:55:47 +00:00
Eugene Zelenko c5dac77ad8 Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 263289
2016-03-11 20:20:38 +00:00
Jim Ingham e78ca659d6 Remove the skip if Darwin since I fixed the crash.
llvm-svn: 263283
2016-03-11 19:15:03 +00:00
Jim Ingham c134810cfb Check for a NULL input filehandle before referencing it.
<rdar://problem/25105824>

llvm-svn: 263274
2016-03-11 18:49:38 +00:00
Marianne Mailhot-Sarrasin 7a4eed280a Fixed MemoryCache L1 cache flush
Use the same method to find the cache line as in Read().

Differential Revision: http://reviews.llvm.org/D18050

llvm-svn: 263233
2016-03-11 13:50:10 +00:00
Pavel Labath d81b2ccb4f Fix a bunch of signedness warnings in unittests
llvm-svn: 263209
2016-03-11 09:00:23 +00:00
Pavel Labath cc0e87cdae Fix a couple of cornercases in FileSpec + tests
Summary:
This fixes a couple of corner cases in FileSpec, related to AppendPathComponent and
handling of root directory (/) file spec. I add a bunch of unit tests for the new behavior.

Summary of changes:
FileSpec("/bar").GetCString(): before "//bar", after "/bar".
FileSpec("/").CopyByAppendingPathComponent("bar").GetCString(): before "//bar", after "/bar".
FileSpec("C:", ePathSyntaxWindows).CopyByAppendingPathComponent("bar").GetCString(): before "C:/bar", after "C:\bar".

Reviewers: clayborg, zturner

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D18044

llvm-svn: 263207
2016-03-11 08:44:44 +00:00
Todd Fiala 91b4bd4b12 skip newly segfaulting test on OS X public CI
llvm-svn: 263205
2016-03-11 08:12:36 +00:00
Jim Ingham d815c9ab88 Fix SBDebugger.GetOutputFileHandle() on OS X.
The swig typemaps had some magic for output File *'s on OS X that made:

SBDebugger.GetOutputFileHandle() 

actually work.  That was protected by a "#ifdef __MACOSX__", but the corresponding define
got lost going from the Darwin shell scripts to the python scripts for running
swig, so the code was elided.  I need to pass the define to SWIG, but only when
targetting Darwin.

So I added a target-platform argument to prepare_bindings, and if that 
is Darwin, I pass -D__APPLE__ to swig, and that activates this code again, and
GetOutputFileHandle works again.  Note, I only pass that argument for the Xcode
build.  I'm sure it is possible to do that for cmake, but my cmake-foo is weak.

I should have been able to write a test for this by creating a debugger, setting the 
output file handle to something file, writing to it, getting the output file handle 
and reading it.  But SetOutputFileHandle doesn't seem to work from Python, so I'd 
have to write a pexpect test to test this, which I'd rather not do.

llvm-svn: 263183
2016-03-11 01:57:45 +00:00
Eugene Zelenko a74f37a599 Fix Clang-tidy modernize-use-nullptr warnings in some files in source/Core; other minor fixes.
llvm-svn: 263174
2016-03-10 23:57:12 +00:00
Marianne Mailhot-Sarrasin 82a827de3b Fixed ValueObject::GetExpressionPath() for paths including anonymous struct/union
When the parent of an expression is anonymous, skip adding '.' or '->' before the expression name.

Differential Revision: http://reviews.llvm.org/D18005

llvm-svn: 263166
2016-03-10 22:10:59 +00:00
Greg Clayton a31baf081b Fixed the python interpreter so that it correctly inherits the top IOHandler's files instead of always using stdin/out/err.
Removed lldb_private::File::Duplicate() and the copy constructor and the assignment operator that used to duplicate the file handles and made them private so no one uses them. Previously the lldb_private::File::Duplicate() function duplicated files that used file descriptors, (int) but not file streams (FILE *), so the lldb_private::File::Duplicate() function only worked some of the time. No one else excep thee ScriptInterpreterPython was using these functions, so that aren't needed nor desired. Previously every time you would drop into the python interpreter we would duplicate files, and now we avoid this file churn.

<rdar://problem/24877720>

llvm-svn: 263161
2016-03-10 20:49:32 +00:00
Aidan Dodds 67dc3e1575 [Renderscript] Add stack argument reading code for Mipsel 3
Fix a problem raised with the previous patches being applied in the wrong order.

Committed on behalf of: Dean De Leo <dean@codeplay.com>

llvm-svn: 263134
2016-03-10 17:50:01 +00:00
Aidan Dodds 6dd4b57987 [Renderscript] Add stack argument reading code for Mipsel 2
This commit implements the reading of stack spilled function arguments for little endian MIPS targets.

Committed on behalf of: Dean De Leo <dean@codeplay.com>

llvm-svn: 263131
2016-03-10 17:37:02 +00:00
Aidan Dodds 17e07c0ab4 [Renderscript] Add stack argument reading code for Mipsel
This commit implements the reading of stack spilled function arguments for little endian MIPS targets.

Committed on behalf of: Dean De Leo <dean@codeplay.com>

llvm-svn: 263130
2016-03-10 17:27:41 +00:00
Aidan Dodds 8433fdbedf [Renderscript] Explicitly set the language to evaluate allocations
Currently it is not specified, and since allocations are usually
requested once we hit a renderscript breakpoint, the language will be
inferred being as renderscript by the ExpressionParser.
Actually allocations attempt to invoke functions part of the RS runtime,
written in C/C++, so evaluating the calls in RenderScript could be
misleading.

In particular, in MIPS, the ABI between C/C++ (mips o32) and
renderscript (arm) might introduce subtle bugs when evaluating such
expressions.

This change explicitly sets the language used to evaluate the allocations
as C++.

Committed on behalf of: Dean De Leo <dean@codeplay.com>

llvm-svn: 263129
2016-03-10 17:23:33 +00:00
Adrian McCarthy 396e02a6e3 Eliminate the TestStarted-XXX and TestFinished-XXX files from check-lldb runs.
Nobody seems to know what purpose these files serve, yet they were accumulating by the thousands in the test traces directory.  I'm proposing we delete them.

Creating these files accounted for about 2.5% of the time to run ninja check-lldb on my machine, which isn't a lot, but it's something.

llvm-svn: 263122
2016-03-10 15:41:11 +00:00
Ewan Crawford 7648dd375f Revert "Track expression language from one place in ClangExpressionParser"
r263099 seems to have broken some OSX tests

llvm-svn: 263107
2016-03-10 12:38:55 +00:00
Ewan Crawford 6dc9db5244 Track expression language from one place in ClangExpressionParser
The current expression language is currently tracked in a few places within the ClangExpressionParser constructor. 
This patch adds a private lldb::LanguageType attribute to the ClangExpressionParser class and tracks the expression language from that one place.

Author: Luke Drummond <luke.drummond@codeplay.com>
Differential Revision: http://reviews.llvm.org/D17719

llvm-svn: 263099
2016-03-10 10:31:08 +00:00