Commit Graph

10419 Commits

Author SHA1 Message Date
Enrico Granata 67391b6904 Fix a couple typos in the previous commit
llvm-svn: 228762
2015-02-10 23:17:07 +00:00
Enrico Granata bb557065f6 Add an LLDB summary for CMTime. Fixes rdar://15370376
llvm-svn: 228759
2015-02-10 23:02:25 +00:00
Oleksiy Vyalov 37386143b8 Extract attach core logic from SBTarget::Attach* methods into unified SBTarget::AttachToProcess and make it work with platform for remote attach purposes.
http://reviews.llvm.org/D7471

llvm-svn: 228757
2015-02-10 22:49:57 +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
Greg Clayton a03b9389ca Don't crash when evaluating a DWARF expression has a DW_OP_bra with nothing on the value stack.
<rdar://problem/18919125>

llvm-svn: 228729
2015-02-10 19:43:15 +00:00
Chaoren Lin c30c49c420 Failsafe directory for shared objects and support executables.
llvm-svn: 228716
2015-02-10 18:30:34 +00:00
Chaoren Lin 03d30fc7bc Adding x86 to supported architectures on x86_64.
llvm-svn: 228715
2015-02-10 18:30:31 +00:00
Hafiz Abid Qadeer df70d8460e Fix build on Windows which was broken by a recent commit.
This file MICmnStreamStdinLinux.cpp is wrongly added in the windows build.
It has no use there. CMakeList.txt for lldb-mi needs to be re-factored to
include the right file for each build. This is quick fix to un-break the build.

llvm-svn: 228714
2015-02-10 18:12:44 +00:00
Sylvestre Ledru 57958b5d35 Fix the LLDB build under Debian Kfreebsd
Summary:
I don't know if there is a better way for the change in source/Host/freebsd/ThisThread.cpp


Reviewers: emaste

Subscribers: hansw, emaste, lldb-commits

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

llvm-svn: 228710
2015-02-10 17:16:13 +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
Greg Clayton cc8913cc6b Fixed a problem where we might omit some breakpoints when using DWARF in .o files.
The problem occurred when we had incorrect address ranges in the debug map that included the padding between functions causing the end address of a line table entry to fall into an inlinked (next function) address range.

<rdar://problem/19721144>

llvm-svn: 228707
2015-02-10 16:53:40 +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 c11b101fb6 And make the globbing behavior available via the SB API
llvm-svn: 228660
2015-02-10 03:16:55 +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 d7a83a9c66 Add a "launch with globber" mode that lets you launch a process after having globbed the command line arguments via argdumper instead of routing via /bin/sh
llvm-svn: 228658
2015-02-10 03:06:24 +00:00
Chaoren Lin be270c1c60 Add JSON.cpp to CMakeLists.txt
llvm-svn: 228639
2015-02-10 00:47:43 +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
Zachary Turner bf0f2b9b3a Dont' use O_CLOEXEC on Windows, since it doesn't exist.
llvm-svn: 228590
2015-02-09 19:13:46 +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
Justin Hibbits f9ee7e4ceb Fix sorting. Spotted by emaste.
llvm-svn: 228549
2015-02-08 21:34:29 +00:00
Justin Hibbits 2559abdaa1 PowerPC64 host also supports 32-bit binaries, so note it.
llvm-svn: 228548
2015-02-08 21:23:27 +00:00
Justin Hibbits 5c0b98e205 Fix off-by-one IsGPR().
f0 was being counted as a GPR, due to the check in IsGPR().  Correct it by
looking at the precise GPR range.

llvm-svn: 228547
2015-02-08 21:23:23 +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
Jason Molenda 75452e8c5c When creating a disassembler for one of the arm variants that can
only execute thumb instructions, force the arch triple string to
be "thumbv..." instead of "armv..." so we do the right thing by
default when disassembling arbitrary chunks of code.
<rdar://problem/15126397> 

