Commit Graph

19216 Commits

Author SHA1 Message Date
Pavel Labath f96b6d9270 Kill modify-python-lldb.py
Summary:
After the last round of cleanups, this script was almost a no-op. The
only piece of functionality that remained was the one which tried to
make the swig-generated function signatures more pythonic.

The "tried" part is important here, as it wasn't doing a really good job
and the end result was not valid python nor c (e.g.,
SetExecutable(SBAttachInfo self, str const * path)).

Doing these transformations another way is not possible, as these
signatures are generated by swig, and not present in source. However,
given that this is the only reason why we need a swig post-process step,
and that the current implementation is pretty sub-optimal, this patch
simply abandons the signature fixup idea, and chooses to simplify our
build process instead.

Reviewers: amccarth, jingham, clayborg

Subscribers: mgorny, lldb-commits

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

llvm-svn: 359092
2019-04-24 13:23:19 +00:00
Raphael Isemann d59c8d3037 Minor code style fix in ClangUserExpression.cpp [NFC]
llvm-svn: 359089
2019-04-24 12:55:00 +00:00
Raphael Isemann 54d99bf0db Shorten comment line to be below 80 characters [NFC]
llvm-svn: 359087
2019-04-24 12:21:03 +00:00
Pavel Labath 2f66b25648 yamlify lit/Minidump tests
Replace checked-in binaries by their yaml equivalents.

llvm-svn: 359074
2019-04-24 08:09:36 +00:00
Pavel Labath 88813103cd PostfixExpression: move parser out of NativePDB internals
Summary:
The postfix expressions in PDB and breakpad symbol files are similar
enough that they can be parsed by the same parser. This patch
generalizes the parser in the NativePDB plugin and moves it into the
PostfixExpression file created in the previous commit (r358976).

The generalization consists of treating any unrecognised token as a
"symbol" node (previously these would only be created for tokens
starting with "$", and other token would abort the parse). This is
needed because breakpad symbols can also contain ".cfa" tokens, which
refer to the frame's CFA.

The cosmetic changes include:
- using a factory function instead of a class for creating nodes (this
  is more generic as it allows the same BumpPtrAllocator to be used for
  other things too)
- using dedicated function for parsing operator tokens instead of a
  DenseMap (more efficient as we don't need to create the DenseMap every
  time).

Reviewers: amccarth, clayborg, JDevlieghere, aleksandr.urakov

Subscribers: jasonmolenda, lldb-commits, markmentovai, mgorny

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

llvm-svn: 359073
2019-04-24 07:27:05 +00:00
Jonas Devlieghere 196123255e [Docs] Add more redirects
Found two more broken links.

llvm-svn: 359063
2019-04-24 01:58:17 +00:00
Jonas Devlieghere 6d0dc28a32 [Docs] Update the CI page
- Add the Sphinx bot
 - Add a little more info

llvm-svn: 359062
2019-04-24 01:48:43 +00:00
Jonas Devlieghere 6f7759672d [Docs] Move external links up
With a duplicate link removed and the API reference moved up, the page
didn't make much sense anymore.

llvm-svn: 359061
2019-04-24 01:48:40 +00:00
Jonas Devlieghere 36371d61ec [Docs] Fix link to C++ docs
... and add a redirect for the old URL.

llvm-svn: 359052
2019-04-24 00:10:23 +00:00
Frederic Riss acbf0058e9 Lock accesses to OptionValueFileSpecList objects
Before a Debugger gets a Target, target settings are routed to a global set
of settings. Even without this, some part of the LLDB which exist independently
of the Debugger object (the Module cache, the Symbol vendors, ...) access
directly the global default store for those settings.

Of course, if you modify one of those global settings while they are being read,
bad things happen. We see this quite a bit with FileSpecList settings. In
particular, we see many cases where one debug session changes
target.exec-search-paths while another session starts up and it crashes when
one of those accesses invalid FileSpecs.

This patch addresses the specific FileSpecList issue by adding locking to
OptionValueFileSpecList and never returning by reference.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 359028
2019-04-23 20:17:04 +00:00
Jonas Devlieghere db41fe166a [Reproducers] Limit logging to calls that cross the API boundary.
We recently moved API logging into the instrumentation macros. This made
that logging is now consistent and abstracted behind a macro for every
API functions, independent of the reproducers. It also means we have a
lot more output. While this is a good thing, it also meant a lot more
noise in the log, from things that aren't always equally interesting,
such as the copy constructor for example.

