Commit Graph

16820 Commits

Author SHA1 Message Date
Pavel Labath 11d0b29446 Revert "[SymbolFilePDB] Fix null array access when parsing the type of a function without any arguments, i.e. 'int main()' and add support to test it"
This reverts commit r322995, as it breaks
lldb-Unit::SymbolFilePDBTests.TestTypedefs
<http://lab.llvm.org:8011/builders/lldb-windows7-android/builds/7715>.

llvm-svn: 323102
2018-01-22 11:51:56 +00:00
Pavel Labath 6a92e99b64 Add SysV Abi for PPC64le
Summary:
This patch implements the ABI Plugin for PPC64le. It was based on the
ABI for PPC64. It also enables LLDB to evaluate expressions using JIT.

Reviewers: labath, clayborg, jhibbits, davide

Reviewed By: labath, clayborg, jhibbits, davide

Subscribers: davide, JDevlieghere, chmeee, emaste, jhibbits, hfinkel, lldb-commits, nemanjai, luporl, lbianc, mgorny, anajuliapc, kbarton

Differential Revision: https://reviews.llvm.org/D41702
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>

llvm-svn: 323100
2018-01-22 11:27:43 +00:00
Pavel Labath 717937d586 Fix TestTargetSymbolsAddCommand [getBuildArtifact refactor]
llvm-svn: 323086
2018-01-22 09:55:30 +00:00
Raphael Isemann 8f52340766 Fix memory leaks in MinidumpParserTest
Summary: We never delete the allocated RegisterContext objects, causing those tests to fail with enabled memory sanitizer.

Reviewers: dvlahovski, zturner

Reviewed By: zturner

Subscribers: zturner, lldb-commits

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

llvm-svn: 323085
2018-01-22 09:48:40 +00:00
Raphael Isemann 1784388567 Fix use after free in DiskFilesOrDirectories
Summary:
We copy the local variable `Resolved` into `Storage` to keep it around. However, we then still let the `SearchDir` ref point to `Resolved` which then is used to access the already freed memory later on. With this patch we point to `Storage` which doesn't get deleted after the current scope exits.

Discovered by memory sanitizer in the CompletionTest.DirCompletionUsername test.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 323082
2018-01-22 09:17:16 +00:00
Raphael Isemann 0b16ef7814 Fix unrepresentable float value in ScalarTest
Summary: float can't represent the given value in the literal, so we get this UB error: `runtime error: 1.23457e+48 is outside the range of representable values of type 'float'`. The test seems to not rely on this specific value, so let's just choose a smaller one that can be represented.

Reviewers: uweigand

Subscribers: lldb-commits

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

llvm-svn: 323081
2018-01-22 08:11:29 +00:00
Raphael Isemann bb3c570633 Fix memory leaks in TestArm64InstEmulation
Summary: We never delete the created instances, so those test fail with the memory sanitizer.

Reviewers: jasonmolenda

Reviewed By: jasonmolenda

Subscribers: aemerson, javed.absar, kristof.beyls, lldb-commits

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

llvm-svn: 323076
2018-01-22 07:22:13 +00:00
Raphael Isemann fbdf0b9315 Make loop counter unsigned in SymbolFilePDB::GetCompileUnitIndex
Summary: This fixes a clang warning.

Reviewers: zturner

Reviewed By: zturner

Subscribers: zturner, lldb-commits

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

llvm-svn: 323075
2018-01-22 06:56:09 +00:00
Jan Kratochvil 79834a1fce Clean up #include "DWARFCompileUnit.h"
Clean up needless+missing #include "DWARFCompileUnit.h" for split of
DWARFCompileUnit to DWARFUnit as discussed in D40466.

Differential revision: https://reviews.llvm.org/D42355

llvm-svn: 323069
2018-01-21 18:03:17 +00:00
Raphael Isemann e07688898b [modules] Fix missing includes/typo in LLDB's includes. [NFC]
Summary:
This patch adds missing includes to the LLDB headers inside `include/` as a first step of building LLDB's source with C++ modules. It also fixes this single `stds::` typo.

Some quick map why some non-obvious includes were necessary:
* lldb/lldb-defines.h for LLDB_INVALID_ADDRESS
* lldb/lldb-types.h for addr_t
* lldb/lldb-defines.h for DISALLOW_COPY_AND_ASSIG
* lldb/DataFormatters/TypeSynthetic.h for SyntheticChildrenFrontEnd

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: zturner, lldb-commits

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

