Commit Graph

16251 Commits

Author SHA1 Message Date
Davide Italiano 0d54c46cdd [VMRange] Remove unused FindRangeIndexThatContainsValue().
llvm-svn: 305111
2017-06-09 21:01:55 +00:00
Davide Italiano e8111778c1 [VMRange] Implement comparison operators using `==` and `<`.
llvm-svn: 305109
2017-06-09 20:49:11 +00:00
Davide Italiano 5ccf12e65f [VMRange] Use llvm::find_if. Thanks to Zachary for the suggestion.
llvm-svn: 305099
2017-06-09 19:14:59 +00:00
Pavel Labath 54d405033a Skip TestNoreturnUnwind on linux+clang+arm
I was over-eager to unable this test in r304976. It still fails in this
combination, at there does not seem to be anything we can do about it,
as the generated code does not preserve the link register.

llvm-svn: 305062
2017-06-09 08:33:59 +00:00
Davide Italiano 983c3d8ed3 [VMRange] Simplify a couple of member functions. NFCI.
llvm-svn: 305035
2017-06-08 23:49:56 +00:00
Pavel Labath c3c721222d Fix backtrace of noreturn functions situated at the end of a module
Summary:
When a call instruction is the last instruction in a function, the
backtrace PC will point past the end of the function. We already had
special code to handle that, but we did not handle the case where the PC
ends up outside of the bounds of the module containing the function,
which is a situation that occured in TestNoreturnUnwind on android for
some arch/compiler combinations.

I fix this by adding an argument to Address resolution code which states
that we are ok with addresses pointing to the end of a module/section to
resolve to that module/section.

I create a reproducible test case for this situation by hand-crafting an
executable which has a noreturn function at the end of a module.

Reviewers: jasonmolenda, jingham

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D32022

llvm-svn: 304976
2017-06-08 13:26:35 +00:00
Pavel Labath 92f6677159 Switch TaskMapOverInt to llvm::function_ref
The function does not persist the callback, so using a lighter-weight
asbtraction seems appropriate.

Also tweak the signatures of the lambdas to match what the TaskMap
interface expects.

llvm-svn: 304924
2017-06-07 16:28:08 +00:00
Zachary Turner 264b5d9e88 Move Object format code to lib/BinaryFormat.
This creates a new library called BinaryFormat that has all of
the headers from llvm/Support containing structure and layout
definitions for various types of binary formats like dwarf, coff,
elf, etc as well as the code for identifying a file from its
magic.

Differential Revision: https://reviews.llvm.org/D33843

llvm-svn: 304864
2017-06-07 03:48:56 +00:00
Vadim Chugunov 98e3e6003d Use exact equality for category language matching, for all languages, except those specifically mentioned.
llvm-svn: 304832
2017-06-06 20:40:24 +00:00
Pavel Labath 32f29fac41 Fix assorted compiler warnings. NFC
llvm-svn: 304796
2017-06-06 14:06:22 +00:00
Pavel Labath 10c41f37b5 replace uses of strerror with llvm::sys::StrError
strerror is not thread-safe. llvm's StrError tries hard to retrieve the
string in a thread-safe way and falls back to strerror only if it does
not have another way.

llvm-svn: 304795
2017-06-06 14:06:17 +00:00
Pavel Labath 9f9422b699 Remove unused variables. NFC
llvm-svn: 304794
2017-06-06 13:40:21 +00:00
Pavel Labath 015f17d3cc New framework for lldb client-server communication tests.
Summary:
This is a new C++ test framework based on Google Test, and one working
example test.
The intention is to replace the existing tests in
packages/Python/lldbsuite/test/tools/lldb-server/ with this suite
and use this framework for all new client server tests.

Reviewers: labath, beanz

Reviewed By: labath, beanz

Subscribers: beanz, emaste, zturner, tberghammer, takuto.ikuta, krytarowski, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D32930
Patch by Jason Majors <jmajors@google.com>

llvm-svn: 304793
2017-06-06 13:40:18 +00:00
Stephane Sezer ca5e153fb1 Avoid invalid string access in ObjCLanguage::MethodName::SetName
Summary:
Don't access `name[1]  if the string is only of length 1.  Avoids a
crash/assertion failure when parsing the string `-`.

Test Plan:
Debug a swift binary, set a breakpoint, watch lldb not crash

Original change by Paul Menage <menage@fb.com>

Reviewers: lldb-commits, clayborg

Differential Revision: https://reviews.llvm.org/D33853

llvm-svn: 304725
2017-06-05 17:44:04 +00:00
Pavel Labath 090b8616e2 cmake: Put PROCESS_VM_READV detection results into Config.h
Reviewers: beanz, eugene

Subscribers: mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D33771