To improve usability, we should increase the signal-to-noise ratio. I
propose to achieve this by only logging API functions that cross the API
boundary. This is a divergence of what we had before, where a select
number of functions were logged, irregardless of the API boundary, a
concept that was introduced for the reproducers. However, I believe this
is in line with the purpose of the API log.

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

llvm-svn: 359016
2019-04-23 17:44:40 +00:00
Davide Italiano bdb864a576 Revert "[EditLineTest] Not always TERM is available, e.g. on some bots."
This was a speculative fix trying to placate some bots, but it's
ultimately just a bot configuration problem and not a code problem.

llvm-svn: 359011
2019-04-23 16:51:20 +00:00
Jonas Devlieghere 3ba5f66177 [Docs] Add missing leading slash
llvm-svn: 359005
2019-04-23 16:00:43 +00:00
Jonas Devlieghere 056fde7527 [Docs] Add 301 redirects for old URLs
llvm-svn: 359004
2019-04-23 15:57:47 +00:00
Pavel Labath 4eda12aea5 Move postfix expression code out of the NativePDB plugin
Summary:
The NativePDB plugin contains code to convert "programs" describing the
layout of function frames into dwarf (for easier interaction with the
rest of lldb). This functionality is useful for the Breakpad plugin too,
as it contains the same kind of expressions (because breakpad info is
generated from pdb files).

In this patch, I move the core classes of this code into a common place,
where it can be used from both files. Previously, these were the details
of the implementation, but here I am exposing them (instead of just a
single "string->string" conversion function), as breakpad will need to
use these in a slightly different way. The reason for that is that
breakpad files generated from dwarf expressions use a slightly different
syntax, although most of the core code can be reused with a bit of
thought.

This is also the reason why I am not moving the parsing or dwarf
generation bits, as they will need to be generalized a bit before
they're usable for both scenarios.

This patch should be NFC, modulo renaming the moved entities to more
neutral names.

The reason I am moving this to the "Symbol" library, is because both
customers will be "Symbol"Files, and also the unwinding code lives in
the Symbol library. From a purely dependency standpoint this code will
probably be standalone, and so it could be moved all the way to Utility,
but that seems too low for this kind of functionality.

Reviewers: jasonmolenda, amccarth, clayborg, JDevlieghere, aleksandr.urakov

Subscribers: aprantl, markmentovai, lldb-commits

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

llvm-svn: 358976
2019-04-23 11:50:07 +00:00
Pavel Labath 330bc8af13 modify-python-lldb: Remove \a-removing code
instead, remove \a directly from the interface files.

llvm-svn: 358967
2019-04-23 10:04:22 +00:00
Pavel Labath 2359429168 FuncUnwinders: remove "current_offset" from function arguments
Summary:
This argument was added back in 2010 (r118882) to support the ability to unwind
from functions whose eh_frame entry does not cover the entire range of
the function.

However, due to the caching happening in FuncUnwinders, this solution is
very fragile. FuncUnwinders will cache the plan it got from eh_frame
regardless of the value of the current_offset, so our ability to unwind
from a given function depended what was the value of "current_offset" the
first time that this function was called.

Furthermore, since the "image show-unwind" command did not know what's
the right offset to pass, this created an unfortunate situation where
"image show-unwind" would show no valid plans for a function, even
though they were available and being used.

In this patch I implement the feature slightly differently. Instead of
giving just a base address to the eh_frame unwinder, I give it the
entire range we are interested in. Then, I change the unwinder to return
the first plan that covers (even partially) that range. This way even a
partial plan will be returned, regardless of the address in the function
where we are stopped at.

This solution is still not 100% correct, as it will not handle a
function which is covered by two independent fde entries. However, I
don't expect anybody will write this kind of functions, and this wasn't
handled by the previous implementation either. If this is ever needed in
the future. The eh_frame unwinder can be extended to return "composite"
unwind plans created by merging sevelar fde entries.

I also create a test which triggers this scenario. As doing this is
virtually impossible without hand-written assembly, the test only works
on x86 linux.

Reviewers: jasonmolenda, clayborg

