Commit Graph

17896 Commits

Author SHA1 Message Date
Davide Italiano e174746c5e [SBAPI/Target] Expose SetStatistics(bool enable)/GetStatistics().
<rdar://problem/44875808>

llvm-svn: 343368
2018-09-28 23:27:54 +00:00
Tatyana Krasnukha c06db02748 [Driver] Remove unused declarations and "include" directives
llvm-svn: 343357
2018-09-28 19:58:03 +00:00
Tatyana Krasnukha 5ce9dc614d Clean-up usage of OptionDefinition arrays
Differential Revision: https://reviews.llvm.org/D52604

llvm-svn: 343348
2018-09-28 17:58:16 +00:00
Luke Cheeseman cea130b0e0 Revert r343318 together with llvm commit r343317
llvm-svn: 343342
2018-09-28 17:02:56 +00:00
Luke Cheeseman c564f5d4db Reapply the changes reverted by r343236
llvm-svn: 343318
2018-09-28 13:38:16 +00:00
Aleksandr Urakov ec97b523be [PDB] Handle `char` as a builtin type
Summary:
`char`, `signed char` and `unsigned char` are three different types,
and they are mangled differently:

```
void __declspec(dllexport) /* ?foo@@YAXD@Z */ foo(char c) { }
void __declspec(dllexport) /* ?foo@@YAXE@Z */ foo(unsigned char c) { }
void __declspec(dllexport) /* ?foo@@YAXC@Z */ foo(signed char c) { }
```

This commit separates `char` from `signed char` and `unsigned char`.

Reviewers: asmith, zturner, labath

Reviewed By: asmith, zturner

Subscribers: teemperor, lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 343298
2018-09-28 07:59:49 +00:00
Aaron Smith 2fc9c3b05f [lldb] Remove an assertion in RichManglingContext::GetBufferRef() hit when debugging a native x86 Windows process
Summary: A RichManglingContext constructed with an invalid demangled name or with a demangled function name without any context will have an empty context. This triggers an assertion in RichManglingContext::GetBufferRef() when debugging a native Windows process on x86 when it shouldn't. Remove the assertion.

Reviewers: aleksandr.urakov, zturner, lldb-commits

Reviewed By: zturner

Subscribers: erik.pilkington

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

llvm-svn: 343292
2018-09-28 02:33:51 +00:00
Greg Clayton 141f208e12 Fixes for GDB remote packet disassembler:
- Add latency timings to GDB packet log summary if timestamps are on log
- Add the ability to plot the latencies for each packet type with --plot
- Don't crash the script when target xml register info is in wierd format

llvm-svn: 343243
2018-09-27 17:55:36 +00:00
Greg Clayton 95c23f6643 Add an interactive mode to BSD archive parser.
llvm-svn: 343242
2018-09-27 17:45:14 +00:00
Luke Cheeseman 66217a3bad Revert r343193 together with r343192
llvm-svn: 343236
2018-09-27 16:48:04 +00:00
Luke Cheeseman 1a7018f6f5 Update CallFrameString API to account for r343114
- CallFrameString now takes an Arch parameter to account for multiplexing
  overlapping CFI directives

llvm-svn: 343193
2018-09-27 10:42:14 +00:00
Raphael Isemann dababf70e2 Refactor ClangUserExpression::GetLanguageForExpr
Summary:
The `ClangUserExpression::GetLanguageForExpr` method is currently a big
source of sadness, as it's name implies that it's an accessor method, but it actually
is also initializing some variables that we need for parsing. This caused that we
currently call this getter just for it's side effects while ignoring it's return value,
which is confusing for the reader.

This patch renames it to `UpdateLanguageForExpr` and merges all calls to the
method into a single call in `ClangUserExpression::PrepareForParsing` (as calling
this method is anyway mandatory for parsing to succeed)

While looking at the code, I also found that we actually have two language
variables in this class hierarchy. The normal `Language` from the UserExpression
class and the `LanguageForExpr` that we implemented in this subclass. Both
don't seem to actually contain the same value, so we probably should look at this
next.

Reviewers: xbolva00

Reviewed By: xbolva00

Subscribers: lldb-commits

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

llvm-svn: 343191
2018-09-27 10:12:54 +00:00
Tatyana Krasnukha e40db05b27 Replace pointer to C-array of PropertyDefinition with llvm::ArrayRef
Differential Revision: https://reviews.llvm.org/D52572

llvm-svn: 343181
2018-09-27 07:11:58 +00:00
Jonas Devlieghere 041e68fe1e [target] Fix typo and give bool a default value
This addresses Stella's review feedback in D51859.