llvm-svn: 323064
2018-01-21 09:54:19 +00:00
Adrian Prantl 595048f3ec Wrap all references to build artifacts in the LLDB testsuite (NFC)
in TestBase::getBuildArtifact(). This NFC commit is in preparation for
https://reviews.llvm.org/D42281 (compile the LLDB tests out-of-tree).

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

llvm-svn: 323007
2018-01-19 23:24:35 +00:00
Aaron Smith 563799b3a6 [SymbolFilePDB] Fix null array access when parsing the type of a function without any arguments, i.e. 'int main()' and add support to test it
Summary:
- Fix a null array access bug. This happens when creating the lldb type for a function that has no argument.
- Implement SymbolFilePDB::ParseTypes method. Using `lldb-test symbols` will show all supported types in the target.
- Create lldb types for variadic function, PDBSymbolTypePointer, PDBSymbolTypeBuiltin
- The underlying builtin type for PDBSymbolTypeEnum is always `Int`, correct it with the very first enumerator's encoding if any. This is more accurate when the underlying type is not signed or another integer type.
- Fix a bug when the compiler type is not created based on PDB_BuiltinType. For example, basic type `long` is of same width as `int` in a 32-bit target, and the compiler type of former one will be represented by the one generated for latter if using the default method. Introduce a static function GetBuiltinTypeForPDBEncodingAndBitSize to correct this issue.
- Basic type `long double` and `double` have the same bit size in MSVC and there is no information in a PDB to distinguish them. The compiler type of the former one is represented by the latter's.
- There is no line informaton about typedef, enum etc in a PDB and the source and line information for them are not shown.
- There is no information about scoped enumeration. The compiler type is represented as an unscoped one.

Reviewers: zturner, lldb-commits, davide, asmith

Reviewed By: zturner, asmith

Subscribers: llvm-commits, davide

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

llvm-svn: 322995
2018-01-19 21:55:44 +00:00
Pavel Labath 91f14e69b8 Remove Platform references from the Host module
Summary:
These were used by Host::LaunchProcess to "resolve" the executable it
was about to launch. The only parts of Platform::ResolveExecutable, which
seem to be relevant here are the FileSpec::ResolvePath and
ResolveExecutableLocation calls.

The rest (most) of that function deals with selecting an architecture
out of a fat binary and making sure we are able to create a Module with that
slice. These are reasonable actions when selecting a binary to debug,
but not for a generic process launching framework (it's technically even
wrong because we should be able to launch a binary with execute
permissions only, but trying to parse such file will obviously fail).

I remove the platform call by inlining the relevant FileSpec calls and
ignoring the rest of the Platform::ResolveExecutable code.  The
architecture found by the slice-searching code is being ignored already
anyway, as we use the one specified in the LaunchInfo, so the only
effect of this should be a different error message in case the
executable does not contain the requested architecture -- before we
would get an error message from the Platform class, but now we will get
an error from the actual posix_spawn syscall (this is only relevant on
mac, as it's the only target supporting fat binaries).

Launching targets for debugging should not be affected as here the
executable is pre-resolved at the point when the Target is created.

Reviewers: jingham, clayborg

Subscribers: lldb-commits, emaste

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

llvm-svn: 322935
2018-01-19 11:10:54 +00:00
Pavel Labath 8872d703ad Fix logging test on windows
Refactor in r322653 broke the logging test on windows because MSVC uses
a fully qualified name as the value of __FUNCTION__, which is not what
we were expecting. I'm changing the code to use the more portable
__func__, which behaves the same as on clang/gcc.

The standard still says that the value of __func__ is implementation
defined, so if we run into problems with this test again we may just
need to drop it.

llvm-svn: 322834
2018-01-18 11:15:50 +00:00
Vedant Kumar 3c3345be1b [CMake] Make check-lldb work with LLDB_CODESIGN_IDENTITY=''
On Darwin, if a test machine isn't set up for code-signing (see
docs/code-signing.txt), running check-lldb should use the system
debugserver instead of the unsigned one built in-tree. This makes it
possible to run lldb's test suite without having code-signing set up,
which is really convenient.

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

