Commit Graph

14191 Commits

Author SHA1 Message Date
Jason Molenda aef8452729 Add the same host logging that I added to PlatformRemoteiOS a few
months back to PlatformRemoteAppleTV and PlatformRemoteAppleWatch
to help understand what's happening when lldb can't find binaries
that it should be finding.

llvm-svn: 264380
2016-03-25 02:17:27 +00:00
Jim Ingham a1e541bf9f Use Clang's FixItHints to correct expressions with "trivial" mistakes (e.g. "." for "->".)
This feature is controlled by an expression command option, a target property and the
SBExpressionOptions setting.  FixIt's are only applied to UserExpressions, not UtilityFunctions,
those you have to get right when you make them.

This is just a first stage.  At present the fixits are applied silently.  The next step
is to tell the user about the applied fixit.

<rdar://problem/25351938>

llvm-svn: 264379
2016-03-25 01:57:14 +00:00
Greg Clayton c9a078a4b1 Ignore global constructor warning in clang.
llvm-svn: 264361
2016-03-24 23:50:03 +00:00
Enrico Granata 701338a75f Make it possible for language plugins to provide additional custom help for 'type lookup'
llvm-svn: 264356
2016-03-24 23:06:42 +00:00
Jason Molenda 5109bfd165 Update the INFOPLIST_FILE setting in the xcode project file
so that the lldb command line binary's version #'s are updated
correctly.
<rdar://problem/25346711> 

llvm-svn: 264353
2016-03-24 22:27:52 +00:00
Stephane Sezer c5273d929f Make File option flags consistent for Python API
Summary:
Fixes SBCommandReturnObject::SetImmediateOutputFile() and
SBCommandReturnObject::SetImmediateOutputFile() for files opened
with "a" or "a+" by resolving inconsistencies between File and
our Python parsing of file objects.

Reviewers: granata.enrico, Eugene.Zelenko, jingham, clayborg

Subscribers: lldb-commits, sas

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

Change by Francis Ricci <fjricci@fb.com>