llvm-svn: 304544
2017-06-02 12:29:08 +00:00
Arnaud A. de Grandmaison af199153cc Remove vestigial CLANG_USED_LIBS.
The actual definition was removed 4 months ago with r294515.

llvm-svn: 304527
2017-06-02 07:48:35 +00:00
Jason Molenda 5f52e10204 Move the code to find a binary in a bundle in the target.exec-search-paths
from PlatformRemoteDarwinDevice into PlatformDarwin, and have both
PlatformRemoteDarwinDevice and PlatformMacOSX call it there.
<rdar://problem/31825940> 

llvm-svn: 304520
2017-06-02 05:17:19 +00:00
Sean Callanan ddf802a04d [TypeSystem] Handle Clang AttributedTypes
When parsing types originating in modules, it is possible to encounter AttributedTypes 
(such as the type generated for NSString *_Nonnull). Some of LLDB's ClangASTContext 
methods deal with them; others do not. In particular, one function that did not was 
GetTypeInfo, causing TestObjCNewSyntax to fail.

This fixes that, treating AttributedType as essentially transparent and getting the 
information for the modified type.

In addition, however, TestObjCNewSyntax is a monolithic test that verifies a bunch of 
different things, all of which can break independently of one another. I broke it 
apart into smaller tests so that we get more precise failures when something (like 
this) breaks.

Differential Revision: https://reviews.llvm.org/D33812

llvm-svn: 304510
2017-06-02 01:24:18 +00:00
Pavel Labath 02f290f652 cmake: Enable process_vm_readv detection on android
Only android and linux can have this function as far as I am aware, but
it seems cleaner to enable this code for all platforms.

llvm-svn: 304405
2017-06-01 11:20:17 +00:00
Hafiz Abid Qadeer f64177ea83 Fix a small issue with -var-update.
If the variable was a pointer, code was ignoring the change in the
pointee.

Discussed in
http://lists.llvm.org/pipermail/lldb-dev/2017-May/012435.html

llvm-svn: 304400
2017-06-01 10:33:13 +00:00
Jim Ingham ab194a26da Forgot to mention rewriting CommandObject::DoExecute
using the SB API's not the lldb_private API's.

llvm-svn: 304379
2017-06-01 01:05:30 +00:00
Sean Callanan a77826c298 Added a testcase for local/namespaced name conflicts.
This works on SVN but is a bit fragile on the Swift branch.
I'm adding the test to both, so we have this path covered.

<rdar://problem/32372372>

llvm-svn: 304314
2017-05-31 17:18:10 +00:00
Benjamin Kramer f3b84c4ebe Replace forward decl with include to unbreak the build.
llvm-svn: 304158
2017-05-29 14:40:07 +00:00
Abhishek Aggarwal d2746dda60 Replaced StructuredData::Type with eStructuredDataType
...missing from r304138 "Added new API to SBStructuredData class"

llvm-svn: 304147
2017-05-29 11:13:30 +00:00
Stephan Bergmann cf4321a44d More StructuredData::Type::eTypeDictionary -> lldb::eStructuredDataTypeDictionary
...missing from previous r304138 "Added new API to SBStructuredData class"

llvm-svn: 304142
2017-05-29 08:51:58 +00:00
Abhishek Aggarwal 5bfee5f1c8 Added new API to SBStructuredData class
Summary:
 - Added API to access data types
    -- integer, double, array, string, boolean and dictionary data types
    -- Earlier user had to parse through the string output to get these
       values

 - Added Test cases for API testing

 - Added new StructuredDataType enum in public include file
   -- Replaced locally-defined enum in StructuredData.h with this new
      one       
   -- Modified other internal files using this locally-defined enum

Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com>

Reviewers: clayborg, lldb-commits

Reviewed By: clayborg

Subscribers: labath

Differential Revision: https://reviews.llvm.org/D33434

llvm-svn: 304138
2017-05-29 08:25:46 +00:00
Ravitheja Addepally 0e62a125bd Fixing Memory Leak
llvm-svn: 303991
2017-05-26 14:26:14 +00:00
Pavel Labath 4c950235b2 Fix 32-bit builds
r303972 used GetValueForKeyAsInteger with mismatched types (e.g.
instantiating with uint64_t, but passing a size_t argument), which
manifested itself on 32-bit architectures.

The intended usage of these functions was to not specify the type
explicitly, and let the compiler figure that out, so switch to that kind
of usage instead.

llvm-svn: 303988
2017-05-26 13:53:39 +00:00
Ravitheja Addepally e714c4f535 Implementation of remote packets for Trace data.
Summary:
The changes consist of new packets for trace manipulation and
trace collection. The new packets are also documented. The packets
are capable of providing custom trace specific parameters to start
tracing and also retrieve such configuration from the server.