llvm-svn: 343180
2018-09-27 06:59:15 +00:00
Fangrui Song 23a6119619 llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
The convenience wrapper in STLExtras is available since rL342102.

llvm-svn: 343164
2018-09-27 03:35:05 +00:00
Tatyana Krasnukha f929e2b073 Fix ProcessKDP after r343130
llvm-svn: 343141
2018-09-26 20:31:39 +00:00
Tatyana Krasnukha d286886e96 Fix OSX build after r343130
llvm-svn: 343134
2018-09-26 19:41:57 +00:00
Tatyana Krasnukha 8fe53c490a Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer llvm::ArrayRef
Differential Revision: https://reviews.llvm.org/D49017

llvm-svn: 343130
2018-09-26 18:50:19 +00:00
Jonas Devlieghere 9123b7ebea [unittest] Fix NativeProcessProtocolTest.cpp (NFC)
Cast std::min's second argument to size_t to prevent conflicting types
for parameter deduction.

llvm-svn: 343087
2018-09-26 10:09:44 +00:00
Aleksandr Urakov bc4707cc17 [PDB] Restore the calling convention from PDB
Summary:
This patch implements restoring of the calling convention from PDB.
It is necessary for expressions evaluation, if we want to call a function
of the debuggee process with a calling convention other than ccall.

Reviewers: clayborg, zturner, labath, asmith

Reviewed By: clayborg

Subscribers: teemperor, lldb-commits, stella.stamenova

Tags: #lldb

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

llvm-svn: 343084
2018-09-26 09:03:34 +00:00
Pavel Labath 0ae4022aa0 Fix a memory read bug in lldb-server
NativeProcessProtocol::ReadMemoryWithoutTrap had a bug, where it failed
to properly remove inserted breakpoint opcodes if the memory read
partially overlapped the trap opcode. This could not happen on x86
because it has a one-byte breakpoint instruction, but it could happen on
arm, which has a 4-byte breakpoint instruction (in arm mode).

Since triggerring this condition would only be possible on an arm
machine (and even then it would be a bit tricky). I test this using a
NativeProcessProtocol unit test.

llvm-svn: 343076
2018-09-26 07:31:41 +00:00
Alexander Polyakov 24b6d3690c [lldb-mi] Fix bugs in target-select-so-path.test
Summary:
* This patch fixes hanging of the test in case of using python3, changes callback
  function that will be called if the timer ends, changes python interpreter to
  `%python` that is set up by llvm-lit.
* Also, the test didn't work properly since it didn't contain a call of
  filecheck_proc.communicate(), that means that filecheck didn't run and its
  return code was equal to 0 in all cases.

Reviewers: teemperor, labath, tatyana-krasnukha, aprantl

Reviewed By: teemperor, labath

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 343033
2018-09-25 21:49:33 +00:00
Jason Molenda a11b3fe26f Change the unwinder to not use a hard-coded limit on the
max number of stack frames to backtrace, make it a setting,
target.process.thread.max-backtrace-depth.
Add a test case for the setting.

<rdar://problem/28759559> 

llvm-svn: 343029
2018-09-25 21:01:54 +00:00
Vedant Kumar 75606b285c [lldbinline] Set directory attribute on test-specific classes
Set the "mydir" attribute of an inline test on the test-specific class,
instead of on the base InlineTest class.

This makes it possible to run dotest.py on a directory containing inline
tests. This wasn't really possible prior to this patch, because what
would happen is that one test would just run over and over again, even
though the test infrastructure would claim that different tests were
being run.

Example:

The test infrastructure claimed that all of these different tests were passing,
which couldn't be true --

$ ./bin/lldb-dotest /Users/vsk/src/tailcall/lldb/test/testcases/functionalities/tail_call_frames/ -G dwarf -t 2>&1 | grep PASS
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestDisambiguateTailCallSeq)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestArtificialFrameStepOutMessage)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestAmbiguousTailCallSeq1)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestDisambiguatePathsToCommonSink)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestDisambiguateCallSite)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestUnambiguousTailCalls)
PASS: LLDB (/Users/vsk/src/builds/tailcall-RA/bin/clang-8-x86_64) :: test_dwarf (lldbsuite.test.lldbtest.TestAmbiguousTailCallSeq2)
RESULT: PASSED (7 passes, 0 failures, 0 errors, 24 skipped, 0 expected failures, 0 unexpected successes)

... because it wasn't even looking at some of these tests:

