Commit Graph

9143 Commits

Author SHA1 Message Date
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