Commit Graph

10345 Commits

Author SHA1 Message Date
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
Enrico Granata 1a4d078583 Fix a problem where a ValueObject could fail to update itself, but since it was previously valid, we'd have an old checksum to compare aginst no new checksum (because failure to update), and assert() and die. Fix the problem by only caring about this assertion logic if updates succeed
llvm-svn: 225418
2015-01-08 00:29:12 +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
Vince Harron 878a2ce554 lldb-platform - static link all llvm dependencies
Differential Revision: http://reviews.llvm.org/D6797

lldb-gdbserver statically links all llvm dependencies. This allows
dead stripping code and reduces total binary size.

This change modifies lldb-plaform to static link llvm dependencies
like lldb-gdbserver.

llvm-svn: 225398
2015-01-07 21:35:07 +00:00
Oleksiy Vyalov 0ddd41cd2d Make DynamicLoaderPOSIXDYLD::DidAttach to deduce a target executable by pid if no executable hasn't been assigned to a target so far.
http://reviews.llvm.org/D6740

llvm-svn: 225332
2015-01-07 01:28:37 +00:00
Vince Harron 3218c0fb94 Adds UriParser::Parse and unit tests
This can be used to parse URIs passed to 'platform connect'

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

llvm-svn: 225317
2015-01-06 23:38:24 +00:00
Greg Clayton 009597d048 Fix needed for the new terminal test I previously checked in. It was crashing due to a NULL dereference.
llvm-svn: 225316
2015-01-06 23:33:34 +00:00
Ed Maste b8602af602 Put FreeBSD note types in their own namespace
Note types are inherently OS-specific, but some note type names are
common to both FreeBSD and Linux. 

llvm-svn: 225299
2015-01-06 22:13:48 +00:00
Zachary Turner c8761f4807 Remove a lock acquisition from ProcessWindows::OnExitProcess.
This was causing a race condition where DoDestroy() would acquire
the lock and then initiate a shutdown and then wait for it to
complete.  But part of the shutdown involved acquiring the same
lock from a different thread.  So the main thread would timeout
waiting for the shutdown to complete and return too soon.

The end result of this is that SBProcess::Kill() was broken on
Windows.

llvm-svn: 225297
2015-01-06 20:56:12 +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
Greg Clayton ad7aa8147a More fixes to ensure if we are asked to launch a x86_64h process on darwin, that darwin-debug knows what to do and how to handle it.
llvm-svn: 225225
2015-01-06 00:25:18 +00:00
Greg Clayton 62f24e97bd Fix being able to get a thread result when calling HostThreadPosix::Join(). It was broken when initially checked in by getting the thread result into a temporary variable and never doing anything with it. Most threads in LLDB don't look at their thread results, but launching processes in a terminal window on MacOSX does require getting a thread result and this broke "process launch --tty" on darwin.
<rdar://problem/19308966>

llvm-svn: 225224
2015-01-06 00:21:29 +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 d1d5cc27d6 When building on Windows, copy Python27(_d).dll to the output folder.
When Python does not exist on the system path, LLDB will be unable
to load it.  Fix this by copying the dll to the output folder so
it will be side-by-side with lldb.exe.

llvm-svn: 225218
2015-01-05 22:29:19 +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
Greg Clayton a05569b0b3 Make sure x7 and x8 are treated as argument registers for arm64.
llvm-svn: 225193
2015-01-05 19:23:33 +00:00
Vince Harron 8cd9a47b59 fix cross compilation to 32 bit arm targets
llvm-svn: 225184
2015-01-05 17:49:23 +00:00
Zachary Turner 34d2173abf Update the website with information about LLDB on Windows.
This patch updates the list of supported platforms to include
Windows, and also provides some detailed getting started instructions
for building LLDB on Windows.

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

llvm-svn: 225023
2014-12-31 00:06:49 +00:00
Zachary Turner e511f0307b Fix HTML formatting and non-conformance.
llvm-svn: 225022
2014-12-31 00:06:41 +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
Andy Gibbs 3acfe1a3d9 Fix trivial signed/unsigned comparison warnings
llvm-svn: 224932
2014-12-29 13:03:19 +00:00
Chandler Carruth 875d3bb538 [cmake/multilib] Teach LLDB to respect the multlib LLVM_LIBDIR_SUFFIX
variable (now provided both by the normal parent LLVM CMake files and by
the LLVMConfig.cmake file used by the standalone build).

This allows LLDB to build into and install into correctly suffixed
libdirs. This is especially significant for LLDB because the python
extension building done by CMake directly uses multilib suffixes when
the host OS does, and the host OS will not always look back and forth
between them. As a consequence, before LLVM, Clang, and LLDB (and every
other subproject) had support for using LLVM_LIBDIR_SUFFIX, you couldn't
build or install LLDB on a multilib system with its python extensions
enabled. With this patch (on top of all the others I have submitted
throughout the project), I'm finally able to build and install LLDB on
my system with Python support enabled. I'm also able to actually run the
LLDB test suite, etc. Now, a *huge* number of the tests still fail on my
Linux system, but hey, actually running them and them testing the
debugger is a huge step forward. =D

llvm-svn: 224930
2014-12-29 12:42:33 +00:00
Chandler Carruth e471e1363e [cmake] Teach the standalone CMake build to find the Python interpreter
the same way the LLVM CMake build does, notably using the proper CMake
module and specifically requesting an older Python version. LLDB relies
pretty heavily on not using Python 3 at this point, and without this
patch it ends up trying to use Python 3 which ends quite badly. =] With
this, I'm able to build LLDB in its standalone mode successfully on
Linux when I have both Python 2.7 and Python 3.3 installed.

llvm-svn: 224929
2014-12-29 12:32:27 +00:00
Jason Molenda 19ba9fbf27 Add support for frameless function compact unwind encodings on x86_64/i386.
This completes the compact unwind support for x86 targets.  

I'm still skipping the UNWIND_X86_64_MODE_STACK_IND encodings for
x86_64 right now because clang was emitting bad data for this form
until it was fixed in r217020 circa Sep 2014.

arm64 parsing still needs to be added.

llvm-svn: 224698
2014-12-22 11:02:02 +00:00
Jason Molenda 5c45c541a2 Various unwinder work.
Most of the changes are to the FuncUnwinders class -- as we've added
more types of unwind information, the way this class was written was
making it a mess to maintain.  Instead of trying to keep one
"non-call site" unwind plan and one "call site" unwind plan, track
all the different types of unwind plans we can possibly retrieve for
each function and have the call-site/non-call-site accessor methods
retrieve those.

Add a real "fast unwind plan" for x86_64 / i386 -- when doing an
unwind through a function, this only has to read the first 4 bytes 
to tell if the function has a standard prologue sequence.  If so, 
we can use the architecture default unwind plan to backtrace 
through this function.  If we try to retrieve the save location for
other registers later on, a real unwind plan will be used.  This
one is just for doing fast backtraces.

Change the compact unwind plan importer to fill in the valid address
range it is valid for. 

Compact unwind, in theory, may have multiple entries for a single
function.  The FuncUnwinders rewrite includes the start of supporting
this correctly.  In practice compact unwind encodings are used for
the entire range of the function today -- in fact, sometimes the same
encoding is used for multiple functions that have the same unwind
rules.  But I want to handle a single function that has multiple
different compact unwind UnwindPlans eventually.

llvm-svn: 224689
2014-12-21 10:44:54 +00:00
Jason Molenda b12a136cdd Re-enable compact unwind use on Mac platforms.
When lldb has a binary with protected section contents,
don't use the on-disk representation of that compact 
uwnind -- read it only out of live memory where it has
been decrypted.

llvm-svn: 224670
2014-12-20 03:12:51 +00:00
Enrico Granata 7863991945 Cleanup some redundant code
llvm-svn: 224659
2014-12-20 01:41:27 +00:00
Oleksiy Vyalov ec8f582aec No need to call SetErrorToErrno when pipe2 succeeds.
http://reviews.llvm.org/D6743

llvm-svn: 224652
2014-12-19 23:52:46 +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
Jim Ingham 4aeb19893b Don't emit the "WARNING: no locations" message when breakpoints are set in
the dummy target.  Say they were set in the dummy target instead.

llvm-svn: 224606
2014-12-19 19:45:31 +00:00
Jim Ingham 4af5961caa Audit uses of ConstString::AsCString() to make sure they weren't assuming
they would always get a non-NULL string back.

<rdar://problem/19298575>

llvm-svn: 224602
2014-12-19 19:20:44 +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
Greg Clayton 3a95b5bce2 Fixed an issue that could cause GetPointeeData() to fail when passing in a non-zero index.
The issue was we had a global variable that was a pointer, and the address type of the children wasn't "load address" when it needed to be. Full details are in the comments of the changes.

<rdar://problem/15107937>

llvm-svn: 224559
2014-12-19 01:28:42 +00:00
Zachary Turner f27ae73617 Always use python-based SWIG generation script for CMake.
As a first step in addressing Bug #21921 this patch prefers
the python-based SWIG generation by default rather than the
shell-based SWIG generation any time python is enabled
(e.g. LLDB_DISABLE_PYTHON is 0).