llvm-svn: 322803
2018-01-18 01:16:30 +00:00
Vedant Kumar 75d7ee6af5 A third attempt to mark TestRdar12408181.py as skipped
Due to an unfortunate difference between the open source test harness
and our internal harness, applying two @skip... decorators to this test
works in the internal build but not in the open source build.

I've tried another approach to skipping this test and tested it out with
the open source harness. Hopefully this sticks!

rdar://36417163

llvm-svn: 322756
2018-01-17 20:54:39 +00:00
Vedant Kumar d122baec22 Try again to mark TestRdar12408181.py as skipped
rdar://36417163

llvm-svn: 322740
2018-01-17 19:25:12 +00:00
Vedant Kumar cc9fd4b661 Skip a flaky test (TestRdar12408181.py)
This test frequently times out on our bots. While we're investigating
the issue, mark the test as skipped so the builds aren't impacted as
much.

rdar://36417163

llvm-svn: 322728
2018-01-17 18:53:42 +00:00
Pavel Labath 555130c3f6 [lldb][PPC64] Fixed long double variables dump
Summary:
LLDB's DumpDataExtractor was not prepared to handle PowerPC's long double type: PPCDoubleDouble.

As it is somewhat special, treating it as other regular float types resulted in getting wrong information about it.
In this particular case, llvm::APFloat::getSizeInBits(PPCDoubleDouble) was returning 0.

This caused the TestSetValues.py test to fail, because lldb would abort on an assertion failure on APInt(), because of the invalid size.

Since in the PPC case the value of item_byte_size was correct and the
getSizeInBits call was only added to support x87DoubleExtended
semantics, this restricts the usage of getSizeInBits to the x87
semantics.

Reviewers: labath, clayborg

Reviewed By: labath

Subscribers: llvm-commits, anajuliapc, alexandreyy, lbianc, lldb-commits

Differential Revision: https://reviews.llvm.org/D42083
Author: Leandro Lupori <leandro.lupori@gmail.com>

llvm-svn: 322666
2018-01-17 15:11:20 +00:00
Pavel Labath b424de390e Fix assertion in ObjectFileELF
In D40616 I (mistakenly) assumed that logging an llvm::Error would clear
it. This of course is only true if logging is actually enabled.

This fixes the assertion by manually clearing the error, but it raises
the point of whether we need a special error-clearing logging primitive.

llvm-svn: 322664
2018-01-17 14:40:25 +00:00
Pavel Labath 243ea5b5fe Simplify some LogTest tests
This removes boilerplate for setting up a log channel and capturing the
output from some of the tests. I do this by moving the setup code into a
test fixture and adding a logAndTakeOutput utility function to log some
string and then retrieve it from the log.

I also use some googlemock goodies to simplify a couple of assertions.

llvm-svn: 322653
2018-01-17 13:46:06 +00:00
Jason Molenda 0af609d17c Remove the hardcoded macos deployment targets altogether
from the xcode project files.  We'll build for the current
OS only, by default.  

llvm-svn: 322603
2018-01-17 00:22:27 +00:00
Pavel Labath dbda285178 One more attempt to fix NetBSD build
llvm-svn: 322477
2018-01-15 11:50:05 +00:00
Pavel Labath e831bb3cd9 Fix NetBSD build for llvm r322475
llvm-svn: 322476
2018-01-15 11:32:43 +00:00
Pavel Labath cc2ba02817 Fix HostInfoBase::ComputeSharedLibraryDirectory comment
The comment seems to indicate that this function would return the "bin"
directory on linux. I've verified that this is not the case, so I'm
updating the comment to match.

llvm-svn: 322472
2018-01-15 09:56:00 +00:00
Aaron Smith 10a02577ea [lldb] Add support to cache a PDB's global scope and fix a bug in getting the source file name for a compiland
Summary:
This commit is a combination of the following changes:
    
- Cache PDB's global scope (executable) in SymbolFilePDB  

- Change naming of `cu` to `compiland` which is PDB specific   

- Change ParseCompileUnitForSymIndex to ParseCompileUnitForUID.
   Prefer using a common name `UID` instead of PDB's `System Index`
   Adding one more argument `index` to this method, which is used to
   specify the index of the compile unit in a cached compile unit array
    
- Add GetPDBCompilandByUID method to simply code
    
