Commit Graph

2807 Commits

Author SHA1 Message Date
Tamas Berghammer c2c3d7185d Merge lldb-platform and lldb-gdbserver into a single binary
This commit merges lldb-platform and lldb-gdbserver into a single binary
of the same size as each of the previous individual binaries. Execution
mode is controlled by the first argument being either platform or
gdbserver.

Patch from: flackr <flackr@google.com>

Differential revision: http://reviews.llvm.org/D7545

llvm-svn: 229683
2015-02-18 15:39:41 +00:00
Oleksiy Vyalov 891f88c1ac Fix TestAttachDenied.py remote execution on Linux.
http://reviews.llvm.org/D7659

llvm-svn: 229587
2015-02-17 23:37:19 +00:00
Ilia K bb0d5aba8e Fix argdumper build in cmake (OS X) after r228636
Previos version of this patch (see r229148) contained two errors:
* make_symlink_darwin_debug passes 2 arguments into make_symlink, but it required 4 arguments (was fixed by r229159)
* make_symlink doesn't work on OS X

As a quick fix, the r229148 and the r229159 were reverted. Now these errors are fixed.

Summary:
This patch fixes the following tests on OS X:

```
  FAIL: test_with_dsym (TestLaunchWithGlob.LaunchWithGlobTestCase)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 456, in wrapper
      return func(self, *args, **kwargs)
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 21, in test_with_dsym
      self.do_test ()
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 42, in do_test
      self.runCmd("process launch -G true -w %s -- fi*.tx?" % (os.getcwd()))
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 1953, in runCmd
      msg if msg else CMD_MSG(cmd))
  AssertionError: False is not True : Command 'process launch -G true -w /Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob -- fi*.tx?' returns successfully
  Config=x86_64-clang
  ======================================================================
  FAIL: test_with_dwarf (TestLaunchWithGlob.LaunchWithGlobTestCase)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 473, in wrapper
      return func(self, *args, **kwargs)
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 28, in test_with_dwarf
      self.do_test ()
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 42, in do_test
      self.runCmd("process launch -G true -w %s -- fi*.tx?" % (os.getcwd()))
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 1953, in runCmd
      msg if msg else CMD_MSG(cmd))
  AssertionError: False is not True : Command 'process launch -G true -w /Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob -- fi*.tx?' returns successfully
```

Reviewers: epertoso, emaste, abidh, clayborg, zturner

Reviewed By: clayborg

Subscribers: abidh, lldb-commits, emaste, epertoso, zturner, clayborg

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

llvm-svn: 229517
2015-02-17 18:25:27 +00:00
Zachary Turner 51f96eeb24 Revert "Revert "I had recently added a new SBFrame::GetVariables() overload with yet another bool argument""
Reverting this commit led to other failures which I did not see at
first.  This turned out to be an easy problem to fix, so I added
SBVariablesOptions.cpp to the CMakeLists.txt.  In the future please
try to make sure new files are added to CMake.

llvm-svn: 229516
2015-02-17 17:55:50 +00:00
Zachary Turner b3b8922cad Revert "I had recently added a new SBFrame::GetVariables() overload with yet another bool argument"
This reverts commit r228975.  It was causing link errors
on the Windows bots, since last Thursday.

http://lab.llvm.org:8011/builders/lldb-x86-win7-msvc/builds/725

Conflicts:
	lldb.xcodeproj/project.pbxproj

llvm-svn: 229514
2015-02-17 17:42:05 +00:00
Pavel Labath df50f9440d Handle trailing spaces on "settings set" command more correctly
Summary:
Currently we have some settings which treat "\ " on settings set commands specially. E.g., it is
a valid way of specifying an argument of " " to a target. However, this fails if "\ " is the last
argument as CommandObjectSettingsSet strips trailing whitespace. This resulted in a surprising
argument of "\" to the target.

This patch disables the training whitespace removal at a global
level. Instead, for each argument type we locally determine whether whitespace stripping makes
sense. Currently, I strip whitespace for all simple object type except of regex and
format-string, with the rationale that these two object types do their own complex parsing and we
want to interfere with them as least as possible. Specifically, stripping the whitespace of a
regex "\ " will result in a (surprising?) error "trailing backslash". Furthermore, the default
value of dissasembly-format setting already contains a trailing space and there is no way for the
user to type this in manually if we strip whitespace.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 229382
2015-02-16 13:13:39 +00:00
Ilia K 6188448299 Rename MiStackTestCase tests according to "test_lldbmi_<command_name>" format
llvm-svn: 229380
2015-02-16 13:00:59 +00:00
Chaoren Lin a06c799729 Fix TestRegisters on remote target.
Summary:
Using spawnSubprocess instead of forkSubprocess, so that the subprocess
spawns on the target and not the host.

Requires http://reviews.llvm.org/D7660 for cleanup.

Test Plan: TestRegisters.py passing.

Reviewers: ovyalov, vharron, clayborg

Subscribers: lldb-commits

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

llvm-svn: 229357
2015-02-16 06:17:51 +00:00
Jason Molenda c980fa92eb Change the default disassembly format again. First attempt at
changing it was in r219544 - after living on that for a few 
months, I wanted to take another crack at this.

The disassembly-format setting still exists and the old format
can be user specified with a setting like

${current-pc-arrow}${addr-file-or-load}{ <${function.name-without-args}${function.concrete-only-addr-offset-no-padding}>}: 

This patch was discussed in http://reviews.llvm.org/D7578

<rdar://problem/19726421>

llvm-svn: 229186
2015-02-13 23:24:21 +00:00
Ilia K a7e79c1b44 Fix build: revert r229148 "Fix argdumper build in cmake (OS X) after r228636" and r229159 "Fix build: make_symlink_darwin_debug passes 2 arguments into make_symlink, but it requires 4 arguments"
llvm-svn: 229166
2015-02-13 22:30:11 +00:00
Ilia K 14a92711ce Fix argdumper build in cmake (OS X) after r228636
Summary:
This patch fixes the following tests on OS X:

```
  FAIL: test_with_dsym (TestLaunchWithGlob.LaunchWithGlobTestCase)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 456, in wrapper
      return func(self, *args, **kwargs)
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 21, in test_with_dsym
      self.do_test ()
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 42, in do_test
      self.runCmd("process launch -G true -w %s -- fi*.tx?" % (os.getcwd()))
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 1953, in runCmd
      msg if msg else CMD_MSG(cmd))
  AssertionError: False is not True : Command 'process launch -G true -w /Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob -- fi*.tx?' returns successfully
  Config=x86_64-clang
  ======================================================================
  FAIL: test_with_dwarf (TestLaunchWithGlob.LaunchWithGlobTestCase)
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 473, in wrapper
      return func(self, *args, **kwargs)
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 28, in test_with_dwarf
      self.do_test ()
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob/TestLaunchWithGlob.py", line 42, in do_test
      self.runCmd("process launch -G true -w %s -- fi*.tx?" % (os.getcwd()))
    File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 1953, in runCmd
      msg if msg else CMD_MSG(cmd))
  AssertionError: False is not True : Command 'process launch -G true -w /Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/launch_with_glob -- fi*.tx?' returns successfully
```

Reviewers: epertoso, emaste, abidh, clayborg, zturner

Reviewed By: clayborg

Subscribers: abidh, lldb-commits, emaste, epertoso, zturner, clayborg

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

llvm-svn: 229148
2015-02-13 20:28:27 +00:00
Vince Harron 4a8abd3f94 Fix TestProcessIO.py when run against a remote target
Fixed test case to copy redirected stdout/stderr files from remote
target to host

llgs wasn't bothering to put the pty master file handle in the right
place if stdout/stderr were redirected to a file. It is still needed
for stdin.

Corrected some log message text