Additionally, this patch changes the default value of
LLDB_DISABLE_PYTHON from 1 to 0 on Windows.

Anyone not using the CMake build is unaffected by this patch.

llvm-svn: 224543
2014-12-18 21:25:53 +00:00
Stephane Sezer b743a8034f Display local kernel version only when non-remote in PlatformLinux.
Summary:
This is part of the Linux remote platform work. Displaying the local
kernel information when remote debugging doesn't make sense, so we
should verify if we are in host mode before doing so.

Test Plan:
Connect to a remote linux platform mode daemon with `platform select
remote-linux` followed by `platform connect ...`, and look at the output
of `platform status`.

Reviewers: tfiala, clayborg, vharron, compnerd

Subscribers: lldb-commits

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

llvm-svn: 224540
2014-12-18 20:24:32 +00:00
Enrico Granata da04fbb535 We don't really handle printing embedded NULs in strings, but if we were to, we would need to have this logic inside the StringPrinter. So, add it.. For, you know, one day in the future where we might want to handle embedded NULs in strings...
llvm-svn: 224537
2014-12-18 19:43:29 +00:00
Zachary Turner 7ae4b6de1d Only compile RegisterContextWindows_x86.cpp for x86 host architecture.
This fixes compilation failures in the 64-bit build of LLDB on Windows.

Patch by Aidan Dodds

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

llvm-svn: 224528
2014-12-18 18:21:33 +00:00
Eric Christopher c9d1c27d48 Fix a format string warning by noting that StringIsBreakpointName
will set the error accordingly and so there's no need to set it
again.

llvm-svn: 224468
2014-12-17 22:26:32 +00:00
Eric Christopher f70824428e Fix initialization order to match that of the source.
llvm-svn: 224467
2014-12-17 22:25:37 +00:00
Enrico Granata 972be53f02 Provide CreateValueFromData,Expression at the SBTarget level as well as the SBValue level; and also make all the implenentations agree on using the matching ValueObject::Create instead of doing code copypastas
llvm-svn: 224460
2014-12-17 21:18:43 +00:00
Zachary Turner ac94b5b14c Work around an internal compiler error in MSVC.
For some reason MSVC ICEs when trying to index into a map using
a temporary object.  Work around this by separating out the call
into multiple lines.

Patch by Aidan Dodds
Differential Revision: http://reviews.llvm.org/D6702
Reviewed by: Zachary Turner, Greg Clayton

llvm-svn: 224443
2014-12-17 18:02:36 +00:00
Zachary Turner 0b9d3eefdb Enhance the Pipe interface for better portability.
This patch makes a number of improvements to the Pipe interface.

1) An interface (PipeBase) is provided which exposes pure virtual
   methods for any implementation of Pipe to override.  While not
   strictly necessary, this helps catch errors where the interfaces
   are out of sync.

2) All methods return lldb_private::Error instead of returning bool
   or void.  This allows richer error information to be propagated
   up to LLDB.

3) A new ReadWithTimeout() method is exposed in the base class and
   implemented on Windows.

4) Support for both named and anonymous pipes is exposed through the
   base interface and implemented on Windows.  For creating a new
   pipe, both named and anonymous pipes are supported, and for
   opening an existing pipe, only named pipes are supported.

New methods described in points #3 and #4 are stubbed out on posix,
but fully implemented on Windows.  These should be implemented by
someone on the linux / mac / bsd side.

Reviewed by: Greg Clayton, Oleksiy Vyalov
Differential Revision: http://reviews.llvm.org/D6686

llvm-svn: 224442
2014-12-17 18:02:19 +00:00
Jim Ingham 5e09c8c32c Add the ability to tag one or more breakpoints with a name. These
names can then be used in place of breakpoint id's or breakpoint id 
ranges in all the commands that operate on breakpoints.

<rdar://problem/10103959>

llvm-svn: 224392
2014-12-16 23:40:14 +00:00
Enrico Granata 395939a483 Improve the performance of the libc++ std::map formatter. This is not the full solution to the slowness of this formatter, but it's a 5% improvement in our testcase performance, which I am not going to complain too hard about.
llvm-svn: 224373
2014-12-16 21:28:16 +00:00
Enrico Granata b476743726 In C++, it's #include not #import
llvm-svn: 224352
2014-12-16 19:10:37 +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
Jason Molenda 0f479da711 Temporarily disable CompactUnwindInfo::GetCompactUnwindInfoForFunction.
The compact unwind importer is getting the wrong unwind info for one
case that I found.  I haven't been able to fix the problem tonight 
and I don't want to leave TOT behaving incorrectly, so just ignore
compact unwind until I can get to the bottom of this.

llvm-svn: 224321
2014-12-16 06:20:30 +00:00
Enrico Granata 3cfc49f5e9 Instead of rolling our own, use the C++11 sanctioned solution
llvm-svn: 224310
2014-12-16 02:34:13 +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
Enrico Granata a6a1d5a623 Provide a SBFrame.register/.reg helper on the Python side of SBFrame to vend a flattened view of registers
Our actual view of registers is a set of register sets, each one of which contains a subset of the actual registers
This makes trivial scripting operations tedious ("I just want to read r7!")

This helper allows things like: print lldb.frame.reg["r7"]

Fixes rdar://19185662

llvm-svn: 224275
2014-12-15 21:30:36 +00:00
Hafiz Abid Qadeer fcbc3cdf3c Replace ioctl with select to reduce processor usage by lldb-mi on OSX.
This saga started with a hang on OSX. 2 solutions were proposed.
1) 'select' based solution works ok on OSX but slows down test completion time
on Linux many times.
2) 'ioctl' base solution also works but it causes heavy processor usage on OSX
as reported by Ilia K.

But as the original hang did not occur on Linux so this commit re-introduces the
'select' in conditional code so that it only runs for OSX. There is no need for
this 'fix' to run on Linux.

Initial patch by Ilia K <ki.stfu@gmail.com>. A few changes were made by me. 

llvm-svn: 224258
2014-12-15 19:09:40 +00:00
Stephane Sezer f2ef94e770 Make the platform process connect path less chatty.
Summary:
If a stream contains an empty string, no need to append it to the output
(otherwise we end up with a blank line). Also, no need to print a status
message when the state changes to connected, as this string brings no
information -- "Process 0" does not mean anything to the user, and the
process being connected has no meaning either.

Test Plan:
Connect to a remote linux platform mode daemon with `platform select
remote-linux` followed by `platform connect ...`, create a target and
run it, observe the output. Also, run the full test suite (dosep.py).

Before:
    (lldb) [...] connect, etc.
    (lldb) r
    Process 0 connected

    Process 5635 launched: '/Users/sas/Source/test' (x86_64)
    Process 5635 stopped

After:
    (lldb) [...] connect, etc.
    (lldb) r
    Process 5635 launched: '/Users/sas/Source/test' (x86_64)
    Process 5635 stopped

Reviewers: tfiala, vharron, clayborg

Subscribers: lldb-commits

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

llvm-svn: 224188
2014-12-13 05:23:51 +00:00
Enrico Granata dd6d24b253 Move a bunch of method implementations over to the C++ file; remove the need for a few includes. All in all, good stuff
llvm-svn: 224174
2014-12-13 02:07:50 +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
Keno Fischer f4b170d0da SyntheticChildrenFrontEnd::* should also be built when python is disabled
Summary:
This moves
- SyntheticChildrenFrontEnd::CreateValueObjectFromExpression
- SyntheticChildrenFrontEnd::CreateValueObjectFromAddress
- SyntheticChildrenFrontEnd::CreateValueObjectFromData
outside the `#ifndef LLDB_DISABLE_PYTHON` since it doesn't seem to depend on python being available and indeed breaks the build when python is disabled.

Reviewers: granata.enrico

Subscribers: lldb-commits

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

llvm-svn: 224170
2014-12-13 00:05:58 +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
Enrico Granata 0d484e9eec The so-called "trivial implementation" has been with us for a few years now. It's probably safe to assume it works.. so remove the #if stuff
llvm-svn: 224147
2014-12-12 19:26:08 +00:00
Enrico Granata 987ed3ce7c Do attempt to ask the impl_backend for the live address of a const result if none is stored in the object itself; this is for symmetry with GetAddressOf()
llvm-svn: 224143
2014-12-12 19:05:44 +00:00
Enrico Granata 6ded39093e Do not set the live address of a const result child if its parent has an invalid live address
llvm-svn: 224142
2014-12-12 18:59:49 +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
Greg Clayton 482f9be175 Make sure if a thread specifies a 'register_data_addr' in a python operating system plug-in, that is is used to fetch the register values.
llvm-svn: 224083
2014-12-11 23:53:52 +00:00
Greg Clayton cd255b3111 Make sure we print errors for python OperatingSystem plug-ins for when things go wrong. We also dump the dictionary or collection that had errors so the user can see which info was wrong.
llvm-svn: 224082
2014-12-11 23:52:05 +00:00
Sean Callanan d919698caa Removed the assertion that we can find any named
Objective-C type in the runtime.  This is not actually
true, it's entirely possible to say

@class DoesntExist;

@interface DoesExist {
  DoesntExist *whyyyyy;
}
@end