Reviewers: clayborg, lldb-commits, tberghammer, labath, zturner

Reviewed By: clayborg, labath

Subscribers: krytarowski, lldb-commits

Differential Revision: https://reviews.llvm.org/D32585

llvm-svn: 303972
2017-05-26 11:46:27 +00:00
Ed Maste d6fa2c3b4d FreeBSD ProcessMonitor: map TRAP_CAP to a trace trap
In the absense of a more specific handler for TRAP_CAP (generated by
ENOTCAPABLE or ECAPMODE while in capability mode) treat it as a trace
trap. Obtained from FreeBSD r318884.

We should later add an option to have LLDB control the trapcap procctl 
(as with ASLR), as well as report a specific stop reason. For now this
change eliminates an assertion failure from LLDB.

llvm-svn: 303965
2017-05-26 03:15:46 +00:00
Kamil Rytarowski 8855c2ca19 Fix bug #28898
lldb: libedit produces garbled, unusable input on Linux

Apply patch from Christos Zoulas, upstream libedit developer.
It has been tested on NetBSD/amd64.

New code supports combination of wide libedit and disabled
LLDB_EDITLINE_USE_WCHAR, which was the popular case on Linux
systems.

llvm-svn: 303907
2017-05-25 20:12:30 +00:00
Pavel Labath e8cd2cca91 Revert "Fix FDE indexing while scan debug_info section."
This reverts commit r303847 as it introduces a number of regressions.
Investigation has showed that we are parsing the CIE entries in the
debug_frame section incorrectly -- we are parsing them the same way as
eh_frame, but the entries in debug_frame have a couple of extra entries
which have not been taken into account.

llvm-svn: 303854
2017-05-25 13:13:12 +00:00
Pavel Labath 45dde23756 Recommit "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"
This is a resubmit of r303732, which was reverted due to a regression.

The original patch caused a regression in TestLoadUnload, which has only showed
up when running the remote test suite. The problem there was that we interrupted
the target just as it has hit the rendezvous breakpoint in the dlopen call. This
meant that the stop reason was set to "breakpoint" even though the event would
not have been broadcast if we had not stopped the process. I fix this by
checking StopInfo->ShouldNotify() before stopping.

I also add a new test for the handling of conditional breakpoints in
expressions, which I noticed to be broken (pr33164)

Differential Revision: https://reviews.llvm.org/D33283

llvm-svn: 303848
2017-05-25 10:50:06 +00:00
Hafiz Abid Qadeer 0b5d6e5d0e Fix FDE indexing while scan debug_info section.
There are some differences between eh_frame and debug_frame formats that
are not considered by DWARFCallFrameInfo::GetFDEIndex. An FDE entry
contains CIE_pointer in debug_frame in same place as cie_id in eh_frame.
As described in dwarf standard (section 6.4.1), CIE_pointer is an
"offset into the .debug_frame section". So, variable cie_offset should
be equal cie_id for debug_frame.

FDE entries with zeroth CIE pointer (which is actually placed in cie_id
variable) shouldn't be ignored also.

I have also added a little change which allow to use debug_info section
when eh_frame is absent. This case really can take place on some platforms.

Patch from tatyana-krasnukha.
https://reviews.llvm.org/D33504

llvm-svn: 303847
2017-05-25 10:21:29 +00:00
Jim Ingham d2a7e8538b Fix the warning when you pass -c to step/next/si/ni.
During some cleanup the test for whether the thread plan
accepted an iteration count was reversed, so we give a 
warning when it will actually work, and don't when it won't.

<rdar://problem/32379280>

llvm-svn: 303832
2017-05-25 02:24:18 +00:00
Kamil Rytarowski 269eec03d6 Correct compiler warnings and Debug build of the NetBSD target
Correct files present only in the NetBSD build.

llvm-svn: 303823
2017-05-24 23:59:50 +00:00
Pavel Labath 7417558f59 Revert "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"
This reverts commit r303732, as it introduces a regression in
TestLoadUnload on android.

llvm-svn: 303740
2017-05-24 11:57:28 +00:00
Pavel Labath 0dc2ad1b13 RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false
Summary:
The function had logic to handle the case when the expression terminated
while we were trying to halt the process, but it failed to take into
account the possibility that the expression stopped because it hit a
breakpoint. This was caused by the fact that the handling of the stopped
events was duplicated for the "halting" and regular cases (the regular
case handled this situation correctly). I've tried to merge these two
cases into one to make sure they stay in sync.

I should call out that the two cases were checking whether the thread
plan has completed in slightly different ways. I am not sure what is the
difference between them, but I think the check should be the same in
both cases, whatever it is, so I just took the one from the regular
case, as that is probably more tested.