llvm-svn: 229141
2015-02-13 19:15:24 +00:00
Ilia K 069dafa4df Add test that checks (gdb) prompt in case of unknown command (MI)
llvm-svn: 229139
2015-02-13 19:13:42 +00:00
Ilia K 576a4a7ea4 Fix test_lldbmi_prompt test by enabling ShowPrompt in CMICmnStreamStdin by default
llvm-svn: 229137
2015-02-13 19:11:39 +00:00
Ilia K b4a110f051 Fix -data-read-memory-bytes command (MI)
Summary:
* Add IsHexadecimalNumber method to CMIUtilString (MI)
* Add number format (dec,hex,auto) to CMICmdArgValNumber (MI)
* Fix -data-read-memory-bytes to pass address in hex format (MI)
* Fix output begin/end/offset fields format in -data-read-memory-bytes
* Fix CMICmdArgValNumber::ExtractNumber to extract 64bit value
* + tests

All tests passed on OS X

Reviewers: abidh, zturner, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, zturner, clayborg, abidh

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

llvm-svn: 229132
2015-02-13 18:42:25 +00:00
Ilia K 8f37ca56d6 Add -exec-arguments command
Summary:
This patch adds -exec-arguments command for lldb-mi. -exec-arguments command allows to specify arguments for executable file in MI mode. Also it contains tests for that command.

Btw, new added files was formatted by clang-format.

Reviewers: abidh, zturner, clayborg

Reviewed By: clayborg

Subscribers: zturner, emaste, clayborg, jingham, lldb-commits

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

llvm-svn: 229110
2015-02-13 14:31:06 +00:00
Hafiz Abid Qadeer 095b128671 Fix for http://llvm.org/bugs/show_bug.cgi?id=21744
GetVariableInfo () collected the values of the variable in a list. But it also
tried to generate the name/value pairs for children. This caused generation of
a wrong value string for may items. This function has been fixed to put value in
the list only.

The handling of --print-value related option has been moved to caller.

GetVariableInfo2 and MIResponseFormVariableInfo3 have been removed. They were
almost the duplicate of functions of similar names. I dont see any difference in
the output of -stack-list-locals and -stack-list-arguments. So these functions
just seemed unnecessary.

Char variable was being printed as a string which caused garbage output. This has
been fixed.

Some misc. cleanup.

Test cases have been added that check -stack-list-locals for struct, array and
pointers. Modified other tests which depended on hard coded line numbers.

Reviewed in http://reviews.llvm.org/D7589

llvm-svn: 229102
2015-02-13 11:53:50 +00:00
Enrico Granata e0d951db44 I had recently added a new SBFrame::GetVariables() overload with yet another bool argument
We talked about it internally - and came to the conclusion that it's time to have an options class

This commit adds an SBVariablesOptions class and goes through all the required dance

llvm-svn: 228975
2015-02-12 23:09:17 +00:00
Jim Ingham e732052f16 Add an -A option to "break set -p" to search all files for matches. Also add the version of
SBTarget::BreakpointCreateBySourceRegex that takes file spec lists to the Python interface,
and add a test for this.

<rdar://problem/19805037>

llvm-svn: 228938
2015-02-12 17:37:46 +00:00
Hafiz Abid Qadeer 95170b1467 Fix the test on Linux.
The exception name that is thrown in Linux is different.
I have |ed it to the already existing one.

llvm-svn: 228932
2015-02-12 16:06:03 +00:00
Pavel Labath c2707bb883 Re-add makefiles of inline tests
llvm-svn: 228925
2015-02-12 14:43:35 +00:00
Ilia K 47448c2162 Except only EIO errors of OSError exception in Base.deletePexpectChild() in lldbtest.py after r227086
llvm-svn: 228877
2015-02-11 21:41:58 +00:00
Ilia K b52ec4d1d5 Clean up test/tools/lldb-mi/TestMiNotification.py (MI)
llvm-svn: 228804
2015-02-11 05:02:44 +00:00
Ilia K 83bdf32cf4 Fix segfault notification in lldb-mi
Summary:
This patch adds system exception handling in lldb-mi + tests.

All tests pass on OS X.

Reviewers: zturner, abidh, clayborg

Reviewed By: clayborg

Subscribers: emaste, lldb-commits, zturner, clayborg, abidh

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

llvm-svn: 228803
2015-02-11 04:58:41 +00:00
Ilia K 81b5c668ac Close terminal after LaunchInTerminalTestCase test
Summary:
The test_launch_in_terminal test leaves a running terminal.
This patch adds "exit" after debugging with eLaunchFlagLaunchInTTY flag.

Reviewers: jingham, zturner, clayborg

Reviewed By: clayborg

Subscribers: emaste, vharron, lldb-commits, clayborg, jingham, zturner

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

llvm-svn: 228801
2015-02-11 04:51:41 +00:00
Vince Harron df3f00f30a Fix 'process launch -i' for remote processes
We want to forward stdin when stdio is not disabled and when we're not
redirecting stdin from a file.

renamed m_stdio_disable to m_stdin_forward and inverted value because
that's what we want to remember.

There was previously a bug that if you redirected stdin from a file,
stdout and stderr would also be redirected to /dev/null

Adds support for remote target to TestProcessIO.py

Fixes ProcessIOTestCase.test_stdin_redirection_with_dwarf for remote
Linux targets

llvm-svn: 228744
2015-02-10 21:09:04 +00:00
Hafiz Abid Qadeer e73e82f2be Fix multiple problems of lldb-mi blocking on input monitoring and needing a return.
Summary:
One of the problem is reported here.
http://llvm.org/bugs/show_bug.cgi?id=22411

A fix was committed for this problem that works only for OSX. This revision
extends that fix to other system. The select system call has some limitation with
multi-threaded application which have been addresses here.

LLDB-mi exits if quit command is given but needs an extra retur if -gdb-exit is
given. That issue has also been addressed.

Reviewers: ki.stfu, emaste

Reviewed By: ki.stfu

Subscribers: lldb-commits

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

llvm-svn: 228709
2015-02-10 17:10:39 +00:00
Ilia K c4f7fdf571 Add thread-id field in *stopped notification (MI)
Summary:
Add thread-id field in *stopped notification (MI) + tests

All tests pass on OS X

Reviewers: zturner, clayborg, abidh

Reviewed By: clayborg

Subscribers: lldb-commits, zturner, clayborg, abidh

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

llvm-svn: 228681
2015-02-10 12:02:03 +00:00
Ilia K 536594f30e Add tests for -interpreter-exec command (MI)
llvm-svn: 228674
2015-02-10 06:35:58 +00:00
Enrico Granata af61b65f63 Add a test case for the launch via argdumper globbing mechanism
llvm-svn: 228659
2015-02-10 03:13:22 +00:00
Enrico Granata 89fdc9a61e Add a JSON producer to LLDB - this is a set of classes that encapsulate JSON objects and allow you to write them to a Stream for subsequent processing
Using this JSON producer, write a little tool that expands its own command-line arguments and dumps them to stdout as a JSON array

llvm-svn: 228636
2015-02-10 00:30:07 +00:00
Hafiz Abid Qadeer e372bda60f Fix MI notification test case on Linux.
This test case was checking for a specific stop reason which is different on
Linux. This caused the test to fail. It now only checks for stoppped. Also added
some more steps to run to main so that we dont pass when application has run to
completion.

llvm-svn: 228584
2015-02-09 18:14:01 +00:00
Pavel Labath 3f308ab127 Fix TestFdLeak.py on Mac.
bug introduced in D7466. For some reason target.Launch behaves differently on linux and mac.

llvm-svn: 228582
2015-02-09 17:42:47 +00:00
Hafiz Abid Qadeer dc0e4915b0 Fix test case for data-disassemble instruction in lldb-mi.
Previously the offset field showed the offset from the section base.
I have fixed it so that first disassembled instruction has offset of 0.
Also made a little modification in the test case to match the output coming
form the lldb-mi.

llvm-svn: 228577
2015-02-09 14:34:12 +00:00
Hafiz Abid Qadeer 7f7df8cba8 Fix test case failure on Linux.
The test case were failing becuase my test compiler was gcc. The generated
code behaved a bit differently to the how the test expected. Adjusted a few
lines so that it works on both gcc and clang.