and this code will not only compile but also run.  So
this assertion will fire in situations users might
encounter.

I left the assertion enabled in debug mode, because we
could still catch a case we're not aware of (i.e., a
class that we *ought* to have found but where somehow
we mis-parsed the name).

<rdar://problem/19151914>

llvm-svn: 224038
2014-12-11 19:33:57 +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
Zachary Turner fb6c3494e7 Fix some test failures for Windows.
llvm-svn: 223982
2014-12-10 23:25:10 +00:00
Eric Christopher 2325e38024 Fix a bunch of [-Werror,-Winconsistent-missing-override] warnings.
llvm-svn: 223973
2014-12-10 22:29:58 +00:00
Eric Christopher b9c4d1d84a Silence -Winconsistent-missing-override warnings.
llvm-svn: 223972
2014-12-10 22:24:56 +00:00
Sean Callanan dc00334dc3 Added support to the expression parser for finding
Objective-C types and enums in modules.  We now have
a three-stage fallback when looking for methods and
properties: first the DWARF, second the modules, third
the runtime.

<rdar://problem/18782288>

llvm-svn: 223939
2014-12-10 19:23:29 +00:00
Duncan P. N. Exon Smith f3079d2762 ClangFunction: Fix destruction order of parser and execution unit
Fix PR21802 by correcting the destruction order of
`ClangExpressionParser` and `IRExecutionUnit` in `ClangFunction`.  The
former has hooks into the latter -- i.e., `clang::CGDebugInfo` points at
the `LLVMContext` -- so it needs to be torn down first.

This was exposed by r223802 in LLVM, which started doing work in the
`CGDebugInfo` teardown.

llvm-svn: 223916
2014-12-10 04:59:18 +00:00
Enrico Granata ff0f23dd41 Remove the last vestige of the world before data formatters :-)
Function pointers had a summary generated for them bypassing formatters, directly as part of the ValueObject subsystem

This patch transitions that code into a hardcoded summary

llvm-svn: 223906
2014-12-10 02:00:45 +00:00
Oleksiy Vyalov b9321bd774 Skip TestExprPathSynthetic test on FreeBSD, Linux & Windows.
llvm-svn: 223905
2014-12-10 01:48:17 +00:00
Oleksiy Vyalov 859e4b5da1 Add D request handler to GDBRemoteCommunicationServer in order to support detach from inferior.
llvm-svn: 223901
2014-12-10 01:27:28 +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
Greg Clayton a97c4d2154 Handle thumb IT instructions correctly all the time.
The issue with Thumb IT (if/then) instructions is the IT instruction preceeds up to four instructions that are made conditional. If a breakpoint is placed on one of the conditional instructions, the instruction either needs to match the thumb opcode size (2 or 4 bytes) or a BKPT instruction needs to be used as these are always unconditional (even in a IT instruction). If BKPT instructions are used, then we might end up stopping on an instruction that won't get executed. So if we do stop at a BKPT instruction, we need to continue if the condition is not true.

When using the BKPT isntructions are easy in that you don't need to detect the size of the breakpoint that needs to be used when setting a breakpoint even in a thumb IT instruction. The bad part is you will now always stop at the opcode location and let LLDB determine if it should auto-continue. If the BKPT instruction is used, the BKPT that is used for ARM code should be something that also triggers the BKPT instruction in Thumb in case you set a breakpoint in the middle of code and the code is actually Thumb code. A value of 0xE120BE70 will work since the lower 16 bits being 0xBE70 happens to be a Thumb BKPT instruction. 

The alternative is to use trap or illegal instructions that the kernel will translate into breakpoint hits. On Mac this was 0xE7FFDEFE for ARM and 0xDEFE for Thumb. The darwin kernel currently doesn't recognize any 32 bit Thumb instruction as a instruction that will get turned into a breakpoint exception (EXC_BREAKPOINT), so we had to use the BKPT instruction on Mac. The linux kernel recognizes a 16 and a 32 bit instruction as valid thumb breakpoint opcodes. The benefit of using 16 or 32 bit instructions is you don't stop on opcodes in a IT block when the condition doesn't match. 

To further complicate things, single stepping on ARM is often implemented by modifying the BCR/BVR registers and setting the processor to stop when the PC is not equal to the current value. This means single stepping is another way the ARM target can stop on instructions that won't get executed.

This patch does the following:
1 - Fix the internal debugserver for Apple to use the BKPT instruction for ARM and Thumb
2 - Fix LLDB to catch when we stop in the middle of a Thumb IT instruction and continue if we stop at an instruction that won't execute
3 - Fixes this in a way that will work for any target on any platform as long as it is ARM/Thumb
4 - Adds a patch for ignoring conditions that don't match when in ARM mode (see below)

This patch also provides the code that implements the same thing for ARM instructions, though it is disabled for now. The ARM patch will check the condition of the instruction in ARM mode and continue if the condition isn't true (and therefore the instruction would not be executed). Again, this is not enable, but the code for it has been added.

<rdar://problem/19145455> 

llvm-svn: 223851
2014-12-09 23:31:02 +00:00
Zachary Turner 543afa18b3 Fix compilation failures resulting from the llvm Metadata refactor.
Patch by Duncan P. N. Exon Smith

llvm-svn: 223844
2014-12-09 22:29:47 +00:00
Jason Molenda ce19fe3f38 Add a new 'eRegisterInLiveRegisterContext' RegisterLocation to track
a register value that is live in the stack frame 0 register context.

Fixes a problem where retrieving a register value on stack frame #n
would involved O(n!) stack frame checks.  This could be very slow on
a deep stack when retrieving register values that had not been
modified/saved by any of the stack frames.  Not common, but annoying
when it was hit.

<rdar://problem/19010211> 

llvm-svn: 223843
2014-12-09 22:28:10 +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
Sean Callanan 1f1aacac96 Removed an unnecessary variaable.
llvm-svn: 223831
2014-12-09 21:20:03 +00:00
Sean Callanan 7375f3e30e Fixed ValueObject::UpdateValueIfNeeded to keep
track of the checksum of the object so we can
track if it is modified.  This fixes a testcase
(test/expression_command/issue_11588) on OS X.

Patch by Enrico Granata.

llvm-svn: 223830
2014-12-09 21:18:59 +00:00
Jason Molenda 28737d8db9 Change AddressSanitzierRuntime to print its info message via
the Debugger's output stream instead of logging to the module.

http://reviews.llvm.org/D6577

llvm-svn: 223826
2014-12-09 20:52:26 +00:00
Enrico Granata e29df230cd This patch does a few things:
- adds a new flag to mark ValueObjects as "synthetic children generated"
- vends new Create functions as part of the SyntheticChildrenFrontEnd that set the flag automatically
- moves synthetic child providers over to using these new functions

No visible feature change, but preparatory work for feature change

llvm-svn: 223819
2014-12-09 19:51:20 +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
Zachary Turner c8d9748c06 Create a valid stop info for all non-breakpoint exceptions.
llvm-svn: 223812
2014-12-09 19:13:50 +00:00
Stephane Sezer 8e6ec453f1 Implement remote process listing in Linux platform.
Summary:

Test Plan: Connect to a remote implementing the platform protocol (ds2 in this case), run `platform process list` and see processes being displayed.

Reviewers: vharron, tfiala, clayborg

Subscribers: lldb-commits

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

llvm-svn: 223752
2014-12-09 03:18:09 +00:00
Oleksiy Vyalov 53c038a581 Add Linux support for HostInfo::GetOSBuildString and HostInfo::GetOSKernelDescription.
llvm-svn: 223737
2014-12-09 02:13:05 +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
Zachary Turner 270e99ab0a Fix some posix assumptions related to running shell commands.
This is a resubmit of r223548, which was reverted due to breaking
tests on Linux and Mac.

This resubmit fixes the reason for the revert by adding back some
accidentally removed code which appends -c to the command line
when running /bin/sh.

This resubmit also differs from the original patch in that it sets
the architecture on the ProcessLaunchInfo.  A follow-up patch will
refactor this to separate the logic for different platforms.

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

Reviewed By: Greg Clayton

llvm-svn: 223695
2014-12-08 21:36:42 +00:00
Zachary Turner 818a3676aa Remove use of GCC-style intrinsics, as they are non-portable.
Differential Revision: http://reviews.llvm.org/D6567

llvm-svn: 223687
2014-12-08 20:00:33 +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
Jason Molenda e589e7e336 The lldb unwinder can now use the unwind information from the compact-unwind
section for x86_64 and i386 targets on Darwin systems.  Currently only the
compact unwind encoding for normal frame-using functions is supported but it
will be easy handle frameless functions when I have a bit more free time to
test it.  The LSDA and personality routines for functions are also retrieved
correctly for functions from the compact unwind section.

This new code is very fresh -- it passes the lldb testsuite and I've done
by-hand inspection of many functions and am getting correct behavior for all
of them.  There may need to be some bug fixing over the next couple weeks as
I exercise and test it further.  But I think it's fine right now so I'm
committing it.

<rdar://problem/13220837> 

