Commit Graph

17140 Commits

Author SHA1 Message Date
Jim Ingham 7b57946801 Fix a thinko in CommandObjectMemoryRegion.
Don't try to read the first argument till you've checked
that there is one.

llvm-svn: 329844
2018-04-11 19:27:03 +00:00
Davide Italiano 082c76e1bf [Target] Remove dead/commented out code. NFC.
Some spring cleaning before I touch this file more extensively.

llvm-svn: 329831
2018-04-11 17:53:02 +00:00
Pavel Labath a70512a958 llgs: Send "rich" errors in response to vAttach packets
There are plenty of ways attaching can go wrong. Having the server
report the exact error means we can give better feedback to the user.
(This patch does not do the second part, it only makes sure the
information is sent from the server.)

Triggering all possible error conditions in a test would prove
challenging, but there is one error that is very easy to reproduce
(attempting to attach while debugging), so I write a test based on that.

The test immediately exposed a bug where the m_send_error_strings field
was being used uninitialized (so it was sometimes true from the get-go),
so I fix that as well.

llvm-svn: 329803
2018-04-11 13:30:54 +00:00
Jim Ingham 1a1dee1a81 Convert an absolute to a group relative reference for TestOptionArgParser.cpp.
llvm-svn: 329745
2018-04-10 19:29:37 +00:00
Jim Ingham 7a048da40c Fix a typo in the gtest build target for Debug configuration.
I usually run DebugClang...

llvm-svn: 329727
2018-04-10 17:49:56 +00:00
Jim Ingham 8c7121b3a6 Fix the Xcode build for the addition of OptionArgsParser.
llvm-svn: 329722
2018-04-10 17:20:27 +00:00
Nico Weber b1cb0b7957 s/LLVM_ON_WIN32/_WIN32/, lldb
LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in            
HandleLLVMOptions.cmake, which is where _WIN32 defined too.  Just use the        
default macro instead of a reinvented one.                                      
                                                                                
See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.  
No intended behavior change.

llvm-svn: 329697
2018-04-10 13:33:45 +00:00
Pavel Labath aec4593ad9 Args: replace isprint8 usage with isprint
It looks like we introduced isprint8 way back in r169417 to be used on
getopt's short_options, which we sometimes set to values which are out
of range for normal chars to indicate options with no short form.

However, this is not how the function is used in the Args class, where
we explicitly process a string character by character.

This removes the last external dependency from the Args class.

llvm-svn: 329682
2018-04-10 10:07:22 +00:00
Pavel Labath 31f199c82d Move OptionElementVector helper structs from Args to Options
These are not used anywhere in the Args class. They should have been
moved as a part of r327110 (Moving Option parsing from Args to Options),
but I did not notice them then.

This does not affect the layering in any way, but in makes sense for the
structs to be defined in the near the code that uses them.

llvm-svn: 329679
2018-04-10 09:48:05 +00:00
Pavel Labath 47cbf4a07b Move Args::StringTo*** functions to a new OptionArgParser class
Summary:
The idea behind this is to move the functionality which depend on other lldb
classes into a separate class. This way, the Args class can be turned
into a lightweight arc+argv wrapper and moved into the lower lldb
layers.

Reviewers: jingham, zturner

Subscribers: lldb-commits

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

llvm-svn: 329677
2018-04-10 09:03:59 +00:00
Tatyana Krasnukha 695fc9c7fe Fix compilation error caused by tgmath.h.
On CentOS calling functions from <tgmath.h> produces multiple errors "'void*' is not a pointer-to-object type".

llvm-svn: 329597
2018-04-09 17:32:56 +00:00
Davide Italiano fccc58a99d [lldb-server] Set a more generous timeout when testing gdbremote.
One of our downstream bot is struggling under load,  but this
value should be enough for everyone.

llvm-svn: 329426
2018-04-06 17:17:20 +00:00
Jan Kratochvil 7ea906459a Revert "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit"
The reverted commit changed DWARFUnit from https://reviews.llvm.org/D40466 and
https://reviews.llvm.org/D42892 that was prepared for DWARFPartialUnit and
made from it a superclass for DWARFTypeUnit.  DWARFUnit's intention was:
	DWARFUnit->DWARFSomeNameUnit->DWARFCompileUnit
	DWARFUnit->DWARFSomeNameUnit->DWARFTypeUnit
	DWARFUnit->DWARFPartialUnit

Discussed at: https://reviews.llvm.org/D45170

This reverts commit r329305.

llvm-svn: 329423
2018-04-06 17:11:13 +00:00
Frederic Riss cd90f878d4 [debugserver] Fix LC_BUILD_VERSION load command handling.
Summary:
In one of the 2 places the LC_BUILD_VERSION load command is handled, there
is a bug preventing us from actually handling them (the address where to
read the load command was not updated). This patch factors reading the
deployment target load commands into a helper and adds testing for the 2
code paths calling the helper.