- Fix a bug in getting the source file name for a PDB compiland.
   For some reason, PDBSymbolCompiland::getSourceFileName() could
   return an empty name, so if that is true, we have to walk through all
   source files of this compiland and determine the right source file
   used to generate this compiland based on language indicated.
    
   The previous implementation called PDBSession::findOneSourceFile 
   method to get its name for the compiland. This is not accurate since
   the `one source file` found could be a header other than source file.

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 322433
2018-01-13 06:58:18 +00:00
Jason Molenda 9f0115fe1c We have two sources for path remapping information that we get out
of a dSYM per-uuid plist that may be present (dsymutil does not
create this plist, it is only added after the fact by additional
tools) -- either the DBGBuildSourcePath + DBGSourcePath pair of
k-v entries which give us the build-time and debug-time remapping,
or the newer DBGSourcePathRemapping dictionary which may give us
multiple remappings.

I'm changing the order that we process these & add them to the
list of source remappings.  If the DBGSourcePathRemapping dict
is present, it should be the first entries we will try.

<rdar://problem/36481989> 

llvm-svn: 322418
2018-01-12 22:42:45 +00:00
Jim Ingham 5ec7cd7227 Fix Breakpoint::RemoveInvalidLocations to fix the exec testcase.
RemoveInvalidLocations was clearing out the m_locations in the
breakpoint by hand, and it wasn't also clearing the locations from
the address->location map, which confused us when we went to update
breakpoint locations.  

I also made Breakpoint::ModulesChanged check the Location's Section
to make sure it hadn't been deleted.  This shouldn't strictly be necessary,
but if the DynamicLoaderPlugin doesn't do it's job right (I'm looking at
you new Darwin DynamicLoader...) then it can end up leaving stale locations
on rerun.  It doesn't hurt to clean them up here as a backstop.

<rdar://problem/36134350>

llvm-svn: 322348
2018-01-12 03:03:23 +00:00
Jim Ingham 8157e8ee8c Fix the Makefile - this version should work on the bot
llvm-svn: 322341
2018-01-12 01:30:33 +00:00
Vedant Kumar 3ffbbeabbc Skip TestFunctionTemplateParameterPack.py, which unexpectedly asserts (PR35920)
This test stresses expression evaluation support for template functions.
Currently the support is rudimentary, and running this test causes assertion
failures in clang. This test cannot be XFAIL'ed because the test harness
treats assertion failures as unexpected events. For now, the test must be
skipped.

llvm-svn: 322340
2018-01-12 01:23:52 +00:00
Jason Molenda c4dd04c5c3 When parsing the target.xml register file, if no architecture has
been specified yet (either by the user, or by one of the lldb
extensions like qHostInfo or qProcessInfo), and the target.xml
includes a <architecture> tag specifying x86_64, set the architecture
appropriately.

I'm not sure what we can expect to see in the <architecture> tag, so
I'm only doing this for x86_64 right now where I've seen "i386:x86_64"
used.  I've seen a target.xml from a jtag board that sends just "arm"
because it doesn't know more specifically what type of board it is
connected to...  

<rdar://problem/29908970> 

llvm-svn: 322339
2018-01-12 01:16:13 +00:00
Jim Ingham e38b018df4 Print the SBDebugger.CreateTarget error message.
This is failing on the bot but not locally.  Maybe
the error message will tell us why.

llvm-svn: 322338
2018-01-12 01:12:45 +00:00
Jim Ingham f4b0884718 Fix the same thinko in another place...
Thanks Jason.

llvm-svn: 322329
2018-01-11 23:52:50 +00:00
Jim Ingham 7581337382 Fix a tiny thinko in this test and re-add.
target.IsValid() not target...

llvm-svn: 322328
2018-01-11 23:31:29 +00:00
Davide Italiano 4bec480f71 [testsuite] Remove a broken test which tried to find App in bundles.
That never really worked, and the change associated isn't yet
committed, so, let's try to make the bots green for now.

llvm-svn: 322322
2018-01-11 22:38:57 +00:00
Pavel Labath b6ac2d9694 Make the bundle folders in the find-app-in-bundle test non-empty
git will not create empty folders, which makes this test fail if the repo is
checked out with git.

llvm-svn: 322271
2018-01-11 12:21:58 +00:00
Tatyana Krasnukha 6c2c08f3a1 Check existence of each required component during construction of LLVMCDisassembler.
Summary:
Actually, fix two issues:

  # remove repeat creation of reg_info, use m_reg_info_ap  for createMCAsmInfo instead;

  # remove possibility to dereference nullptr during createMCAsmInfo invocation, that could lead to undefined behavior.