llvm-svn: 223625
2014-12-08 03:09:00 +00:00
Sean Callanan 957a872cb1 Fixed an unfortunate reversed conditional that
resulted in hard-to-track-down crashes.  Sigh.

llvm-svn: 223575
2014-12-06 02:31:49 +00:00
Kate Stone 641e9f8c69 Improvements to FastDemangler to correct parsing of <local-name> encodings for string literal and parameter/entity cases. Patch courtesy of slydiman.
llvm-svn: 223569
2014-12-06 01:42:41 +00:00
Jim Ingham 4623b9d3e2 Reverting r223548 which broke running in the shell on OS X.
llvm-svn: 223568
2014-12-06 01:41:10 +00:00
Jim Ingham 33df7cd345 Add the ability to set breakpoints with conditions, commands, etc,
in the "dummy-target".  The dummy target breakpoints prime all future
targets.  Breakpoints set before any target is created (e.g. breakpoints
in ~/.lldbinit) automatically get set in the dummy target.  You can also
list, add & delete breakpoints from the dummy target using the "-D" flag,
which is supported by most of the breakpoint commands.

This removes a long-standing wart in lldb...

<rdar://problem/10881487>

llvm-svn: 223565
2014-12-06 01:28:03 +00:00
Sean Callanan ceeb74e606 Now that we get types from modules, we occasionally
encounter clang::ExternalASTSources that are not instances
of ClangExternalASTSourceCommon.  We used to blithely
assume that all are, and so we could use static_cast<>.
That's no longer the case, so we have to have these AST
sources register themselves.

llvm-svn: 223560
2014-12-06 01:03:30 +00:00
Jim Ingham 67d7af9c34 Fix a type (MAX_PATH instead of PATH_MAX) and remove an unused variable.
llvm-svn: 223559
2014-12-06 01:03:17 +00:00
Sean Callanan 498ff1c1b8 Add new-lines after module compiler errors so
they are readable.

llvm-svn: 223557
2014-12-06 00:56:43 +00:00
Jim Ingham 0ccb02c4e9 Add an initial description of the rules for constructing new SB API classes.
llvm-svn: 223550
2014-12-06 00:28:05 +00:00
Zachary Turner 00cdc98b7f Fix some posix assumptions related to running shell commands.
Differential Revision: http://reviews.llvm.org/D6553

Reviewed By: Greg Clayton

llvm-svn: 223548
2014-12-06 00:14:24 +00:00
Jim Ingham 4701521ba0 Add a list iterable helper and use it to make a Breakpoint
iterator in the BreakpointList class.

llvm-svn: 223544
2014-12-05 23:21:30 +00:00
Jim Ingham 15fe293460 First pass at a description of the lldb coding conventions.
llvm-svn: 223543
2014-12-05 23:18:01 +00:00
Zachary Turner 22ac8711a5 Fix some uninitialized variables in ClangExpressionParser.
Reviewed by: Sean Callanan

llvm-svn: 223541
2014-12-05 22:54:56 +00:00
Enrico Granata 2f02fe0bd3 Add commands
type format info
type summary info
type synthetic info

These commands all take an expression, evaluate it, and show which of the respective formatter (if any) applies to the result of the expression

Fixes rdar://12059317

llvm-svn: 223511
2014-12-05 20:59:08 +00:00
Eric Christopher 73d15f2127 Fix a bunch of [-Werror,-Winconsistent-missing-override] warnings.
llvm-svn: 223501
2014-12-05 19:21:49 +00:00
Eric Christopher 3a078aefb6 Fix a few default label in switch which covers all
enumeration values [-Werror,-Wcovered-switch-default]
warnings.

llvm-svn: 223499
2014-12-05 19:09:02 +00:00
Zachary Turner 0a526eb855 Subtract the size of the breakpoint opcode from the PC when getting the bp site.
llvm-svn: 223498
2014-12-05 18:46:14 +00:00
Zachary Turner 301d184784 Load / unload modules in the target when the OS events occur.
This causes all deferred breakpoints to be correctly resolved as
the modules that they reside in are loaded.

llvm-svn: 223497
2014-12-05 18:46:04 +00:00
Zachary Turner cfd3b1ae6f Implement an empty DynamicLoader plugin for Windows.
llvm-svn: 223496
2014-12-05 18:45:53 +00:00
Zachary Turner b88ec656b5 Fix compilation errors after clang modules checkin.
llvm-svn: 223484
2014-12-05 17:38:20 +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
Sean Callanan 221262996a Added CMake support so all the Clang modules code
will at least be built by non-OS X builders. This
should head off some build breakage at the pass.

llvm-svn: 223437
2014-12-05 01:31:55 +00:00
Sean Callanan c8278afc9f Changes to the expression parser to actually use
the types that we find in Clang modules.

llvm-svn: 223436
2014-12-05 01:27:35 +00:00
Sean Callanan c631b64fab Additional changes required by r223433.
llvm-svn: 223435
2014-12-05 01:26:42 +00:00
Sean Callanan 9998acd004 This is the meat of the code to add Clang modules
support to LLDB.  It includes the following:

- Changed DeclVendor to TypeVendor.
- Made the ObjCLanguageRuntime provide a DeclVendor
  rather than a TypeVendor.
- Changed the consumers of TypeVendors to use
  DeclVendors instead.
- Provided a few convenience functions on
  ClangASTContext to make that easier.

llvm-svn: 223433
2014-12-05 01:21:59 +00:00
Sean Callanan 47aed6365f Added the LLDB enumeration necessary to find the
Clang headers directory.  Needed by r223430.

llvm-svn: 223432
2014-12-05 01:17:47 +00:00
Sean Callanan 5dc2981cf8 Added support to Platform to indicate (1) whether the
current platform supports Clang modules, and (2) what
options to pass to Clang so it can load those Clang
modules.

llvm-svn: 223431
2014-12-05 01:16:31 +00:00
Sean Callanan b1e1c62fac Add support for embedding Clang compiler headers
like tgmath.h and stdarg.h into the LLDB installation,
and then finding them through the Host infrastructure.

Also add a script to actually do this on Mac OS X.

llvm-svn: 223430
2014-12-05 01:15:04 +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 be5e1e5c9b Fix a minor error where I forgot to declare a variable.
llvm-svn: 223393
2014-12-04 22:07:02 +00:00
Zachary Turner 9b69327b43 Revert "Use timeout when reading debugserver's port from a named pipe."
This reverts commit 4a5ad2c077166cc3d6e7ab4cc6e3dcbbe922af86.

Windows doesn't support select() for pipe objects, and this also fails
to compile on Windows.  Reverting this until we can get it sorted out
to keep the windows build working.

llvm-svn: 223392
2014-12-04 22:06:42 +00:00
David Majnemer b313e46cc6 Revert "Fix a build breakage. Looks like the LLVM side of this change has been reverted"
This reverts commit r223375.  We need to use unique_ptr to build with
LLVM r223183.

llvm-svn: 223388
2014-12-04 21:26:25 +00:00
Enrico Granata 20675c8478 We should not pretend that an int is a valid ObjC pointer. If your number truly is a pointer, po (id)myNumber is a better alternative. Fixes rdar://16585032
llvm-svn: 223379
2014-12-04 19:31:51 +00:00
Greg Clayton 2e644415ba Remove dead code from SymbolFileDWARF:
lldb::TypeSP 
SymbolFileDWARF::FindDefinitionTypeForDIE (
    DWARFCompileUnit* dwarf_cu, 
    const DWARFDebugInfoEntry *die, 
    const lldb_private::ConstString &type_name);

This function isn't used as it has been replaced by:

lldb::TypeSP
SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext (
    const DWARFDeclContext &die_decl_ctx);

I am about to change the way we resolve C/C++ class/struct/union types and want to clean up SymbolFileDWARF before I start.

llvm-svn: 223376
2014-12-04 18:49:24 +00:00
Enrico Granata c5d32d751e Fix a build breakage. Looks like the LLVM side of this change has been reverted
llvm-svn: 223375
2014-12-04 18:39:40 +00:00
Hafiz Abid Qadeer ebbb8f3a41 Cleanup of the fix done recently for a lldb-mi hang on OSX.
It was observed that we dont need to set stdin to unbuffered and setting console
to non-canonical mode.

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

llvm-svn: 223353
2014-12-04 11:05:31 +00:00
Zachary Turner 1ed7b87db3 Improve the comments on PutSTDIN, GetSTDOUT, and GetSTDERR.
Differential Revision: http://reviews.llvm.org/D6513

llvm-svn: 223308
2014-12-03 23:15:14 +00:00
Zachary Turner b3ff719b04 Manually call ModulesDidLoad when the executable is loaded.
This is a temporary workaround to get deferred breakpoint
resolution working until Bug 21720 is addressed.  Even with this
workaround, it will only resolve deferred breakpoints in the
executable module, and not in a shared library.

llvm-svn: 223273
2014-12-03 22:04:31 +00:00
Zachary Turner c6a6653ebb Correctly shutdown when DoDestroy is called with an active exception.
Previously if we got a DoDestroy while stopped at a breakpoint, we
would detach and then say the process had exited.  This is completely
wrong, as it resulted in the python script incorrectly assuming that
the process had actually exited and trying to delete the image, when
in fact it had done no such thing.

