Commit Graph

14516 Commits

Author SHA1 Message Date
Renato Golin 15cb0bd080 [LLDB] Adding lldb_private namespace to DiagnosticSeverity. NFC.
This is a fix due to the addition of the new DiagnosticSeverity in
LLVMContext.h. This may warrant a change in name to be LLDB specific
but I leave that to the LLDB experts to refactor.

llvm-svn: 269562
2016-05-14 13:14:39 +00:00
Todd Fiala 4728cf7e85 surface build error content through test event system
Summary:
print build errors nicely in test output

This test infrastructure change adds a new Python exception
for test subject builds that fail.  The output of the build
command is captured and propagated to both the textual test
output display code and to the test event system.

The ResultsFormatter objects have been modified to do something
more useful with this information.  The xUnit formatter
now replaces the non-informative Python build error stacktrace
with the build error content.  The curses ResultsFormatter
prints a 'B' for build errors rather than 'E'.

The xUnit output, in particular, makes it much easier for
developers to track down test subject build errors that cause
test failures when reports come in from CI.

Reviewers: granata.enrico

Subscribers: llvm-commits

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

llvm-svn: 269525
2016-05-14 00:42:30 +00:00
Todd Fiala 7c5f7caa20 test infra: catch bad decorators and import-time errors
Summary:
This change enhances the LLDB test infrastructure to convert
load-time exceptions in a given Python test module into errors.
Before this change, specifying a non-existent test decorator,
or otherwise having some load-time error in a python test module,
would not get flagged as an error.

With this change, typos and other load-time errors in a python
test file get converted to errors and reported by the
test runner.

This change also includes test infrastructure tests that include
covering the new work here.  I'm going to wait until we have
these infrastructure tests runnable on the main platforms before
I try to work that into all the normal testing workflows.

The test infrastructure tests can be run by using the standard python module testing practice of doing the following:

cd packages/Python/lldbsuite/test_event
python -m unittest discover -s test/src -p 'Test*.py'

Those tests run the dotest inferior with a known broken test and verify that the errors are caught.  These tests did not pass until I modified dotest.py to capture them properly.

@zturner, if you have the chance, if you could try those steps above (the python -m unittest ... line) on Windows, that would be great if we can address any python2/3/Windows bits there.  I don't think there's anything fancy, but I didn't want to hook it into test flow until I know it works there.

I'll be slowly adding more tests that cover some of the other breakage I've occasionally seen that didn't get collected as part of the summarization.  This is the biggest one I'm aware of.

Reviewers: zturner, labath

Subscribers: zturner, lldb-commits

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

llvm-svn: 269489
2016-05-13 21:36:26 +00:00
Zachary Turner 4fd6a96008 Clean up test results on Windows.
Remove XFAIL from some tests that now pass.
Add XFAIL to some tests that now fail.
Fix a crasher where a null pointer check isn't guarded.
Properly handle all types of errors in SymbolFilePDB.

llvm-svn: 269454
2016-05-13 18:26:30 +00:00
Ed Maste 718e2968f8 Disable HostThread::Cancel assertion on FreeBSD
It is still used by ProcessMonitor::StopMonitoringChildProcess and
ProcessMonitor::StopOpThread.

llvm-svn: 269434
2016-05-13 17:01:59 +00:00
Ed Maste d589a75595 Remove unused variable
llvm-svn: 269421
2016-05-13 14:49:38 +00:00
Pavel Labath 04b979ffb2 Remove ASTContexts from SystemInitializerCommon
Summary:
The AST contexts are not needed in the server components, and the clang context in particular
pulls in large parts of clang into the binary. Simply removing these two calls reduces the
lldb-server size by about 50%--80%, depending on the architecture and build type.

This should not impact the client parts as the same calls are already present in
SystemInitializerFull.

Reviewers: tberghammer, clayborg

Subscribers: lldb-commits

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

llvm-svn: 269416
2016-05-13 13:40:51 +00:00
Sagar Thakur adc1abe77e [LLDB][MIPS] Provide ABI string to compiler for appropriate code generation for MIPS
Patch by Nitesh Jain.

Summary: These patch will set clang::TargetOptions::ABI and accordingly code will be generated for MIPS target.