Subscribers: lldb-commits

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

llvm-svn: 358964
2019-04-23 09:57:14 +00:00
Pavel Labath 7a78420353 UnwindPlan: pretty-print dwarf expressions
Summary:
Previously we were printing the dwarf expressions in unwind rules simply
as "dwarf-expr". This patch uses the existing dwarf-printing
capabilities in lldb to enhance this dump output, and print the full
decoded dwarf expression.

Reviewers: jasonmolenda, clayborg

Subscribers: aprantl, lldb-commits

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

llvm-svn: 358959
2019-04-23 09:16:51 +00:00
Pavel Labath ed4f48d290 yamlify TestMiniDumpUUID binaries
Summary:
Instead of checking in raw minidump binaries, check in their yaml form,
and call yaml2obj in the test.

Reviewers: clayborg

Subscribers: javed.absar, lldb-commits

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

llvm-svn: 358957
2019-04-23 08:49:39 +00:00
Jason Molenda 759805fd8a One small tweak to LocateExecutableScriptingResources - I
was still stat'ing the possibly-dSYM FileSpec before I
(more cheaply) checked the filepath for telltale dSYM
components.
<rdar://problem/50086007> 

llvm-svn: 358939
2019-04-23 01:13:27 +00:00
Jason Molenda 9270a201b9 Add a small check to PlatformDarwin::LoadScriptingResourceForModule
which reads the python files in a dSYM bundle, to check that the
SymbolFile is actually a dSYM bundle filepath; delay any fetching
of the ScriptInterpreter until after we've done that check.

When debugging a binary without a dSYM on darwin systems, the
SymbolFile we fetch is actually the ObjectFile -- so we would do
an unnecessary trip into Python land and stat around the filesystem
looking for a python file to read in.  There's no reason to do any
of this unless the SymbolFile's file path includes the .dSYM bundle
telltale path components.

<rdar://problem/50065315> 

llvm-svn: 358938
2019-04-23 01:02:51 +00:00
Jason Molenda a38b8c8abc Fix a bug in my change to ModulesDidLoad in r357955.
In the process of hoisting the LoadScriptingResourceForModule
out of Target::ModuleAdded and into Target::ModulesDidLoad,
I had ModulesDidLoad fetching the Target's entire image list
and look for scripting resources in those -- instead of only
looking for scripting resources in the modules that had
been added to the target's image list.

<rdar://problem/50065315> 

llvm-svn: 358929
2019-04-22 22:42:29 +00:00
Jonas Devlieghere d44a7be17b [Docs] Move API docs to the front page
This moves the links to the C++ and Python API docs up to the main page.
As of now the links are still broken [1], but at least this will prevent
the additional frustration of searching for the links only to find out
they're broken.

[1] http://lists.llvm.org/pipermail/lldb-dev/2019-April/014992.html

llvm-svn: 358928
2019-04-22 22:41:55 +00:00
Adrian Prantl a6314ea6c2 Rename C++ TestGlobalVariables.py to have a distinct name from C version.
llvm-svn: 358924
2019-04-22 22:16:33 +00:00
Davide Italiano 2a27af8237 [EditLineTest] Not always TERM is available, e.g. on some bots.
llvm-svn: 358918
2019-04-22 20:27:10 +00:00
Jonas Devlieghere 32176baee7 [Reproducers] Fix lifetime issue
Deallocating the data recorder in during the ::Keep() operation causes
problems down the line when exiting the debugger. The command
interpreter still holds a pointer to the now deallocated object and has
no way to know it no longer exists. This is exactly what the m_record
flag was meant for, although it wasn't hooked up properly either.

llvm-svn: 358916
2019-04-22 20:05:02 +00:00
Aleksandr Urakov ee12a75e38 [NativePDB] Add anonymous namespaces support
Summary:
This patch adds anonymous namespaces support to the native PDB plugin.

I had to reference from the main function variables of the types that are inside
of the anonymous namespace to include them in debug info. Without the references
they are not included. I think it's because they are static, then are visible
only in the current translation unit, so they are not needed without any
references to them.

There is also the problem case with variables of types that are nested in
template structs. For now I've left FIXME in the test because this case is not
related to the change.

Reviewers: zturner, asmith, labath, stella.stamenova, amccarth