The fix employed here is that when we get a DoDestroy, we do 3 steps:

1) initiate a termination sequence on the process
2) If we were stopped handling an exception of any kind, mask it and
   let the program resume, causing the program to see the termination
   request and exit on its own.
3) Let the program exit normally, and close all of our handles before
   returning control back to DoDestroy.

This fixes Bug 21722 and Bug 21723.

llvm-svn: 223272
2014-12-03 22:04:18 +00:00
Oleksiy Vyalov e8fb6937ba Use timeout when reading debugserver's port from a named pipe.
http://reviews.llvm.org/D6490

llvm-svn: 223251
2014-12-03 18:19:16 +00:00
Hafiz Abid Qadeer afd188fee4 Remove unnecessary changes committed in r223222.
There were 2 different patches in discussion. One using ioctl
and other using select. We decided to use the ioctl but committed
code also have some changes which were only needed for 'select'.
This patch removes them.

llvm-svn: 223227
2014-12-03 12:48:19 +00:00
Hafiz Abid Qadeer 25383ac01b Fix a hang on OSX while executing -exec-run.
Now we wait for input to become available before blocking in fgets.
More details on problem can be found in 
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20141201/014290.html

Patch from dawn@burble.org.

llvm-svn: 223222
2014-12-03 10:23:06 +00:00
Jason Molenda 286fd1aaac Update setMCJITMemoryManager call to keep in line with llvm r223183.
Patch from Ryan Goodfellow.

llvm-svn: 223196
2014-12-03 04:02:03 +00:00
Jason Molenda 22f58dffeb Mark the armv7 q0-q3 and q8-q15 registers as volatile (not callee
preserved) in the ABI.

Realistically lldb isn't able to track register saves of any of
the neon regs right now so we should probably mark all of the 
regs as unavailable when you're not on stack frame 0...

<rdar://problem/19115127> 

llvm-svn: 223174
2014-12-02 23:21:05 +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
Jason Molenda 98b3fde8ac Fix the behavior of ${current-pc-arrow} in the default disassembly
format for the not-current-stack-frame.  This was causing
test/functionalities/inferior-assert to fail.

Also document the new additions to the format specifications used
in the disassembly-format changes to formats.html.

<rdar://problem/19102757> 

llvm-svn: 223096
2014-12-02 00:26:21 +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 e0d93f523b Enable enabling and disabling breakpoints on Windows.
llvm-svn: 223089
2014-12-01 23:13:52 +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
Zachary Turner c7a17ed460 Only normalize FileSpec paths *after* resolving them.
Normalizing paths before resolving them can cause the path to
become denormalized after resolution.

llvm-svn: 223087
2014-12-01 23:13:32 +00:00
Enrico Granata e2068207be The register keyword is deprecated in C++11, so clang complains strongly about swig generating register declarations. Abuse the preprocessor to define the keyword away
llvm-svn: 223084
2014-12-01 22:51:03 +00:00
Greg Clayton afa91e339b lldb can deadlock when launched with an non-existing executable:
% lldb /bin/nonono
(lldb) target create "/bin/nonono"
error: unable to find executable for '/usr/bin/nonono'
<deadlock>

The problem was the initial commands 'target create "/bin/nonono"' were put into a pipe and the command interpreter was being run with:

void
CommandInterpreter::RunCommandInterpreter(bool auto_handle_events,
                                          bool spawn_thread,
                                          CommandInterpreterRunOptions &options)
{
    // Always re-create the command intepreter when we run it in case
    // any file handles have changed.
    bool force_create = true;
    m_debugger.PushIOHandler(GetIOHandler(force_create, &options));
    m_stopped_for_crash = false;
    
    if (auto_handle_events)
        m_debugger.StartEventHandlerThread();
    
    if (spawn_thread)
    {
        m_debugger.StartIOHandlerThread();
    }
    else
    {
        m_debugger.ExecuteIOHanders();
        
        if (auto_handle_events)
            m_debugger.StopEventHandlerThread();
    }
    
}

If "auto_handle_events" was set to true and "spawn_thread" was false, we would execute:

m_debugger.StartEventHandlerThread();
m_debugger.ExecuteIOHanders();
m_debugger.StopEventHandlerThread();


The problem was there was no synchonization in Debugger::StartEventHandlerThread() to ensure the event handler was listening to events and the the call to "m_debugger.StopEventHandlerThread()" would do:

void
Debugger::StopEventHandlerThread()
{
    if (m_event_handler_thread.IsJoinable())
    {
        GetCommandInterpreter().BroadcastEvent(CommandInterpreter::eBroadcastBitQuitCommandReceived);
        m_event_handler_thread.Join(nullptr);
    }
}

The problem was that the event thread might not be listening for the CommandInterpreter::eBroadcastBitQuitCommandReceived event yet.

The solution is to make sure the Debugger::DefaultEventHandler() is listening to events before we return from Debugger::StartEventHandlerThread(). Once we have this synchonization we remove the race condition.

This fixes radar:

<rdar://problem/19041192>

llvm-svn: 223083
2014-12-01 22:41:27 +00:00
Greg Clayton d90ac932d9 Added a new regular expression to the "_regexp-break" command ("b" by default):
(lldb) b /break here/

This will set a source level regular expression breakpoint on any text between the first '/' and the last '/'. The equivalent command will be:

(lldb) breakpoint set --source-pattern-regexp 'break here'

llvm-svn: 223082
2014-12-01 22:34:03 +00:00
Vince Harron 6eddf8df2a Added StringExtractor::DecodeHexU8 && GetHexBytesAvail
DecodeHexU8 returns a decoded hex character pair, returns -1 if a
valid hex pair is not available.

GetHexBytesAvail decodes all available hex pairs.

llvm-svn: 223081
2014-12-01 22:19:33 +00:00
Vince Harron e5a9eaaaed StringExtractor unit tests
Unit tests to cover StringExtractor in advance of minor new
functionality & minor refactor

llvm-svn: 223080
2014-12-01 22:10:15 +00:00
Jason Molenda 5197ba5b01 Add support for 32-bit i386 binaries.
llvm-svn: 222952
2014-11-29 09:17:40 +00:00
Jason Molenda c9acfeb55b The finishing touches on getting the compact unwind dumping completed
for x86_64.  i386, arm, arm64 aren't handled yet but those are minor
variations on this format.

This commit also adds code to read the symbol table out of the
binary and read the LC_FUNCTION_STARTS to augment the symbol table
with the start addresses of all the functions - and print the
function names when showing the unwind info.

llvm-svn: 222951
2014-11-29 07:05:07 +00:00
Jason Molenda a6f75467da Add support for UNWIND_X86_64_MODE_STACK_IND entries.
Correct the function offset computations in UNWIND_SECOND_LEVEL_REGULAR
tables.  A few other small fixes.

llvm-svn: 222910
2014-11-28 03:54:13 +00:00
Oleksiy Vyalov 2f206d6ee4 Make LLGS to open a named pipe and write a listening port to it only when a proper port value is received.
llvm-svn: 222902
2014-11-27 20:51:24 +00:00
Jason Molenda 671001cc66 A little more work on the compact unwind dumper.
UNWIND_X86_64_MODE_STACK_IND mode is almost correct; extra stack
space allocated before the reg saves isn't handled right.  Still a
little wobbily on the file addresses of functions.  Finally understand
how the 6 registers that may be saved are ordered in just 10 its
of space -- the Lehmer code for the registers is derived and then
the sequence is encoded in a variable base number.  Added some
comments with references to what the code is doing so it'll be
easier for others to track down.

llvm-svn: 222884
2014-11-27 13:21:38 +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 e13d71c57c Refactor SocketAddress::getaddrinfo - avoid calling IsValid if ::getaddrinfo has failed.
Otherwise, IsValid crashes on assertation in GetFamilyLength.

llvm-svn: 222862
2014-11-27 00:32:54 +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
Hafiz Abid Qadeer 05200e3b19 Re-order the base classes to prevent a crash in Linux.
In the initialization list of IOHandlerConfirm, *this is basically casting
IOHandlerConfirm to its base IOHandlerDelegate and passing it to constructor of
IOHandlerEditline which uses it and crashes as constructor of IOHandlerDelegate
is still not called. Re-ordering the base classes makes sure that constructor of
IOHandlerDelegate runs first.

It would be good to have a test case for this case too.

llvm-svn: 222816
2014-11-26 10:19:32 +00:00
Zachary Turner 807eb55b08 When a process stops, set the StopInfo object on Windows.
llvm-svn: 222776
2014-11-25 19:03:19 +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
Zachary Turner 9f877de2e6 Add some more comments explaining the purpose of some Register classes.
llvm-svn: 222774
2014-11-25 19:02:47 +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
Ed Maste ef43413593 Fix lldb(1) man page formatting
- Use canonical date order (per groff & mandoc)
- Fix capitalization on one .Nm
- Remove EOL whitespace

Patch by Baptiste Daroussin in FreeBSD svn r274927.