llvm-svn: 228576
2015-02-09 13:54:51 +00:00
Ilia K 1f80267792 Remove forgotten file test/tools/lldb-mi/TestMiProgramArgs.py after r228286
llvm-svn: 228574
2015-02-09 13:18:24 +00:00
Pavel Labath b4bf1c65b7 Fix descriptor leak in multi-target debugging
Summary:
When debugging two targets concurrently, the pseude terminal master fd from the first one would
leak into the second. This fixes the problem by setting O_CLOEXEC on the master fd. Test
included.

Reviewers: clayborg, vharron

Subscribers: lldb-commits

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

llvm-svn: 228570
2015-02-09 11:37:56 +00:00
Hafiz Abid Qadeer 93ad6b31ec Fix a handling of full path in break-insert.
For some time, eclipse (CDT) uses full path of the file in break-insert command
when putting breakpoint on a source line. On windows, a typical command looks
like the following.
56-break-insert -f F:\\work\\ws\\test\\main.c:49

Current implementation in lldb-mi have problem in 2 ways.
1. It was assuming that there will be only one : in the path which is wrong if full
path is supplied.
2. CDT sends out path with double backslashes in windows which gives error on 
resolution.

Fixed the : issue in lldb-mi. Changed FileSpec::Normalize to make sure that it
handles the path with \\ correctly. Added test cases to check for full path in
both lldb-mi and lldb. Also added a test case to check SBFileSpec with double
slashes.

llvm-svn: 228538
2015-02-08 20:21:08 +00:00
Zachary Turner dc494d5303 Dont' use close_fds = True on Windows.
If you do, the test runner will fail immediately with the error:

close_fds is not supported on Windows platforms if you redirect
stdin/stdout/stderr.

llvm-svn: 228472
2015-02-07 00:14:55 +00:00
Ilia K 6af632f93c Fix a missing "*stopped" notification in LLDB-MI after "process launch -s" in case of remote-macosx
Summary:
This patch fixes *stopped notification for remote target when started with eLaunchFlagStopAtEntry (for example, using "process launch -s").

See explanation below:
```
Target::Launch (ProcessLaunchInfo &launch_info, Stream *stream)
{
...
if (state != eStateConnected && platform_sp && platform_sp->CanDebugProcess ())
{
   ...
}
else
{
   ...
   if (m_process_sp)
      error = m_process_sp->Launch (launch_info);
}

if (error.Success())
{
    if (launch_info.GetFlags().Test(eLaunchFlagStopAtEntry) == false)
    {
        ....
    }
    -- missing event if eLaunchFlagStopAtEntry is set --
    m_process_sp->RestoreProcessEvents ();
}
...
return error
```

Also this patch contains tests and you can check how it works.

Reviewers: zturner, clayborg, abidh

Reviewed By: clayborg

Subscribers: clayborg, abidh, zturner, lldb-commits

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

llvm-svn: 228417
2015-02-06 18:15:05 +00:00
Ilia K 5a62abf88e Fix ConvenienceVariablesCase.test_with_dsym_and_run_command test after r227285
Summary:
This fixes test_with_dsym_and_run_command and test_with_dwarf_and_run_commands tests after r227285: "SBThread::GetDescription should use the Thread format instead of making up"

log:
```
======================================================================
FAIL: test_with_dsym_and_run_command (TestConvenienceVariables.ConvenienceVariablesCase)
Test convenience variables lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 456, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 612, in wrapper
    func(*args, **kwargs)
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/embedded_interpreter/TestConvenienceVariables.py", line 18, in test_with_dsym_and_run_command
    self.convenience_variables()
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/embedded_interpreter/TestConvenienceVariables.py", line 83, in convenience_variables
    patterns = ['SBThread: tid = 0x[0-9a-f]+'])
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 2091, in expect
    msg if msg else EXP_MSG(str, exe))
AssertionError: False is not True : 'print lldb.thread
thread #1: tid = 0x80d885, 0x0000000100000f4d a.out`main(argc=1, argv=0x00007fff5fbff078) + 29 at main.c:4, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
' matches expected result
Config=x86_64-clang
======================================================================
FAIL: test_with_dwarf_and_run_commands (TestConvenienceVariables.ConvenienceVariablesCase)
      Test convenience variables lldb.debugger, lldb.target, lldb.process, lldb.thread, and lldb.frame.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 473, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 641, in wrapper
    func(*args, **kwargs)
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 612, in wrapper
    func(*args, **kwargs)
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 537, in wrapper
    func(*args, **kwargs)
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 537, in wrapper
    func(*args, **kwargs)
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/embedded_interpreter/TestConvenienceVariables.py", line 28, in test_with_dwarf_and_run_commands
    self.convenience_variables()
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/functionalities/embedded_interpreter/TestConvenienceVariables.py", line 83, in convenience_variables
    patterns = ['SBThread: tid = 0x[0-9a-f]+'])
  File "/Users/testuser/build/workspace/LLDB_master_release_OSX/llvm_master/tools/lldb/test/lldbtest.py", line 2091, in expect
    msg if msg else EXP_MSG(str, exe))
