Commit Graph

12713 Commits

Author SHA1 Message Date
Sean Callanan a994b0b273 Made GetScratchTypeSystemForLanguage return an error if desired.
Also made it not store nullptrs in its TypeSystemMap, so it will retry to make
the AST context if it errored out last time.

llvm-svn: 249167
2015-10-02 18:40:30 +00:00
Tamas Berghammer b285e9e0d2 Change expected stop reason in TestInferiorAssert for Android API <= 16
llvm-svn: 249120
2015-10-02 12:00:04 +00:00
Tamas Berghammer f5ead561b3 Fix several issues around .ARM.exidx section handling
* Use .ARM.exidx as a fallback unwind plan for non-call site when the
  instruction emulation based unwind failed.
* Work around an old compiler issue where the compiler isn't sort the
  entries in .ARM.exidx based on their address.
* Fix unwind info parsing when the virtual file address >= 0x80000000
* Fix bug in unwind info parsing when neither lr nor pc is explicitly
  restored.

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

llvm-svn: 249119
2015-10-02 11:58:26 +00:00
Enrico Granata 72d8a72241 Teach 'type lookup' to pull types from clang modules; also add a test case
llvm-svn: 249117
2015-10-02 01:23:11 +00:00
Sean Callanan 9301ec1191 Eliminated redundant "constructors" for ClangExpressionVariable.
The ClangExpressionVariable::CreateVariableInList functions looked cute, but                                                                                                                                           
caused more confusion than they solved.  I removed them, and instead made sure                                                                                                                                         
that there are adequate facilities for easily adding newly-constructed                                                                                                                                                 
ExpressionVariables to lists.      

I also made some of the constructors that are common be generic, so that it's
possible to construct expression variables from generic places (like the ABI and
ValueObject) without having to know the specifics about the class.

llvm-svn: 249095
2015-10-01 23:07:06 +00:00
Dawn Perchik 8587212085 [lldb-mi] Add support for StopAtEntry in MI via "-exec-run --start".
This patch adds a --start option to the lldb-mi -exec-run command for
getting process stopped at entry point after launch.  It is equivelent
to the -s option in the lldb command line interpreter:
    process launch -s
and is therefore not supported on all hosts and/or targets.  To check
if the --start option is supported, see if the corresponding feature
"exec-run-start-option" is in the list of options reported by the lldb-mi
"-list-features" command.

Patch from engineer.developer@gmail.com (Kirill Lapshin)
Reviewed by: ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12977

llvm-svn: 249072
2015-10-01 21:15:43 +00:00
Oleksiy Vyalov af87713a81 Fix Android build after r249047.
llvm-svn: 249055
2015-10-01 19:08:00 +00:00
Enrico Granata 9b0af1b86f Add a 'type lookup' command. This command is meant to look up type information by name in a language-specific way.
Currently, it only supports Objective-C - C++ types can be looked up through debug info via 'image lookup -t', whereas ObjC types via this command are looked up by runtime introspection

This behavior is in line with type lookup's behavior in Xcode 7, but I am definitely open to feedback as to what makes the most sense here

llvm-svn: 249047
2015-10-01 18:16:18 +00:00
Oleksiy Vyalov d21ca280cb Use %HOME%/.lldb/module_cache as a default module cache directory.
http://reviews.llvm.org/D13323

llvm-svn: 249040
2015-10-01 17:48:57 +00:00
Sean Callanan 1ab1ee7620 Removed a mutex guard that I accidentally pasted in from other code.
It was causing deadlocks when stepping out.

llvm-svn: 249039
2015-10-01 17:48:25 +00:00
Sean Callanan b92bd7538e Made Target hold a map of languages to TypeSystems, and added some accessors.
Also added some target-level search functions so that persistent variables and
symbols can be searched for without hand-iterating across the map of
TypeSystems.

llvm-svn: 249027
2015-10-01 16:28:02 +00:00
Sagar Thakur 2ee26ee37b Romove accidentially added statement in r249020
llvm-svn: 249021
2015-10-01 15:15:42 +00:00
Sagar Thakur b8862c0107 [LLDB][MIPS] Fix gp register value for o32 applications on 64-bit target
GP registers for o32 applications were always giving zero value because SetType() on the RegisterValue was causing the accessor functions to pickup the value from m_scalar of RegisterValue which is zero.
In this patch byte size and byte order of register value is set at the time of setting the value of the register.