Reviewers: ovyalov, clayborg
Subscribers: lldb-commits, mohit.bhakkad, sagar, jaydeep, bhushan
Differential: D18638
llvm-svn: 269407
2016-05-13 11:04:47 +00:00
Enrico Granata 7d1ff51f4a Add a check for version 15 of the shared cache format
<rdar://problem/26207478>

llvm-svn: 269378
2016-05-12 23:04:43 +00:00
Greg Clayton 1e20f021f3 Fix some long standing issues that caused tests to be flaky.
The main issues were:
- Listeners recently were converted over to used by getting a shared pointer to a listener. And when they listened to broadcasters they would get a strong reference added to them meaning the listeners would never go away. This caused memory usage to increase and would cause performance issue if many steps were done.
- The lldb_private::Process private state thread had an issue where if a "stop" contol signal was attempted to be sent to that thread, it could end up not responding in 2 seconds and end up getting cancelled which might cause us to cancel a thread that had a mutex locked and it would deadlock the test.

This change makes broadcasters hold onto weak references to listeners. It also fixes some bad threading code that had races inside of it by making the m_events_mutex be non-recursive and getting rid of fragile use of a Predicate<bool> to say that new events are available, and replacing it with using the m_events_mutex with a new m_events_condition to control access to the events in a safer way.

The private state thread now uses a safer way to communicate that the control event has been received by the private state thread: it makes a EventDataReceipt instance that it attaches to the event that sends the control to the private state thread and used this to synchronize the fact that the private state thread has received the event instead of using a Predicate<bool> to convey the info. When the signal event is received, it will pull the event off of the queue in the private state thread and cause the EventData::DoOnRemoval() to be called, which will signal that the event has been received. This cleans up the signal delivery notification so it doesn't rely on a member variable of the process class to convey the info.

std::shared_ptr<EventDataReceipt> event_receipt_sp(new EventDataReceipt());
m_private_state_control_broadcaster.BroadcastEvent(signal, event_receipt_sp);

<rdar://problem/26256353> Listeners are being kept around longer than they should be due to recent changs
<rdar://problem/26256258> Private process state thread can be cancelled and cause deadlocks in test suite

llvm-svn: 269377
2016-05-12 22:58:52 +00:00
Greg Clayton 1059a067f9 Don't crash when a process' task port goes bad.
<rdar://problem/26256049>

llvm-svn: 269373
2016-05-12 22:36:47 +00:00
Greg Clayton ff8e6a763f Fix libstdc++ failure where <atomic> is not able to be imported on Darwin systems.
The adding of <atomic> to test_common.h broke 12 tests on Darwin. We work around this by not including <atomic> when building on darwin for libstdc++ tests.

llvm-svn: 269372
2016-05-12 22:33:02 +00:00
Cameron Desrochers 739fc77c01 Added missing makefile from patch D19124 (should fix the corresponding commit rL269340)
llvm-svn: 269366
2016-05-12 22:10:16 +00:00
Marianne Mailhot-Sarrasin 3fe7158174 [LLDB] Added support for PHI nodes to IR interpreter
This allows expressions such as 'i == 1 || i == 2` to be executed using the IR interpreter, instead of relying on JIT code injection (which may not be available on some platforms).

Patch by cameron314

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

llvm-svn: 269340
2016-05-12 20:00:53 +00:00
Kamil Rytarowski f49f2ee6d6 Add CMake bits necessary for standalone build
Summary: Developed on NetBSD with pkgsrc.

Reviewers: zturner, labath

Subscribers: jevinskie, zturner, tfiala, Eugene.Zelenko, artagnon, joerg, lldb-commits

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

llvm-svn: 269332
2016-05-12 19:49:17 +00:00
Kamil Rytarowski eab80e5856 Turn on LLDB_EDITLINE_USE_WCHAR on NetBSD
Summary: The editline(3) library in NetBSD is by default internally wide.

Reviewers: clayborg, emaste

Subscribers: joerg, lldb-commits

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

llvm-svn: 269330
2016-05-12 19:46:08 +00:00
Pavel Labath 194357c509 Fix a race in ProcessGDBRemote::MonitorDebugServerProcess
Summary:
MonitorDebugServerProcess went to a lot of effort to make sure its asynchronous invocation does
not cause any mischief, but it was still not race-free. Specifically, in a quick stop-restart
sequence (like the one in TestAddressBreakpoints) the copying of the process shared pointer via
target_sp->GetProcessSP() was racing with the resetting of the pointer in DeleteCurrentProcess,
as they were both accessing the same shared_ptr object.