$ ./bin/lldb-dotest /Users/vsk/src/tailcall/lldb/test/testcases/functionalities/tail_call_frames/ -G dwarf -t 2>&1 | grep "Change dir"
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/sbapi_support
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/thread_step_out_or_return
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2
Change dir to: /Users/vsk/src/tailcall/lldb/packages/Python/lldbsuite/test/functionalities/tail_call_frames/ambiguous_tail_call_seq2

E.g it was only building one of them:

$ ls lldb-test-build.noindex/functionalities/tail_call_frames/                        
ambiguous_tail_call_seq2

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

llvm-svn: 343023
2018-09-25 20:20:13 +00:00
Pavel Labath 7bfc416bfb XFAIL some tests in TestTargetCreateDeps on linux
On linux, we do not support automatic loading of dependent modules, so
the module list will always contain just one module (until the target is
launched).

llvm-svn: 343016
2018-09-25 19:52:04 +00:00
Tatyana Krasnukha 891d7504bb Replace boolean parameter with enum value according r342633
llvm-svn: 342998
2018-09-25 17:59:44 +00:00
Tatyana Krasnukha 4aa028b3aa [Swig] Merge typemaps with same bodies
Differential Revision: https://reviews.llvm.org/D52376

llvm-svn: 342959
2018-09-25 10:30:32 +00:00
Alexander Polyakov 42be321ca8 [lldb-mi] Fix hanging of target-select-so-path.test
Summary:
The target-select-so-path test might hang on
some platforms. The reason of that behavior
was in incorrect usage of Filecheck and lldb-mi
processes. Instead of redirecting lldb-mi's output
to Filecheck, we should run lldb-mi session,
finish the session, collect its output and then pass
it to Filecheck.
Also, this patch adds a timer to the test to prevent
it from hanging in the future.

Reviewers: tatyana-krasnukha, aprantl, teemperor

Reviewed By: tatyana-krasnukha, teemperor

Subscribers: apolyakov, aprantl, teemperor, ki.stfu, abidh, lldb-commits

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

llvm-svn: 342915
2018-09-24 19:10:48 +00:00
Pavel Labath 27104981ad Add NativeProcessProtocol unit tests
Summary:
NativeProcessProtocol is an abstract class, but it still contains a
significant amount of code. Some of that code is tested via tests of
specific derived classes, but these tests don't run everywhere, as they
are OS and arch-specific. They are also relatively high-level, which
means some functionalities (particularly the failure cases) are
hard/impossible to test.

In this approach, I replace the abstract methods with mocks, which
allows me to inject failures into the lowest levels of breakpoint
setting code and test the class behavior in this situation.

Reviewers: zturner, teemperor

Subscribers: mgorny, lldb-commits

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

llvm-svn: 342875
2018-09-24 12:11:04 +00:00
Raphael Isemann bfc5ef6c5b Change type of m_user_expression_start_pos to size_t
AbsPosToLineColumnPos is the only reader of m_user_expression_start_pos
and actually treats it like a size_t. Also the value we store in
m_user_expression_start_pos is originally a size_t, so it makes sense
to change the type of this variable to size_t.

llvm-svn: 342804
2018-09-22 13:33:08 +00:00
Tatyana Krasnukha 7aa9e7bc57 Move architecture-specific address adjustment to architecture plugins
Differential Revision: https://reviews.llvm.org/D48623

llvm-svn: 342762
2018-09-21 18:56:44 +00:00
Tatyana Krasnukha c4bc88b541 build: add libedit to include paths
Differential Revision: https://reviews.llvm.org/D51999

llvm-svn: 342757
2018-09-21 18:34:41 +00:00
Tatyana Krasnukha af2c73e13d Add dependency on llc required by find-variable-dwo test
llvm-svn: 342733
2018-09-21 13:40:22 +00:00
Tatyana Krasnukha ec9a6a2701 Skip test if gcc version is less than 7.1 since it doesn't support -gcolumn-info option
llvm-svn: 342732
2018-09-21 13:20:26 +00:00
Vedant Kumar f853c6e074 [lldbtest] Fix self.filecheck check file lookup
The 'test_filename' property in TestBase changes over time, so
attempting to find a check file relative to the directory containing
'test_filename' is flaky.

Use the absolute path of the check file as that's always correct (and
simpler). This relies on the test driver changing into the test
directory, which it seems we can safely assume.

As a drive-by, make self.filecheck respect the trace (-t) option.

llvm-svn: 342699
2018-09-20 23:56:39 +00:00
Tatyana Krasnukha d54ee88a75 Replace boolean parameter with enum value according r342633
llvm-svn: 342671
2018-09-20 17:57:24 +00:00
Shafik Yaghmour e23d0b636c Refactor FindVariable() core functionality into StackFrame out of SBFrame
rdar://problem/14365983