llvm-svn: 249020
2015-10-01 15:05:31 +00:00
Tamas Berghammer 3e8947be91 Fix Android-SDK detection on API 10 device
Run the getprop command with AdbClient::Shell instead of
Platform::RunShellCommand because getting the output from getprop
with Platform::RunShellCommand have some (currently unknown) issues.

llvm-svn: 249014
2015-10-01 13:58:01 +00:00
Tamas Berghammer 76011b63cd Fix breakpoint opcode calculation on Linux
Change the way we detect if we have to place a thumb breakpoint instead
of an arm breakpoint in the case when no symbol table or mapping symbols
are available. Detect it based on the LSB of the FileAddress instead of
the LSB of the LoadAddress because the LSB of the LoadAddress is already
masked out.

llvm-svn: 249013
2015-10-01 13:57:57 +00:00
Tamas Berghammer 3c47151d1a Restrict the scope of a hack in DYLDRendezvous
The hack is there to work around an incorrect load address reported
by the android linker on API 21 and 22 devices. This CL restricts the
hack to those android API levels.

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

llvm-svn: 249012
2015-10-01 13:57:54 +00:00
Tamas Berghammer 539cd118b2 Trim the output of mktem in PlatformAndroid::DownloadSymbolFile
Differential revision: http://reviews.llvm.org/D13293

llvm-svn: 248998
2015-10-01 09:42:23 +00:00
Pavel Labath 746ffd6980 Revert "Fixing a subtle issue on Mac OS X systems with dSYMs..."
This reverts commit r248985, as it was breaking all remote
expression-evaluating tests (on android at least).

