Commit Graph

9356 Commits

Author SHA1 Message Date
Reid Kleckner 56d861fbb9 Attempt to fix the expression parser after r214119
__INT?_TYPE__ is now explicitly, so adding an explicit 'signed'
specifier causes errors.

llvm-svn: 214233
2014-07-29 21:59:33 +00:00
Greg Clayton 2be78ba934 Remove unused variable that was causing a warning.
llvm-svn: 214230
2014-07-29 21:47:02 +00:00
Greg Clayton c76fa8a3eb Resolve the executable _before_ we try to get the module specifications.
Also fixed the host 32 and 64 bit arch to return "x86_64-apple-macosx" again instead of "x86_64-apple-" (unspecified OS) after recent changes.

<rdar://problem/17845078> 

llvm-svn: 214223
2014-07-29 21:27:21 +00:00
Greg Clayton 82625d3a5f Use the most up to date dsymutil on Darwin, not the one in /usr/bin/dsymutil.
llvm-svn: 214207
2014-07-29 20:10:59 +00:00
Zachary Turner 12f6f53618 [Windows] Delegate str[n]casecmp to the appropriate MSVCRT func.
llvm-svn: 214197
2014-07-29 19:08:55 +00:00
Greg Clayton a3a6c12c03 When constructing an ArchSpec from a MachO cpu type and subtype, don't set the OS for x86_64 and x86 in case the binary ends up being for macosx or ios.
<rdar://problem/17819272> 

llvm-svn: 214188
2014-07-29 18:04:57 +00:00
Zachary Turner d8a5273993 Fix compile error on Windows.
A piece of a future patch accidentally made it in, this simply
fixes the error.

llvm-svn: 214161
2014-07-29 05:39:21 +00:00
Todd Fiala ef7150925f Fixup TestStepNoDebug to cleanup properly on shutdown.
This was causing core dumps on MacOSX and was not properly
cleaning up the state of the inferior before exiting.

The test was overriding def tearDown(), but failed to
call the base class after doing its own cleanup.  This
essentially eliminated normal clean-up activity.

llvm-svn: 214138
2014-07-28 22:53:49 +00:00
Zachary Turner 35ed13262d Teach LLDB about Windows processes.
This patch creates a simple ProcessWindows process plugin.
The only thing it knows how to do currently is create processes.

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

llvm-svn: 214094
2014-07-28 16:45:18 +00:00
Zachary Turner 9e757b7ebe Use llvm Support functions to get the user's home directory.
Assuming that the user's home directory is at ~ is incorrect on
Windows.  This patch delegates the request to LLVM's support
library, which already provides a cross-platform implementation
of this function.

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

llvm-svn: 214093
2014-07-28 16:45:05 +00:00
Zachary Turner ad587ae4ca Fix supported architectures on PlatformWindows.
i386, i486, i486sx, and i686 are all indistinguishable as far as
PE/COFF files are concerned.  This patch adds support for all of
these architectures to PlatformWindows.

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

llvm-svn: 214092
2014-07-28 16:44:49 +00:00
Zachary Turner 3b2065f017 Fix the MSVC build. MSVC does not support constexpr.
llvm-svn: 214091
2014-07-28 16:44:28 +00:00
Matthew Gardiner fc2a8c407d Test commit, please ignore
llvm-svn: 214062
2014-07-28 06:21:40 +00:00
Todd Fiala 31bde322f3 llgs: add --reverse-connect support.
Also includes --reverse-connect tests for llgs and debugserver.

llvm-svn: 214031
2014-07-26 20:39:17 +00:00
Todd Fiala b1d57febf7 Minor fixups to documentation for Process::Launch()/DoLaunch().
The code had moved forward with changes for using ProcessLaunchInfo,
but the documentation still referred to arguments that no longer
get passed to these methods.

llvm-svn: 213965
2014-07-25 19:24:52 +00:00
Todd Fiala d947406427 Fix an x86 assembler stack unwind calculation for non-volatile registers.
This change has the practical effect of fixing some backtrace
scenarios that would fail with inferiors running on the Android Art
host-side JVM under Linux x86_64 on Ubuntu 14.04.

See this lldb-commits thread for more details:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140721/011988.html

Change by Tong Shen.
Reviewed by Jason Molenda.

Tested:
Ubuntu 14.04 x86_64, clang-3.5-built lldb.
MacOSX 10.10 Preview 4, Xcode 6 Beta 4-built lldb.

llvm-svn: 213914
2014-07-25 01:15:34 +00:00
Todd Fiala e88aea3234 Fix configure/make builds on MacOSX.
Change by Keno Fischer.

llvm-svn: 213904
2014-07-24 23:22:58 +00:00
Jim Ingham a9b498955c We were turning off all these tests on OSX and FreeBSD because of a known (and fairly unimportant) bug.
Keep a test for that bug, but let the useful parts of the test run anyway.

llvm-svn: 213875
2014-07-24 16:56:19 +00:00
Ed Maste 3feafa78bd Fix endian test for big-endian hosts
The uint16_t cast truncated the magic value to 0x00000304, making the
first byte 0 (eByteOrderInvalid) on big endian hosts.

Reported by Justin Hibbits.

llvm-svn: 213861
2014-07-24 13:28:16 +00:00
Jason Molenda 9e7da0fb44 Add debug asserts / sanity checks to
GDBRemoteRegisterContext::ReadRegisterBytes and
GDBRemoteRegisterContext::WriteRegisterBytes to ensure we don't try
to read/write off the end of the register buffer.  This should never
happen but we've had some target confusion in the past where it
did; adding the checks is prudent to avoid crashing here if it happens
again.

<rdar://problem/16450971> 
<rdar://problem/16458182>

llvm-svn: 213829
2014-07-24 01:53:11 +00:00
Jason Molenda 36a216eefc Increase the gdb-remote packet timeout for the first packet we send
to the remote side (QStartNoAckMode) - it may take a little longer
than normal to get a reply.

In debugserver, hardcode the priority for several threads so they
aren't de-prioritized when a user app is using system resources.
Also, set the names of the threads.

<rdar://problem/17509866>

llvm-svn: 213828
2014-07-24 01:36:24 +00:00
David Majnemer 5149bac8b4 Add a .clang-format file to enhance formatting experience with clang-format
clang-format is a handy tool that formats code very intelligently.  I'd
like to use it with LLDB but it requires a .clang-format file to inform
it about LLDB-specific formatting rules.

More information on these rules are here:
http://clang.llvm.org/docs/ClangFormatStyleOptions.html

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

llvm-svn: 213823
2014-07-24 00:26:04 +00:00
David Majnemer b98a5e04ac ObjectFileMachO: Silence signed/unsigned comparison warning
File::SeekFromStart returns an off_t representing the position of the
file after seeking.  This return value is always going to be one of two
values: the input or -1 in the case of failure.

ObjectFileMachO compares an expression of type off_t from the return of
File::SeekFromStart(segment.fileoff) and compares it for equality with
segment.fileoff.

The type of segment_command_64::fileoff is unsigned while off_t is
signed, comparing them emits a diagnostic under GCC.

Instead, we can just compare SeekFromSTart with -1 to see if we
successfully seeked.

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

llvm-svn: 213822
2014-07-24 00:24:12 +00:00
Enrico Granata d75303581f Ensure that if some unspecified person were to pass in an invalid architecture when trying to create a target, that it would fail, but not cause LLDB to crash.
llvm-svn: 213781
2014-07-23 18:18:38 +00:00
Greg Clayton 56b796856f Make sure we don't crash if someone (E.G.) comments out on entry from g_core_definitions[] without removing the ArchSpec::Core enumeration when submitting from source.
We now catch the issue with a static_assert() at compile time and use llvm::array_lengthof(g_core_definitions) as well.

<rdar://problem/17767541>

llvm-svn: 213778
2014-07-23 18:12:06 +00:00
Todd Fiala 002fb104bd Add kalimba architecture checking to TestImageListMultiArchitecture
Verify that ObjectFileELF's kalimba detection works regardless
of the host platform.

Change by Matthew Gardiner.

llvm-svn: 213763
2014-07-23 15:16:35 +00:00
Todd Fiala a7804f249b Improve documentation on triple encoding expectations for qHostInfo response.
Change by Matthew Gardiner.

llvm-svn: 213756
2014-07-23 14:48:41 +00:00
Todd Fiala d8eaa17587 Update lldb to track recent Triple arm64 enum removal and collapse into aarch64.
See the following llvm change for details:

r213743 | tnorthover | 2014-07-23 05:32:47 -0700 (Wed, 23 Jul 2014) | 9 lines
AArch64: remove arm64 triple enumerator.

This change fixes build breaks on Linux and MacOSX lldb.

llvm-svn: 213755
2014-07-23 14:37:35 +00:00
Saleem Abdulrasool 6310757568 Plugins: silence a few more signed comparision warnings
Address a few signed-compare warnings that were triggered on GCC 4.8.2.

llvm-svn: 213716
2014-07-23 01:53:54 +00:00
Saleem Abdulrasool b5c128b3c7 Target: silence a GCC warning
GCC emits a warning:
    warning: enumeral and non-enumeral type in conditional expression [enabled by default]
which does not seem to have a flag to control it.  Simply add an explicit cast
for the boolean value.

llvm-svn: 213715
2014-07-23 01:53:52 +00:00
Todd Fiala 015d818b59 Enable lldb-platform exe support for Linux.
This change enables lldb-platform for Linux.  In addition, it does the following:

* fixes Host::GetLLDBPath() to work on Linux/*BSD for ePathTypeSupportExecutableDir-relative paths.

* adds more logging and comments around lldb-platform startup and remote lldb-platform usage.

* refactors lldb-platform remote-* support for Darwin and Linux into PlatformPOSIX.  This, in theory, is the bulk of what is needed for *BSD to make remote connections to lldb-platform as well (although I haven't tested that yet).  FreeBSD can make similar changes to their Platform* as was made here for PlatformLinux to pick up the rest of the bits.

* teaches GDBRemoteCommunication to use lldb-gdbserver for non-Apple hosts.

llvm-svn: 213707
2014-07-22 23:41:36 +00:00
David Majnemer 12bb77ddd1 SBCommunication: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This fixes a diagnostic emitted by GCC.

llvm-svn: 213696
2014-07-22 22:12:58 +00:00
David Majnemer f57a430b90 ScriptInterpreterPython: %p should be used with void-pointer
printf's %p format specifier expects an argument of type void-pointer,
not type PyThreadState*.  Fix this with a static_cast.

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

llvm-svn: 213695
2014-07-22 22:02:48 +00:00
David Majnemer 8490da15a8 Host: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This silences a warning emitted by GCC when building LLDB.

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

llvm-svn: 213693
2014-07-22 22:00:42 +00:00
David Majnemer 702c1d0986 SBHostOS: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This fixes a warning emitted by GCC.

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

llvm-svn: 213692
2014-07-22 22:00:04 +00:00
David Majnemer 5ff0278b68 PluginManager: Don't cast from void-pointer to pointer-to-function
GCC warns on reinterpret_cast expressions involving a void-pointer
source and a pointer-to-function destination.  Take a detour through
intptr_t to silence it.

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

llvm-svn: 213691
2014-07-22 21:59:22 +00:00
David Majnemer 695f0f1024 TypeSynthetic: Fix a pointer-to-function to void-pointer cast
reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

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

llvm-svn: 213682
2014-07-22 20:40:01 +00:00
David Majnemer fba933f94b Mangled: Fix an 'unused variable' warning on GNU/Linux
Platforms which don't use LLDB's built-in demangler don't use the
'mangled_length' variable.  Instead, replace it's only use by an
expression it is equivalent to.

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

llvm-svn: 213681
2014-07-22 20:36:37 +00:00
Kate Stone e2b2186652 Dramatically improves C++ demangling performance by introducing a new implementation that is much faster than the existing demangler. While not yet complete, the new demangler will fail gracefully when it encounters symbols it isn’t prepared to deal with. In these cases LLDB will fall back to using the full demangler to prevent a loss in functionality. On sizable code bases the fast path succeeds 95% of the time, providing a significant net win.
The new implementation is located in source/Core/FastDemangle.cpp.  It’s fairly straightforward C code with a few basic C++ extensions.  It should compile with little or no change on a variety of platforms, but of course it is still only useful for symbols that comply with the Itanium ABI mangling spec (plus a few Clang extensions.)

<rdar://problem/15397553> <rdar://problem/15794867>

llvm-svn: 213671
2014-07-22 17:03:38 +00:00
Zachary Turner 9ef307bfc1 Make the test runner understand Windows command shell execution.
Currently, the test runner makes the assumption that it will run
commands through /bin/sh.  This is obviously not true on Windows,
so this patch abstracts this logic out somewhat.  Instead of
having the caller build the command string himself, the caller
will now pass in argument list of the form [[a, b], [c, d], ...]
which will get converted into a string of the form a b; c d or
a b && c d, depending on the platform.

Reviewed by: Todd Fiala

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

llvm-svn: 213669
2014-07-22 16:19:29 +00:00
Deepak Panickal 71f5b50f8b Fix an issue where an entry point of 0x00 would cause LLDB to think that the ELF is not executable without checking for ET_EXEC
llvm-svn: 213644
2014-07-22 12:01:43 +00:00
Deepak Panickal d4f3f94e6a Fix the warnings introduced
llvm-svn: 213643
2014-07-22 11:59:11 +00:00
Kate Stone bb1321a7be Improve LLDB's embedded C++ demangler by addressing the following two issues:
1) Preserve ref qualification state in a local variable while parsing a nested name.  Previously, the state was recorded in the shared db reference and could therefore be overwritten when parsing multiple levels of nested names (e.g.: when a qualified name has qualified template args.)

2) Address an off-by-one error when testing whether or not a thunk is non-virtual.  This resulted in the demangled identifying all thunks as non-virtual.

llvm-svn: 213591
2014-07-22 00:18:52 +00:00
Saleem Abdulrasool 0fb2f5d0f9 build: silence GCC warning on Linux
LLDWrapPython.cpp is a generated file.  This contains a double assignment to the
same value, which causes GCC to emit a warning about sequence point evaluation
causing a use-before-init.  Simply silence the warning.

llvm-svn: 213575
2014-07-21 18:18:52 +00:00
Deepak Panickal 5780657be8 Update CMakeLists.txt and Makefiles for building/linking the Hexagon ABI and Dynamic Loader
llvm-svn: 213568
2014-07-21 17:24:05 +00:00
Deepak Panickal 8006d319c2 Add the Hexagon DSP breakpoint opcode to PlatformWindows and PlatformLinux
llvm-svn: 213567
2014-07-21 17:22:12 +00:00
Deepak Panickal 2526ee5a2d ABI for the Hexagon DSP
llvm-svn: 213566
2014-07-21 17:21:01 +00:00
Deepak Panickal ca238a7b82 Dynamic loader for the Hexagon DSP
llvm-svn: 213565
2014-07-21 17:19:12 +00:00
Zachary Turner 07b21d7a69 Rename dosep.ty to dosep.py
llvm-svn: 213555
2014-07-21 16:16:31 +00:00
Zachary Turner 37373b0c98 Remove spurious debugging message from CMake.
llvm-svn: 213553
2014-07-21 16:10:20 +00:00
Saleem Abdulrasool 6747c7d01b linux process: silence GCC switch coverage warning
Add missing entry for eExecMessage message type to silence GCC switch coverage
warning.

llvm-svn: 213470
2014-07-20 05:28:57 +00:00
Saleem Abdulrasool e1401eb747 build: fix cmake warning with newer CMake
Hoist the compatibility macros out a level and re-use them when adding link
dependencies.  Silences a warning from CMake.

llvm-svn: 213469
2014-07-20 05:28:55 +00:00
Jim Ingham 4ac0443fd9 Add the ability to suppress the creation of a persistent
result variable and use in in "Process::LoadImage" so that,
for instance, "process load" doesn't increment the return
variable number.

llvm-svn: 213440
2014-07-19 01:09:16 +00:00
Jim Ingham 6971b861d7 In Process::LoadImage, use the same function call both to call dlopen and to collect
the error if there is one.

llvm-svn: 213436
2014-07-19 00:37:06 +00:00
Greg Clayton 759e7441af LLDB now correctly handles virtual inheritance.
Test case added as well.

<rdar://problem/16785904>

llvm-svn: 213433
2014-07-19 00:12:57 +00:00
Zachary Turner 2f12195b1d Allow the user to override the LLDB_TEST_COMPILER at CMake level.
llvm-svn: 213421
2014-07-18 22:46:22 +00:00
Zachary Turner be9c423b95 Test commit. Having trouble committing from one machine but not
another, attempting to fix it.

llvm-svn: 213413
2014-07-18 21:06:51 +00:00
Zachary Turner a6473a7994 Fix a bug with order of operations.
llvm-svn: 213411
2014-07-18 21:03:06 +00:00
Zachary Turner c9bf0c70b5 Make lldb -P work on Windows.
lldb -P, which outputs its python path, works by using Host-layer
facilities to get information about the loaded python module.  This
Host functionality was unimplemented on Windows, so this patch
implements it.  Additionally, it removes a pexpect dependency from
the test runner and uses an equivalent invocation of subprocess.

Reviewed by: Todd Fiala

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

llvm-svn: 213410
2014-07-18 20:36:08 +00:00
Greg Clayton d46bb62610 Fixing warnings shouldn't introduce a crasher.
Fix the warning the correct way without making things crash when ENABLE_MUTEX_ERROR_CHECKING is non enabled.

<rdar://problem/17703039>

llvm-svn: 213394
2014-07-18 18:32:45 +00:00
Joerg Sonnenberger 968697d161 Use PRIx64.
llvm-svn: 213366
2014-07-18 11:58:19 +00:00
Zachary Turner 05c30880b6 Use the designated PYTHON_EXECUTABLE during build.
We were hardcoding "python" as the command to run the swig wrapper
scripts.  We should be using PYTHON_EXECUTABLE instead.

llvm-svn: 213354
2014-07-18 07:06:13 +00:00
Zachary Turner 045fde58d1 Fixes a number of issue related to test portability on Windows.
99% of this CL is simply moving calls to "import pexpect" to a more
narrow scope - i.e. the function that actually runs a particular
test.  This way the test suite can run on Windows, which doesn't have
pexpect, and the individual tests that use pexpect can be disabled on
a platform-specific basis.

Additionally, this CL fixes a few other cases of non-portability.
Notably, using "ps" to get the command line, and os.uname() to
determine the architecture don't work on Windows.  Finally, this
also adds a stubbed out builder_win32 module.

The full test suite runs correctly on Windows after this CL, although
there is still some work remaining on the C++ side to fix one-shot
script commands from LLDB (e.g. script print "foo"), which currently
deadlock.

Reviewed by: Todd Fiala

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

llvm-svn: 213343
2014-07-18 01:02:02 +00:00
Greg Clayton 26a15efa77 Fixed the objective C symbol parsing in ObjectFileMachO.
This fixes all of the hidden ivar test cases and any case where we try to find the full definition of an objective C class.

This also means hidden ivars show up again.

<rdar://problem/15458957>
llvm.org/pr20270
llvm.org/pr20269
llvm.org/pr20272

llvm-svn: 213328
2014-07-17 22:51:31 +00:00
Jim Ingham cf973791a1 ReadPointedString takes a Stream not a DataBuffer.
llvm-svn: 213314
2014-07-17 21:53:48 +00:00
Zachary Turner fa59e62012 Create an _d suffixed symlink when doing a debug Windows build.
_lldb is built as an extension module on Windows.  Normally to load
an extension module named 'foo', Python would look for the file
'foo.pyd'.  However, when a debug interpreter is used, Python will
look for the file 'foo_d.pyd'.  This change checks the build
configuration and creates the correct symlink name based on the
build configuration.

llvm-svn: 213306
2014-07-17 20:36:14 +00:00
Jim Ingham 3ac7cf3be9 In Process::LoadImage, if dlopen returns 0x0 fetch the error with dlerror and report
that in the returned Error.

llvm-svn: 213294
2014-07-17 18:55:25 +00:00
Sean Callanan 2683aca12e Fixed our install-headers script to set version
numbers correctly.

<rdar://problem/17708687>

llvm-svn: 213284
2014-07-17 17:26:38 +00:00
Sean Callanan 0feb17ec5c Two fixes in the Objective-C language runtime:
- First, when logging, be helpful by printing
  the real name of the class;

- Second, up the limit for number of classes
  from 16k to 128k, and put in an assertion
  (and better error handling when not in a
  debug configuration) when we cross that
  limit the next time.

<rdar://problem/17052976>

llvm-svn: 213218
2014-07-17 01:20:37 +00:00
Greg Clayton a1bce2ef1a Modify the EFI KDP debugging to not use any dynamic loader since it does manual dynamic loading itself via python modules.
Also track down the required binary by trying to locate the main executable module through LLDB's symbol and executable file locating code.

<rdar://problem/16570258>

llvm-svn: 213199
2014-07-16 21:16:27 +00:00
Greg Clayton 0fdd3ae54d ^C wasn't interrupting an expression during a long evaluation or deadlock.
The problem was that we have an IOHandler thread that services the IOHandler stack. The command interepter is on the top of the stack and it receives a "expression ..." command, and it calls the IOHandlerIsComplete() callback in the command interpereter delegate which runs an expression. This causes the IOHandlerProcessSTDIO to be pushed, but since we are running the code from the IOHandler thread, it won't get run. When CTRL+C is pressed, we do deliver the interrupt to the IOHandlerProcessSTDIO::Interrupt() function, but it was always writing 'i' to the interrupt pipe, even if we weren't actively reading from the debugger input and the pipes. This fix works around the issue by directly issuing the async interrupt to the process if the process is running.

A longer term more correct fix would to be run the IOHandler thread and have it just do the determination of the input and when complete input is received, run the code that handles that input on another thread and syncronize with that other thread to detect when more input is desired. That change is too big to make right now, so this fix will tide us over until we can get there.

<rdar://problem/16556228>

llvm-svn: 213196
2014-07-16 21:05:41 +00:00
Zachary Turner 4041116579 Fix some warnings in the Windows build.
llvm-svn: 213194
2014-07-16 20:28:24 +00:00
Todd Fiala 17096d7669 Add Host::MAX_THREAD_NAME_LENGTH constant.
This value gets set to a max uint32_t value when there is no known limit; otherwise,
it is set to a value appropriate for the platform.  For the moment, only
Linux, FreeBSD and NetBSD set it to 16.  All other platforms set it to
the max uint32_t value.

Modifies the Process private state thread names to fit within a 16-character limit
when the max thread name length is <= 16.  These guarantee that the thread names
can be distinguished within the first 16 characters.  Prior to this change, those
threads had names in the final dotted name segment that were not distinguishable
within the first 16 characters.

llvm-svn: 213183
2014-07-16 19:03:16 +00:00
Zachary Turner 0152e73a73 Fix build broken as a result of r213171.
r213171 renames the 'clangRewriteCore' library to 'clangRewrite'.
This change simply updates the makefiles to reference the correct
library name.

llvm-svn: 213181
2014-07-16 18:53:18 +00:00
Todd Fiala f9ad21d22a gdb-remote test noise suppression on MacOSX.
This change adds a member to the base test case for gdb-remote that
indicates whether a stub makes two X stop notification reports on kill
commands.  This is set to true for debugserver tests.

The test for killing an attached process after it's first stop notification
has been modified to look at that flag and add an extra X packet matcher
so the "unmatched packet warning" doesn't get emitted for the second X on
MacOSX with debugserver.

I also broke those tests out of the monolithic TestLldbGdbServer mega test
case and put it in its own, new TestGdbRemoteKill.py file and test case.

Tested:
Ubuntu 14.04 x86_64, clang-3.5 built lldb, no test failures.
MacOSX 10.9.4, Xcode 6.0 Beta 3 built lldb, no test failures.

llvm-svn: 213166
2014-07-16 16:15:42 +00:00
Todd Fiala cfee963282 Add kalimba as a platform.
This change comprises of additions and some minor changes in order that
"kalimba" is listed as a supported platform and that debugging any
kalimbas results in PlatformKalimba being associated with the target.

The changes are as follows:

* The PlatformKalimba implementation itself
* A tweak to ArchSpec
* .note parsing for Kalimba in ObjectFileELF.cpp
* Plugin registration
* Makefile additions

Change by Matthew Gardiner

Minor tweak for cmake and Xcode by Todd Fiala

Tested:
Ubuntu 14.04 x86_64, clang 3.5-built lldb, all tests pass.
MacOSX 10.9.4, Xcode 6.0 Beta 1-built lldb, all tests pass.

llvm-svn: 213158
2014-07-16 15:03:10 +00:00
Greg Clayton 2c156f852c Fixed the an objective C test case so it passes correctly.
Fixed the test case to use a runtime function prototype that will be correct ([NSString stringWithCString: "new"]) instead of one that won't (expression str = [NSString stringWithFormat: @"%cew", 'N']). The runtime doesn't track vararg functions correctly so we can't reconstitute the function correctly.

Also fixed some expressions that used "str_id" whose type was "id" and do the necessary casting since "id" doesn't have any methods.

llvm-svn: 213113
2014-07-16 00:42:06 +00:00
Greg Clayton 0d830b4226 TestObjCMethods.FoundationTestCase was failing due to an error, fixed now.
<rdar://problem/16322133>
llvm.org/pr20267

llvm-svn: 213111
2014-07-16 00:39:15 +00:00
Greg Clayton 325948cc48 Fix compile warning.
llvm-svn: 213106
2014-07-15 23:27:56 +00:00
Jim Ingham 0aca5f0934 The following files:
LinuxThread.cpp
LinuxThread.h
NativeRegisterContext.h
ProcessLinux.cpp
ProcessLinux.h
ProcessMonitor.cpp
ProcessMonitor.h

Were inserted in the CopyFiles phase of the "desktop" aggregate target.  That caused them to get
copied to /usr/shared/man/man1 on install, which isn't right.  Not sure why they were there...
I removed them.  If this was supposed to achieve some other purpose, we should discuss how to do
that correctly on the mailing list.

<rdar://problem/17642262>

llvm-svn: 213094
2014-07-15 21:24:58 +00:00
Greg Clayton 45a44f3c4d Any commands that are executed through the public interface using SBCommandInterpreter::HandleCommand() are assumed to be in non-interactive mode.
Any commands that want interactivity (stdin) will need to be executed through the normal command interpreter using the debugger's in/out/err file handles, or by using "command source".

Individual commands through the API will have their STDIN disabled. The STDOUT and STDERR will be redirected into the SBCommandReturnObject argument to SBCommandInterpreter::HandleCommand() as usual.

This helps with a deadlock situation in an IDE (Xcode) where the IDE was managing the breakpoint actions by setting a breakpoint callback and doing things manually.

<rdar://problem/17386271>

llvm-svn: 213023
2014-07-15 00:25:59 +00:00
Greg Clayton fb8b37a49d If Process::Finalize() has been called, don't track process state changes.
<rdar://problem/17540766>

llvm-svn: 213007
2014-07-14 23:09:29 +00:00
Greg Clayton 52edb364a1 lldb.LLDB_ARCH_DEFAULT now works correctly on Macs with haswell enabled kernels.
<rdar://problem/17604133>

llvm-svn: 213004
2014-07-14 22:53:02 +00:00
Todd Fiala 24189d4c86 Modified gdb-remote tests to run with automatically-chosen ports.
Now that llgs supports communicating the 0-port choose-a-port
mechanism and can communicate that back to a caller via the
--named-pipe option (at parity with debugserver), we use this
mechanism to always start llgs and debugserver gdb-remote
protocol tests without needing to use some port arbitration
mechanism.  This eliminates some potential intermittent failures vs. the
previous random port and collision-avoidance strategy used.

llvm-svn: 212923
2014-07-14 06:24:44 +00:00
Ed Maste c25d5cc777 Fix lldb-gdbserver build
s_listen_thread had the wrong type.

llvm-svn: 212884
2014-07-12 21:46:39 +00:00
Todd Fiala a6a362a086 llgs: modify to accept --native-regs flag.
This is the last flag sent by lldb-platform that was not accepted
by llgs and is accepted by debugserver.

Conditionalized out a bit more code in prep for Windows
support one day based on _WIN32 define.

Updated the lldb-gdbserver usage string to represent
recent updates to command line arguments (and some older
ones like --attach pid).

Implements https://github.com/tfiala/lldb/issues/37

llvm-svn: 212879
2014-07-12 17:34:24 +00:00
Ed Maste 78d117eb63 Add FreeBSD failure decorator for TestCallStopAndContinue
The testrun now completes successfully on my FreeBSD 11.0-CURRENT
laptop.  There are some intermittent failures on the FreeBSD buildbot
still, which should be addressed in later commits.

llvm.org/pr20274

llvm-svn: 212878
2014-07-12 15:41:03 +00:00
Ed Maste 8abef69ad9 Add FreeBSD decorator for TestMultipleDebuggers
llvm.org/pr20282

llvm-svn: 212877
2014-07-12 15:21:55 +00:00
Todd Fiala 289ca249f0 llgs: implement --setsid.
The --setsid (-S) option changes the session id for the lldb-gdbserver process.
This is used by tools such as lldb-platform and allows the user to prevent
llgs from being in the same session as a calling terminal session.
This will prevents terminal group control signals from affecting
lldb-gdbserver.

See also:
https://github.com/tfiala/lldb/issues/38

llvm-svn: 212873
2014-07-12 01:12:44 +00:00
Greg Clayton 2740787dc9 lldb needs to support DW_op_piece masks for values in subregister and also to be able to piece together a value that is spread across multiple registers.
Patch from Adrian Prantl.

<rdar://problem/16040521> 

llvm-svn: 212867
2014-07-12 00:24:33 +00:00
Greg Clayton 44362e06d1 Allow generic ARM cores to match any more specific ARM architecture.
<rdar://problem/15932248>

llvm-svn: 212863
2014-07-12 00:11:34 +00:00
Greg Clayton 7248ac026c Remove assert now that we have a 'i' character that might come through as well as the 'q' character on the interrupt pipe.
<rdar://problem/15840749>

llvm-svn: 212856
2014-07-11 23:15:11 +00:00
Todd Fiala 67041194b9 Added llgs --named-pipe support and program_name-version_number printout support.
Added a unit test to test debugserver and llgs compliance on --named-pipe support.

Modified llgs to implement --named-pipe support.  (Note: need to revisit with
new generic pipe support).

llvm-svn: 212854
2014-07-11 22:50:13 +00:00
Greg Clayton a39390699c Don't crash when a SBType is handed out through the API and later used after the module that owns the type is deleted.
The fix adds a std::weak_ptr<Module> into the TypeImpl and fills in the weak pointer when possible. It also checks to make sure the module is still alive prior to using it which should make our API safer to use.

<rdar://problem/15455145> 

llvm-svn: 212853
2014-07-11 22:43:15 +00:00
Greg Clayton bca7db7177 Don't use "lldb." global variables in LLDB commands.
llvm-svn: 212852
2014-07-11 22:41:30 +00:00
Todd Fiala 09512ec2af Modify ObjectFileELF::GetArchitecture() to avoid calling ParseSectionHeaders() when we have headers.
Change by Matthew Gardiner.

llvm-svn: 212825
2014-07-11 15:43:51 +00:00
Todd Fiala 6477ea87b7 Prevent ObjectFileELF::GetSectionHeaderInfo() from reparsing section headers.
If we have any section headers in the collection, we already parsed them.
Therefore, don't reparse the section headers when the section_headers collection
is not empty.

See this thread for more details:
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140707/011721.html

Change by Matthew Gardiner

llvm-svn: 212822
2014-07-11 15:13:33 +00:00
Greg Clayton 205ca1e89f Enable the ability to enable debug info generation when evaluating expressions.
llvm-svn: 212792
2014-07-11 01:03:57 +00:00
Greg Clayton fb9756131e Remove code that was merged incorrectly.
llvm-svn: 212791
2014-07-11 00:51:53 +00:00
Zachary Turner 0ab4b48992 Get the python scripting interface working on Windows.
This patch fixes a number of issues with embedded Python on
Windows.  In particular:

1) The script that builds the python modules was normalizing the
   case of python filenames during copies.  The module name is
   the filename, and is case-sensitive, so this was breaking code.

2) Changes the build to not attempt to link against python27.lib
   (e.g. the release library) when linking against msvcrt debug
   library.  Doing a debug build of LLDB with embedded python
   support now requires you to provide your own self-compiled
   debug version of python.

3) Don't import termios when initializing the interpreter.  This
   is part of a larger effort to remove the dependency on termios
   since it is not available on Windows.  This particular instance
   was unnecessary and unused.

Reviewed by: Todd Fiala

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

llvm-svn: 212785
2014-07-10 23:47:42 +00:00
Greg Clayton 3f19ada88e Cleanup the iOS simulator code.
Fixes include:
- Don't say that "<arch>-apple-ios" is compatible with "<arch>-apple-macosx"
- Fixed DynamicLoaderMacOSXDYLD so specify an architecture that was converted solely from a cputype and subtype, just specify the file + UUID.
- Fixed PlatformiOSSimulator::GetSupportedArchitectureAtIndex() so it returns the correct archs
- Fixed SymbolFileDWARFDebugMap to load .o files correctly by just specifying the architecture without the vendor and OS now that "<arch>-apple-ios" is not compatible with "<arch>-apple-macosx" so we can load .o files correctly for DWARF with debug map
- Fixed the coded in TargetList::CreateTarget() so it does the right thing with an underspecified triple where just the arch is specified.

llvm-svn: 212783
2014-07-10 23:33:37 +00:00
Todd Fiala 57cacb013f Flipped intermittent test failures from skip to XFAIL.
The following intermittently-failing tests have been flipped from
skip to XFAIL on some combo of Linux and MacOSX:

TestCallStopAndContinue.py (Linux, MacOSX)
TestCallWithTimeout.py (Linux)
TestConvenienceVariables.py (Linux)
TestStopHookMultipleThreads.py (Linux)

The following new tests have been marked XFAIL but are just
intermittently failing:

TestMultipleDebug.py (definitely intermittent on MacOSX, not sure I've seen
it pass yet on Linux)

llvm-svn: 212762
2014-07-10 20:52:08 +00:00
Zachary Turner 026861b87d Move the post-build step that creates lldb.py.
Being in lldb\source, ${CMAKE_CURRENT_BINARY_DIR} would resolve to
the build\tools\lldb\source directory.  For correct operation, and
parity with the shell script, it needs to resolve to the
build\tools\lldb\scripts directory.

llvm-svn: 212760
2014-07-10 20:37:47 +00:00
Zachary Turner 454955e1b3 Add better logging to the new Python-based SWIG generation scripts.
llvm-svn: 212759
2014-07-10 20:25:18 +00:00
Bruce Mitchener 350b78e5ea Reapply typo fix.
This was lost in the re-merging of command validation changes.

llvm-svn: 212721
2014-07-10 14:45:57 +00:00
Jason Molenda 3b9a93498b Get the inferior binary's name via the command line argument instead
of hardcoding it.

llvm-svn: 212698
2014-07-10 10:23:01 +00:00
Jason Molenda 91c2a99740 Fix test name.
llvm-svn: 212694
2014-07-10 09:55:19 +00:00
Todd Fiala b35103ebb9 Fix a type mismatch in NativeProcessLinux that shows up in 32-bit builds.
http://llvm.org/bugs/show_bug.cgi?id=20255

llvm-svn: 212685
2014-07-10 05:25:39 +00:00
Todd Fiala 202ecd26da Fixes for broken Debian build - g++ 4.7 support.
These fix the broken debian lldb build, which is using g++ 4.7.2.

TypeFormat changes:
1. stopped using the C++11 "dtor = default;" construct.
The generated default destructor in the two derived classes wanted
them to have a different throws() semantic that was causing 4.7 to
fail to generate it.  I switched these to empty destructors defined
in the .cpp file.

2. Switched the m_types map from an ordered map to an unordered_map.
g++ 4.7's c++ library supports the C++11 emplace() used by TypeFormat
but the same c++ library's map impl does not.  Since TypeFormat didn't
look like it depended on ordering in the map, I just switched it to
a std::unordered_map.

NativeProcessLinux - g++ 4.7 chokes on lexing the "<::" in
static_cast<::pid_t>(wpid).  g++ 4.8+ and clang are fine with it.
I just put a space in between the "<" and the "::" and that cleared
it up.

llvm-svn: 212681
2014-07-10 04:39:13 +00:00
Jason Molenda 277335f9b2 Add a new 'stresstest' category, set the api/multiple-debuggers test case as a stresstest.
llvm-svn: 212673
2014-07-10 02:21:16 +00:00
Jason Molenda 8c07401504 Add a new test in api/multiple-debuggers which tries to create 50
debug sessions simultaneously to expose race conditoin/locking
issues.

This directory has an inferior program, testprog.cpp that has a
couple of functions we can put breakpoints on.

It has a driver program, multi-process-driver.cpp, which links
against the LLDB solib and uses the SB APIs.  It creates 50 pthreads,
creates a debugger on all of them, launches a debug session of the
inferior testprog, hits a couple breakpoints, walks the stack,
continues, etc., and then kills the inferior and ends the debug
session.

A pass is if all fifty debug sessions complete successfully
in the alloted time (~60 seconds).

We may need to tweak this one to work correctly on different
platforms/targets but I wanted to get it checked in to start.

llvm-svn: 212671
2014-07-10 02:17:31 +00:00
Todd Fiala 9e2d329818 Skip tests that are intermittent on Linux, fix gdb-remote port-grabbing code.
Marked skipped for Linux:
TestCallStopAndContinue
TestConvenienceVariables
TestStopHookMultipleThreads

Fixed up gdb-remote port-grabbing code to use a random port in a wide range,
and to allow that to fail more gracefully.  This appears to have solved some
gdb-remote intermittent failing behavior.

llvm-svn: 212662
2014-07-09 23:10:43 +00:00
Todd Fiala 8a4ee50e58 Skip TestCallStopAndContinue and TestCallThatRestarts on Darwin.
These are failing intermittently.

See http://llvm.org/bugs/show_bug.cgi?id=19246 for TestCallThatRestarts.  Also applies to Linux.
See http://llvm.org/bugs/show_bug.cgi?id=20274 for TestCallStopAndContinue.

llvm-svn: 212660
2014-07-09 22:03:30 +00:00
Todd Fiala fb17762ee5 Marked TestTargetAPI.test_launch_new_process_and_redirect_stdout_with_* as XFAIL on Darwin.
See http://llvm.org/bugs/show_bug.cgi?id=20273

llvm-svn: 212659
2014-07-09 21:24:41 +00:00
Todd Fiala 8f694d92f9 TestRealDefinition tests marked XFAIL on Darwin.
http://llvm.org/bugs/show_bug.cgi?id=20272

llvm-svn: 212657
2014-07-09 21:21:39 +00:00
Todd Fiala 2efa5655a9 Marked failing TestObjCDynamicValue tests as XFAIL on Darwin.
See http://llvm.org/bugs/show_bug.cgi?id=20271

llvm-svn: 212656
2014-07-09 21:19:03 +00:00
Todd Fiala 7a7dbb8a6c Marked failing TestObjCDynamicSBType tests XFAIL on Darwin.
See http://llvm.org/bugs/show_bug.cgi?id=20270

llvm-svn: 212655
2014-07-09 21:15:46 +00:00
Todd Fiala 51452ed75b Marked failing TestHiddenIvars tests as XFAIL on Darwin.
See http://llvm.org/bugs/show_bug.cgi?id=20269

llvm-svn: 212654
2014-07-09 21:10:13 +00:00
Todd Fiala 532d8a709b Marked TestObjCMethods failing tests XFAIL, fixed cleanup code, removed now-passing expected failure markers.
All tests matching '-p TestObjCMethods' now are marked correctly for MacOSX, and some
error classes have been removed in cleanup code looking for files that
might not exist due to previous failure.

See http://llvm.org/bugs/show_bug.cgi?id=20267

llvm-svn: 212650
2014-07-09 21:02:52 +00:00
Todd Fiala 046ca1faec Marked failing test XFAIL for TestRegisterVariables.test_with_dsym_and_run_command on Darwin
See http://llvm.org/bugs/show_bug.cgi?id=20266

llvm-svn: 212648
2014-07-09 20:45:09 +00:00
Todd Fiala 90198a81e0 Marked failing Darwin TestProcessLaunch tests as XFAIL
See http://llvm.org/bugs/show_bug.cgi?id=20265

llvm-svn: 212647
2014-07-09 20:42:14 +00:00
Todd Fiala 6667e1192a TestDataFormatterStdVector.test_with_dsym_and_run_command marked XFAIL on Darwin
See http://llvm.org/bugs/show_bug.cgi?id=20264

llvm-svn: 212646
2014-07-09 20:38:27 +00:00
Todd Fiala 1928c9bd53 Disable TestDataFormatterStdMap.test_with_dsym_and_run_command on Darwin
See http://llvm.org/bugs/show_bug.cgi?id=20263

llvm-svn: 212645
2014-07-09 20:33:51 +00:00
Greg Clayton 73d80faa78 Make sure the "command regex add" has a unique name for editline history purposes.
llvm-svn: 212644
2014-07-09 20:18:54 +00:00
Todd Fiala c0b1eae6b4 Mark failing tests in TestDataFormatterObjC on Darwin as XFAIL
See http://llvm.org/bugs/show_bug.cgi?id=20260 for more details.

llvm-svn: 212639
2014-07-09 19:00:21 +00:00
Zachary Turner 3ddcd314f2 Dont' use a random probe & alloc strategy for the IRMemoryMap.
The current strategy for host allocation is to choose a random
address and attempt to allocate there, eventually failing if the
allocation cannot be satisfied.

The C standard only guarantees that RAND_MAX >= 32767, so for
platforms that use a very small RAND_MAX allocations will fail
with very high probability.  On such platforms (Windows is one),
you can reproduce this trivially by running lldb, typing "expr (3)"
and then hitting enter you see a failure.  Failures generally
happen with a frequency of about 1 failure every 5 evaluations.

There is no good reason that allocations need to look like "real"
pointers, so this patch changes the allocation scheme to simply
jump straight to the end and grab a free chunk of memory.

Reviewed By: Sean Callanan

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

llvm-svn: 212630
2014-07-09 16:42:27 +00:00
Zachary Turner df734cdd39 Fix tests broken by the OptionValidator changes.
The getopt library has a structure called option (lowercase).  We
have a structure called Option (uppercase).  previously the two
structures had exactly the same definitions, and we were doing a
C-style cast of an Option* to an option*.  C-style casts don't
bother to warn you when you cast to unrelated types, but in the
original OptionValidator patch I modified the definition of Option.

This patch fixes the errors by building an array of option
structures and filling it out the correct way before passing it to
the getopt library.

This also fixes one other source of test failures: an uninitialized
read that occurs due to not initializing a field of the
OptionDefinition.

Reviewed By: Todd Fiala

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

llvm-svn: 212628
2014-07-09 16:32:07 +00:00
Zachary Turner d37221dc5d Revert "Fix broken tests due to new error output."
This reverts commit ec7c94f8e6860968d384b578e5564a9c55c80b4a and
re-enables OptionValidators.

llvm-svn: 212627
2014-07-09 16:31:49 +00:00
Todd Fiala 013434e547 __arm64__ and __aarch64__ #ifdef adjustments
Change by Paul Osmialowski

See http://reviews.llvm.org/D4379 for details.

llvm-svn: 212583
2014-07-09 01:29:05 +00:00
Jason Molenda 52d760399c Correct indentation level for one line.
llvm-svn: 212582
2014-07-09 01:10:37 +00:00
Jason Molenda 45938b96ee Tweak for lldb coding style consistency.
llvm-svn: 212575
2014-07-08 23:46:39 +00:00
Greg Clayton 389be9558f Make sure that qProcessInfo packet returns correct cpu type/subtype for processes on Haswell machines with a Haswell enabled kernel.
<rdar://problem/17332107>

llvm-svn: 212567
2014-07-08 21:45:21 +00:00
Jim Ingham 7a88ec9ac0 Add the ability to provide a "count" option to the various "thread step-*" operations. Only
step-inst and step-inst are currently supported, the rest just warn that they are not supported
if you try to provide a count.

llvm-svn: 212559
2014-07-08 19:28:57 +00:00
Jim Ingham c60b6eadec Document the "thread.completed-expression" feature in the "expression" command help.
llvm-svn: 212558
2014-07-08 19:27:35 +00:00
Bruce Mitchener 42b107a4ec Revert accidental change to Xcode project.
llvm-svn: 212554
2014-07-08 18:09:58 +00:00
Bruce Mitchener aaa0ba31a9 Fix typos.
llvm-svn: 212553
2014-07-08 18:05:41 +00:00
Jean-Daniel Dupas c3aba6aafa Simplify Host::GetOSVersion() on macosx.
It removes usage of the deprecated function CFURLCreateDataAndPropertiesFromResource().

llvm-svn: 212552
2014-07-08 17:42:17 +00:00
Todd Fiala 9189e034f1 Remove hack from dotest.py to fix extra output on -P command, and fix MacOSX multi-threaded test run collisions on crashlog.dylib.
On MacOSX, we need to adjust the way we clean up the crashlog dylib in deleteCrashInfoDylib().
Right now it is only geared to run one test at a time.  For now I'm just skipping the delete.
I'll work with Apple on a fix that handles this.  It seems to only cause one dylib total to
hang around that might otherwise have been deleted.  Fixes MacOSX multiple tests running
at the same time.  (I didn't hit this on Yosemite, might be an issue that only shows up
on Mavericks?)

llvm-svn: 212548
2014-07-08 16:29:54 +00:00
Todd Fiala 9734280f33 Fix broken tests due to new error output.
This reverses out the options validators changes.  We'll get these
back in once the changes to the output can be resolved.

Restores broken tests on FreeBSD, Linux, MacOSX.

Changes reverted: r212500, r212317, r212290.

llvm-svn: 212543
2014-07-08 15:55:32 +00:00
Todd Fiala 57fd7abd58 Fix broken MacOSX Xcode build for CommandOptionValidators.cpp.
llvm-svn: 212536
2014-07-08 14:52:11 +00:00
Todd Fiala 3f0a360f18 Enable multi-process testing for MacOSX.
This change modifies the way the multi-threaded test runner works.
It uses the Python multiprocessing library rather than the threading
library.  Investigation showed that all MacOSX threads were waiting on
the global python lock when using the threading approach.  Not sure
why that differed from the Linux/FreeBSD implementations.

The new approach uses the multiprocessing library's Pool class.  It's
mildly cleaner than the other version, runs multithreaded on MacOSX,
and seems to have caused no performance regression on Linux.  The
worker thread logic is simpler with the Pool managing the worker
processes.

This also includes a minor change to the test runner's python
lldb dir logic using the -P option.  It now looks at the last line
of output rather than the first line.  This covers part of the issue
of extra options validation logic getting spit out.  The test runner
will now pick up the right python library directory.  It does not
fix all the issues, though, as a ton of tests (50+ on Linux) are
failing due to unexpected output when running lldb.

llvm-svn: 212513
2014-07-08 06:42:37 +00:00
Zachary Turner 310035a4f9 Implment "platform process list" for Windows.
This patch implements basic functionality of the "platform process
list" command for Windows.  Currently this has the following
limitations.

* Certain types of filtering are not enabled (e.g. filtering by
  architecture with -a), although most filters work.
* The username of the process is not yet obtained.
* Using -v to list verbose information generates an error.
* The architecture column displays the entire triple, leading to
  misaligned formatting of the printed table.

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

llvm-svn: 212510
2014-07-08 04:52:15 +00:00
Zachary Turner 24f3dee6ca Fix a compilation failure caused by a non-const reference.
llvm-svn: 212509
2014-07-08 04:28:07 +00:00
Jim Ingham 3f762ef111 Add docs for the "thread.completed-expression" format entry.
llvm-svn: 212507
2014-07-08 01:10:49 +00:00
Jim Ingham 30fadafefe If a hand-called function is interrupted by hitting a breakpoint, then
when you continue to finish off the function call, the expression result
will be included as part of the thread stop info.

llvm-svn: 212506
2014-07-08 01:07:32 +00:00
Zachary Turner 28638911cd Invalidate process UID/GID-related command options on Windows.
Windows uses a different process security model and does not have
a concept of process UID or GID.  This patch makes these options
invalid on Windows.  Attempting to specify these options when the
current platform is Windows will generate an error.

Reviewed by: Jim Ingham
Differential Revision: http://reviews.llvm.org/D4373

llvm-svn: 212500
2014-07-07 23:54:51 +00:00
Todd Fiala 8bb347350a Mark test_watchpoint_multiple_threads_with_dwarf as XFAIL on Linux/clang.
See http://llvm.org/bugs/show_bug.cgi?id=20233 for details.

llvm-svn: 212491
2014-07-07 21:28:37 +00:00
Todd Fiala 020ed611ff Mark Radar9974002DataFormatterTestCase test XFAIL on Linux.
See http://llvm.org/bugs/show_bug.cgi?id=20232 for details.

llvm-svn: 212489
2014-07-07 21:13:39 +00:00
Todd Fiala bf997d59eb Marked TestLongjmp.py tests XFAIL for Linux.
See http://llvm.org/bugs/show_bug.cgi?id=20231

llvm-svn: 212488
2014-07-07 21:07:41 +00:00
Todd Fiala 234c887e42 Marked TestFormatters.py XFAIL on Linux per pr20230.
See http://www.llvm.org/bugs/show_bug.cgi?id=20230 for details.

llvm-svn: 212486
2014-07-07 20:58:38 +00:00
Todd Fiala 6d1fbc9c56 Allow specification of no source display on stop.
See http://llvm.org/bugs/show_bug.cgi?id=20149 for details.

Change by Randy Smith.

llvm-svn: 212485
2014-07-07 20:47:24 +00:00
David Majnemer aea50ce97c CMake: Let LLDB build with CMake 3
Teach add_lldb_library to correctly use the CMake 2.8.12
PUBLIC/PRIVATE/INTERFACE keywords.  LLDB's CMake configuration would
inconsistently apply these keywords; this was previously a warning in
CMake 2.x but became an error in CMake 3.

llvm-svn: 212482
2014-07-07 20:29:00 +00:00
Sylvestre Ledru 8d352c6dcd llvm::IntrusiveRefCntPtr => std::shared_ptr to match the changes in clang r212388
llvm-svn: 212413
2014-07-06 18:39:39 +00:00
Sylvestre Ledru ceab3ac375 remove trailing whitespace + remove some useless comments
llvm-svn: 212411
2014-07-06 17:54:58 +00:00
Sylvestre Ledru 3cc9d63031 Update lldb code to match the change in clang r212386
llvm-svn: 212410
2014-07-06 17:50:36 +00:00
Alp Toker 5f83864b7c Track changes from clang r212388
llvm-svn: 212391
2014-07-06 05:36:57 +00:00
Alp Toker edc902f3bb Track IntrusiveRefCntPtr::get() changes from LLVM r212366
llvm-svn: 212368
2014-07-05 03:06:05 +00:00
Todd Fiala 1b67c66c9c Windows build fixes and removal of endlessly recursive termination function.
This change removes the ScriptInterpreter::TerminateInterpreter() call which
ended up endlessly calling itself as things currently stand.  It also cleans
up some other Windows-related cmake changes.

See http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140630/011544.html
for more details.

Change by Zachary Turner

llvm-svn: 212320
2014-07-04 06:58:01 +00:00
Todd Fiala 8422c5ae6d Fix Windows build when python is not explicitly enabled
Currently Windows disables Python builds by default.  This
change ensures we don't process the scripts dir when we're
on Windows unless we're explicitly enabling python, which
prevents a build error.

Change by Deepak Panickal

llvm-svn: 212319
2014-07-04 06:43:47 +00:00
Todd Fiala 859aff501b Fix OptionDefinition break from r212290.
Fixes some structure definitions in CommandObjectType
that needed to be adjusted for a new OptionDefinition
field.

llvm-svn: 212317
2014-07-04 06:09:04 +00:00
Zachary Turner 35974065fe Fix -Wnull-conversion warning.
llvm-svn: 212304
2014-07-03 23:44:14 +00:00
Zachary Turner de963e9a09 Adds the notion of an OptionValidator.
The purpose of the OptionValidator is to determine, based on some
arbitrary set of conditions, whether or not a command option is
valid for a given debugger state.  An example of this might be
to selectively disable or enable certain command options that
don't apply to a particular platform.

This patch contains no functional change, and does not actually
make use of an OptionValidator for any purpose yet.  A follow-up
patch will begin to add the logic and users of OptionValidator.

Reviewed by: Greg Clayton, Jim Ingham

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

llvm-svn: 212290
2014-07-03 20:34:18 +00:00
Zachary Turner 78b84f5454 Fix compilation errors introduced by host Pipe abstraction
on Windows.

llvm-svn: 212255
2014-07-03 05:20:28 +00:00
Bruce Mitchener 1d0089fa5c Add enumerations for additional languages from DWARF spec updates.
llvm-svn: 212246
2014-07-03 00:49:08 +00:00
Todd Fiala dda6194399 lldb - problem with some PTRACE_* constants in NativeProcessLinux.cpp file
See http://reviews.llvm.org/D4366 for details.

Change by Paul Paul Osmialowski

Today this is the only problem that I'm facing trying to cross-compile lldb for AArch64 using Linaro's toolchain.

PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS are not defined for AArch64
These things can be defined different ways for other architectures, e.g. for x86_64 Linux, asm/ptrace-abi.h defines them as preprocessor constants while sys/ptrace.h defines them in enum along with corresponding PT_* preprocessor constants
NativeProcessLinux.cpp includes sys/ptrace.h
To avoid accidental redefinition of enums with preprocessor constants, I'm proposing this patch which first checks for PT_* preprocessor constants then checks for PTRACE_* constants then when it still can not find them, it defines preprocessor constants.
Similar approach was already used for PTRACE_GETREGSET and PTRACE_SETREGSET constants; in this case however it was easier, since enum values in sys/ptrace.h and preprocessor constants shared all exactly the same names (e.g. there's no additional PT_GETREGSET name defined).

llvm-svn: 212225
2014-07-02 21:34:04 +00:00
Greg Clayton 100eb93f89 Add host layer support for pipes.
Windows does support pipes, but they do so in a slightly different way. Added a Host layer which abstracts the use of pipes into a new Pipe class that everyone can use.

Windows benefits include:
- Being able to interrupt running processes when IO is directly hooked up 
- being able to interrupt long running python scripts
- being able to interrupt anything based on ConnectionFileDescriptor

llvm-svn: 212220
2014-07-02 21:10:39 +00:00
Greg Clayton 03108393a3 Make LLDB.framework link again on Yosemite.
llvm-svn: 212213
2014-07-02 20:32:01 +00:00
Jean-Daniel Dupas 2ab92cf8f0 Removing Carbon dependency by removing obsolete code.
The only part using Carbon is a function in Host.mm used to open a file in Xcode.
That code is broken and it is no longer useful as Xcode supports LLDB natively.

llvm-svn: 212208
2014-07-02 19:37:25 +00:00
Jim Ingham e029fa5781 If a breakpoint gets deleted, any SBBreakpoints representing that
breakpoint should return false from IsValid.

llvm-svn: 212206
2014-07-02 18:44:43 +00:00
Zachary Turner a746e8e58a Start converting usages of off_t to other types.
off_t is a type which is used for file offsets.  Even more
specifically, it is only used by a limited number of C APIs that
deal with files.  Any usage of off_t where the variable is not
intended to be used with one of these APIs is a bug, by definition.

This patch corrects some easy mis-uses of off_t, generally by
converting them to lldb::offset_t, but sometimes by using other
types such as size_t, when appropriate.

The use of off_t to represent these offsets has worked fine in
practice on linux-y platforms, since we used _FILE_OFFSET_64 to
guarantee that off_t was a uint64.  On Windows, however,
_FILE_OFFSET_64 is unrecognized, and off_t will always be 32-bit.
So the usage of off_t on Windows actually leads to legitimate bugs.

Reviewed by: Greg Clayton

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

llvm-svn: 212192
2014-07-02 17:24:07 +00:00
Jean-Daniel Dupas e7c7c3de93 Replace uint32_t by lldb::RegisterKing in register context API.
llvm-svn: 212172
2014-07-02 09:51:28 +00:00
Todd Fiala 14bbef5ac7 Add Kalimba support to ArchSpec.
See http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140630/011508.html
for more details.

Change by Matthew Gardiner.

llvm-svn: 212145
2014-07-01 23:33:32 +00:00
Bruce Mitchener d93c4a3339 Fix typos.
llvm-svn: 212132
2014-07-01 21:22:11 +00:00
Bruce Mitchener 8e97653528 Terminate italics tag.
llvm-svn: 212131
2014-07-01 21:19:25 +00:00
Bruce Mitchener 4d1a26dcc2 Minumum -> Minimum.
llvm-svn: 212129
2014-07-01 21:18:35 +00:00
Deepak Panickal 9b35cf52d2 This creates a valid Python API for Windows, pending some issues. The changes included are -
- Ported the SWIG wrapper shell scripts to Python so that they would work on Windows too along with other platforms
 - Updated CMake handling to fix SWIG errors and manage sym-linking on Windows to liblldb.dll
 - More build fixes for Windows

The pending issues are that two Python modules, termios and pexpect are not available on Windows.
These are currently required for the Python command interpreter to be used from within LLDB.

llvm-svn: 212111
2014-07-01 17:57:19 +00:00
Todd Fiala 9be5049a01 Use native ::pid_t in Linux ProcessMonitor (local debugging).
There were a few places where we were not catching the possibility of negative
error codes in waitpid() calls.  This change fixes those remaining after
the llgs branch fixes to ProcessMonitor.

Change by Shawn Best.

llvm-svn: 212107
2014-07-01 16:30:53 +00:00
Zachary Turner 0ec7baa9f4 Fix Windows build after llgs upstream.
With _HAS_EXCEPTIONS=0, Windows' version of <thread> will fail to
compile because it calls __uncaught_exception(), which is compiled
out due to _HAS_EXCEPTIONS=0.  This just creates a stub version
of __uncaught_exception() which always fails.

llvm-svn: 212076
2014-07-01 00:18:46 +00:00
Todd Fiala 2850b1be2e Fixup Windows build breaks for the llgs upstream.
Also moves NativeRegisterContextLinux* files into the Linux directory.
These, like NativeProcessLinux, should only be built on Linux or a cross
compiler with proper headers.

llvm-svn: 212074
2014-06-30 23:51:35 +00:00
Todd Fiala af245d115b Add lldb-gdbserver support for Linux x86_64.
This change brings in lldb-gdbserver (llgs) specifically for Linux x86_64.
(More architectures coming soon).

Not every debugserver option is covered yet.  Currently
the lldb-gdbserver command line can start unattached,
start attached to a pid (process-name attach not supported yet),
or accept lldb attaching and launching a process or connecting
by process id.

The history of this large change can be found here:
https://github.com/tfiala/lldb/tree/dev-tfiala-native-protocol-linux-x86_64

Until mid/late April, I was not sharing the work and continued
to rebase it off of head (developed via id tfiala@google.com).  I switched over to
user todd.fiala@gmail.com in the middle, and once I went to github, I did
merges rather than rebasing so I could share with others.

llvm-svn: 212069
2014-06-30 21:05:18 +00:00
Todd Fiala 3dc2fb2fc0 Factored out Linux proc file reading into separate class.
Both NativeProcessLinux (in llgs branch) and Linux Host.cpp had similar code to handle /proc 
file reading.  I factored that out into a new Linux-specific ProcFileReader class and added a method
that the llgs branch will use for line-by-line parsing.

This change also adds numerous Linux-specific files to Xcode that were missing from the Xcode
project files.

Related to https://github.com/tfiala/lldb/issues/27

llvm-svn: 212015
2014-06-30 04:14:13 +00:00
Todd Fiala 6d6b55d153 Pull ProcessInfo and ProcessLaunchInfo out of Target/Process.
Elevate ProcessInfo and ProcessLaunchInfo into their own headers.
llgs will be using ProcessLaunchInfo but doesn't need to pull in
the rest of Process.h.

This also moves a bunch of implementation details from the header
declarations into ProcessInfo.cpp and ProcessLaunchInfo.cpp.

Tested on Ubuntu 14.04 Cmake and MacOSX Xcode.

Related to https://github.com/tfiala/lldb/issues/26.

llvm-svn: 212005
2014-06-30 00:30:53 +00:00
Zachary Turner a57596658a Don't truncate the target triple when initializing clang.
Reviewed by: Sean Callanan

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

llvm-svn: 211968
2014-06-27 23:19:42 +00:00
Todd Fiala e220200c85 Implemented gdb-remote protocol tests for vCont;s and vCont;s:{thread}
Also added tests for presence of vCont;c, vCont;C, vCont;s, vCont;S as
returned by vCont? query.

Broke out single step functionality from TestLldbGdbServer into base class.
Used by new TestGdbRemoteSingleStep (using $s) and TestGdbRemote_vCont.

Also part of llgs wrap-up, see:
https://github.com/tfiala/lldb/issues/12

llvm-svn: 211965
2014-06-27 22:11:56 +00:00
Todd Fiala 6ce5b63019 Updated ObjectFileELF tests to include more varaints.
Removed the distribution EXEs from FreeBSD and Ubuntu.
Added a hello-world .cpp file, and compiled it for
several platform/compiler variants:

Ubuntu 14.04 x86_64, clang 3.5 (the ubuntu1 3.5 pre variant)
Ubuntu 14.04 x86_64, gcc 4.8.2
FreeBSD 10.0 x86_64, clang 3.3
FreeBSD 10.0 x86_64, gcc 4.7.3
NetBSD 6.1 x86_64, gcc 4.5.3

I also added the NetBSD expected architecture and triple.
Note I have NetBSD not appending the version info to the
OS name, in contrast to FreeBSD.

llvm-svn: 211954
2014-06-27 20:07:03 +00:00
Todd Fiala b91de7861c Fix ObjectFileELF to determine architectures independent of host.
Previously ObjectFileELF was simplifying and assuming the object file it was
looking at was the same as the host architecture/triple.  This would break
attempts to run, say, lldb on MacOSX against lldb-gdbserver on Linux since
the MacOSX lldb would say that the linux elf file was really an Apple MacOSX
architecture.  Chaos would ensue.

This change allows the elf file to parse ELF notes for Linux, FreeBSD and
NetBSD, and determine the OS appropriately from them.  It also initializes
the OS type from the ELF header OSABI if it is set (which it is for FreeBSD
but not for Linux).

Added a test with freebsd and linux images that verify that 
'(lldb) image list -t -A' prints out the expected architecture for each.

llvm-svn: 211907
2014-06-27 16:52:49 +00:00
Jim Ingham c1fdb889a9 Revert the debugserver part of r211868. While formally a fine change, debugserver
doesn't depend on llvm (it really doesn't even depend on anything in lldb) and this
nicety isn't worth adding that dependence.

llvm-svn: 211903
2014-06-27 16:02:55 +00:00
Chandler Carruth 61220ef405 [cmake] When Python is disabled for LLDB, don't try to install the
python bindings.

For example, this prevents errors on systems that disable python because
the system python isn't available. Without this, we still try to install
things and get install errors when that doesn't work.

llvm-svn: 211899
2014-06-27 15:04:42 +00:00
Saleem Abdulrasool 28606954bf lldb: remove adhoc implementation of array_sizeof
Replace adhoc inline implementation of llvm::array_lengthof in favour of the
implementation in LLVM.  This is simply a cleanup change, no functional change
intended.

llvm-svn: 211868
2014-06-27 05:17:41 +00:00
Bruce Mitchener 6a7f33387d Fix a few typos.
llvm-svn: 211851
2014-06-27 02:42:12 +00:00
Bruce Mitchener bb8e39b1a9 Test commit: wether -> whether.
llvm-svn: 211842
2014-06-27 01:58:47 +00:00
Todd Fiala 34413ec640 Fix an incomplete null structure spec in Python readline suppression module.
Now that I'm building Linux with clang, I'm seeing more clang warnings.
This fills in some extra fields missing in the final end-of-structure-array
marker.

llvm-svn: 211812
2014-06-26 22:35:36 +00:00
Zachary Turner cfcd7914da Fix silly compilation error.
llvm-svn: 211728
2014-06-25 18:40:58 +00:00
Zachary Turner 1536244594 Fix a bug in the IRMemoryMap which generated bogus allocations.
Previously, only the starting locations of the candidate interval
and the existing interval were compared.  To correctly detect
range intersections, it is necessary to compare the entire range
of both intervals against each other.

Reviewed by: scallanan

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

llvm-svn: 211726
2014-06-25 18:37:19 +00:00
Zachary Turner 736d4d85db Replace GCC-specific intrinsic with portable alternative.
Not all supported compilers have GCC intrinsics, so this patch
uses the correct portable alternative.

Additionally, this patch fixes an off-by-one error.  __builtin_ffs
returns the 1-based index of the least-significant 1-bit, but the
function expects the base 2 logarithm of the number, which is
equivalent to the 0-based index of the least-significant 1-bit.

Reviewed by: Keno Fischer

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

llvm-svn: 211669
2014-06-25 05:42:32 +00:00
Jim Ingham 106d02866d Added an option to turn OFF the "detach on error" behavior that was added
to debugserver when launching processes.

<rdar://problem/16216199>

llvm-svn: 211658
2014-06-25 02:32:56 +00:00
Ed Maste 2bc7643d10 Remove extra newline from log Printf
Clean up this one specifically, as it has the effect of double-spacing
the list of thread stop reasons, and substantially bloats the log file
when opening a core with hundreds of threads.

There are other cases of extra newlines.  Some of them do increase
readability, so avoid a general sweep for now.

llvm-svn: 211655
2014-06-25 00:38:35 +00:00
Greg Clayton 48672afb66 Patch from Keno Fischer to enable JITLoaderGDB with mach-o file support.
The patch is as is with the functionality left disabled for apple vendors because of performance regressions. If this is enabled it ends up searching for symbols in all shared libraries that are loadeded.

llvm-svn: 211638
2014-06-24 22:22:43 +00:00
Jim Ingham 6008924508 Rework fix in r201744. You really DO need to waitpid twice to get the
process fully reaped.  The race & bad behavior was because we were letting
the reaping thread in LLDB to also set the Process exit status, so debugserver
would sometimes be shut down before it got a chance to report the exit status, 
and then we got confused.

<rdar://problem/16555850>

llvm-svn: 211636
2014-06-24 21:51:42 +00:00
Todd Fiala 5d1b9c7386 Fix up Windows build for the SBUnixSignals addition.
Change by Zachary Turner.

llvm-svn: 211635
2014-06-24 21:38:31 +00:00