For the test, I modified TestUnwindExpression to run the expression with
a smaller timeout (this is how I found this bug originally). With a 1ms
one thread timeout, the test failed consistently without this patch.

Reviewers: jingham

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D33283

llvm-svn: 303732
2017-05-24 09:46:48 +00:00
Stephane Sezer e3bb52bb2e Fix bad change in RenderScriptx86ABIFixups.cpp, forgot to change everything necessary
Summary: I didn't change all instances of i to I in this loop. I am a bad person and should feel bad. :(

Reviewers: sas

Differential Revision: https://reviews.llvm.org/D33456

Change by Alex Langford <apl@fb.com>

llvm-svn: 303677
2017-05-23 19:22:31 +00:00
Stephane Sezer 02295000c2 hange RenderScriptx86ABIFixups.cpp to use llvm::AttributeList iterator
LLVM::AttributeList recently had getNumSlots() removed, which broke the
build. This fixes the build using functions introduced in the
update to LLVM::AttributeList.

Change by Alex Langford <apl@fb.com>

llvm-svn: 303674
2017-05-23 18:54:03 +00:00
Jim Ingham c1dd88c2e6 We shouldn't put actual tests in directories that contain
other test directories.

llvm-svn: 303643
2017-05-23 16:11:21 +00:00
Pavel Labath b8372cfa33 Add support for new (3.0.11+) swigs
Summary:
A change in swig 3.0.9 has caused it to generate modules incompatible
with us using them as __init__.py (bug #769). Swig 3.0.11 adds a setting to help
fix this problem, so use that. Support for older versions of swig remains
unaffected.

Reviewers: zturner

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D33409

llvm-svn: 303627
2017-05-23 10:55:17 +00:00
Pavel Labath 6bb7e21f10 Fix incorrect Status -> Error rename in IOHandler
Change 302872 was a massive rename of the Error class to Status.

The change included an incorrect rename of the "Status" window
in the LLDB GUI from "Status to "Error". This patch undoes this incorrect
rename and restores the status window's correct name.

Differential Revision: https://reviews.llvm.org/D33241
Patch by Brian Gianforcaro.

llvm-svn: 303553
2017-05-22 14:13:38 +00:00
Jason Molenda 631a0bb924 Don't override the SDKs and force the use of /System/Library/Frameworks to
find the python headers when buiding crashinfo.c
<rdar://problem/32288076> 

llvm-svn: 303465
2017-05-19 23:00:42 +00:00
Pavel Labath a24a3a30d0 Add Status -- llvm::Error glue
Summary:
This adds functions to convert between llvm::Error and Status classes.
Posix errors in Status are represented as llvm::ECError, and the rest as
llvm::StringError.

For the conversion from Error to Status, ECError is again represented as
a posix error in Status, while other errors are stored as generic errors
and only the string value is preserved.

Reviewers: zturner, jingham

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D33241

llvm-svn: 303348
2017-05-18 12:46:50 +00:00
Ted Woodward c8556788a0 Fix error string set in AddName to take a StringRef.
llvm-svn: 303278
2017-05-17 17:48:55 +00:00
Pavel Labath 1b8fe5ec8d Make TestConflictingSymbol run on non-darwin targets
For remote targets we need to call registerSharedLibrariesWithTarget to
make sure they are installed alongside main executable. This also
required a small fixup in the the mentioned function as in this case
"One" was both a directory name and a library name template. I fixed it
to make sure it checks that the string refers to a file before it
assumed it was a full library path.

llvm-svn: 303248
2017-05-17 11:47:44 +00:00
Sean Callanan 9c99faa856 [Expression parser] Look up module symbols before hunting globally
When it resolves symbol-only variables, the expression parser
currently looks only in the global module list. It should prefer
the current module.

I've fixed that behavior by making it search the current module
first, and only search globally if it finds nothing. I've also
added a test case.

After review, I moved the core of the lookup algorithm into
SymbolContext for use by other code that needs it.

Thanks to Greg Clayton and Pavel Labath for their help.

Differential Revision: https://reviews.llvm.org/D33083

llvm-svn: 303223
2017-05-16 23:46:13 +00:00
Pavel Labath 26d49a640a Skip TestWatchedVarHitWhenInScope on android arm because it triggers a kernel bug
llvm-svn: 303160
2017-05-16 11:58:18 +00:00
Sean Callanan 732a6f432e [TypeSystem] Fix inspection of Objective-C object types
ptr_refs exposed a problem in ClangASTContext's implementation: it
uses an accessor to downcast a QualType to an
ObjCObjectPointerType, but the accessor is not fully general.
getAs() is the safer way to go.

I've added a test case that uses ptr_refs in a way that would
crash before the fix.

<rdar://problem/31363513>

llvm-svn: 303110
2017-05-15 19:55:20 +00:00