The testing is a little bit complicated because the only times those load
commands matter is when debugging a simulator process. I added a new
decorator to check that a specific SDK is available. The actual testing was
fairly easy once I knew how to run a simulated process.

Reviewers: jasonmolenda, labath

Subscribers: lldb-commits

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

llvm-svn: 329374
2018-04-06 04:28:12 +00:00
Davide Italiano 5f969602f0 [dotest] --skip-category should append and not override.
<rdar://problem/38566150>

llvm-svn: 329358
2018-04-05 22:46:39 +00:00
Pavel Labath bc4987b877 One more windows build fix
llvm-svn: 329314
2018-04-05 16:59:36 +00:00
Pavel Labath 6b3c8bb02e Fix windows build after r329296
Add a couple of #include <csignal>s.

llvm-svn: 329309
2018-04-05 16:23:54 +00:00
Greg Clayton 118bcd9ce2 Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding DWARFTypeUnit
Many things that were in DWARFCompileUnit actually need to be in DWARFUnit. This patch moves all DWARFUnit specific things over into DWARFUnit and fixes the layering. This is in preparation for adding DWARFTypeUnit for the .debug_types patch.

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

llvm-svn: 329305
2018-04-05 15:52:39 +00:00
Pavel Labath 441460dc91 Remove unused NativeProcessProtocol.h include from Platform.h
After removing it, I got a couple of compile errors because we were
missing some symbols (SIGKILL and such), as their definitions were not
transitively included anymore. I fix this by including csignal from
PosixApi.h, as it's windows version provides a stub definitions of these
symbols. This should make the result of #including PosixApi.h more
consistent across platforms (although in the long run, we should just
get rid of this header).

llvm-svn: 329296
2018-04-05 15:17:51 +00:00
Pavel Labath 878e96f266 Fix error in QEnableErrorStrings gdb-remote docs
this probably happened because we changed the name of the packet
mid-review.

llvm-svn: 329295
2018-04-05 15:17:43 +00:00
Greg Clayton de01668b14 Added a BSD archive tool.
This is a combination stand alone BSD archive tool that can dump BSD archives:

% bsd.py /path/to/foo.a

Search archives for an object file:

% bsd.py --object foo.o bar.a

Dump the symbol definitions found in the __.SYMDEF objects:

% bsd.py --symdef bar.a

Find symbols by name that are listed in the __.SYMDEF objects:

% bsd.py --symbol _Z123 bar.a

Extract objects from BSD archives:

% bsd.py --object foo.o bar.a --extract
% bsd.py --object foo.o bar.a --extract --outfile /tmp/foo.o
% bsd.py --object foo.o bar.a --extract --mtime 0x1234556

It also has installs a new LLDB command line command when imported into LLDB:

(lldb) command script import ~/Dropbox/bin/bsd.py
The "verify-debug-map-objects" command has been installed, type "help verify-debug-map-objects" for detailed help.
(lldb) verify-debug-map-objects a.out

This will iterate through all object files and verify the modification times match for any .o files, it will verify any .o files from BSD archives are found and have matching modification times and print out errors if any are found.

llvm-svn: 328990
2018-04-02 17:20:21 +00:00
Davide Italiano 49d802862d [Core] Grab-bag of improvements for Scalar.
Remove Scalar::Cast.

It was noted on the list that this method is unused. So, this patch
removes it.

Fix Scalar::Promote for most integer types

This fixes promotion of most integer types (128- and 256-bit types are
handled in a subsequent patch) to floating-point types. Previously
promotion was done bitwise, where value preservation is correct.

Fix Scalar::Promote for 128- and 256-bit integer types

This patch fixes the behavior of Scalar::Promote when trying to
perform a binary operation involving a 128- or 256-bit integer type
and a floating-point type. Now, the integer is cast to the floating
point type for the operation.

Patch by Tom Tromey!

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

llvm-svn: 328985
2018-04-02 16:50:54 +00:00
Frederic Riss f4e7e5210c Support template template parameters
Summary:
We would fail to resolve (and thus display the value of) any
templated type which contained a template template argument even
though we don't really use template arguments.

This patch adds minimal support for template template arguments,
but I doubt we need any more than that.

Reviewers: clayborg, jingham

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 328984
2018-04-02 16:18:32 +00:00
Jonas Devlieghere aa430c018f [test] Exit lldb-dotest in a more Pythonic way.
As suggested by Keith Smiley in:
https://github.com/apple/swift-lldb/pull/486