Reviewed By: amccarth

Subscribers: zloyrobot, aprantl, teemperor, lldb-commits, leonid.mashinskiy

Tags: #lldb

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

llvm-svn: 358873
2019-04-22 07:14:40 +00:00
Pavel Labath f6e8063145 Minidump: yamlify module-related unit tests
The tests reading the untouched module list are now not using any lldb
code (as module list loading lives in llvm now), so they can be removed.
The "filtering" of the module list remains (and probably will remain) an
lldb concept, so I keep those tests, but replace the checked-in binaries
with their yaml equivalents.

The binaries which are no longer referenced by any tests have been
removed.

llvm-svn: 358850
2019-04-21 13:12:40 +00:00
Pavel Labath d50ec8ef5c @skipIfLinux flaky lldb-mi tests
llvm-svn: 358848
2019-04-21 13:02:49 +00:00
Pavel Labath e8687e6ee1 Make TestVSCode_step pass reliably
Summary:
The test was failing occasionally (1% of runs or so), because of
unpredictable timings between the two threads spawned by the test. If
the second thread hit the breakpoint right as we were stepping out of
the function on the first thread, we would still be stuck at the inner
frame when the process stopped.

This would cause errors like:
    File "/home/worker/lldb-x86_64-debian/lldb-x86_64-debian/llvm/tools/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py", line 67, in test_step
      self.assertEqual(x1, x3, 'verify step out variable')
  AssertionError: 2 != 1 : verify step out variable

AFAICT, lldb-vscode is doing the right thing here, and the problem is
that the test is not taking this sequence of events into account. Since
the test is about testing stepping, it does not seem necessary to have
threads in the inferior at all, so I just rewrite the test to execute
the code we're supposed to step through directly on the main thread.

Reviewers: clayborg, jgorbe

Subscribers: jfb, lldb-commits

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

llvm-svn: 358847
2019-04-21 13:02:41 +00:00
Pavel Labath 27e9d982eb modify-python-lldb.py: Remove docstring formatting code
The strings have been already cleaned up in r358683, so this code is not
doing anything anymore.

While comparing the outputs before and after removing the formatting
code, I've found a couple of docstrings that managed to escape my perl
script in r358683, so I format them manually with this patch.

llvm-svn: 358846
2019-04-21 12:48:53 +00:00
Jonas Devlieghere d600e6fa85 [Tests] Split float test into float and doubles
As I was waiting for the test suite to complete at 99% I noticed this
test taking quite a bit of time. Since it's easy to split I just went
ahead and did so.

llvm-svn: 358792
2019-04-19 22:37:55 +00:00
Jonas Devlieghere f7f03622ec [Docs] Add more info about building the docs
Including the C++ and Python reference.

llvm-svn: 358777
2019-04-19 19:03:58 +00:00
Jim Ingham d42b381445 This test doesn't need to be run for all debug formats.
llvm-svn: 358776
2019-04-19 18:46:56 +00:00
Jonas Devlieghere 52cf94090f [Docs] Make Doxygen functional
This fixes the doxygen configuration to be functional again. I removed
the customer header and footer, as well as the no-longer-existent style
sheet. I also widened the scope of the documentation, from just the
public API to include the private interfaces as well.

llvm-svn: 358773
2019-04-19 18:02:35 +00:00
Davide Italiano 185de8eeaa [Python] Simplify the code. NFCI.
llvm-svn: 358721
2019-04-18 23:24:54 +00:00
Davide Italiano 085626a873 [crashlog] Strip trailing `\n` from check_output return.
Generally having spurious `\n` doesn't matter, but here the
returning string is a command which is executed, so  we want
to strip it. Pointed out by Jason.

llvm-svn: 358717
2019-04-18 21:32:36 +00:00
Sam McCall 3a75330f57 [CodeComplete] Remove obsolete isOutputBinary().
Summary:
It's never set to true. Its only effect would be to set stdout to binary mode.
Hopefully we have better ways of doing this by now :-)

Reviewers: hokein

Subscribers: jkorous, arphaman, kadircet, llvm-commits

Tags: #llvm

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