To avoid this, I simply pass in a weak_ptr to the process when the callback is created. Locking
this pointer is race-free as they are two separate object even though they point to the same
process instance. This also removes the need for the complicated tap-dance around retrieving the
process pointer.

Reviewers: clayborg

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 269281
2016-05-12 11:10:01 +00:00
Ted Woodward 911d57840a Keep original source path and mapped path in LineEntry
Summary:
The "file" variable in a LineEntry was mapped using target.source-map, except when stepping through inlined code. This patch adds a new variable to LineEntry, "original_file", that contains the original file from the debug info. "file" will continue to (possibly) be mapped.

Some code has been changed to use "original_file". This is code dealing with symbols. Code dealing with source files will still use "file". Reviewers, please confirm that these particular changes are correct.

Tests run on Ubuntu 12.04 show no regression.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 269250
2016-05-11 22:46:53 +00:00
Pavel Labath 998bdc5b75 Generalize child process monitoring functions
Summary:
This replaces the C-style "void *" baton of the child process monitoring functions with a more
C++-like API taking a std::function. The motivation for this was that it was very difficult to
handle the ownership of the object passed into the callback function -- each caller ended up
implementing his own way of doing it, some doing it better than others. With the new API, one can
just pass a smart pointer into the callback and all of the lifetime management will be handled
automatically.

This has enabled me to simplify the rather complicated handshake in Host::RunShellCommand. I have
left handling of MonitorDebugServerProcess (my original motivation for this change) to a separate
commit to reduce the scope of this change.

Reviewers: clayborg, zturner, emaste, krytarowski

Subscribers: lldb-commits

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

llvm-svn: 269205
2016-05-11 16:59:04 +00:00
Omair Javaid 86e0dd5c1c Xfail failing watchpoint tests on aarch64-linux
Some watchpoint tests fail on aarch64-linux as it lacks support for intalling watchpoints which are not alligned at 8bytes boundary.

Marking them as xfail for now. 

llvm-svn: 269187
2016-05-11 13:57:20 +00:00
Sagar Thakur 477eb42f85 [LLDB][MIPS] Setting appropriate ArchSpec::m_flags based on ABI
Patch by Nitesh Jain.

Summary: The ArchSpec::m_flags will be set based on ELF flag ABI.

Reviewers: ovyalov, clayborg
Subscribers: lldb-commits, mohit.bhakkad, sagar, jaydeep, bhushan
Differential: D18858
llvm-svn: 269181
2016-05-11 13:08:29 +00:00
Ravitheja Addepally b2ba5a5467 Rewriting TestMultithreaded.py to solve flakyness on Linux
Summary:
test_listener_event_process_state checks for Threads
and Frames in the multithreaded_queue. The listener_func has
more computational load, which may be latter executed than the
pop leading to the failure. This patch tries to only check for
frames in listener_func as presence of frames also confirms 
prescence of threads and avoids the second push into the 
multithreaded_queue.

Reviewers: lldb-commits, clayborg, labath

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

llvm-svn: 269168
2016-05-11 09:54:41 +00:00
Omair Javaid e94459fa6c Corrected aarch64 register no in TestBreakpointConditions.py
Test uses x1 in breakpoint expression while objdump shows that x1 is never used in the code and may have random values.
Using x0 make sure that we are using a registe that will have a positive value and breakpoint expression will evaluate true atleast once.

llvm-svn: 269164
2016-05-11 09:29:14 +00:00
Enrico Granata c3b0a5b099 In some cases, type lookup has to deal with situations where it cannot reconstruct a compile unit or a function, but it still has a valid symbol - and it can use that in order to figure out the preferential language for lookups
This is not the right thing for all clients (notably the expression parser), so put it in type lookup specific code

Fixes rdar://problem/22422313

llvm-svn: 269095
2016-05-10 18:16:33 +00:00
Pavel Labath 7189b0fdb2 Fix logging in Listener.cpp
Clear() log message was claiming it was the destructor, which had me very confused when looking
at the log messages. Fix the message, and add a log message to the real destructor.