Patch by Shafik Yaghmour

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

llvm-svn: 342663
2018-09-20 17:06:34 +00:00
Jonas Devlieghere 26ba928214 [target] Change target create's behavior wrt loading dependent files.
When creating a target, lldb loads all dependent files (i.e. libs in
LC_LOAD_DYLIB for Mach-O). This can be confusing, especially when two
versions of the same library end up in the shared cache. It's possible
to change this behavior, by specifying  target create -d <target> these
dependents are not loaded.

This patch changes the default behavior to only load dependent files
only when the target is an executable. When creating a target for a
library, it is now no longer necessary to pass -d. The user can still
override this behavior by specifying the -d option to change this
behavior.

rdar://problem/43721382

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

llvm-svn: 342634
2018-09-20 09:09:13 +00:00
Jonas Devlieghere f9a07e9f8d [NFC] Turn "load dependent files" boolean into an enum
This is an NFC commit to refactor the "load dependent files" parameter
from a boolean to an enum value. We want to be able to specify a
default, in which case we decide whether or not to load the dependent
files based on whether the target is an executable or not (i.e. a
dylib).

This is a dependency for D51934.

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

llvm-svn: 342633
2018-09-20 09:09:05 +00:00
Shafik Yaghmour 8306f76e56 [DataFormatters] Add formatter for C++17 std::variant
rdar://problem/43691454

Patch by Shafik Yaghmour.

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

llvm-svn: 342563
2018-09-19 18:07:05 +00:00
Vedant Kumar 9b13bea61a Allow use of self.filecheck in LLDB tests (c.f self.expect)
Add a "filecheck" method to the LLDB test base. This allows test authors
to pattern match command output using FileCheck, making it possible to
write stricter tests than what `self.expect` allows.

For context (motivation, examples of stricter checking, etc), see the
lldb-dev thread: "Using FileCheck in lldb inline tests".

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

llvm-svn: 342508
2018-09-18 19:31:47 +00:00
Shafik Yaghmour 2ee93d28fd Revert "[DataFormatters] Add formatter for C++17 std::variant"
This reverts commit r342421.

Because it breaks build bot http://green.lab.llvm.org/green/job/lldb-cmake-clang-5.0.2//418/console

llvm-svn: 342424
2018-09-17 23:15:35 +00:00
Shafik Yaghmour 854a35092c [DataFormatters] Add formatter for C++17 std::variant
rdar://problem/43691454

Patch by Shafik Yaghmour.

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

llvm-svn: 342421
2018-09-17 22:10:44 +00:00
Jim Ingham 25256c7f09 Add docs for scripted breakpoint resolvers
Differential Revision: https://reviews.llvm.org/D52065

llvm-svn: 342419
2018-09-17 21:55:46 +00:00
Davide Italiano d405d2792d Revert "[IRInterpreter] Minor cleanups, add comments. NFCI."
This breaks buildbots.

llvm-svn: 342404
2018-09-17 18:14:38 +00:00
Raphael Isemann 9dd34c8385 Add descriptions to completed expressions
Summary:
Completing inside the expression command now uses the new description API
to also provide additional information to the user. For now this information
are the types of variables/fields and the signatures of completed function calls.

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 342385
2018-09-17 12:06:07 +00:00
Alexander Polyakov 1641556593 [lldb-mi] Correct regex in the symbol-list-lines test
Summary:
The test failed in case of compiling a test suite with
gcc (checked versions are 5.2.0 and 7.3.0) because it
adds one more line entry comparing to clang. It doesn't
break the test's logic, so I just added a regex that matches
this case.

Reviewers: tatyana-krasnukha, aprantl, clayborg

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 342329
2018-09-15 17:05:20 +00:00
Davide Italiano a64157f19f [IRInterpreter] Minor cleanups, add comments. NFCI.
llvm-svn: 342280
2018-09-14 20:48:34 +00:00
Alex Langford fde4cda9f7 Fix lldb-vscode README.md
Summary: The readme was missing "-" characters to enable links

Patch by Nathan Lanza <nathan@lanza.io>

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

llvm-svn: 342266
2018-09-14 19:41:20 +00:00
Davide Italiano 5f6789ef6e [IRInterpreter] Fall back to JIT with 128-bit values.
They're not that common, and falling back is definitely
better than throwing an error instead of the result. If we
feel motivated, we might end up implementing support for these,
but it's unclear whether it's worth the effort/complexity.

Fixes PR38925.

<rdar://problem/44436068>

llvm-svn: 342262
2018-09-14 18:55:31 +00:00