Commit Graph

11410 Commits

Author SHA1 Message Date
Robert Flack eb83fabfa0 Only check _ZN function prefix in Linux and FreeBSD targets in SymbolFileDWARF
In http://reviews.llvm.org/D9754 I enabled the mangled symbol name lookup
workaround used to find global and anonymous namespace symbols in linux binaries
for all platforms, however we should still only check for these symbols when
processing Linux or FreeBSD binaries where they are relevant. This patch makes
this change.

Test Plan: The tests from the original revision still pass:
TestCallCPPFunction.py
TestCallStopAndContinue.py
TestExprs.py
TestExprsChar.py
TestNamespace.py
TestOverloadedFunctions.py
TestRvalueReferences.py
TestThreadExit.py

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

llvm-svn: 237467
2015-05-15 18:59:59 +00:00
Robert Flack 4629c4b9cb Choose stdlib for test suite based on target platform.
When compiling programs for the test suite we currently choose which stdlib to
use based on the host platform, but should be basing this on the target
platform.

Test Plan: ./dotest.py $DOTEST_OPTS -t -p TestThreadExit.py
This test previously failed mac->linux most of the time due to using the mac
host's atomic declaration.

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

llvm-svn: 237466
2015-05-15 18:54:32 +00:00
Greg Clayton 1548440c45 OperatingSystem plug-ins need to avoid running code when fetching thread lists. This patch helps with that by making all SBValue objects that are fetched not try to do dynamic type resolution. Objective C can end up running code to fetch a list of all ISA pointers so we can tell when something is dynamic and this running code could cause the OS plug-in to continue the target.
This fix disabled dynamic types, fetches the new threads from the OS plug-in, then restores the setting.

<rdar://problem/20768407> 

llvm-svn: 237465
2015-05-15 18:40:24 +00:00
Greg Clayton 286ea2342d Fix the lldb-mi Xcode project build target to it compiles.
llvm-svn: 237464
2015-05-15 18:38:04 +00:00
Ilia K d9f1a78aa0 Add --move-to-nearest-code / target.move-to-nearest-code options
Summary:
This option forces to only set a source line breakpoint when there is an exact-match

This patch includes the following commits:
# Add the -m/--exact-match option in "breakpoint set" command
## Add exact_match arg in BreakpointResolverFileLine ctor
## Add m_exact_match field in BreakpointResolverFileLine
## Add exact_match arg in BreakpointResolverFileRegex ctor
## Add m_exact_match field in BreakpointResolverFileRegex
## Add exact_match arg in Target::CreateSourceRegexBreakpoint
## Add exact_match arg in Target::CreateBreakpoint
## Add -m/--exact-match option in "breakpoint set" command
# Add target.exact-match option to skip BP if source line doesn't match
## Add target.exact-match global option
## Add Target::GetExactMatch
## Refactor Target::CreateSourceRegexBreakpoint to accept LazyBool exact_match (was bool)
## Refactor Target::CreateBreakpoint to accept LazyBool exact_match (was bool)
# Add target.exact-match test in SettingsCommandTestCase
# Add BreakpointOptionsTestCase tests to test --skip-prologue/--exact-match options
# Fix a few typos in lldbutil.check_breakpoint_result func
# Rename --exact-match/m_exact_match/exact_match/GetExactMatch to --move-to-nearest-code/m_move_to_nearest_code/move_to_nearest_code/GetMoveToNearestCode
# Add exact_match field in BreakpointResolverFileLine::GetDescription and BreakpointResolverFileRegex::GetDescription, for example:
was:
```
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, locations = 1, resolved = 1, hit count = 2
  1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2
```
now:
```
1: file = '/Users/IliaK/p/llvm/tools/lldb/test/functionalities/breakpoint/breakpoint_command/main.c', line = 12, exact_match = 0, locations = 1, resolved = 1, hit count = 2
  1.1: where = a.out`main + 20 at main.c:12, address = 0x0000000100000eb4, resolved, hit count = 2