Also noticed that the destructor was needlessly locking the broadcaster mutex (as Clear was
locking it again anyway), so remove that as well.

llvm-svn: 269058
2016-05-10 13:46:25 +00:00
Pavel Labath d86bc2af27 Fix SymbolFilePDBTests.cpp
llvm-svn: 269057
2016-05-10 13:46:22 +00:00
Pavel Labath ebc7135f8e Fix race in TestExitDuringStep and unify pseudo_barrier handling
Summary:
TestExitDuringStep was very rarely hanging on the buildbots. I can't be sure, but I believe this
was because of the fact that it declared its pseudo_barrier variable as "volatile int", which is
not sufficient to guarantee corectness (also, all other tests used atomic variables for this, and
they were passing reliably AFAIK). Besides switching to an atomic variable in this test as well,
I have also took this opportunity to unify all the copies of the pseudo_barrier code to a single
place to reduce the chance of this happening again.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 269025
2016-05-10 07:54:25 +00:00
Jim Ingham 958faec74f Add a testcase for "BreakpointSetBySourceRegex"
This tests both that we set the breakpoint on the right line, and that restricting by file
and/or the function, we get the right breakpoints.

llvm-svn: 269004
2016-05-10 01:52:44 +00:00
Sean Callanan e402e56492 Added a testcase that verifies that multiline expressions work.
llvm-svn: 268971
2016-05-09 21:14:18 +00:00
Sean Callanan f52c40c57f Fixed multiline expressions, and removed some dead code.
IOHandlerLinesUpdated() does nothing, and IOHandlerIsInputComplete should be
implemented but isn't.  This means that multiline expressions don't work.  This
patch fixes that.  Test case to follow in the next commit.

llvm-svn: 268970
2016-05-09 21:13:27 +00:00
Pavel Labath b5935bfd7d Mark TestPrintStackTraces as flaky on linux
PR27687

llvm-svn: 268934
2016-05-09 16:59:29 +00:00
Pavel Labath 1dfd5b1694 Enable NamespaceLookupTestCase.test_scope_lookup_before_using_with_run_command on linux
test appears to be passing now.

llvm-svn: 268923
2016-05-09 14:43:22 +00:00
Pavel Labath b8d8c62b34 Fix assertion in SymbolFilePDB
llvm::Error requires all errors to be handled. Simply checking the whether there was an error is
not enough, you have to actuall call handle(All)Errors, in case there was an error.

llvm-svn: 268906
2016-05-09 11:07:43 +00:00
Jim Ingham 7fa7dc36fe Take the API lock in SBThread::IsValid & SBFrame::IsValid.
The IsValid calls can try to reconstruct the thread & frame, which can 
take various internal locks.  This can cause A/B locking issues with
the Target lock, so these calls need to that the Target lock.

llvm-svn: 268828
2016-05-07 00:54:56 +00:00
Jim Ingham 8bbfdcd181 Remove some lldbassert's from the packet checking code.
Greg says he doesn't need these asserts anymore and since they cause occasional test suite
crashes, out they go.

llvm-svn: 268827
2016-05-07 00:52:18 +00:00
Jim Ingham 9b8eb155d8 Fix the way the ShouldStopHere checker handles the general case of "stepping through line 0 code".
That's good 'cause it means all the different kinds of source line stepping won't leave user in the middle of
compiler implementation code or code inlined from odd places, etc.  But it turns out that the compiler
also marks functions it MIGHT inline as all being of line 0.  That would mean we single step through this code
instead of just stepping out.  That is both inefficient, and more error prone 'cause these little nuggets tend
to be bits of hand-written assembly and the like and are hard to step through.

This change just checks and if the entire function is marked with line 0, we step out rather than step through.

<rdar://problem/25966460>

llvm-svn: 268823
2016-05-06 23:44:10 +00:00
Zachary Turner 50c58c0d01 Fix LLDB after removal of PDB_ErrorCode
llvm-svn: 268802
2016-05-06 21:35:47 +00:00
Saleem Abdulrasool d97dd11f2f debugserver; fix -Wunused-local-typedef, -Wunused-variable warnings
Remove the typedef and local structure which was unused.  Fixes last of the new
clang warnings in the debugserver build.  NFC.