llvm-svn: 222655
2014-11-24 15:01:11 +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 54166af611 Fixed an issue where a DW_FORM_ref{2,4,8} might be extracted incorrectly because the wrong compile unit was being used to calculate the compile unit relative offset.
This was fixed by making the DWARFFormValue contain the compile unit that it needs so it can decode its form value correctly. Any form value that requires a compile unit will now assert. If any of the assertions that were added are triggered, then code that led to the extraction of the form value without properly setting the compile unit must be fixed immediately. 

<rdar://problem/19035440>

llvm-svn: 222602
2014-11-22 01:58:59 +00:00
Jason Molenda cea6d634a5 When a RegisterContext produces an invalid CFA address, change
UnwindLLDB::AddOneMoreFrame to try the fallback unwind plan on
that same stack frame before it tries the fallback unwind plan
on the "next" or callee frame.

In RegisterContextLLDB::TryFallbackUnwindPlan, when we're
trying the fallback unwind plan to see if it is valid, make
sure we change all of the object ivars that might be used in
the process of fetching the CFA & caller's saved pc value 
and restore those if we decide not to use the fallback 
unwindplan.

<rdar://problem/19035079> 

llvm-svn: 222601
2014-11-22 01:52:03 +00:00
Jim Ingham 893c932acf This is the first step of making lldb able to create target-specific things
(e.g. breakpoints, stop-hooks) before we have any targets - for instance in 
your ~/.lldbinit file.  These will then get copied over to any new targets 
that get created.  So far, you can only make stop-hooks.

Breakpoints will have to learn to move themselves from target to target for
us to get them from no-target to new-target.

We should also make a command & SB API way to prime this ur-target.

llvm-svn: 222600
2014-11-22 01:42:44 +00:00
Jim Ingham 0f17c5570d Make the sourcing of the local .lldbinit file quiet.
<rdar://problem/19065278>

llvm-svn: 222599
2014-11-22 01:33:22 +00:00
Zachary Turner e5bd103621 [ProcessWindows] Clean up the register definitions array.
llvm-svn: 222597
2014-11-22 00:37:14 +00:00
Enrico Granata e8eb47037c Just a few words to introduce the extra optional argument to Python summaries
llvm-svn: 222594
2014-11-22 00:06:30 +00:00
Enrico Granata 7e4df56aae Enable Python summaries to use custom SBTypeSummaryOptions if the user is so inclined. Updates to the webdoc will follow
llvm-svn: 222593
2014-11-22 00:02:47 +00:00
Jason Molenda 4104b908cc Fix mispelled 'ling' Python property to be 'line' in
SBLineEntry and SBDeclaration.  Patch from Chris Willmore.
<rdar://problem/19054323> 

llvm-svn: 222592
2014-11-22 00:00:17 +00:00
Greg Clayton 39766d9eda Remove print statement that was accidentally left in.
llvm-svn: 222589
2014-11-21 23:34:35 +00:00
Enrico Granata 49a6746942 Per off-list feedback, this API returns the *first* value with a given name, not the *only* one. Rename it to reflect that
llvm-svn: 222582
2014-11-21 22:23:08 +00:00
Enrico Granata e9a09c74fa Add an API on SBValueList to find the first value with a given name stored in the list
llvm-svn: 222576
2014-11-21 21:45:03 +00:00
Enrico Granata a126e462c2 Do some cleanup of DumpValueObjectOptions. The whole concept of raw printing was split between feature-specific flags, and an m_be_raw flag, which then drove some other changes in printing behavior. Clean that up, so that each functionality has its own flag .. oh, and make the bools all go in a bitfield since I may want to add more of those over time
llvm-svn: 222548
2014-11-21 18:47:26 +00:00
Oleksiy Vyalov ff9a07203e Extend PipePosix with child_processes_inherit support - to control whether pipe handles should be inherited by a child process.
http://reviews.llvm.org/D6348

llvm-svn: 222541
2014-11-21 16:18:57 +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
Jason Molenda c6127dd653 Change CommandObjectTargetModulesLoad so that the filename argument
is treated as a string instead of a FileSpec.

OptionValueFileSpec::SetValueFromCString() passes the c string to
FileSpec::SetFile(str, true /* resolve */) - and with Zachary's
changes to FileSpec we're using llvm::sys::fs::make_absolute() to
do that "resolve" action now, where we used to use realpath().

One important difference between llvm::sys::fs::make_absolute and
realpath is that when they're handed a filename (no directory),
realpath prepends the current working directory *and if the file exists*,
returns that full path.  If that file doesn't exist, the caller 
uses the basename only.

llvm::sys::fs::make_absolute prepends the current working directory
regardless of whether it exists or not. 

I considered having FileSpec::SetFile save the initial pathname,
call FileSpec::Resolve, and then check to see if the Resolve return
path exists - and if not, go back to the original one.

But instead I just went with changing 'target modules load' to treat its 
filename argument as a string instead of a FileSpec.  This brings it
in line with how 'target modules list' works.

<rdar://problem/18955416> 

llvm-svn: 222498
2014-11-21 02:25:15 +00:00
Zachary Turner 7f013bcd60 Rename lldb registers to contain lldb_ prefix.
LLDB supports many different register numbering schemes, and these
are typically prefixed with an indicator that lets the user know
what numbering scheme is used.  The gcc numbering scheme is
prefixed with gcc, and there are similar ones for dwarf, gdb,
and gcc_dwarf.

LLDB also contains its own internal numbering scheme, but the enum
for LLDB's numbering scheme was prefixed differently.  This patch
changes the names of these enums to use the same naming scheme for
the enum values as the rest of the register kinds by removing gpr_
and fpu_ prefixes, and instead using lldb_ prefixes for all enum
values.

Differential Revision: http://reviews.llvm.org/D6351
Reviewed by: Greg Clayton

llvm-svn: 222495
2014-11-21 02:00:21 +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
Jim Ingham 661f29dde4 Make the option parsing of -k & -K match the help strings.
llvm-svn: 222479
2014-11-20 23:37:13 +00:00
Zachary Turner 7b1534e452 Remove duplicated enum, use the authoritative one.
Running a diff against lldb-x86-register-enums.h and the file
modified in this patch, the two enums were completely identical.

Deleting one of them to reduce code noise.

llvm-svn: 222478
2014-11-20 23:19:40 +00:00
Zachary Turner 17f383d498 [ProcessWindows] Implement a RegisterContextWindows for x86.
This implements the skeleton of a RegisterContext for Windows.
In particular, this implements support only for x86 general purpose
registers.

After this patch, LLDB on Windows can perform basic debugging
operations in a single-threaded inferior process (breakpoint,
register inspection, frame select, unwinding, etc).

Differential Revision: http://reviews.llvm.org/D6322
Reviewed by: Greg Clayton

llvm-svn: 222474
2014-11-20 22:47:32 +00:00
Jim Ingham c0b4d5a1f6 "nexti" should not step over inlined functions.
<rdar://problem/16705325>

llvm-svn: 222459
2014-11-20 22:04:45 +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
Stephane Sezer e5f27decf9 Fix a typo in lldb-gdb-remote.txt.
Test Plan: None.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 222440
2014-11-20 18:50:16 +00:00
Oleksiy Vyalov 5d06474b29 Add test for denied process attach by pid and fix found bugs in Process/ProcessPOSIX.cpp
and FreeBSD/ProcessMonitor.

http://reviews.llvm.org/D6240

llvm-svn: 222372
2014-11-19 18:27:45 +00:00
Oleksiy Vyalov b92935b444 Fix broken build after removing StringMap::GetOrCreateValue in favor of StringMap::insert.
llvm-svn: 222370
2014-11-19 17:24:58 +00:00
Jason Molenda 51a4511b72 Add additional checks to the SavedLocationForRegister method
where it is retrieving the Return Address register contents
on a target where that's a thing.  If we fail to get a valid
RA, we force a switch to the fallback unwind plan.  This patch
adds a sanity check for that fallback unwind plan -- it must
get a valid CFA for this frame in addition to being able to
retrieve the caller's PC -- and it correctly marks the unwind
rules as failing if the fallback unwind plan fails.

<rdar://problem/19010211> 

llvm-svn: 222301
2014-11-19 02:29:52 +00:00
Jim Ingham 4add3b13f0 Add "-k" and "-K" options to the driver, that allow you to register
some commands that will get run if the target crashes.

Also fix the bug where the local .lldbinit file was not getting
sourced before not after the target was created from the file options on the
driver command line.

<rdar://problem/19019843>

llvm-svn: 222295
2014-11-19 01:28:13 +00:00
Enrico Granata 49bfafb510 Shuffle APIs around a little bit, so that if you pass custom summary options, we don't end up caching the summary hence obtained. You may want to obtain an uncapped summary, but this should not be reflected in the summary we cache. The drawback is that we don't cache as aggressively as we could, but at least you get to have different summaries with different options without having to reset formatters or the SBValue at each step
llvm-svn: 222280
2014-11-18 23:36:25 +00:00
Enrico Granata 34042212b2 Add the ability for the NSString and libc++ std::string formatters to retrieve uncapped data
llvm-svn: 222277
2014-11-18 22:54:45 +00:00
Enrico Granata 489af08f67 Allow dsymutil to exists in a path with spaces in it
llvm-svn: 222276
2014-11-18 22:47:33 +00:00
Ismail Pazarbasi 526223319c Revert "git-svn test commit"
This reverts commit aa8d370ee798f75bc05a1ae9a240bc3e5b6870ac.