llvm-svn: 328966
2018-04-02 10:44:36 +00:00
Davide Italiano b5294a3b59 [lldb-dotest] Don't swallow error exit codes.
llvm-svn: 328894
2018-03-30 19:24:08 +00:00
Pavel Labath 47381fa611 NativeThreadProtocol: delete dead code
These functions were unused as everyone just went straight for the
direct operations on the register context. In fact, the
Save/RestoreAllRegisters actually appear to be wrong (inverted). Thanks
to Tatyana for pointing this out.

These functions are not very useful now that we can guarantee that each
thread always contains a valid register context, so I just delete them.

llvm-svn: 328770
2018-03-29 10:09:11 +00:00
Frederic Riss fa37026db3 Prevent double release of mach ports
Summary:
When a MIG routine returns KERN_FAILURE, the demux function will release any OOL resources like ports. In this case, task_port and thread_port will be released twice, potentially resulting in use after free of the ports.

I don't think we can test this in any useful way
rdar://problem/37331387

Reviewers: jasonmolenda

Subscribers: lldb-commits

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

llvm-svn: 328761
2018-03-29 03:49:41 +00:00
Jim Ingham b873748e15 Revert r328715. Wasn't wrong, just not the issue.
llvm-svn: 328721
2018-03-28 18:05:43 +00:00
Jim Ingham 3eb39766bb Explicitly import subprocess
For some reason on one of our bots subprocess wasn't already
imported. Do so explicitly.

llvm-svn: 328715
2018-03-28 17:06:23 +00:00
Pavel Labath 5a84123490 gdb-remote: Fix checksum verification for messages with escape chars
Summary:
We've had a mismatch in the checksum computation between the sender and
receiver. The sender computed the payload checksum using the wire
encoding of the packet, while the receiver did this after expanding
un-escaping and expanding run-length-encoded sequences. This resulted in
communication breakdown if packets using these feature were sent in the
ack mode.

Normally, this did not cause any issues since the only packet we send in
the ack-mode is the QStartNoAckMode packet, but I ran into this when
debugging the lldb-server tests which (for better or worse) don't use
this mode.

According to the gdb-remote documentation "The two-digit checksum is computed as
the modulo 256 sum of all characters between the leading ‘$’ and the
trailing ‘#’", it seems that our sender is doing the right thing here.
Therefore, I fix the receiver the match the sender behavior and add a
test.

With this bug fixed, we can see that lldb-server is sending a stop-reply
after receiving the "k" in the same way as debugserver does (but we
weren't detecting this because at that point the connection was dead
already). I fix that expectation as well.

Reviewers: clayborg, jasonmolenda

Subscribers: mgorny, lldb-commits

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

llvm-svn: 328693
2018-03-28 10:19:10 +00:00
Davide Italiano 675767a591 Use the DWARF linkage name when importing C++ methods.
When importing C++ methods into clang AST nodes from the DWARF symbol
table, preserve the DW_AT_linkage_name and use it as the linker
("asm") name for the symbol.

Concretely, this enables `expression` to call into names that use the
GNU `abi_tag` extension, and enables lldb to call into code using
std::string or std::list from recent versions of libstdc++. See
https://bugs.llvm.org/show_bug.cgi?id=35310 . It also seems broadly
more robust than relying on the DWARF->clang->codegen pipeline to
roundtrip properly, but I'm not immediately aware of any other cases
in which it makes a difference.

Patch by Nelson Elhage!

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

llvm-svn: 328658
2018-03-27 19:40:50 +00:00
Davide Italiano 01c33b8189 [Core] Correctly handle float division in Scalar.
Patch by Tom Tromey!

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

llvm-svn: 328649
2018-03-27 18:37:54 +00:00
Jason Molenda 49b30d5ad5 Add the same new entitlement from r326399 to
the macos entitlement list.
<rdar://problem/38887712> 

llvm-svn: 328591
2018-03-26 23:13:17 +00:00
Adrian Prantl 7341691502 Fix check for verbose logging.
Thanks to Pavel for pointing this out!

llvm-svn: 328557
2018-03-26 17:40:44 +00:00
Pavel Labath 9a652a84b1 Fix TestDisassembleBreakpoint broken by r328488
The first issue was that the test was capturing the "before" disassembly
before launching, and the "after" after. This is a problem because some
of the disassembly will change after we know the load address (e.g. PCs
in call instructions). I fix this by capturing both disassemblies with
the process running.

The second issue was that the refactor in r328488 accidentaly changed
the meaning of the test, as it was no longer disassembling the function
which contained the breakpoint.

While inside, I also modernize the test to use
lldbutil.run_to_source_breakpoint and prevent debug-info replication.

llvm-svn: 328504
2018-03-26 15:17:58 +00:00
Pavel Labath 22dccd008e Make @skipUnlessSupportedTypeAttribute windows-compatible
- close_fds is not compatible with stdin/out redirection on windows. I
  just remove it, as this is not required for correct operation.