llvm-svn: 228486
2015-02-07 06:03:49 +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
Oleksiy Vyalov 8379068941 Make lldb-platform to clear m_process_launch_info when hanlding qProcessInfo request - otherwise subsequent process launches will reuse data from previous launch.
llvm-svn: 228430
2015-02-06 19:56:33 +00:00
Vince Harron e0be425a53 Add support for SBProcess::PutSTDIN to remote processes
Processes running on a remote target can already send $O messages
to send stdout but there is no way to send stdin to a remote
inferior.

This allows processes using the API to pump stdin into a remote
inferior process.

It fixes a hang in TestProcessIO.py when running against a remote
target.

llvm-svn: 228419
2015-02-06 18:32:57 +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 56e271568f Fix darwin-debug installation in cmake (OS X)
Summary: Fix darwin-debug installation in cmake (OS X)

Reviewers: zturner, clayborg

Subscribers: lldb-commits, zturner, clayborg

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

llvm-svn: 228416
2015-02-06 18:13:10 +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
Pavel Labath 3a2da9eb0d Fix TestProcesslaunch regression caused by D7372
Summary:
After closing all the leaked file descriptors to the inferior tty, the following problem occured:
- when stdin, stdout and stderr are redirected, there are no slave descriptors open (which is good)
- lldb has a reader thread, which attempts to read from the master end of the tty
- this thread receives an EOF
- in response, it closes it's master end
- as this is the last open file descriptor for the master end, this deletes the tty and sends
  SIGHUP to the inferior (this is bad)

I fix this problem by making sure the master end remains open for the duration of the inferior
process by storing a copy of the file descriptor in ProcessMonitor. I create a copy to avoid
ownership issues with the reading thread.

Reviewers: ovyalov, emaste

Subscribers: lldb-commits

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

llvm-svn: 228391
2015-02-06 11:32:52 +00:00
Hafiz Abid Qadeer be86bb1e6a Give error on "-inferior-tty-set" command.
This command is not implemented yet. Giving error gives chance to clients to
handle it properly instead of falsely assuming the lldb-mi is supporting it.

llvm-svn: 228389
2015-02-06 11:06:41 +00:00
Tamas Berghammer d858487edd Fix build of lldb-gdbserver and lldb-platform for android (arm32, x86)
* Fix cmake script for android x86
* Reorder includes to avoid collision between system macros and local
  variables in clang framework

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

llvm-svn: 228388
2015-02-06 10:57:40 +00:00
Tamas Berghammer 5830aa755b Fix TestThreadSpecificBreakpoint with LLGS
* Set the state of the process into running/stepping on continue/step operations
* Add mutex to use transactions in Thread State Coordinator
** It is required because the events from two Signal Handler or form a Signal handler and a Resume request shouldn't overlap
* Send Stop Replay Packet only when the state of the process changed

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

llvm-svn: 228387
2015-02-06 10:42:33 +00:00
Bruce Mitchener 2ba84a6af7 Add additional DWARF 5 language constants.
This also hooks up the new C++14 language constant to be treated
the same as the other C++ language constants.

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

llvm-svn: 228386
2015-02-06 06:46:52 +00:00
Jim Ingham 9bdea541ca Add a "-a/--address" option to "thread until". You can specify one or more line numbers (as arguments)
and/or one or more addresses (with -a) and until will stop at the first one of  thesepoints it hits,
or on exit from the function if you leave the function before hitting any of these stop points.

<rdar://problem/12438270>

llvm-svn: 228370
2015-02-06 02:10:56 +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
Ilia K 13f77bdc02 Test commit
llvm-svn: 228315
2015-02-05 17:25:01 +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
Oleksiy Vyalov 4536c458e1 Fix warning about the use of mktemp and make platform agnostic by adding and using PipeBase::CreateWithUniqueName - on behalf of flackr.
http://reviews.llvm.org/D7348

llvm-svn: 228307
2015-02-05 16:29:12 +00:00