llvm-svn: 268759
2016-05-06 17:33:13 +00:00
Saleem Abdulrasool 247731d4d3 debugserver: fix a couple of -Wmissing-field-initializers warnings
Explicitly provide an initializer for the std::vector in the constructed type.
Addresses -Wmissing-field-initializers warnings from clang.  NFC.

llvm-svn: 268758
2016-05-06 17:33:09 +00:00
Saleem Abdulrasool 4533f7b6e8 debugserver: fix some -Wpessimizing-move warnings
Remove the unnecessary use of std::move to permit the compiler to perform NVRO
instead.  Fixes more warnings from clang.  NFC.

llvm-svn: 268757
2016-05-06 17:33:04 +00:00
Saleem Abdulrasool 2bb818880b debugserver: fix a few -Wcovered-swift-default warnings
Remove a couple of `default` cases from switches which are covered.  This is
beneficial since it would allow the compiler to indicate when a new enum value
is added and the switch is not updated.  Fixes some warnings from clang.  NFC.

llvm-svn: 268756
2016-05-06 17:33:01 +00:00
Saleem Abdulrasool bd7ecf4b02 debugserver: fix some -Wformat-pedantic warnings
Perform explicit casts for the log message to address some `-Wformat-pedantic`
warnings from clang.  NFC.

llvm-svn: 268755
2016-05-06 17:32:58 +00:00
Eugene Zelenko 774b8da47f Fix standalone build on RHEL6.
Differential revision: http://reviews.llvm.org/D19991

llvm-svn: 268750
2016-05-06 17:03:09 +00:00
Enrico Granata 5f57b6ee0f Revert r268591
"Allow LanguageRuntimes to return an error if they fail in the course of dynamic type discovery

This is not meant to report that a value doesn't have a dynamic type - it is only meant as a mechanism to propagate actual type discovery issues (e.g. malformed type metadata for languages that have such a notion)

This information is used by ValueObjectDynamic to set its own m_error, which is a fairly sharp and heavyweight tool to begin with

For the time being, this is an architectural improvement but a practical no-op as no existing runtimes are actually setting errors"

I need to think about what I want to do in this space more carefully - this attempt might be too heavy of a hammer for the nail I am trying to fix, and I don't want to leave it in while I ponder

llvm-svn: 268686
2016-05-05 21:10:28 +00:00
Todd Fiala 57a4e5b3d0 Fix TestEvents.py on OS X
This change addresses a hang/segfault in TestEvents.py. The threads that
run the listener loops now do an SBListener.Clear() before they wrap up
their work. This prevents the test from trying to clean up the
SBListener too late.

There is a separate issue here which is that we should prevent this
clean-up time lock-up, but that is out of scope for this particular
change. I'd like to get these tests back and running the normal flow
rather than skipping them.

This addresses:
llvm.org/pr25924 (at least, the OS X side, although I suspect this will
also address Linux)

http://reviews.llvm.org/D19983
reviewed by: Jim Ingham

llvm-svn: 268653
2016-05-05 17:48:14 +00:00
Todd Fiala bcab6484eb fix argument usage for '-#' command line option
This was broken in the grand configuration change.  Now
using -# works again.

llvm-svn: 268638
2016-05-05 16:01:15 +00:00
Tamas Berghammer 21c3fdeda8 Guard AddCXXSynthetic with LLDB_DISABLE_PYTHON
The function only avaibleble when python is enabled. Guard the new call
in the Java plugin with LLDB_DISABLE_PYTHON until we can change
AddCXXSynthetic to be available in all case to get the build bots green
again.

llvm-svn: 268626
2016-05-05 12:46:45 +00:00
Pavel Labath 0360c0f63d Bump up timeout in AdbClient
now that the timeout actually means something, we see that sometimes adb is just really slow in
replying to the DONE packet during file push. Give it more time to complete.

llvm-svn: 268623
2016-05-05 11:25:57 +00:00
Tamas Berghammer 2ff833060c Add support for displaying Java array types on Andorid
Differential revision: http://reviews.llvm.org/D19540

llvm-svn: 268622
2016-05-05 11:18:21 +00:00
Pavel Labath bb06ffaff3 Downgrade skip to xfail in TestBitfields on linux
the test should no longer crash, but we need to investigate why ToT clang still generates debug
info we don't understand.

llvm-svn: 268619
2016-05-05 09:03:22 +00:00