llvm-svn: 358696
2019-04-18 17:35:55 +00:00
Jonas Devlieghere f2293a95de [Docs] Add LLDB bots
llvm-svn: 358693
2019-04-18 17:31:20 +00:00
Stefan Granitz 31d0ce005c [CMake] Emit LLDB.framework.dSYM to avoid potential name collision with driver's lldb.dSYM
Summary:
Emit framework's dSYM bundle as LLDB.framework.dSYM instead of LLDB.dSYM, because the latter could conflict with the driver's lldb.dSYM when emitted in the same directory on case-insensitive file systems.
Requires https://reviews.llvm.org/D60862

Reviewers: friss, beanz, bogner

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 358686
2019-04-18 16:37:22 +00:00
Pavel Labath eba97426d4 Clean up docstrings in swig interface files
Summary:
This patch removes the "//----" frames and "///" leading lines from
docstring comments.  We already have code doing transformations like this in
modify-python-lldb.py, but that's a script I'd like to remove. Instead
of running these transformations everytime we run swig, we can just
perform equivalent on its input once.

This patch can be reproduced (e.g. for downstream merges) with the
following "sweet" perl command:

  perl -i -p -e 'BEGIN{ $/ = undef;} s:(" *\n) *//-----*\n:\1:gs; s:^(     *)/// ?:\1:gsm; s:^ *//------*\n( *\n)?( *"):\2:gsm; s: *$::gsm; s:\n *"\):"):gsm' scripts/interface/*.i

This command produces nearly equivalent python files to those produced
by the relevant code in modify-python-lldb.py. The only difference I
noticed is that here I am slightly more agressive in removing trailing
newlines from docstring comments (the python script seems to leave
newlines in class-level docstrings).

Reviewers: amccarth, clayborg, jingham, aprantl

Subscribers: lldb-commits

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

llvm-svn: 358683
2019-04-18 16:23:33 +00:00
Michal Gorny 36d6bf8841 [lldb] [test] Mark three more tests flakey/xfail on NetBSD
llvm-svn: 358660
2019-04-18 12:31:48 +00:00
Jonas Devlieghere ea6037d84e [Shell] Simplify Extracting Python Version
Instead of parsing the Python version with a fairly convoluted regex,
just print the major and minor version and call it a day.

llvm-svn: 358635
2019-04-18 01:37:19 +00:00
Kuba Mracek e5e9a6be6a [lldb] Don't filter variable list when doing a lookup by mangled name in SymbolFileDWARF::FindGlobalVariables
Differential Revision: https://reviews.llvm.org/D60737

llvm-svn: 358629
2019-04-18 00:15:44 +00:00
Davide Italiano 5f4c6dcc11 [Cmake] Add missing dependency for running tests.
This is needed now that we marked lldb-test as EXCLUDE_ALL, to
make sure `ninja lldb-test-deps` doesn't fail.

llvm-svn: 358625
2019-04-17 23:43:01 +00:00
Davide Italiano e3b5eba1ba [crashlog] Use the right path for dsymforUUID and remove an unnecessary import.
<rdar://problem/49925960>

llvm-svn: 358615
2019-04-17 21:51:55 +00:00
Frederic Riss 8ecb7bbe2b [CMake] Remove Apple-specific version logic.
We were using the LLDB-Info.plist as the canonical holder of the
version number, but there is really no good reason to do this. If
anything the plist should be generated using the information provided
to CMake.

For now just remove the logic extracting the version from the plist
and rely on LLDB_VERSION_STRING.

llvm-svn: 358604
2019-04-17 18:23:22 +00:00
Aaron Smith b8ec7eee81 Clear the output string passed to GetHostName()
LLVM's wchar to UTF8 conversion routine expects an empty string to store the output.
GetHostName() on Windows is sometimes called with a non-empty string which triggers
an assert. The simple fix is to clear the output string before the conversion.

llvm-svn: 358550
2019-04-17 03:13:06 +00:00
Davide Italiano b2930b8631 [tools] Only build lldb-test when needed.
llvm-svn: 358533
2019-04-16 21:56:07 +00:00
Alex Langford 7603bd52e3 [Process] Fix linux arm64 single step compilation failure
This was updated in r356703 to use llvm::sys::RetryAfterSignal, which
comes from llvm/Support/Errno.h. The header wasn't added, so it fails if
you compile for arm64/aarch64.

llvm-svn: 358530
2019-04-16 21:21:28 +00:00