llvm-svn: 222275
2014-11-18 22:45:59 +00:00
Ismail Pazarbasi d98f7558bf git-svn test commit
llvm-svn: 222273
2014-11-18 22:44:51 +00:00
Eric Christopher b0a1814ff3 More override warning cleanup.
llvm-svn: 222271
2014-11-18 22:40:27 +00:00
Ismail Pazarbasi cc7d7f5e01 Find SWIG with CMake
SWIG is searched under certain paths within python script. CMake can
detect SWIG with find_package(SWIG). This is used iff user checks
LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION. If
buildSwigWrapperClasses.py does not receive swigExecutable argument,
then the script will use its current search implementation.

llvm-svn: 222262
2014-11-18 21:46:06 +00:00
Greg Clayton 306baae3c4 Fixed the stop hook test after recent editline changes.
llvm-svn: 222246
2014-11-18 19:45:23 +00:00
Ed Maste 2aff396080 Add decorator for test that fails on FreeBSD after editline rework
llvm.org/21599

llvm-svn: 222245
2014-11-18 19:30:13 +00:00
Jim Ingham 7d8555c413 Patch from dawn@burble.org to make the --silent-run do what it says, not the opposite of what it says.
llvm-svn: 222243
2014-11-18 19:12:13 +00:00
Jason Molenda ae3e40dd61 Fix up the code in the FuncUnwinders class that
retrieves the personality routine addr and the
LSDA addr.  Don't bother checking with the
"non-call site" unwind plan - this kind of
information is only going to come from the 
call site unwind plan.

llvm-svn: 222226
2014-11-18 05:57:42 +00:00
Jason Molenda b2115cf81a Add documentation for the SBTarget::ReadInstructions and
SBTarget::GetInstructions APIs so it's a little clearer to 
understand which should be used.

<rdar://problem/18787018>

llvm-svn: 222225
2014-11-18 05:43:11 +00:00
Jason Molenda 9211ec4fcc Make the mutex ivar in Unwind recursive so we don't have a thread
deadlocking when we have the base Unwind class and the HistoryUnwind
subclass both trying to acquire the lock on the same thread to clear
their respective ivar state.
<rdar://problem/18986350> 

llvm-svn: 222221
2014-11-18 04:57:28 +00:00
Jason Molenda e9c7ecf66e Read the LSDA and Personality Routine function address out of the
eh_frame data.  These two pieces of information are used in the
process of exception handler unwinding on SysV ABI systems.

This patch reads the data from the eh_frame section 
(DWARFCallFrameInfo.cpp), allows for it to be saved & read out
of a given UnwindPlan (UnwindPlan.h, UnwindPlan.cpp) - as well
as printing the information in the UnwindPlan::Dump method - and
adds methods to the FuncUnwinders object so that higher levels
can query if a given function has an LSDA / personality routine
defined.

It's only lightly tested, but seems to be working correctly as long
as your have this information in eh_frame.  Does not address getting
this information from compact unwind yet on Darwin systems.

<rdar://problem/18742797> 

llvm-svn: 222214
2014-11-18 02:27:42 +00:00
Greg Clayton ea508635de Have CommandObjectCommandsAddRegex inherit from IOHandlerDelegateMultiline so it will not immediately terminate after the first regular expression in "command regex <name>" commands.
Fixed the prompt to not include non-printable characters as it was hosing up the prompt when you ran "command regex foo" and entered multi-line editing mode.

Fixed error strings to include more complete descriptions when bad regular expressions are entered.

Removed the old IOHandlerLinesUpdated function as it is no longer needed (inheriting from IOHandlerDelegateMultiline takes care of what this function used to do).

llvm-svn: 222207
2014-11-18 00:43:17 +00:00
Greg Clayton dacf689a34 Fixed a broken test suite test after recent editline merges.
The problem is that editline currently is trying to be smart when we paste things into a terminal window. It detects that input is pending and multi-line input is accepted as long as there is anything pending.

So if you open lldb and paste the text between the quotes:

"command regex carp
s/^$/help/

carp
"

We still still be stuck in the "command regex" multi-line input reader as it will have all three lines:

"s/^$/help/

carp
"

The true fix for this is something Kate Stone will soon work on:

- multi-line input readers must opt into this paste/pending input feature ("expr" will opt into it, all other commands won't)
- If we are in a multi-line input reader that requests this and stuff is pasted, then it will do what it does today
- if we start in a IOHandler that doesn't need/want pending input and text is pasted, and we transistion to a IOHandler that does want this functionality, then disable the pending input. Example text would be:

"frame variable
thread backtrace
expr
for (int i=0;i<10;++i)
  (int)printf("i = %i\n", i);

frame select 0
"

When we push the expression multi-line reader we would disable the pending input because we had pending input _before_ we entered "expr".

If we did this first:

(lldb) expr

Then we pasted:

"void foo()
{
}

void bar()
{
}
"

Then we would allow the pending input to not look for an empty line to terminate the expression. We filed radar 19008425 to track fixing this issue.

llvm-svn: 222206
2014-11-18 00:39:31 +00:00
Enrico Granata 099263b487 Fix a problem where the StringPrinter could be mistaking an empty string for a read error, and reporting spurious 'unable to read data' messages. rdar://19007243
llvm-svn: 222190
2014-11-17 23:14:11 +00:00
Enrico Granata 6cd8e0c9b0 Add APIs on SBFunction and SBCompileUnit to inquire about the language type that the function/compile unit is defined in
llvm-svn: 222189
2014-11-17 23:06:20 +00:00
Eric Christopher e0569982db Fix override/virtual warnings.
llvm-svn: 222186
2014-11-17 22:55:13 +00:00
Zachary Turner c30189921e Change HostThread::GetNativeThread() to return a derived reference.
Previously using HostThread::GetNativeThread() required an ugly
cast to most-derived type.  This solves the issue by simply returning
the derived type directly.

llvm-svn: 222185
2014-11-17 22:42:57 +00:00
Oleksiy Vyalov 5453933867 Fix broken NativeProcessLinux.cpp after signature change of ResolveExecutable.
llvm-svn: 222184
2014-11-17 22:42:28 +00:00
Oleksiy Vyalov 6edef20405 Fix broken Linux build after signature change of ResolveExecutable.
llvm-svn: 222182
2014-11-17 22:16:42 +00:00
Zachary Turner 1019695b38 Move the thread logic around to fit better into LLDB's process model.
Previously we were directly updating the thread list and stopping
and restarting the process every time threads were created.  With
this patch, we queue up thread launches and thread exits, resolve
these all internally, and only update the threads when we get an
UpdateThreadList call.  We now only update the private state on
an actual stop (i.e. breakpoint).

llvm-svn: 222178
2014-11-17 21:31:30 +00:00
Zachary Turner d553d00c79 Disable Editline on Windows.
Editline does not work correctly on Windows.  This goes back at
least to r208369, and as a result r210105 was submitted to disable
libedit at runtime on Windows.

More recently, r222163 was submitted which re-writes editline
entirely, but makes the situation even worse on Windows, to the
point that it doesn't even compile.  While it would be easy to
fix the compilation failure, this patch simply stops compiling
Editline entirely on Windows, as the simple compilation fix would
still result in a broken use of select on Windows, and as such a
broken implementation of Editline.

Since Editline was already disabled to begin with on Windows, we
don't attempt to fix the compilation failure or the underlying
issues, and instead just disable it "even more".

llvm-svn: 222177
2014-11-17 21:31:18 +00:00
Zachary Turner 05d77c8b71 Fix broken build after signature change of ResolveExecutable.
llvm-svn: 222176
2014-11-17 21:30:58 +00:00
Jason Molenda 557109377d Small tweaks to make the editline sources match the lldb
source layout.

llvm-svn: 222171
2014-11-17 20:10:15 +00:00
Greg Clayton 8012cadbf3 Fixed more fallout from running the test suite remotely on iOS devices.
Fixed include:
- Change Platform::ResolveExecutable(...) to take a ModuleSpec instead of a FileSpec + ArchSpec to help resolve executables correctly when we have just a path + UUID (no arch).
- Add the ability to set the listener in SBLaunchInfo and SBAttachInfo in case you don't want to use the debugger as the default listener. 
- Modified all places that use the SBLaunchInfo/SBAttachInfo and the internal ProcessLaunchInfo/ProcessAttachInfo to not take a listener as a parameter since it is in the launch/attach info now
- Load a module's sections by default when removing a module from a target. Since we create JIT modules for expressions and helper functions, we could end up with stale data in the section load list if a module was removed from the target as the section load list would still have entries for the unloaded module. Target now has the following functions to help unload all sections a single or multiple modules:

    size_t
    Target::UnloadModuleSections (const ModuleList &module_list);

    size_t
    Target::UnloadModuleSections (const lldb::ModuleSP &module_sp);

llvm-svn: 222167
2014-11-17 19:39:20 +00:00
Kate Stone e30f11d9ee Complete rewrite of interactive editing support for single- and multi-line input.
Improvements include:
* Use of libedit's wide character support, which is imperfect but a distinct improvement over ASCII-only
* Fallback for ASCII editing path
* Support for a "faint" prompt clearly distinguished from input
* Breaking lines and insert new lines in the middle of a batch by simply pressing return
* Joining lines with forward and backward character deletion
* Detection of paste to suppress automatic formatting and statement completion tests
* Correctly reformatting when lines grow or shrink to occupy different numbers of rows
* Saving multi-line history, and correctly preserving the "tip" of history during editing
* Displaying visible ^C and ^D indications when interrupting input or sending EOF
* Fledgling VI support for multi-line editing
* General correctness and reliability improvements

llvm-svn: 222163
2014-11-17 19:06:59 +00:00
Enrico Granata 6e0566c6d9 Not all things callable have an im_self, so harden the test logic against that. getattr(,,None) is the closest to ?. we have in Python, so use that
llvm-svn: 222160
2014-11-17 19:00:20 +00:00
Greg Clayton 35c91347e6 Fixes for remote test suite execution of the "lldb/test/lang" directory.
Fixes include:
- Add a new lldbtest.TestBase function named registerSharedLibrariesWithTarget. This function can be called using the shared libraries for your test suite either as shared library basename ("foo"), path basename ("libfoo.dylib") or full path ("/tmp/lldb/test/lang/c/carp/libfoo.dylib"). These shared libraries are then registered with the target so they will be downloaded when the test is run remotely. 
- Changed a lot of tests over to use SBDebugger::CreateTarget(...) calls instead of using "file a.out" commands.
- Cleaned up some tests to add new locations for breakpoints that all compilers should be able to abide by. Some tests and constants being loaded into values of structs and some compilers like arm64 will often combine two constant data loads into a single source line so some breakpoint locations were not being set correctly. Adding lines like 'puts("")' allow us to lock onto a source line that will have code.

llvm-svn: 222156
2014-11-17 18:40:27 +00:00
Zachary Turner ca0c84cade Fix buildSwigWrapperClasses.py after recent break.
A re-ordering of some enum values exposed a lingering bug where an
invalid key was indexing a dictionary.

llvm-svn: 222154
2014-11-17 18:38:22 +00:00
Greg Clayton ce0b8e0fc9 Fix some issue with running the test suite remotely on iOS.
- Added a new "--apple-sdk" flag that can be specified on Darwin only so the correct cross compilers can be auto-selected without having to specify the "--compiler" flag.
- Set SDKROOT if needed

llvm-svn: 222153
2014-11-17 18:32:17 +00:00
Zachary Turner 1d6af02e2d Reformat lldb-mi using clang-format.
Courtesy of dawn@burble.org.

llvm-svn: 222150
2014-11-17 18:06:21 +00:00
Zachary Turner 119767db85 [ProcessWindows] Create a TargetThreadWindows class.
This creates a TargetThreadWindows class and updates the thread
list of the Process with the main thread.  Additionally, we
fill out a few more overrides of Process base class methods.  We
do not yet update the thread list as threads are created and/or
destroyed, and we do not yet propagate stop reasons to threads as
their states change.

llvm-svn: 222148
2014-11-17 17:46:43 +00:00
Zachary Turner a2fc3a4090 [ProcessWindows] Implement read / write process memory.
llvm-svn: 222147
2014-11-17 17:46:27 +00:00
Ed Maste 9dfcaf4854 Fix Darwin and FreeBSD OS type detection
Obtained in part from http://reviews.llvm.org/D6290

llvm-svn: 222136
2014-11-17 15:40:18 +00:00
Ed Maste 0178e7587e Whitespace cleanup and remove non-canonical headers
llvm-svn: 222135
2014-11-17 15:37:59 +00:00
Ed Maste 9251e2e61c Add decorator for intermittently failing test on FreeBSD
This test has intermittently failed on FreeBSD for quite some time when
run as part of the full test suite.  It generally passes when run by
itself.  Mark as expected failure for now to reduce buildbot noise.

llvm.org/pr15039 test fails intermittently on FreeBSD

llvm-svn: 222134
2014-11-17 15:27:09 +00:00
Jason Molenda b412e529e2 Add a little sketch of a program that can extract unwind
information from the compact unwind section used on darwin
for exception handling, and dump that information..

The UNWIND_X86_64_MODE_RBP_FRAME and UNWIND_X86_64_MODE_DWARF
entries look to be handled correctly.

UNWIND_X86_64_MODE_STACK_IMMD and UNWIND_X86_64_MODE_STACK_IND 
are still a work in progress.

Only x86_64 is supported right now.  Given that this is an
experiment in parsing the section contents, I don't expect to
add other architectures; they are trivial variations on this
arch.  There exists a real dumper included in the Xcode tools, 
unwinddump.

llvm-svn: 222127
2014-11-17 11:43:37 +00:00
Jim Ingham 96a1596a7a For some reason, sometimes the directory paths that clang emits have internal
relative paths, like:

/whatever/llvm/lib/Sema/../../include/llvm/Sema/

That causes problems with our type uniquing, since we use the declaration file
and line as one component of the uniquing, and different ways of getting to the
same file will have different directory spellings, though they are functionally
equivalent.  We end up with two copies of the exact same type because of this, 
and that makes the expression parser give "duplicate type" errors.

I added a method to resolve paths with ../ in them and used that in the FileSpec::Equals,
for comparing Declarations and for doing Breakpoint compares as well, since they also
suffer from this if you specify breakpoints by full path (since nobody knows what
../'s to insert...)

<rdar://problem/18765814>

llvm-svn: 222075
2014-11-15 01:54:26 +00:00
Enrico Granata e63de11a1a I don't need this ivar. It was probably there from the olden days where dynamic type support was flakey. Remove and save space
llvm-svn: 222063
2014-11-14 23:38:23 +00:00
Jim Ingham 90556aa757 Fix examine-threads to build for arm64.
llvm-svn: 222059
2014-11-14 22:58:25 +00:00
Enrico Granata e65a28f36f Removed a couple of static helpers in the data formatters, replaced with new general logic in StringLexer
llvm-svn: 222058
2014-11-14 22:58:11 +00:00
Shawn Best 954eae0ed4 add Makefile rule for test program CREATE_STD_THREADS
Effectively removes -lpthreads from linux/gcc build of test programs in test/api/multithreaded. This was done due to that combination causing a test program to hang due, likely due to an issue with gcc linker and libstdc++ conflicting pthreads code in test program and pthread used by lldb.  Issue has been documented at:
http://llvm.org/bugs/show_bug.cgi?id=21553

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

llvm-svn: 222031
2014-11-14 19:41:33 +00:00
Oleksiy Vyalov 477e42a6fb Apply SOCK_CLOEXEC flag to socket API functions in order to avoid handle leakage to a forked child process.
http://reviews.llvm.org/D6204

llvm-svn: 222004
2014-11-14 16:25:18 +00:00
Stephane Sezer 5109a7938d Properly specify the regex used to match register indexes.
Summary: Something like "core:1" would match and try to be interpreted by the following code otherwise.

Test Plan: Run tests and make sure the ones failing previously now pass.

Reviewers: tfiala, clayborg

Subscribers: lldb-commits

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

llvm-svn: 221980
2014-11-14 09:46:21 +00:00
Vince Harron 01e87d3fe2 fix minor comment typo
llvm-svn: 221950
2014-11-13 23:45:59 +00:00
Stephane Sezer 22ed42e4c8 Specify checksums properly for llgs test suite packets.
Summary: These checksums are ignored by llgs but some implementations require them to be specified properly.

Test Plan: Re-run llgs tests with the checksums and make sure we don't break anything.

Reviewers: tfiala, clayborg

Subscribers: lldb-commits

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

llvm-svn: 221927
2014-11-13 21:39:24 +00:00
Greg Clayton bf702ceed1 Fixed "SBTarget SBDebugger::CreateTarget (const char *filename)" to use the same semantics as other SBDebugger::CreateTarget() functions.
The issues were:
- If you called this function with any arch other than the default target architecture, creating the target would fail because the Target::GetDefaultArchitecture() would not match the single architecture in the file specified. This caused running the test suite remotely with lldb-platform to fail many many tests due to the bad target.
- It would specify the currently selected platform which might not work for the specified platform

All other SBDebugger::CreateTarget calls do not assume an architecture or platform and if they aren't specified, they don't auto select the wrong one for you.

With this fix, SBTarget SBDebugger::CreateTarget (const char *filename) now behaves like the other SBDebugger::CreateTarget() variants.

llvm-svn: 221908
2014-11-13 18:30:06 +00:00
Greg Clayton 14418e0409 Remove extra "/" character from paths resolved in iOS SDKs and also be sure to update the SDK directory infos if needed before we start using m_sdk_directory_infos.
llvm-svn: 221907
2014-11-13 18:25:33 +00:00
Oleksiy Vyalov 1339b5e8ae Refactor NativeProcessLinux::AttachToProcess in order to avoid reinterpret_cast from NativeProcessProtocol* to NativeProcessLinux*.
llvm-svn: 221906
2014-11-13 18:22:16 +00:00