Placed checking of a component right after its creation to simplify the code and avoid same issues later.

Reviewers: zturner, clayborg, jingham, jasonmolenda, labath

Reviewed By: clayborg, labath

Subscribers: labath, lldb-commits

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

llvm-svn: 322270
2018-01-11 12:06:22 +00:00
Eugene Zemtsov b7386d9943 Advanced guessing of rendezvous breakpoint (resubmit)
When rendezvous structure is not initialized we need to set up
rendezvous breakpoint anyway. In this case the code will locate
dynamic loader (interpreter) and look for known function names.

This is r322209, but with fixed VDSO loading fixed.

Bug: https://bugs.llvm.org/show_bug.cgi?id=25806
Differential Revision: https://reviews.llvm.org/D41533

llvm-svn: 322251
2018-01-11 03:46:35 +00:00
Jim Ingham e8db13da0a Running this on other systems won't work because I don't
know how to specifically build a MachO binary on other systems.

llvm-svn: 322239
2018-01-10 23:32:43 +00:00
Jason Molenda 8049b4db55 Remove Environment.h, test-dwarf.cpp, test-dwarf.exe
from being listed as a part of the desktop or 
desktop/desktop_no_xpc Targets - they should not be
a part of any target.  Having them listed as a part of
desktop target results in them being added to the 
Copy Files build phase for desktop and I'm guessing
they'd end up in the manpage directory or something.

llvm-svn: 322237
2018-01-10 23:11:29 +00:00
Jim Ingham 1f74a24ac0 Runs the part of the test that just finds the binary on all systems.
That should work everywhere. Then only try actually running on macosx.

llvm-svn: 322235
2018-01-10 23:06:34 +00:00
Jim Ingham d657eb6551 Add a test for finding a binary in an app package.
llvm-svn: 322232
2018-01-10 22:52:42 +00:00
Eugene Zemtsov 5c84e4b001 Revert "Advanced guessing of rendezvous breakpoint"
This reverts commit r322209, because it broke
TestNoreturnUnwind,TestInferiorAssert and TestNumThreads on i386.

llvm-svn: 322229
2018-01-10 22:25:33 +00:00
Eugene Zemtsov 4c3ea8029e Advanced guessing of rendezvous breakpoint
When rendezvous structure is not initialized we need to set up
rendezvous breakpoint anyway. In this case the code will locate
dynamic loader (interpreter) and look for known function names.

Bug: https://bugs.llvm.org/show_bug.cgi?id=25806
Differential Revision: https://reviews.llvm.org/D41533

llvm-svn: 322209
2018-01-10 19:04:36 +00:00
Davide Italiano 90d96aa107 [XCodebuild] Catch up with recent changes (Environment.cpp).
llvm-svn: 322208
2018-01-10 18:53:00 +00:00
Pavel Labath 7da84753a3 Handle O reply packets during qRcmd
Summary:
Gdb servers like openocd may send many $O reply packets for the client to output during a qRcmd command sequence.  Currently, lldb interprets the first O packet as an unexpected response.  Besides generating no output, this causes lldb to get out of sync with future commands because it continues reading O packets from the first command as response to subsequent commands.

This patch handles any O packets during an qRcmd, treating the first non-O packet as the true response.

Preliminary discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013078.html

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: labath, lldb-commits

Differential Revision: https://reviews.llvm.org/D41745
Patch by Owen Shaw <llvm@owenpshaw.net>

llvm-svn: 322190
2018-01-10 14:39:08 +00:00
Pavel Labath e71429d1d8 Add empty() function to the Environment class
Needed to make the previous Freebsd fix work.

llvm-svn: 322188
2018-01-10 14:17:40 +00:00
Pavel Labath 75c6de0be2 Another attempt to fix FreeBsd build
the previous fix did not work because of different const qualifications
on the envp pointer.

This should resolve that (and remove a couple of const_casts in the
process).

llvm-svn: 322187
2018-01-10 13:53:40 +00:00
Tim Northover 400c7b3c7a Fix Xcode build for r322174
llvm-svn: 322183
2018-01-10 13:32:01 +00:00
Pavel Labath 3ff377a927 Fix windows and freebsd builds for r322174 (Environment)
llvm-svn: 322176
2018-01-10 12:25:48 +00:00