```

Test Plan:
./dotest.py -v --executable $BUILDDIR/bin/lldb functionalities/breakpoint/
./dotest.py -v --executable $BUILDDIR/bin/lldb settings/
./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/breakpoint/

Reviewers: jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, jingham

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

llvm-svn: 237460
2015-05-15 18:16:15 +00:00
Ilia K 236714c67a Improve the MiVarTestCase.test_lldbmi_var_list_children test (MI)
llvm-svn: 237454
2015-05-15 16:13:51 +00:00
Pavel Labath 9eb1ecb9af [NativeProcessLinux] Fix removal of temporary breakpoints
Summary:
There was an issue in NPL, where we attempted removal of temporary breakpoints (used to implement
software single stepping), while some threads of the process were running. This is a problem
since we currently always use the main thread's ID in the removal ptrace call. Therefore, if the
main thread was still running, the ptrace call would fail, and the software breakpoint would
remain, causing all kinds of problems. This change removes the breakpoints after all threads have
stopped. This fixes TestExitDuringStep on Android arm and can also potentially help in other
situations, as previously the breakpoint would not get removed if the thread stopped for another
reason.

Test Plan: TestExitDuringStep passes, other tests remain unchanged.

Reviewers: tberghammer

Subscribers: tberghammer, aemerson, lldb-commits

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

llvm-svn: 237448
2015-05-15 13:49:01 +00:00
Robert Flack fd8893fd96 Add EmulateInstructionMIPS to the xcode project file to fix build after r237420.
llvm-svn: 237446
2015-05-15 13:37:02 +00:00
Pavel Labath 6e35163cca [NativeProcessLinux] Fix potential race during thread exit
Summary:
This is the same issue as we had in D9145 for thread creation. Going through the full
ThreadDidStop/RequestResume cycle can cause a deferred notification to fire, which is not correct
when we are ignoring an event and resuming the thread. In this case it doesn't matter much since
the thread will die after that anyway, but for correctness, we should do the same thing here.
Also treating the SIGTRAP case the same way.

Test Plan: Tests continue to pass.

Reviewers: chaoren, ovyalov

Subscribers: lldb-commits

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

llvm-svn: 237445
2015-05-15 13:30:59 +00:00
Robert Flack 6e1fd35bfe Skip TestPluginCommands.py if host lldb library is incompatible with remote.
TestPluginCommands.py attempts to build a library which links against the host
built lldb library. This will only work if the remote is compatible with
binaries produced by the host.

Test Plan:
./dotest.py $DOTEST_OPTS -v -t -p TestPluginCommands.py
Test is skipped if remote platform is incompatible with host platform (i.e. mac
-> linux).

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

llvm-svn: 237444
2015-05-15 12:39:33 +00:00
Ilia K 3ac979c4da Fix CMICmdArgValPrintValues::Validate & enable 4 tests that were XFAIL'ed in r237437 (MI)
llvm-svn: 237443
2015-05-15 12:33:04 +00:00
Ilia K 25d29ba5ec Set specific values for VariableInfoFormat_e enum and remove kNumVariableInfoFormats (MI)
llvm-svn: 237438
2015-05-15 11:55:09 +00:00
Ilia K fbc88aa1dd XFAIL 4 lldb-mi tests to get Linux build green back (MI)
llvm-svn: 237437
2015-05-15 11:51:52 +00:00
Pavel Labath 48fca3b982 Fix StopInfoWatchpoint handling after r237411
r237411 exposed the following issue: ProcessGDBRemote used the description field in the
stop-reply to set the description of the StopInfo. In the case of watchpoints, the packet
description contains the raw address that got hit, which is not exactly the information we want
to display to the user as the stop info. Therefore, I have changed the code to use the packet
description only if the StopInfo does not already have a description. This makes the behavior
equivalent to the pre-r237411 behavior as then the SetDecription call got ignored for
watchpoints.

llvm-svn: 237436
2015-05-15 10:14:51 +00:00
Tamas Berghammer 69fc298a94 Fix virtual step handling in ThreadPlanStepInRange
Differential revision: http://reviews.llvm.org/D9773

llvm-svn: 237435
2015-05-15 10:14:15 +00:00
Ilia K 27e2c058c9 Fix parsing of print-values arg (MI)
# Add CMICmdArgValPrintValues argument
# Rework -stack-list-arguments/-stack-list-locals/-stack-list-variables/-var-update/-var-list-children
  commands to use the CMICmdArgValPrintValues argument instead of usage of pair of non-mandatory
  arguments like: CMICmdArgValNumber(0) || CMICmdArgValLongOptions("no-values")

llvm-svn: 237429
2015-05-15 09:46:28 +00:00
Ilia K 06d2855fb3 Fix a reason of *stopped notifications due to SIGINT/SIGSTOP signals (MI)
# Add SBProcess::GetInterruptedFromEvent
# Add vrEvent arg in CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStateStopped
  and CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal
# Refactor CMICmnLLDBDebuggerHandleEvents::HandleProcessEventStopSignal
## Clean up and fix typos
## Remove vwrbShouldBrk arg
# Fix MiSignalTestCase.test_lldbmi_stopped_when_stopatentry_{local,remote}
  to expect SIGSTOP instead of SIGINT

llvm-svn: 237426
2015-05-15 09:29:09 +00:00
Ilia K d50ea2fc15 Fix a few compile warnings
llvm-svn: 237425
2015-05-15 09:15:27 +00:00
Omair Javaid cdad63b33d LLDB build broke after applying patch http://reviews.llvm.org/D9706
This patch fixes the issue.

llvm-svn: 237421
2015-05-15 08:30:29 +00:00
Bhushan D. Attarde 794a4d5a9f Assembly profiler for mips32
Summary:
Implementation of assembly profiler for MIPS32 using EmulateInstruction which currently scans only prologue/epilogue assembly instructions. It uses llvm::MCDisassembler to decode assembly instructions.

Reviewers: clayborg, jasonmolenda

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

llvm-svn: 237420
2015-05-15 06:53:30 +00:00
Omair Javaid ea8c25a802 This patch adds support for setting/clearing hardware watchpoints and breakpoints on AArch64 (Arm v8) 64-bit hardware.
http://reviews.llvm.org/D9706

llvm-svn: 237419
2015-05-15 06:29:58 +00:00
Oleksiy Vyalov 9953f0886b Reverting r237392 since it broke TestNumThreads on ubuntu builder.
llvm-svn: 237415
2015-05-15 02:05:10 +00:00
Jason Molenda 0453be9bd9 The StopInfo base class has an m_description std::string.
Remove the m_description ivar from the StopInfoBreakpoint
and StopInfoWatchpoint subclasses of StopInfo.  Also,
initialize the m_description ivar in the StopInfo ctor.
<rdar://problem/20902950> 

llvm-svn: 237411
2015-05-15 00:19:28 +00:00
Zachary Turner 275806f90b Don't bother dynamic loading the Windows Slim RW Lock API.
This API has been present since XP, and I think it's safe to
drop support for XP (since other things have been introduced long
ago which already don't work on XP anyway).

With this patch, we can statically bind against the exports and
not bother falling back to a CRITICAL_SECTION if we can't load
the API.

llvm-svn: 237402
2015-05-14 22:50:19 +00:00
Adrian McCarthy d26b0c4d31 Enable multithreaded debugging on Windows.
llvm-svn: 237392
2015-05-14 21:07:59 +00:00
Siva Chandra b8c238c080 [TestSendSignal] Include signal.h instead of sys/signal.h in the test case.
Summary:
Android API-9 does not have sys/signal.h. However, all sys/signal.h
has when present is an include of signal.h.

Test Plan: dotest.py -p TestSendSignal on linux and Android.

Reviewers: chaoren

Reviewed By: chaoren

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 237381
2015-05-14 19:02:13 +00:00
Ed Maste 31bc506987 Avoid Linux-specific header in platform-independent tests
llvm-svn: 237371
2015-05-14 16:39:02 +00:00
Ed Maste 4dd8fba21e XTIMEOUT tests timing out on the FreeBSD buildbot
llvm-svn: 237369
2015-05-14 16:25:52 +00:00
Siva Chandra ff2b29d0ea [TestAttachDenied] Use a file instead of a pipe for synchronization.
Summary:
One cannot use mknod or mkfifo on user Android devices. This commit
changes the use of pipe to a file to synchronize between the inferior
and the test.

Test Plan: dotest.py -P TestAttachDenied

Reviewers: ovyalov, chaoren

Reviewed By: chaoren

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 237328
2015-05-14 01:36:47 +00:00
Enrico Granata b2d643146f Implement an objc tagged-pointer info command that will provide information about what LLDB thinks an ObjC tagged pointer represents
llvm-svn: 237322
2015-05-14 00:46:47 +00:00
Vince Harron de92b52015 Added XTIMEOUT for TestAttachDenied.py
llvm-svn: 237319
2015-05-13 23:59:03 +00:00
Ed Maste da04cb2643 Add mips64el trap opcode to PlatformFreeBSD as well
llvm-svn: 237315
2015-05-13 23:12:51 +00:00
Ed Maste af0494f158 Restore breaks lost in shuffling GetSoftwareBreakpointTrapOpcode
llvm-svn: 237313
2015-05-13 23:09:43 +00:00
Ed Maste dfef0cecd4 Add AArch64 and MIPS breakpoint opcodes and sort cases
New opcodes from PlatformLinux.cpp

llvm-svn: 237306
2015-05-13 22:40:01 +00:00
Ed Maste a157bc8539 Initial FreeBSD/arm live debugging support
Patch by Tom Rix, except using the RegisterContextFreeBSD_arm files
added in r235305 instead.

llvm-svn: 237303
2015-05-13 22:33:12 +00:00
Ed Maste a928d9550c Rearrange PlatformFreeBSD to match PlatformLinux
No functional change, but this simplifies diffs of the two.

llvm-svn: 237302
2015-05-13 22:26:24 +00:00
Zachary Turner fb69dd8b64 Don't import lock on Windows.
lock imports fcntl, which doesn't exist on Windows.  If we need
to use this class on Windows, we will need to implement something
based on the CreateMutex API.

llvm-svn: 237292
2015-05-13 20:21:33 +00:00
Zachary Turner 535a69112b Fix broken test, this wasn't supposed to get committed.
llvm-svn: 237291
2015-05-13 20:21:22 +00:00
Robert Flack fa5ad65e5c Select expected remote libc++ library name based on remote platform.
Select expected remote libc++ library name based on remote platform. This is
used to verify libc++ is in the loaded image list by various tests which use it.

Test Plan:
Passes the following tests mac -> linux with this patch:
TestDataFormatterLibccIterator.py
TestDataFormatterLibccMap.py
TestDataFormatterLibccMultiMap.py
TestDataFormatterLibcxxMultiSet.py
TestDataFormatterLibcxxSet.py
TestDataFormatterUnordered.py

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

llvm-svn: 237288
2015-05-13 20:17:34 +00:00
Zachary Turner 1b988b4b64 Fix line endings.
I must have committed these with windows line endings a few months
ago when I did this work.

llvm-svn: 237283
2015-05-13 19:45:06 +00:00
Zachary Turner ff33eefcc7 Fix an issue with finding python on Windows.
Someone must have changed the behavior of FileSpec slightly
relating to whether or not there is a trailing backslash when calling
GetPath() and GetDirectory().  This caused ScriptInterpreterPython
to find the wrong values when initializing sys.path, and as a result
we couldn't find the lldb module.

This patch fixes the issue, and also adds a test to make sure that
GetDirectory() does not return a string containing a trailing slash.

llvm-svn: 237282
2015-05-13 19:44:57 +00:00
Zachary Turner 1aa755ce77 Remove DoAttachToProcessWithId(lldb::pid_t).
There were two versions of DoAttachToprocessWithId.  One that takes
a pid_t, and the other which takes a pid_t and a ProcessAttachInfo.
There were no callers of the former version, and all of the
implementations of this version were simply forwarding calls to
one version or the other.

llvm-svn: 237281
2015-05-13 19:44:44 +00:00
Zachary Turner 7271bab3bb Have Platform::KillProcess try to use the process plugin first.
llvm-svn: 237280
2015-05-13 19:44:24 +00:00
Jim Ingham f9e1a165dd Add a comment clarifying what func_name_type_mask is.
llvm-svn: 237279
2015-05-13 19:01:15 +00:00
Ted Woodward bb1e283cc5 Change Linux Platform to support non-host Linux architectures
Summary:
This was originally http://reviews.llvm.org/D8709 , but I didn't commit it correctly. 

Since then GetSupportedArchitectureAtIndex() has been changed. That change, http://reviews.llvm.org/D9511 , breaks non-x86 linux implementations, so this change goes back to the old implementation and adds remote linux support from D8709.

D8709 summary:

The Linux Platform currently will only say the Host architecture is supported. This patch retains that behavior for the Host Platform, but adds a list of architectures for the Remote Platform.


Reviewers: clayborg, flackr

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 237278
2015-05-13 18:52:56 +00:00
Robert Flack 79e4a4b213 Check the host platform to determine logging channel to test in TestRegisters.py
Checks the host platform to determine logging channel to test in
TestRegisters.py as the logging runs host side.

Test Plan:
./dotest.py $DOTEST_OPTS -v -t -p TestRegisters.py
This passes mac -> linux as it's logging the correct channel.

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

llvm-svn: 237271
2015-05-13 18:23:10 +00:00
Robert Flack 5cbd3bfca1 Enable workaround for finding functions in global namespace on linux binaries on
all hosts.

We require a workaround to be able to locate global and anonymous namespace
functions in the dwarf symbols on linux binaries. This patch enables this code
on all platforms so that we can still find these symbols when debugging from a
different host platform.

Test Plan:
The following tests begin passing when running with a mac host to linux client:
TestCallCPPFunction.py
TestCallStopAndContinue.py
TestExprs.py
TestExprsChar.py
TestNamespace.py
TestOverloadedFunctions.py
TestRvalueReferences.py
TestThreadExit.py

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

llvm-svn: 237270
2015-05-13 18:20:02 +00:00
Ilia K 0e919bca7f Refactor lldb-mi's prompt
Summary:
This patch fixes/cleans code around of (gdb) prompt:
# Add CMICmnStreamStdout::WritePrompt
# Clean up CMICmnStreamStdout::TextToStdout (don't lock
  the m_mutex twice because it will be locked in CMICmnStreamStdout::WritePriv)
# Remove unused CMICmnStreamStdin::m_bShowPrompt field
# Refactor CMICmnLLDBDebuggerHandleEvents to use CMICmnStreamStdout::WritePrompt
  instead of TextToStdout("(gdb)")
# Refactor CMIDriver to use CMICmnStreamStdout::WritePrompt instead of
  ```
    if (bOk && m_rStdin.GetEnablePrompt())
        bOk = m_rStdOut.WriteMIResponse(m_rStdin.GetPrompt());
  ```

Test Plan: ./dotest.py -v --executable $BUILDDIR/bin/lldb tools/lldb-mi/

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, abidh

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

llvm-svn: 237248
2015-05-13 12:18:20 +00:00
Tamas Berghammer 4276cb3a50 Fix arm instruction emulation of add (imm) and sub (imm)
Differential revision: http://reviews.llvm.org/D9704

llvm-svn: 237240
2015-05-13 09:25:06 +00:00
Ewan Crawford 78baa19781 Remote Non-Stop Support
Summary:
 
This patch is the beginnings of support for Non-stop mode in the remote protocol. Letting a user examine stopped threads, while other threads execute freely.

Non-stop mode is enabled using the setting target.non-stop-mode, which sends a QNonStop packet when establishing the remote connection.
Changes are also made to treat the '?' stop reply packet differently in non-stop mode, according to spec https://sourceware.org/gdb/current/onlinedocs/gdb/Remote-Non_002dStop.html#Remote-Non_002dStop.
A setting for querying the remote for default thread on setup is also included.

Handling of '%' async notification packets will be added next.

Reviewers: clayborg

Subscribers: lldb-commits, ADodds, ted, deepak2427

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

llvm-svn: 237239
2015-05-13 09:18:18 +00:00