AssertionError: False is not True : 'print lldb.thread
thread #1: tid = 0x80d8d3, 0x0000000100000f4d a.out`main(argc=1, argv=0x00007fff5fbff078) + 29 at main.c:4, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
' matches expected result
Config=x86_64-clang
```


Reviewers: zturner, jingham, abidh, clayborg

Subscribers: abidh, lldb-commits, jingham, clayborg, zturner

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

llvm-svn: 228415
2015-02-06 18:11:56 +00:00
Ilia K 761a7a4b67 Fix evaluation commands (MI)
Summary:
These changes include:
* Fix -var-create to be able use current frame '*' (MI)
* Fix print-values option in -var-update (MI)
* Fix 'variable doesn't exist' error in -var-show-attributes (MI)
* Mark print-values option as 'handled-by-cmd' in -var-update (MI)
* Fix SBValue::GetValueDidChange if value was changed
* Fix lldb-mi: -data-evaluate-expression shows undef vars. Before this fix -data-evaluate-expression perceives undefined variables as strings:
```
(gdb)
-data-evaluate-expression undef
^done,value="undef"
```
* Minor fix: -data-evaluate-expression uses IsUnknownValue()
* Enable MiEvaluateTestCase test

All test pass on OS X.

Reviewers: abidh, clayborg

Subscribers: lldb-commits, clayborg, abidh

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

llvm-svn: 228414
2015-02-06 18:10:30 +00:00
Ilia K 1a0ec0f15d Fix -stack-list-locals and -stack-list-arguments (MI)
Summary:
These changes include:
* Add eVariableInfoFormat argument for MIResponseFormVariableInfo{,2,3} and GetVariableInfo{,2} functions
* Fix -stack-list-locals and -stack-list-arguments: they ingored print-values
* Enable MiStackTestCase tests for -stack-list-xxx commands

All test pass on OS X.

Reviewers: abidh, clayborg

Reviewed By: abidh

Subscribers: lldb-commits, clayborg, abidh

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

llvm-svn: 228412
2015-02-06 18:08:24 +00:00
Ilia K b792be8e79 Fix -data-list-register-names/-data-disassemble, minor fix in -data-list-register-values (MI)
Summary:
* Fix -data-list-register-names command: previously it ignored regno arguments and always showed all registers
* Add 'size' field to -data-disassemble command: now we are able to get an instruction's size
* Minor fix in -data-list-register-value: fix comments/code style
* Enable all tests in MiDataTestCase
* Fix the GetRegister function that gets an register by its index

These changes were tested on OS X; all MiDataTestCase tests were passed.

Reviewers: clayborg, abidh

Reviewed By: clayborg, abidh

Subscribers: clayborg, abidh, lldb-commits

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

llvm-svn: 228393
2015-02-06 12:43:05 +00:00
Ilia K 5fcdc2f7c3 Add a comment in tools/lldb-mi/TestMiExit.py after r228286
llvm-svn: 228324
2015-02-05 18:20:32 +00:00
Pavel Labath ef0d0c65f0 Check-in generated test makefiles
for rationale, see D7407.

llvm-svn: 228314
2015-02-05 17:03:22 +00:00
Pavel Labath 97a9ac1982 Avoid leaking log file descriptors into the inferior process.
Summary:
This commit adds a new open flag File::eOpenOptionCloseOnExec (i.e., O_CLOEXEC), and adds it to
the list of flags when opening log files (#ifndef windows). A regression test is included.

Reviewers: vharron, clayborg

Subscribers: lldb-commits

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

llvm-svn: 228310
2015-02-05 16:44:42 +00:00
Ed Maste 72b3b62fac In fd leak test report all open fds, not only first failure
llvm-svn: 228306
2015-02-05 16:11:33 +00:00
Hafiz Abid Qadeer cb8c3d789e Add and update lldb-mi tests.
This patch includes following changes:

Fix comments and code style
Add new tests for many commands
Improve existing tests
Merge MiProgramArgsTestCase and MiExecTestCase
Improve runCmd of MiTestCaseBase: add exactly option
Improve test example (make it more complicated)

Patch from ki.stfu. I xfailed some tests on Linux and also
added an empty command after -gdb-exit as it blocks without
it.

Patch was reviewed in http://reviews.llvm.org/D7410.

llvm-svn: 228286
2015-02-05 10:35:17 +00:00
Pavel Labath f81ed47a07 Clean up dependency .d.$$$$ files for tests
Summary:
Mac-only tests were leaving .d.$$$$ dependency files left in the test tree. This happened
because:
1) "make clean" was invoked although no tests in the folder were run
2) The Makefile had main.d as a dependency, which meant it tried to compile the source file (to extract
dependencies).
3) The compile failed (does not compile on linux) and left behind a main.d.$$$$ temporary file.
4) "make clean" tried to clean up these temporary files, but the expansion $(wildcard *.d.[0-9]*)
was performed before the temporary file was created, so this file was not caught.

I fix this by giving all the temporary files deterministic names, which makes it easier to clean
them up afterwards. I also make the rules for generating the dependency files more robust and
less likely to leak files in the first place.

Reviewers: vharron, zturner

Subscribers: lldb-commits

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

llvm-svn: 228285
2015-02-05 09:52:42 +00:00
Oleksiy Vyalov 1ef7b2c897 Extend SBPlatform with capability to launch/terminate a process remotely. Integrate this change into test framework in order to spawn processes on a remote target.
http://reviews.llvm.org/D7263

llvm-svn: 228230
2015-02-04 23:19:15 +00:00
Vince Harron fa03bac794 Get test/types tests passing on remote targets
redirecting output to a path that will work well on host or target.
copying file from output location to location on local host that
test will read from

llvm-svn: 228217
2015-02-04 22:25:34 +00:00
Greg Clayton 554f68d385 Get rid of Debugger::FormatPrompt() and replace it with the new FormatEntity class.
Why? Debugger::FormatPrompt() would run through the format prompt every time and parse it and emit it piece by piece. It also did formatting differently depending on which key/value pair it was parsing. 

The new code improves on this with the following features:
1 - Allow format strings to be parsed into a FormatEntity::Entry which can contain multiple child FormatEntity::Entry objects. This FormatEntity::Entry is a parsed version of what was previously always done in Debugger::FormatPrompt() so it is more efficient to emit formatted strings using the new parsed FormatEntity::Entry.
2 - Allows errors in format strings to be shown immediately when setting the settings (frame-format, thread-format, disassembly-format
3 - Allows auto completion by implementing a new OptionValueFormatEntity and switching frame-format, thread-format, and disassembly-format settings over to using it.
4 - The FormatEntity::Entry for each of the frame-format, thread-format, disassembly-format settings only replaces the old one if the format parses correctly
5 - Combines all consecutive string values together for efficient output. This means all "${ansi.*}" keys and all desensitized characters like "\n" "\t" "\0721" "\x23" will get combined with their previous strings
6 - ${*.script:} (like "${var.script:mymodule.my_var_function}") have all been switched over to use ${script.*:} "${script.var:mymodule.my_var_function}") to make the format easier to parse as I don't believe anyone was using these format string power user features.
7 - All key values pairs are defined in simple C arrays of entries so it is much easier to add new entries.

These changes pave the way for subsequent modifications where we can modify formats to do more (like control the width of value strings can do more and add more functionality more easily like string formatting to control the width, printf formats and more).

llvm-svn: 228207
2015-02-04 22:00:53 +00:00
Vince Harron c46945149c Fix TestTargetAPI.py when run against remote host.
In tests where stdio is redirected to a file, the file must be copied
back from the remote host for analysis by the test.

llvm-svn: 228175
2015-02-04 19:25:21 +00:00
Pavel Labath 9180f96cfe Have llgs tests output their traces into session dir
Summary: This reduces the bloat in the source tree and makes the tests more consistent.

Reviewers: vharron, zturner

Subscribers: lldb-commits

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

llvm-svn: 228134
2015-02-04 10:48:29 +00:00
Pavel Labath 493c3a127f Avoid leakage of file descriptors in LLDB and LLGS
Summary:
Both LLDB and LLGS are leaking file descriptors into the debugged process. This plugs the leak by
closing the unneeded descriptors. In one case I use O_CLOEXEC, which I hope is supported on
relevant platforms. I also added a regression test and plugged a fd leak in dosep.py.

Reviewers: vharron, clayborg

Subscribers: lldb-commits

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

llvm-svn: 228130
2015-02-04 10:36:57 +00:00
Enrico Granata decf03b68f Add an expectall() API that allows you to pass a list of patterns and have pexpect match *ALL* of them instead of just picking one
llvm-svn: 227938
2015-02-03 03:11:59 +00:00
Enrico Granata 3ea3b39319 Make it easier to see what's going on by tracing the test case
llvm-svn: 227936
2015-02-03 02:46:36 +00:00
Chaoren Lin a1f0ba7d38 Mark TestProcessLaunch.test_set_working_dir_with_dwarf as expected to fail in LLGS mode due llvm.org/pr20265
llvm-svn: 227927
2015-02-03 01:51:28 +00:00
Chaoren Lin 28e57429fc Share crash information between LLGS and local POSIX debugging with
CrashReason class. Deliver crash information from LLGS to lldb via
description field of thread stop packet.

llvm-svn: 227926
2015-02-03 01:51:25 +00:00
Chaoren Lin 72b8f05878 Mark several tests as XFAIL with new expectedFailureLLGS decorator since they are failing in Darwin for the same reason.
llvm-svn: 227925
2015-02-03 01:51:18 +00:00
Chaoren Lin 86fd8e45f4 Modify ThreadStateCoodrinator in order to resume threads if stop wasn't requested.
llvm-svn: 227924
2015-02-03 01:51:15 +00:00
Chaoren Lin 20433ae11b Fixed TestInferiorChanged
replaced expected stop reason 'address invalid' with 'signal SIGSEGV'

llvm-svn: 227921
2015-02-03 01:51:06 +00:00
Chaoren Lin 0c1463d4ea Fixed TestInferiorCrashing failures
LLGS debugging is outputting different thread stop reasons than
local linux debugging.  The stop reasons are reasonable so I've left
left them alone.  Might update them to match darwin in the future.

llvm-svn: 227920
2015-02-03 01:51:05 +00:00
Enrico Granata 9c3a07984f Allow customizing the timeout of the inferior
llvm-svn: 227906
2015-02-03 01:06:35 +00:00
Enrico Granata 9c58e8aac4 And, do not define arguments twice
llvm-svn: 227905
2015-02-03 01:00:44 +00:00
Enrico Granata 35dd52cf3e Allow pexpect exact matches
llvm-svn: 227904
2015-02-03 00:59:28 +00:00
Enrico Granata 18cf8e018a Some cleanup in lldbpexpect
llvm-svn: 227889
2015-02-02 23:03:37 +00:00
Enrico Granata 15c752f9fa Nice syntax typo in lldbpexpect
llvm-svn: 227887
2015-02-02 22:55:46 +00:00
Enrico Granata 78b7d5fab2 Add an helper class to write pexpect-based test cases
Over time, we should improve this class and port all pexpect based testing over to using this

llvm-svn: 227875
2015-02-02 22:12:39 +00:00
Ed Maste 655b59854f Adapt test for tid format on non-Darwin platforms
llvm-svn: 227580
2015-01-30 16:45:24 +00:00
Ed Maste 87ff93c0fd Restrict SigtrampUnwind test to Darwin only
It needs OS-specific knowledge and has not yet been adapted to other
systems.

llvm-svn: 227579
2015-01-30 16:33:02 +00:00
Ed Maste a8f3f76f63 Skip Objective-C test on non-Darwin platforms
llvm-svn: 227578
2015-01-30 16:31:07 +00:00
Greg Clayton d26a1e5060 Fixed the failing test:
./dotest.py -A x86_64 -C clang -v -t  -f TestImageListMultiArchitecture.test_image_list_shows_multiple_architectures

The problem was that if the platform wasn't compatible with the current file in the "target create" command, it wasn't finding a platform that was like it used to.

Also, the currently selected platform was being used upload the file _before_ the target was created which was incorrect as "target create a.out" might switch platforms if its architecture doesn't match, so I moved the uploading to happen after the target was created so we use the right platform (the one in the target, not the selected one).

llvm-svn: 227380
2015-01-28 22:08:17 +00:00
Enrico Granata 951bdd5f41 Move several GetByteSize() calls over to the brave new world of taking an ExecutionContext*
And since enough of these are doing the right thing, add a test case to verify we are doing the right thing with freeze drying ObjC object types

Fixes rdar://18092770

llvm-svn: 227282
2015-01-28 01:09:45 +00:00
Greg Clayton 56f455c9fc Added test case to make sure we don't regress on settings breakpoints by selector and with the various partially specified ObjC specified breakpoints.
This test tests the equivalent of:
    breakpoint set --name count
    breakpoint set --selector count
    breakpoint set --name isEqual:
    breakpoint set --selector isEqual:
    breakpoint set --name "-[MyClass(MyCategory) myCategoryFunction]"
    breakpoint set --name "-[MyClass myCategoryFunction]"
    breakpoint set --name "[MyClass myCategoryFunction]"

llvm-svn: 227271
2015-01-27 23:45:56 +00:00
Hafiz Abid Qadeer 692f5f3795 Clean lldb-mi test cases.
This patch adds lldbmi_testcase.MiTestCaseBase class and removes
a lot of repitition in the lldb-mi test cases. Also cleans import
list and code-style.

Presented for review in http://reviews.llvm.org/D7162.
Patch from Ilia K <ki.stfu@gmail.com>.

llvm-svn: 227218
2015-01-27 18:03:50 +00:00
Greg Clayton 199e7c125e Fix the test to disassemble as if at address zero, not at an invalid address. The default SBAddress constructor sets the offset to 0xffffffffffffffff and the section to NULL.
This was causing problems on clang 602 branches that use MemoryObjects to as the container for opcode bytes instead of a plain array of bytes. So we were asking for 3 bytes to be disassembled at address 0xffffffffffffffff which would cause an unsigned overflow and cause the MemoryObject to refuse to read anymore bytes.

llvm-svn: 227153
2015-01-27 00:22:36 +00:00
Enrico Granata 3de4971a7a Add an overload of SetValueFromCString() to ValueObjectSynthetic that is just a passthrough to the parent object
Without this overload, attempts to edit the value of a variable with synthetic children enabled would change the value inside the synthetic ValueObject, but not propagate the changes to the underlying storage, hence resulting in no write for any meaningful purpose

Comes with a test case, and fixes rdar://19586311

llvm-svn: 227120
2015-01-26 19:33:52 +00:00
Hafiz Abid Qadeer a73d1ce74f Also except OSError when terminating a child.
Ilia K <ki.stfu@gmail.com> sent this patch. He noted that it was possible for
child to be terminated after isAlive call and before we send it quit command.
In this case, sending command to it causes OSError. This patch just adds this
exception to the except list.

llvm-svn: 227086
2015-01-26 12:03:05 +00:00
Enrico Granata 953a3df779 Replace more runCmd('continue') with process control API.
llvm-svn: 226860
2015-01-22 20:53:04 +00:00
Oleksiy Vyalov 49b71c609c Make OSX test run firewall friendly.
http://reviews.llvm.org/D7115

llvm-svn: 226856
2015-01-22 20:03:21 +00:00
Enrico Granata 7a2421095c Add a benchmark test case that shows how much slower repeat 'continue' commands are than going through the SB API directly
llvm-svn: 226852
2015-01-22 19:33:53 +00:00
Enrico Granata e24b8a03b9 Speed these tests up quite significantly by using the SB API instead of running the "continue" command at each step
The reason why one mechanism is so much faster than the other (as in, ~10 seconds vs. ~1 minute) is quite baffling to me at the moment, but these are not process handling tests, so do what's faster

llvm-svn: 226730
2015-01-21 22:51:59 +00:00
Kate Stone 2136ace961 Fixed a makefile rule used by several tests
Now quotes dsymutil path, required when running tests where the toolchain is in a path that contains a space

llvm-svn: 226695
2015-01-21 19:30:00 +00:00
Zachary Turner 83887fb7dc Fix some platform specific paths in TestSettings.py.
We were referring to hardcoded paths /bin/ls and /bin/cat.  For
the purposes of this test, the actual value it's set to doesn't
matter, and it might as well be a non-existent path.  All that
matters is that the before and after values have to match, and
that trailing whitespace is stripped.  On Windows FileSpec
(correctly) converts /bin/ls to D:\bin\ls though, so the before
and after values won't match.  So this patch just correctly builds
up a valid path in a platform-agnostic manner, and verifies that
it matches before and after the set.

llvm-svn: 226625
2015-01-21 00:40:27 +00:00
Zachary Turner 0c426319f6 XFAIL pexpect tests on Windows.
At some point we will need to either provide a pexpect equivalent
on Windows, or provide some other method of doing out-of-process
tests.

Even with a pexpect replacement, it may be worth re-evaluating
some of these tests to see if they would be better served as
in-process tests.  The larger issue of coming up with a pexpect
replacement on Windows is tracked in http://llvm.org/pr22274.

llvm-svn: 226614
2015-01-20 22:36:03 +00:00
Ed Maste 135f6abd48 Fix help test cases after r226068
From: Ilia K <ki.stfu@gmail.com>
Differential Revision: http://reviews.llvm.org/D7066

llvm-svn: 226568
2015-01-20 15:13:01 +00:00
Jim Ingham d5ac1ab65d Fix a race condition where you could set the selected thread & target in the
CommandInterpreter's execution context AFTER the process had started running
and before it initially stopped.  Also fixed one test case that was implicitly
using this (and an abuse of the async mode) to accidentally succeed.

<rdar://problem/16814726>

llvm-svn: 226528
2015-01-19 23:51:51 +00:00
Zachary Turner 8f3f7beac4 During source manager test, write back the file using binary mode.
On Windows, opening with "w" opens it as text instead of binary.
This causes translation of newline characters, so that "\n" turns
into "\r\n", which in turn leads to git detecting that the file
has changed and wanting to commit it.

llvm-svn: 226220
2015-01-15 22:53:44 +00:00
Greg Clayton d237ae4b2f Fixed the regex test case after recent modifications to the "help" command output.
<rdar://problem/18527567>

llvm-svn: 226218
2015-01-15 22:52:17 +00:00
Jim Ingham d762df8c24 Make sure that when a breakpoint is hit but its condition is not met,
the hit count is not updated.
Also, keep the hit count for the breakpoint in the breakpoint.  We were
using just the sum of the location's hit counts, but that was wrong since if a shared library is
unloaded, and the location goes away, the breakpoint hit count should not suddenly drop
by the number of hits there were on that location.

llvm-svn: 226074
2015-01-15 01:41:04 +00:00
Zachary Turner 12947b7e25 Fix a number of tests on Windows.
These fix various issues with path handling and disable a few tests
which use features of LLVM which are not yet supported on Windows.

llvm-svn: 226042
2015-01-14 21:42:53 +00:00
Ed Maste 55f74e829b test: Add workaround for FreeBSD libedit vs readline issue
If stdout is not a terminal Python executes
    rl_variable_bind ("enable-meta-key", "off");

This produces a warning with FreeBSD's libedit because the
enable-meta-key variable is unknown.  Not an issue on Apple because
cpython commit f0ab6f9f0603 added a #ifndef __APPLE__ around the call.
See http://bugs.python.org/issue19884 for more information.

For now we just discard the warning output to get the tests working
again on FreeBSD.

llvm-svn: 226037
2015-01-14 20:32:33 +00:00
Jason Molenda 5155e5070c Don't run functionalities/tty under sudo / as root.
The terminal window will be opened under the ownership
of the real userid and it won't be able to open the
socket talking back to lldb -- the testsuite will hang
here.

The same thing probably should be done for lldb when run
on a remote system over ssh.  I added a line for that 
but commented it out for now because I haven't
tested it.

llvm-svn: 225748
2015-01-13 00:54:59 +00:00
Jason Molenda a05677126d Hoist the RegisterNumber class out of RegisterContextLLDB and make
it more generally available. 

Add checks to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite() so
that it won't try to augment an UnwindPlan that already describes
the function epilogue.

Add a test case for backtracing out of _sigtramp on Darwin systems.
This could probably be adapted to test the same thing on linux/bsd but 
the function names of sigtramp and kill are probably platform
specific and I'm not sure what they should be.

llvm-svn: 225578
2015-01-10 04:01:03 +00:00
Greg Clayton ad6b82dd53 Add C++ breakpoint tests where names are partially specified to ensure we don't regress on this again.
Top of tree never regressed, but we have internal branches that we constantly merge and we need to make sure we don't regress.

<rdar://problem/19429907>

llvm-svn: 225572
2015-01-10 01:35:02 +00:00
Siva Chandra 0f1b4997ce [TestInferiorAssert] Differentiate DWARF and DSYM tests with suffixes.
Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 225564
2015-01-10 00:25:23 +00:00
Stephane Sezer 24a14c93e6 Modify dotest.py to be able to run without an lldb build.
Summary: This will ease llgs development a bit by not requiring an lldb/lldb.py build to launch the tests. Also, we can now use LLDB_DEBUGSERVER_PATH to point to a debug server to use to run the tests. I used that to point to a ds2 build and run llgs tests against ds2.

Reviewers: clayborg, tfiala, vharron

Subscribers: lldb-commits

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

llvm-svn: 225549
2015-01-09 21:54:27 +00:00
Greg Clayton b547278cae Fixed an issue where you couldn't delete a user defined regex, python, or multi-word command by adding a new "command delete" command.
This new command will delete user defined regular commands, but not aliases. We still have "command unalias" to remove aliases as they are currently in different buckets. Appropriate error messages are displayed to inform the user when "command unalias" is used on removable user defined commands that points users to the "command delete" command.

Added a test to verify we can remove user defined commands and also verify that "command unalias" fails when used on a user defined command.
<rdar://problem/18248300>

llvm-svn: 225535
2015-01-09 19:08:20 +00:00
Siva Chandra 311c7db8e3 [InlineTest] getRerunArgs returns an empty string if the test was skipped.
Summary:
The main issue that this patch is trying to address is that the current
implementation of getRerunArgs of InlineTest relies on the attribute
'using_dsym' which could be absent if the test was skipped altogether.
[That is, if both dsym and dwarf tests were skipped.]

While at it, the use of deprecated Python module 'new' is eliminated.

Test Plan: [Linux] dotest.py -p TestExprPathSynthetic

Reviewers: vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 225496
2015-01-09 01:54:44 +00:00
Enrico Granata 9aa7e8e9ff Dynamic values have been around (and stable and reliable) for long enough that we can turn them on by default
Change the default of prefer-dynamic-value to eDynamicDontRunTarget (i.e. enable dynamic values, but do not run code to do so)

Of course, disable this for the test suite, since testing no-dynamic-values is actually valuable

Fixes rdar://17363061

llvm-svn: 225486
2015-01-09 00:47:24 +00:00
Enrico Granata 20c321caf8 This patch fixes my think-o in ValueObject::UpdateValueIfNeeded() about the right thing to assert()
It also comes with a (rudimentary) test case that gets itself in a failed update scenario, and checks that we don't crash
This is the easiest case I could think of that forces the failed update case Zachary was seeing

llvm-svn: 225463
2015-01-08 19:11:43 +00:00
Vince Harron ede5965b2a Added documentation for test timeout
Differential Revision: http://reviews.llvm.org/D6669

Submitted for Chaoren Lin

llvm-svn: 225425
2015-01-08 02:11:26 +00:00
Greg Clayton 7099558499 Fix inlined test cases so they print out the correct command to run when they fail instead of printing out incorrect information.
To fix this I added a new method to TestBase:

    def getRerunArgs(self):
        return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
        
The InlineTest which inherits from TestBase then overrides this function with a custom version which does the right thing.

llvm-svn: 225407
2015-01-07 22:25:50 +00:00
Greg Clayton 8646421daa Added a test case for launching a process in a separate terminal window to ensure we don't regress on this.
A recent POSIX host thread issue where HostThreadPosix::Join() wasn't returning the thread result was responsible for this regression, yet we had no test case covering this so it wasn't discovered.

llvm-svn: 225284
2015-01-06 19:17:58 +00:00
Siva Chandra 89ce955a32 Make array symbol reading resilient to incomplete DWARF.
Summary:
GCC emits DW_TAG_subrange_type for static member arrays, but with no
attributes. This in turn results in wrong type/value of the array when
printing with 'target variable <array var name>'. This patch fixes this
so that the array value is printed in this format:

    (<element type> []) <array var name> = {}

Earlier, the array was being interpreted to be of its element type.

Note: This does not fix anything to do with 'expr' or 'p' commands.
Those commands still error out complaining about incomplete types.

Test Plan: dotest.py -p TestStaticVariables

Reviewers: emaste, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 225219
2015-01-05 23:06:14 +00:00
Zachary Turner f6896b09b4 Fix about 20 tests on Windows.
Passing the argument string from dosep to dotest was failing on
Windows due to the fact that Windows uses \ for its path separator.
As a result, shlex.split() was treating it as an escape character.
This fixes the issue by telling shlex.split() to not use posix mode
when running on Windows.

llvm-svn: 225195
2015-01-05 19:37:03 +00:00
Hafiz Abid Qadeer bd48bdad50 Cleanup lldb-mi test cases.
Following changes were done.
1. Remove the extra line after -exec-run.
2. Remove check for prompt.
3. Remove 'quit' command. 

Initial patch was contributed by ki.stfu@gmail.com.

llvm-svn: 224990
2014-12-30 17:11:31 +00:00
Siva Chandra aaa3d47863 [TestEvents] Replace expectedFailureLinux with skipIfLinux
Summary:
If we do not mark them as skip, they are still executed, which in
turn is leading to an assertion failure. The change also adds
skipIfLinux to a testlet which was not previously marked with
skipIfLinux. This is because running even that test let leads to an
assertion failure.

Test Plan: dotest.py -C clang -p TestEvents.py

Reviewers: vharron

Reviewed By: vharron

Subscribers: lldb-commits

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

llvm-svn: 224644
2014-12-19 22:41:43 +00:00
Siva Chandra 5ab2e07231 [TestStaticVariables] Mark the one unmarked test let also expectedFailure.
Summary:
The test is question here is already annotated
with @expectedFailureDarwin(9980907).

This change also removes an uneccessary (and probably wrong) logic of
byssing few asserts if the compiler is not clang or llvm-gcc.

Both GCC and Clang emit incomplete debug info. Clang emits this:

< 1><0x00000026>    DW_TAG_class_type
                      DW_AT_name                  "A"
                      DW_AT_byte_size             0x00000001
                      DW_AT_decl_file             0x00000001
                      DW_AT_decl_line             0x0000001b
< 2><0x0000002e>      DW_TAG_member
                        DW_AT_name                  "g_points"
                        DW_AT_type                  <0x0000003b>
                        DW_AT_decl_file             0x00000001
                        DW_AT_decl_line             0x0000001e
                        DW_AT_external              yes(1)
                        DW_AT_declaration           yes(1)
                        DW_AT_accessibility         DW_ACCESS_public
< 1><0x0000003b>    DW_TAG_array_type
                      DW_AT_type                  <0x00000046>
< 2><0x00000040>      DW_TAG_subrange_type
                        DW_AT_type                  <0x0000007b>

Notice that the DIE at 0x40 does not specify an upperbound. This is with
Clang-3.5 and Clang ToT.

GCC emits this:

< 1><0x000000aa>    DW_TAG_class_type
                      DW_AT_name                  "A"
                      DW_AT_byte_size             0x00000001
                      DW_AT_decl_file             0x00000001
                      DW_AT_decl_line             0x0000001b
                      DW_AT_sibling               <0x000000c1>
< 2><0x000000b4>      DW_TAG_member
                        DW_AT_name                  "g_points"
                        DW_AT_decl_file             0x00000001
                        DW_AT_decl_line             0x0000001e
                        DW_AT_type                  <0x000000c1>
                        DW_AT_external              yes(1)
                        DW_AT_accessibility         DW_ACCESS_public
                        DW_AT_declaration           yes(1)
< 1><0x000000c1>    DW_TAG_array_type
                      DW_AT_type                  <0x0000007e>
                      DW_AT_sibling               <0x000000cc>
< 2><0x000000ca>      DW_TAG_subrange_type

The DIE at 0xca is missing attributes. This is with gcc-4.8.2.

Test Plan: dotest.py -C clang -P TestStaticVariables.py

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 224643
2014-12-19 22:40:05 +00:00
Siva Chandra f010d23497 [TestCompletion] Spawn LLDB with '--no-use-colors'.
Summary:
TestCompletion was broken for Ubuntu (and probably for Debian also).
The issue was that the lldb prompt in color (which is the default
behavior) was confusing pexpect.

Test Plan: "http://199.223.233.39:8011/lldb-try-clang-build-clang-test/"

Reviewers: zturner, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 224642
2014-12-19 22:37:23 +00:00
Zachary Turner 54fa73afed Don't generate lldb inline test Makefiles if Makefile already exists.
Differential Revision: http://reviews.llvm.org/D6664
Reviewed by: Sean Callanan

llvm-svn: 224593
2014-12-19 18:26:33 +00:00
Zachary Turner 3e9ca3a625 Delete MSVC intermediate files on "make clean" from tests.
lld-link shells out to MSVC for certain types of work, and this
results in some MSVC output files being generated even though
clang / lld are the compiler / linker.  This is expected, so we
make sure to clean these output files on make clean.

llvm-svn: 224345
2014-12-16 16:48:19 +00:00
Hafiz Abid Qadeer 547cb78774 Fixed 2 typos in help.
llvm-svn: 224331
2014-12-16 10:20:35 +00:00
Greg Clayton a2162b3166 If a binary was stripped we sometimes didn't show the ivars of an Objective C class correctly. Now we do as we consult the runtime data for the class so we don't have to have a symbol in the symbol table.
Fixed:
1 - try the symbol table symbol for an ObjC ivar and use it if available
2 - fall back to using the runtime data since it is slower to gather via memory read
3 - Fixed our hidden ivars test case to test this to ensure we don't regress
4 - split out a test case in the hidden ivars to cover only the part that was failing so we don't have an expected failure for all of the other content in the test.

<rdar://problem/18882687>

llvm-svn: 224306
2014-12-16 01:33:17 +00:00
Enrico Granata cf87ab9390 Now that AddressOf() does sane things with const results, this check is wrong. Since this is actually quite orthogonal to what this test is all about, actually get rid of the assertions
llvm-svn: 224290
2014-12-15 23:36:23 +00:00
Vince Harron 17f429f462 Tests will timeout if they exceed time limit.
Default time limit is 5 minutes.

Override the default timeout of 5 minutes with LLDB_TEST_TIMEOUT.
LLDB_TEST_TIMEOUT=10m

Override the timeout for individual tests with LLDB_[TESTNAME]_TIMEOUT.
E.g., LLDB_TESTCONCURRENTEVENTS_TIMEOUT=2m

Set to "0" to run without timeout.

Submitted for Chaoren Lin

llvm-svn: 224171
2014-12-13 00:08:19 +00:00
Enrico Granata fea9039511 Some more cleanup of the ValueObjectConstResultImpl code. NFC.
llvm-svn: 224160
2014-12-12 22:37:44 +00:00
Enrico Granata 53d498bc66 Fix up this test case
llvm-svn: 224157
2014-12-12 22:11:32 +00:00
Enrico Granata 15ee703045 Add a test case to validate that AddressOf() and GetLoadAddress() work on a ValueObjectConstResult. This test passing is the baseline of functionality we want to ensure for our const results
llvm-svn: 224151
2014-12-12 21:23:55 +00:00
Zachary Turner 555a7a6ad2 Add a method to disable the Windows crash / assert dialogs.
When running the test suite on Windows, we can't have Windows popping
up dialogs when LLDB crashes in native code because it will hang
the test suite.  This patch silences those dialogs by checking an
environment variable at startup and configuring Windows based on
its value.

This patch also adds an environment variable to force inferiors to
never spawn in their own console window.  This is useful to prevent
new window spawm when running the test suite.

Reviewed by: Scott Graham

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

llvm-svn: 224137
2014-12-12 18:10:52 +00:00
Zachary Turner 29278a6ac4 Disable the remaining ProcessIO test on Windows.
This still relies on PutSTDIN, just indirectly.  So it was hanging
due to not being able to get stdin from the test.

llvm-svn: 223983
2014-12-10 23:25:28 +00:00
Oleksiy Vyalov b9321bd774 Skip TestExprPathSynthetic test on FreeBSD, Linux & Windows.
llvm-svn: 223905
2014-12-10 01:48:17 +00:00
Zachary Turner 1b0b3e7e9c Disable data formatter tests on Windows.
clang does not yet support MS-ABI record layout for externally-sourced
ASTs.  As a result, attempting to format something that requires data
layout results in undefined behavior in clang, in this case an assert.

http://llvm.org/pr21800 tracks fixing this on the clang side.

llvm-svn: 223868
2014-12-10 00:39:17 +00:00
Enrico Granata 986fa5f4eb Extend ValueObject::GetExpressionPath() to do something reasonable for synthetic children
Because of the way they are created, synthetic children cannot (in general) have a sane expression path

A solution to this would be letting the parent front-end generate expression paths for its children
Doing so requires a significant amount of refactoring, and might not always lead to better results (esp. w.r.t. C++ templates)

This commit takes a simpler approach:
- if a synthetic child is of pointer type and it's a target pointer, then emit *((T)value)
- if a synthetic child is a non-pointer, but its location is in the target, then emit *((T*)loadAddr)
- if a synthetic child has a value, emit ((T)value)
- else, don't emit anything

Fixes rdar://18442386

llvm-svn: 223836
2014-12-09 21:41:16 +00:00
Zachary Turner 80c2c60f36 XFAIL all of TestInferiorAssert.py tests on Windows.
Getting this working correctly is a significant amount of work.
Assertions on Windows show up as error code 0xC0000409, which is
STATUS_STACK_BUFFER_OVERRUN.  In order to accurately determine
that this is not just any stack buffer overrun, but one triggered
by a call to abort, we would need to analyze the call stack.  This
in turn requires better symbol support for Windows executables,
and work on LLDB to make stack frames better on Windows.

For now, these are XFAIL'ed and tracked in http://llvm.org/pr21793.

llvm-svn: 223816
2014-12-09 19:28:00 +00:00
Jim Ingham e72bf20687 Simple test for file & line dummy breakpoints.
llvm-svn: 223731
2014-12-09 01:28:22 +00:00
Enrico Granata 0c10a85000 Add the ability for an SBValue to create a persisted version of itself.
Such a persisted version is equivalent to evaluating the value via the expression evaluator, and holding on to the $n result of the expression, except this API can be used on SBValues that do not obviously come from an expression (e.g. are the result of a memory lookup)

Expose this via SBValue::Persist() in our public API layer, and ValueObject::Persist() in the lldb_private layer

Includes testcase

Fixes rdar://19136664

llvm-svn: 223711
2014-12-08 23:13:56 +00:00
Zachary Turner 57ee6d67cc Fix platform shell test to run "dir c:\" instead of "ls /" on Windows.
llvm-svn: 223700
2014-12-08 21:50:05 +00:00
Hafiz Abid Qadeer 290ece8278 Fix a bug where global variable can be reported as local.
There was an error in ORing mask which is used for getting a list of variables.
Previously, these constants were unnamed, and possible it become the reason of this
bug. Also added test case for -stack-list-local and -stack-list_arguments.

Patch from Ilia K <ki.stfu@gmail.com>.

llvm-svn: 223674
2014-12-08 18:07:40 +00:00
Stephane Sezer 7a1d22a2af Fix a crash in dotest.py when the lldb executable is not built.
Summary: If lldb is not built, dotest.py throws an exception because we are using an unset variable.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 223446
2014-12-05 05:02:41 +00:00
Vince Harron 41b3f630d7 Reverting r223423, test timeout
Was causing dosep to hang in some cases.

llvm-svn: 223441
2014-12-05 02:06:03 +00:00
Vince Harron de0d41fb4d Kill any python test script that takes more than 5 minutes
There is at least one test that hangs on the Linux debian buildbot.

When that test hangs, the buildbot kills dosep which loses all test
results.  This change kills just the hung test and should let us see
which test is hanging.  This is useful for that test and any others
in the future which start hanging.

llvm-svn: 223423
2014-12-05 00:23:03 +00:00
Zachary Turner be40b2f1b2 Fix broken test suite on Windows after r223091.
Differential Revision: http://reviews.llvm.org/D6484
Reviewed by: Oleksiy Vyalov

llvm-svn: 223155
2014-12-02 21:32:44 +00:00
Oleksiy Vyalov a3ff6af484 Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment - make lldbtest.registerSharedLibrariesWithTarget to support multiple platforms.
http://reviews.llvm.org/D6392

llvm-svn: 223091
2014-12-01 23:21:18 +00:00
Zachary Turner e068d91824 Link test executables with LLD on Windows.
Clang generates DWARF debug info with section names longer
than 8 characters.  This is only supported by an extension
to PE/COFF which the MSVC linker doesn't implement.  So
trying to link DWARF-enabled object files with MSVC will
lead to corrupt debug information in the executable.

llvm-svn: 223088
2014-12-01 23:13:41 +00:00
Hafiz Abid Qadeer e7914cfb0e Add test for MI tokens.
This file tests the sequence of digits that can come before
an MI command.

Patch from dawn@burble.org.

llvm-svn: 222873
2014-11-27 09:19:46 +00:00
Oleksiy Vyalov dc4067c852 Fix several test failures on Linux/FreeBSD caused by compiler configuration and invalid environment.
http://reviews.llvm.org/D6392

llvm-svn: 222845
2014-11-26 18:30:04 +00:00
Hafiz Abid Qadeer be6992c7d3 Improve lldb-mi tests.
summary of changes:
  Cleanup: Use "line_number" API instead of hardcoded source lines
  Combine child.sendline with previous child.send command.
  test_lldbmi_tokens: Add test for MI tokens.
  test_lldbmi_badpathexe: Remove check for prompt so test for bad path can be enabled.

Patch from dawn@burble.org.

llvm-svn: 222838
2014-11-26 16:37:51 +00:00
Zachary Turner 82da55fe57 Disable GetSTDOUT, GetSTDERR, and PutSTDIN on Windows.
These methods are difficult / impossible to implement in a way
that is semantically equivalent to the expectations set by LLDB
for using them.  In the future, we should find an alternative
strategy (for example, i/o redirection) for achieving similar
functionality, and hopefully deprecate these APIs someday.

llvm-svn: 222775
2014-11-25 19:03:08 +00:00
Hafiz Abid Qadeer 1cbac4e94f Add initial lldb-mi tests.
Test 'test_lldbmi_interrupt' is only enabled for Darwin as
it seems to cause a timeout error on Linux.
Patch from dawn@burble.org.

llvm-svn: 222750
2014-11-25 10:41:57 +00:00
Siva Chandra 51aba6ffa9 Mark 9 lldb unit tests for ubuntu as XFAIL.
The following lldb unit tests fail check-lldb on ubuntu:

TestDataFormatterStdMap.py
TestDataFormatterStdVBool.py
TestDataFormatterStdVector.py
TestDataFormatterSynthVal.py
TestEvents.py
TestInitializerList.py
TestMemoryHistory.py
TestReportData.py
TestValueVarUpdate.py

These unit test failures are for non-core functionality. The intent is to
reduce the check-lldb FAILS to core functionality FAILS and then circle
back later and fix these FAILS at a later date.

llvm-svn: 222608
2014-11-22 05:55:00 +00:00
Greg Clayton 39766d9eda Remove print statement that was accidentally left in.
llvm-svn: 222589
2014-11-21 23:34:35 +00:00
Shawn Best d64bc4bee6 fix Bug21211 : reworked test/api/multithreaded/test_listener_event_description.cpp to work properly on Linux/FreeBSD
Issue D5632 fixed an issue where linux would dump spurious output to tty on startup (due to a broadcast stop event). After the checkin, it was noticed on FreeBSD a unit test was now failing. On closer investigation I found the test was using the C++ API to launch an inferior while using an SBListener to monitor the public state changes. As on OSx, it was expecting to see:

eStateRunning
eStateStopped

On Linux/FreeBSD, there is an extra state change

eStateLaunching
eStateRunning
eStateStopped

I reworked the test to work for both cases and re-enabled the test of FreeBSD.

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

llvm-svn: 222511
2014-11-21 06:49:39 +00:00
Ed Maste cec2a5b270 Rework parallel test process count logic
The default value for opt.thread_count was multiprocessing.cpu_count(),
which meant the LLDB_TEST_THREADS environment variable was never used.
It's not easy to pass the -t option to the test run when invoking it
from e.g. 'ninja check-lldb', so having the environment variable as an
option is useful.

Change the logic so that the thread count is set by the first one of:

  1. The -t option to test/dosep.py
  2. The LLDB_TEST_THREADS environment variable
  3. The machine's CPU count from multiprocessing.cpu_count()

llvm-svn: 222501
2014-11-21 02:41:25 +00:00
Jim Ingham c57059059d Add a test for the driver's "-k" option.
llvm-svn: 222484
2014-11-21 00:14:57 +00:00
Ed Maste 365eb05c70 Remove decorator for FreeBSD test that now passes
llvm-svn: 222449
2014-11-20 19:43:33 +00:00
Ed Maste 55f410bf16 Add decorator for FreeBSD failure
llvm.org/pr21620

llvm-svn: 222442
2014-11-20 18:56:11 +00:00
Stephane Sezer b6e8192a85 Properly specify a few checksum values for llgs tests.
Summary: In noack mode, these checksums are ignored by llgs, but some implementations need them still. Specify these checksums to ease integration.

Test Plan: Run the tests before and after the change and make sure nothing breaks.

Reviewers: clayborg, tfiala

Subscribers: lldb-commits

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

llvm-svn: 222441
2014-11-20 18:50:46 +00:00