- the command string was assuming a posix shell. I rewrite the Popen
  invocation to avoid the need for passing the arguments through a shell.

llvm-svn: 328489
2018-03-26 12:47:40 +00:00
Pavel Labath d5ee7ab47e Add and fix some tests for PPC64
Summary:
TestExprsChar.py
Char is unsigned char by default in PowerPC.

TestDisassembleBreakpoint.py
Modify disassemble testcase to consider multiple architectures.

TestThreadJump.py
Jumping directly to the return line on PowerPC architecture dos not
means returning the value that is seen on the code. The last test fails,
because it needs the execution of some assembly in the beginning of the
function. Avoiding this test for this architecture.

TestEhFrameUnwind.py
Implement func for ppc64le test case.

TestWatchLocation.py
TestStepOverWatchpoint.py
PowerPC currently supports only one H/W watchpoint.

TestDisassembleRawData.py
Add PowerPC opcode and instruction for disassemble testcase.

Reviewers: labath

Reviewed By: labath

Subscribers: davide, labath, alexandreyy, lldb-commits, luporl, lbianc

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

llvm-svn: 328488
2018-03-26 12:42:07 +00:00
Pavel Labath 5af3fb2b94 [LLDB][PPC64] Fix TestGdbRemoteAuxvSupport
Summary: PPC64's auxvec has a special key that must be ignored.

Reviewers: clayborg, labath

Reviewed By: clayborg, labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D43771
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 328486
2018-03-26 12:00:52 +00:00
Pavel Labath a057877a2e Add a test for setting the load address of a module with differing physical/virtual addresses
Summary:
First attempt at landing D42145 was reverted because it caused test
failures on some android devices. It turned out this was because these
devices had vdso modules with differing physical and virtual addresses.
This was not caught earlier because all of the modules in our tests
either lack physical addresses or have them identical to virtual ones.

In the discussion on the patch, we came to the conclusion that in the
scenario where we are merely setting a load address of a module (for
example from a dynamic loader plugin), we should always use virtual
addresses (i.e., preserve status quo). This patch adds a test to make
sure we don't regress in that direction.

Reviewers: owenpshaw

Subscribers: lldb-commits

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

llvm-svn: 328485
2018-03-26 11:45:32 +00:00
Jim Ingham df9f50d23c Add support for __attribute__(trivial_abi).
<rdar://problem/36035075>, <rdar://problem/36035039>

llvm-svn: 328389
2018-03-23 23:44:52 +00:00
Jason Molenda 953d843dfb Remove CommandObjectStats.cpp & CleanUpTest.cpp from
installing in the man page directory.

llvm-svn: 328383
2018-03-23 23:32:16 +00:00
Jason Molenda 2582b9675b Put CommandObjectStats.cpp in lldb-core target, remove CommandObjectStats.h from targets.
llvm-svn: 328382
2018-03-23 22:50:23 +00:00
Davide Italiano 10166c7468 [Commands] Add a (currently empty) `stats` command.
This one will be used to print statistics about lldb sessions
(including, e.g. number of expression evaluation succeeded or
failed). I decided to commit the skeleton first so that we have
a clean reference on how a command should be implemented.
My future commits are going to populate this command and test
it.

<rdar://problem/36555975>

llvm-svn: 328378
2018-03-23 21:55:48 +00:00
Jason Molenda 379128d3f2 Change the darwin-debug target to build the standard
archs.

llvm-svn: 328374
2018-03-23 21:37:19 +00:00
Davide Italiano fce6277b93 [CMakeLists] Update file list after recent changes.
llvm-svn: 328373
2018-03-23 21:21:17 +00:00
Davide Italiano 88ad88667c [Commands] Remove dead code for unused `args` command.
It wasn't even registered.

(lldb) apropos args
No commands found pertaining to 'args'. Try 'help' to see
a complete list of debugger commands.

llvm-svn: 328370
2018-03-23 21:04:34 +00:00
Davide Italiano fd679c0e22 [Command] Remove dead code for the syntax command.
I'm going to add a new commend so I figured I could do
some spring cleaning.

llvm-svn: 328368
2018-03-23 20:58:05 +00:00
Adrian Prantl 6b2d5950d3 Log ObjC Runtime messages only in verbose mode
llvm-svn: 328365
2018-03-23 20:17:39 +00:00
Davide Italiano 7bbfd8a5b9 [CommandObjectFrame] Remove dead code.
llvm-svn: 328278
2018-03-23 00:14:41 +00:00
Aaron Smith 308e39ca8d [SymbolFilePDB] Use section contributions as another way to determine the compiland
Some PDB Symbols don't have line information. Use the section contributions to determine their compiland. 
This is useful to determine the parent compiland for PDBSymbolTypeData, i.e. variables.

llvm-svn: 328232
2018-03-22 19:26:33 +00:00