llvm-svn: 264351
2016-03-24 22:22:20 +00:00
Greg Clayton 1cf2aa8257 Get rid of a global constructor and also make this code safe to use after the global destructor chain has been run on the main thread.
llvm-svn: 264348
2016-03-24 21:49:22 +00:00
Greg Clayton 1e05c3bc28 Get rid of two global constructors by making things static variables in the only function that uses these variables.
llvm-svn: 264347
2016-03-24 21:48:10 +00:00
Greg Clayton 8e1232af42 Get rid of a global constructor that was causing a warning on MacOSX and make the Timer safe to use after the main threads global destructor chain is called.
llvm-svn: 264346
2016-03-24 21:46:47 +00:00
Enrico Granata 3cf9ff12c5 Make 'type lookup' print an error message instead of complete radio silence when it can't find a type matching user input
It would be fun to make it provide suggestions (e.g. 'can't find NString, did you mean NSString instead?'), but this worries me a little bit on the account of just how thorough of a type system scan it would have to do

llvm-svn: 264343
2016-03-24 21:32:39 +00:00
Ted Woodward fab31220fe Fix for missing prompt on Windows
Summary: On Windows (and possibly other hosts with LLDB_DISABLE_LIBEDIT defined), the (lldb) prompt won't print after async output, like from a breakpoint hit or a step. This patch forces the prompt to be printed out after async output.

Reviewers: zturner, clayborg

Subscribers: amccarth, lldb-commits

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

llvm-svn: 264332
2016-03-24 20:35:03 +00:00
Siva Chandra 02f593f0b8 [JITLoaderGDB] Read jit entry struct manually.
Summary:
Though r264012 was fancy enough to make reading the jit entry struct
work with templates, the packing and alignment attributes do not work on
Windows. So, this change makes it plain and simple with manual reading
of the jit entry struct.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 264217
2016-03-23 23:27:23 +00:00
Stephane Sezer 8e38c66645 Implement ObjectFilePECOFF::GetEntryPointAddress.
Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

llvm-svn: 264173
2016-03-23 18:00:13 +00:00
Kuba Brecka ed0b2f7dd5 Follow-up for r264162 to fix the CMake build (update LLDBDependencies.cmake).
llvm-svn: 264168
2016-03-23 16:54:23 +00:00
Kuba Brecka 6a83143650 Add ThreadSanitizer debugging support.
This patch adds ThreadSanitizer support into LLDB:
- Adding a new InstrumentationRuntime plugin, ThreadSanitizerRuntime, in the same way ASan is implemented.
- A breakpoint stops in `__tsan_on_report`, then we extract all sorts of information by evaluating an expression. We then populate this into StopReasonExtendedInfo.
- SBThread gets a new API, SBThread::GetStopReasonExtendedBacktraces(), which returns TSan’s backtraces in the form of regular SBThreads. Non-TSan stop reasons return an empty collection.
- Added some test cases.

Reviewed by Greg Clayton.

llvm-svn: 264162
2016-03-23 15:36:22 +00:00
Enrico Granata d033e1cef5 Change 'apropos' such that it doesn't look into the "long help/syntax" strings for commands
This solves issues such as 'apropos foo' returning valid matches just because syntax examples happen to use 'foo' as a placeholder token

Fixes rdar://9043025

llvm-svn: 264123
2016-03-23 01:21:55 +00:00
Sean Callanan cd46960e6b Reverted a change in r264074 that made lldb-mi use lldb_private APIs.
FileSystem::Fopen is a lldb_private API, but lldb-mi uses only the
public API.  Depending on lldb_private APIs makes Xcode builds fail.
I reverted the portion of r264074 that added such a dependency.

llvm-svn: 264113
2016-03-22 22:42:42 +00:00
Enrico Granata bfb75e9bbc Make it so that a command alias can actually remove the help/long help from its parent command by setting itself to an empty help string
llvm-svn: 264108
2016-03-22 22:12:59 +00:00
Siva Chandra c8391975e3 [lldb-mi] Uncomment a line in CMakeLists.txt to make linux build happy.
Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 264104
2016-03-22 21:37:56 +00:00
Enrico Granata 660764a060 Fix a bug caused by my alias refactoring where, if an alias was defined in terms of another alias, trying to run the nested command would actually cause a crash in the command interpreter
llvm-svn: 264096
2016-03-22 21:07:54 +00:00
Sean Callanan 00294b34a3 Backend support for top-level Clang epxressions
This patch adds a new ExecutionPolicy, eExecutionPolicyTopLevel, which
tells the expression parser that the expression should be JITted as top
level code but nothing (except static initializers) should be run.  I
have modified the Clang expression parser to recognize this execution
policy.  On top of the existing patches that support storing IR and
maintaining a map of arbitrary Decls, this is mainly just patching up a
few places in the expression parser.

I intend to submit a patch for review that exposes this functionality
through the "expression" command and through the SB API.  That patch
also includes a testcase for all of this.

<rdar://problem/22864976>

llvm-svn: 264095
2016-03-22 21:05:51 +00:00
Enrico Granata 0569b5bd6b Changes to the Xcode project file to make LLDB build again after llvm/Support/ConvertUTF.h was brought into the driver
llvm-svn: 264087
2016-03-22 20:16:51 +00:00
Zachary Turner 190fadcdb2 Unicode support on Win32.
Win32 API calls that are Unicode aware require wide character
strings, but LLDB uses UTF8 everywhere.  This patch does conversions
wherever necessary when passing strings into and out of Win32 API
calls.

Patch by Cameron
Differential Revision: http://reviews.llvm.org/D17107
Reviewed By: zturner, amccarth

llvm-svn: 264074
2016-03-22 17:58:09 +00:00
Mohit K. Bhakkad 19d806792a [LLDB]{MIPS] Fix TestPlatformProcessConnect.py
Patch by Nitesh Jain

Reviewers: clayborg, labath.
Subscribers: jaydeep, bhushan, mohit.bhakkad, sagar, lldb-commits.
Differential Revision: http://reviews.llvm.org/D18082

llvm-svn: 264030
2016-03-22 08:08:02 +00:00
Siva Chandra f027e130d8 [JITLoaderGDB] Pack the jit entry struct according to the target arch.
Reviewers: clayborg

Subscribers: tberghammer, dsrbecky, lldb-commits

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

llvm-svn: 264012
2016-03-22 00:35:31 +00:00
Sean Callanan bd4dc69308 Collect IRExecutionUnits as part of persistent expression state.
IRExecutionUnits contain code and data that persistent declarations can
depend on.  In order to keep them alive and provide for lookup of these
symbols, we now allow any PersistentExpressionState to keep a list of
execution units.  Then, when doing symbol lookup on behalf of an 
expression, any IRExecutionUnit can consult the persistent expression
states on a particular Target to find the appropriate symbol.

<rdar://problem/22864976>

llvm-svn: 263995
2016-03-21 22:23:38 +00:00
Jim Ingham 6896b35585 Compilation can end up calling functions (e.g. to resolve indirect functions) so I added
a way for compilation to take a "thread to use for compilation".  If it isn't set then the
compilation will use the currently selected thread.  This should help keep function execution
to the one thread intended.

llvm-svn: 263972
2016-03-21 19:21:13 +00:00
Pavel Labath 3f124190e2 Attempt to fix MSVC build (no __attribute__ there)
llvm-svn: 263899
2016-03-20 13:37:55 +00:00
Jim Ingham d23be3d30d Use Enrico's new CommandAlias to give better help to the "sif" command.
llvm-svn: 263865
2016-03-19 00:53:20 +00:00
Sean Callanan b3a36df39e Handle any persistent Decl in the Clang expression parser, not just types.
Persistent decls have traditionally only been types.  However, we want to
be able to persist more things, like functions and global variables.  This
changes some of the nomenclature and the lookup rules to make this possible.

<rdar://problem/22864976>

llvm-svn: 263864
2016-03-19 00:51:43 +00:00
Jim Ingham 072c395fda Fix the project file for the removal of lldb-mi's Platform.cpp.
llvm-svn: 263861
2016-03-19 00:21:21 +00:00
Sean Callanan 579e70c9b0 Add a DiagnosticManager replace error streams in the expression parser.
We want to do a better job presenting errors that occur when evaluating
expressions. Key to this effort is getting away from a model where all
errors are spat out onto a stream where the client has to take or leave
all of them.

To this end, this patch adds a new class, DiagnosticManager, which
contains errors produced by the compiler or by LLDB as an expression
is created. The DiagnosticManager can dump itself to a log as well as
to a string. Clients will (in the future) be able to filter out the
errors they're interested in by ID or present subsets of these errors
to the user.

This patch is not intended to change the *users* of errors - only to
thread DiagnosticManagers to all the places where streams are used. I
also attempt to standardize our use of errors a bit, removing trailing
newlines and making clients omit 'error:', 'warning:' etc. and instead
pass the Severity flag.

The patch is testsuite-neutral, with modifications to one part of the
MI tests because it relied on "error: error:" being erroneously
printed. This patch fixes the MI variable handling and the testcase.

<rdar://problem/22864976>

llvm-svn: 263859
2016-03-19 00:03:59 +00:00
Zachary Turner 29365da0e8 Delete the custom implementation of signal() on Windows.
The Windows SDK provides a version of signal() that is much more
limited compared to other platforms.  It only supports about 5-6
signal values.  LLDB uses signals for a number of things, most
notably to handle Ctrl+C so we can gracefully shut down.  The
portability solution to this on Windows has been to provide a
hand-rolled implementation of `signal` using the name `signal`
so that you could write code that simply calls signal directly
and it would work.

But this introduces a multiply defined symbol with the builtin
version and depending on how you included header files, you could
get yourself into a situation where you had linker errors.  To
make matters worse, it led to a ton of compiler warnings.  Worst
of all though is that this custom implementation of signal was,
in fact, identical for the purposes of handling Ctrl+C as the
builtin implementation of signal.  So it seems to have literally
not been serving any useful purpose.

This patch deletes all the custom signal() functions for Windows,
and includes the signal.h system header, so that any calls to
signal now go to the actual version provided by the Windows SDK.

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

llvm-svn: 263858
2016-03-18 23:47:48 +00:00
Zachary Turner e867044824 Fix a build issue where the python module could become stale.
We are using hardlinks instead of symlinks, and we attempted to
have some logic where we don't re-create the link if the target
file already exists.  This logic is faulty, however, when you
manually delete the source file (e.g. liblldb.dll) and then rebuild
lldb so that a brand new liblldb.dll gets written.  Now the two files
have different inodes, but the target exists, so we would not remake
the link and the target would become stale.

We fix this by only doing the optimization if they are really the
exact same file (by comparing inode numbers), and if they are not
the same file but the target exists, we delete it and re-create
the link.

llvm-svn: 263844
2016-03-18 22:33:59 +00:00
Greg Clayton 5ba3d3e632 Added a break statement that was needed. Caught by clang's unannotated case fall through warning.
llvm-svn: 263830
2016-03-18 20:53:35 +00:00
Greg Clayton 6a41dae468 Fixed an case fall through that wasn't meant to happen. Caught by clang's unannotated case fall through warning.
llvm-svn: 263826
2016-03-18 20:36:30 +00:00
Greg Clayton 31460392c1 Fixed a bug where DW_AT_start_scope would fall through to DW_AT_artificial in SymbolFileDWARF::ParseVariableDIE(). This was caught by the clang warning that catches unannotated case fall throughs.
llvm-svn: 263824
2016-03-18 20:33:49 +00:00
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