llvm-svn: 248995
2015-10-01 09:03:33 +00:00
Bruce Mitchener f0248ca545 Add a Post-Build Event on Windows to copy the correct custom Python DLL to the LLDB binaries dir
Summary:
After a developer builds LLDB from source on Windows (assuming they've built it with Python support enabled), they may be somewhat flustered when it fails to launch with a cryptic error.

{F890625}

This happens because Windows can't find python27.dll (or python27_d.dll in case LLDB was built in debug mode). Many developers may have previously installed a release build of Python 2.7 and will not notice anything is amiss when they run a release build of LLDB because Windows will load the python27.dll from one of the system directories or `PATH` (rather than the one that the LLDB build instructions tell them to build). The issue tends to be more pronounced with debug builds of LLDB, since fewer developers probably have python27_d.dll sitting in one of the Windows system directories.

To ensure Windows loads the correct custom built Python DLL when launching LLDB I've added a post-build event that copies the relevant DLL (based on the LLDB build configuration) from `PYTHON_HOME` to the directory in which the LLDB executable is generated.

Patch by Vadim Macagon. Thanks!

Reviewers: brucem, zturner

Subscribers: lldb-commits

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

llvm-svn: 248992
2015-10-01 07:55:44 +00:00
Bruce Mitchener 852cb7fb0d Use the correct Python lib for each build configuration generated by the Visual Studio CMake generator
Summary:
Previously `CMAKE_BUILD_TYPE` was used to determine whether to link in `python27.lib` or `python27_d.lib`, unfortunately this only works reliably when using a CMake generator that generates a single build configuration (e.g. Ninja). The Visual Studio CMake generator generates four build configurations at once (`Debug`, `Release`, `RelWithDebInfo`, `MinSizeRel`), so if `CMAKE_BUILD_TYPE` is set to `Debug` all four build configurations end up linking in `python27_d.lib`, this is clearly undesirable.

To ensure that the correct Python lib is used for each build configuration the value of `PYTHON_LIBRARY` is now determined using generator expressions that evaluate to either the debug or release Python lib. The values of `PYTHON_EXECUTABLE` and `PYTHON_DLL` are now likewise determined using generator expressions.

Note that these changes only apply to the Windows build.

Patch by Vadim Macagon. Thanks!

Reviewers: zturner, brucem

Subscribers: zturner, lldb-commits

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

llvm-svn: 248991
2015-10-01 07:47:38 +00:00
Bruce Mitchener c32c277b84 Include platform agnostic <HostGetOpt.h> in the place of <getopt.h>
Summary: Problem caught on NetBSD with missing getopt_long_only(3).

Change by Kamil Rytarowski <n54@gmx.com>

Reviewers: joerg, brucem

Subscribers: brucem, lldb-commits

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

llvm-svn: 248990
2015-10-01 07:45:58 +00:00
Jason Molenda 8b2f23d515 Fixing a subtle issue on Mac OS X systems with dSYMs (possibly
introduced by r235737 but I didn't look into it too closely).

A dSYM can have a per-UUID plist in it which tells lldb where
to find an executable binary for the dSYM (DBGSymbolRichExecutable)
- other information can be included in this plist, like how to
remap the source file paths from their build pathnames to their
long-term storage pathnames.

This per-UUID plist is a unusual; it is used probably exclusively
inside apple with our build system.  It is not created by default
in normal dSYMs.

The problem was like this:

  1. lldb wants to find an executable, given only a UUID
     (this happens when lldb is doing cross-host debugging
      and doesn't have a copy of the target system's binaries)

  2. It eventually calls LocateMacOSXFilesUsingDebugSymbols
     which does a spotlight search for the dSYM on the local
     system, and failing that, tries the DBGShellCommands
     command to find the dSYM.

  3. It gets a dSYM.  It reads the per-UUID plist in the dSYM.
     The dSYM has a DBGSymbolRichExecutable kv pair pointing to
     the binary on a network filesystem.

  4. Using the binary on the network filesystem, lldb now goes
     to find the dSYM.

  5. It starts by looking for a dSYM next to the binary it found.

  6. lldb is now reading the dSYM over a network filesystem,
     ignoring the one it found on its local filesystem earlier.

Everything still *works* but it's much slower.

This would be a tricky one to write up in a testsuite case;
you really need the binary to not exist on the local system.
And LocateMacOSXFilesUsingDebugSymbols will only compile on
Mac OS X - even if I found a way to write up a test case, it
would not run anywhere but on a mac.

One change Greg wanted while I was touching this code was to
have LocateMacOSXFilesUsingDebugSymbols (which could be asked
to find a binary OR find a dSYM) to instead return a ModuleSpec
with the sum total of everything it could find.  This
change of passing around a ModuleSpec instead of a FileSpec
was percolated up into ModuleList::GetSharedModule.

The changes to LocateMacOSXFilesUsingDebugSymbols look larger
than they really are - there's a lot of simple whitespace changes
in there.

I ran the testsuites on mac, no new regressions introduced

<rdar://problem/21993813> 

llvm-svn: 248985
2015-10-01 05:37:22 +00:00
Sean Callanan 0f625f42fd Use the preferred display language when making a persistent variable from a
ValueObject.

llvm-svn: 248971
2015-10-01 00:39:03 +00:00
Sean Callanan 7aeb7e256b Changed PersistentExpressionState to allow symbol lookups. Clang doesn't
report any (yet).

llvm-svn: 248970
2015-10-01 00:38:06 +00:00
Enrico Granata 6754e04f6d Introudce a IsTopLevelFunction() API on Language and Function
This is meant to support languages that have a scripting mode with top-level code that acts as global

For now, this flag only controls whether 'frame variable' will attempt to treat globals as locals when within such a function

llvm-svn: 248960
2015-09-30 23:12:22 +00:00
Oleksiy Vyalov de1736ae02 Fix Linux build.
llvm-svn: 248956
2015-09-30 22:27:55 +00:00
Todd Fiala 84f14ab0fb Fixes a potential hang in test runner timeout logic.
Part of https://llvm.org/bugs/show_bug.cgi?id=25002

In writing the new process_control test included here,
I discovered that the scenario would hang indefinitely,
bypassing the timeout logic.

This fixes the indefinite hang, converting an error
in the new test to a failure.  I'll fix the failure
next.  This one was heinous enough to fix on its own,
though.

llvm-svn: 248936
2015-09-30 20:13:58 +00:00
Sean Callanan 8f1f9a1be3 Now persistent expression data no longer lives with the Target, but rather with
the corresponding TypeSystem.  This makes sense because what kind of data there
is -- and how it can be looked up -- depends on the language.

Functionality that is common to all type systems is factored out into
PersistentExpressionState.

llvm-svn: 248934
2015-09-30 19:57:57 +00:00
Tamas Berghammer 4e28ee243c Make the ArmUnwindInfo parsing code endian independent
Differential revision: http://reviews.llvm.org/D13291

llvm-svn: 248910
2015-09-30 15:17:06 +00:00
Adrian McCarthy a0bad88e59 Removed an unused member variable. Affects Windows only.
llvm-svn: 248909
2015-09-30 14:57:21 +00:00
Tamas Berghammer 150c87c859 Fix xcode build after rL248903
llvm-svn: 248908
2015-09-30 14:55:08 +00:00
Tamas Berghammer 648f3c7efa Add support for .ARM.exidx unwind information
.ARM.exidx/.ARM.extab sections contain unwind information used on ARM
architecture from unwinding from an exception.

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

llvm-svn: 248903
2015-09-30 13:50:14 +00:00
Tamas Berghammer b926d01d2a XFAIL 2 test in TestTargetCommands on android-aarch64
The 2 test just get enabled with the recemt test system refactor.

llvm-svn: 248901
2015-09-30 13:42:06 +00:00
Pavel Labath 8f4db787d5 Fix TestAttachDenied on linux
This test was timing out because the test inferior was forking a child, which was not terminated
correctly. The test contained provisions to terminate this child, but these were no longer
working. The idea was to wake up upon receiving SIGTERM and then kill the child. However, this
was failing because the test first tried to use SIGHUP, which ended up killing the inferior.

Fix: make sure we catch SIGHUP also.
llvm-svn: 248889
2015-09-30 10:59:39 +00:00
Tamas Berghammer c8fd130a2c Merge dwarf and dsym tests
Currently most of the test files have a separate dwarf and a separate
dsym test with almost identical content (only the build step is
different). With adding dwo symbol file handling to the test suit it
would increase this to a 3-way duplication. The purpose of this change
is to eliminate this redundancy with generating 2 test case (one dwarf
and one dsym) for each test function specified (dwo handling will be
added at a later commit).

Main design goals:
* There should be no boilerplate code in each test file to support the
  multiple debug info in most of the tests (custom scenarios are
  acceptable in special cases) so adding a new test case is easier and
  we can't miss one of the debug info type.
* In case of a test failure, the debug symbols used during the test run
  have to be cleanly visible from the output of dotest.py to make
  debugging easier both from build bot logs and from local test runs
* Each test case should have a unique, fully qualified name so we can
  run exactly 1 test with "-f <test-case>.<test-function>" syntax
* Test output should be grouped based on test files the same way as it
  happens now (displaying dwarf/dsym results separately isn't
  preferable)

Proposed solution (main logic in lldbtest.py, rest of them are test
cases fixed up for the new style):
* Have only 1 test fuction in the test files what will run for all
  debug info separately and this test function should call just
  "self.build(...)" to build an inferior with the right debug info
* When a class is created by python (the class object, not the class
  instance), we will generate a new test method for each debug info
  format in the test class with the name "<test-function>_<debug-info>"
  and remove the original test method. This way unittest2 see multiple
  test methods (1 for each debug info, pretty much as of now) and will
  handle the test selection and the failure reporting correctly (the
  debug info will be visible from the end of the test name)
* Add new annotation @no_debug_info_test to disable the generation of
  multiple tests for each debug info format when the test don't have an
  inferior

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

llvm-svn: 248883
2015-09-30 10:12:40 +00:00
Todd Fiala 6fe591b45d Skipping TestAttachDenied.py on Linux as it is hanging on a buildbot after r248834.
I'll track down what is happening here.

llvm-svn: 248846
2015-09-29 23:06:56 +00:00
Sean Callanan e6f4a8261a Removed a bunch of dependencies of Materializer on ClangUserExpression.
Instead we now just generically use UserExpression.

llvm-svn: 248842
2015-09-29 22:52:50 +00:00
Todd Fiala 2d3754d82e test runner: switch to pure-Python timeout mechanism
The timeout mechanism has been implemented in python,
so there is no more dependence on external utilities
for timing out an inferior dotest.py process.

Platform-specific bits are implemented for POSIX-like
and Windows platforms.  There is a small class named
ProcessHelper in process_control.py that needs to be
overridden for platforms that fall outside of the
POSIX-like and Windows platforms.

See http://reviews.llvm.org/D13124 for more details.

llvm-svn: 248834
2015-09-29 22:19:06 +00:00
Pavel Labath 4a7436fd82 Enable test_create_after_attach_with_dwarf_and_popen on linux
The test still remains XTIMEOUTed. Will remove that as well if it turns out its passing.

llvm-svn: 248790
2015-09-29 12:42:56 +00:00
Tamas Berghammer 9d8dde8ce5 Change oat symbolization code for android to work on non-rooted devices
On android when debugging an apk we run lldb-server as application user
because the sell user (on non-rooted device) can't attach to an
application. The problem is that "adb pull" will run as a shell user
what can't access to files created by lldb-server because they will be
owned by the application user. This CL changes the oat symbolization
code to run "oatdump --symbolize" to generate an output what is owned
by the shell user.

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

llvm-svn: 248788
2015-09-29 11:04:18 +00:00
Jason Molenda c8badb717b Remove one of the three spaces after a period in one of the breakpoint
set help messages.
<rdar://problem/22870082> 

llvm-svn: 248755
2015-09-28 23:02:00 +00:00
Oleksiy Vyalov 36c42b592d Bind listener to 127.0.0.1 to make sure that loopback address is used.
llvm-svn: 248722
2015-09-28 17:42:16 +00:00
Pavel Labath 8ff61200f4 Remove XTIMEOUT from TestProcessAttach on linux
llvm-svn: 248711
2015-09-28 13:27:48 +00:00
Pavel Labath c8c77d46ef Revert "Fix race condition during process detach"
This fix is not correct on its own until D12968 is resolved. Will resumbit once that is done.

llvm-svn: 248702
2015-09-28 09:37:51 +00:00
Todd Fiala d47346d0f8 Added python script to support running pylint.
See the script comments for how to modify your
pylintrc file (e.g. $HOME/.pylintrc) to support
always finding the lldb-specific Python library
directories.

With the pylintrc modification using this script,
the lldb python tests and test inferstructure can
be linted on any of potentially multiple lldb source
trees on the system without further work from
the developer.  

llvm-svn: 248676
2015-09-26 23:00:35 +00:00
Sean Callanan 6d874ee31a Moved ClangExpressionHelper.h into the Clang expression parser plug-in.
llvm-svn: 248631
2015-09-25 22:47:07 +00:00
Sean Callanan 4dbb271fcc Moved more Clang-specific parts of the expression parser into the Clang plugin.
There are still a bunch of dependencies on the plug-in, but this helps to
identify them.
There are also a few more bits we need to move (and abstract, for example the
ClangPersistentVariables).

llvm-svn: 248612
2015-09-25 20:35:58 +00:00
Dawn Perchik 5e8115b33b Add comment in StringExtractor::GetHexU8
llvm-svn: 248601
2015-09-25 18:23:50 +00:00
Dawn Perchik a556fe8ec3 [lldb-mi] Fix assignment operator in CMIUtilString
Fix assignment operator in CMIUtilString to not crash the debugger if it
is passed a NULL pointer, which can happen in code like the following:

    SBValue val;
    CMIUtilString s;
    //...
    s = val.GetSummary();

Patch from evgeny.leviant@gmail.com
Reviewed by: clayborg, ki.stfu
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13094

llvm-svn: 248597
2015-09-25 18:08:45 +00:00
Ed Maste 4d5dc31c9c Re-enable FreeBSD tests do not hang locally
These tests used to hang on the old FreeBSD buildbot, which has been
retired.  They do not hang when run locally, but do fail.

llvm.org/pr24939

llvm-svn: 248577
2015-09-25 16:10:40 +00:00