Commit Graph

12417 Commits

Author SHA1 Message Date
Adrian Prantl 3bc71193bd Comment the fact that DWARFDebugInfoEntry isn't copyable. 2019-11-15 09:14:48 -08:00
Davide Italiano 95c770fbfb [Utility] Remove a dead header [PPC64LE_ehframe_Registers.h] 2019-11-14 15:29:47 -08:00
Jonas Devlieghere 3b142bc9ff [LLDB] Fix more -Wdocumentation issues (NFC) 2019-11-14 14:31:44 -08:00
Jordan Rupprecht f2e65447b3 [lldb][Editline] Support ctrl+left/right arrow word navigation.
Summary:
This adds several 5C/5D escape codes that allow moving forward/backward words similar to bash command line navigation.

On my terminal, `ctrl+v ctrl+<left arrow>` prints `^[[1;5D`. However, it seems inputrc also maps other escape variants of this to forward/backward word, so I've included those too. Similar for 5C = ctrl+right arrow.

Reviewers: JDevlieghere, labath

Reviewed By: JDevlieghere, labath

Subscribers: merge_guards_bot, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70137
2019-11-14 11:41:11 -08:00
Adrian Prantl dcb5bd9109 Fix incorrect comment. 2019-11-14 09:55:24 -08:00
Adrian Prantl 268e11f95d Convert condition to early exit (NFC) 2019-11-14 09:38:49 -08:00
Adrian Prantl 0352007fdb Convert UpdateExternalModuleListIfNeeded to use early exits. 2019-11-14 09:35:06 -08:00
Adrian Prantl 83f5287567 Rename DWO -> Clang module to avoid confusion. (NFC) 2019-11-14 09:13:49 -08:00
Adrian Prantl 0e45e60c6f Use ForEachExternalModule in ParseTypeFromClangModule (NFC)
I wanted to further simplify ParseTypeFromClangModule by replacing the
hand-rolled loop with ForEachExternalModule, and then realized that
ForEachExternalModule also had the problem of visiting the same leaf
node an exponential number of times in the worst-case. This adds a set
of searched_symbol_files set to the function as well as the ability to
early-exit from it.

Differential Revision: https://reviews.llvm.org/D70215
2019-11-14 08:58:31 -08:00
Pavel Labath 6e3ecd1884 [lldb] Fix dwo variant of TestLibCxxFunction
The test was failing due to a bug in SymbolFileDWARF::FindFunctions --
the function was searching the main dwarf unit for DW_TAG_subprograms,
but the main unit is empty in case of split dwarf.  The fix is simple --
search the non-skeleton unit instead.

This bug went unnoticed because this function is expensive, and so one
generally avoids calling it.
2019-11-14 16:29:36 +01:00
Raphael Isemann 8715ffdf1a [lldb] Fix that trailing backslashes in source lines break the Clang highlighter
Summary:
Clang's raw Lexer doesn't produce any tokens for trailing backslashes in a line. This doesn't work with
LLDB's Clang highlighter which builds the source code to display from the list of tokens the Lexer returns.
This causes that lines with trailing backslashes are lacking the backslash and the following newline when
rendering source code in LLDB.

This patch removes the trailing newline from the current line we are highlighting. This way Clang doesn't
drop the backslash token and we just restore the newline after tokenising.

Fixes rdar://57091487

Reviewers: JDevlieghere, labath

Reviewed By: JDevlieghere, labath

Subscribers: labath, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70177
2019-11-14 11:11:20 +01:00
Jonas Devlieghere 8ac053eea2 [LLDB] Cleanup the DataEncoder utility. (NFC)
This commit removes unused methods from the DataEncoder class and cleans
up the API by making all the internal methods private.
2019-11-13 15:44:51 -08:00
Jonas Devlieghere 9634064cfa [LLDB] Fix another set of -Wdocumentation warnings
At this point I'm just fixing issues as I see them pop up locally in
incremental builds.
2019-11-13 15:13:06 -08:00
Jonas Devlieghere 95807cb039 [LLDB] Remove dead code from StreamFile 2019-11-13 15:08:51 -08:00
Davide Italiano 294ef766e8 [RegisterContext] Remove now unneded vestiges. 2019-11-13 14:53:13 -08:00
Jonas Devlieghere 8df482e51c [LLDB] Fix a bunch of -Wdocumentation warnings in ExpressionParser 2019-11-13 14:40:55 -08:00
Adrian Prantl 9072f0103b Remove redundant check. (NFC) 2019-11-13 14:19:01 -08:00
Adrian Prantl 7f9d36e2db Use cheaper, equivalent predicate. (NFC) 2019-11-13 14:16:40 -08:00
Adrian Prantl 3d30c142e1 Rename clang-module-related *DWO* functions to *ClangModule* (NFC)
This avoids confusing them with fission-related functionality.

I also moved two accessor functions from DWARFDIE into static
functions in DWARFASTParserClang were their only use is located.
2019-11-13 14:07:20 -08:00
Adrian Prantl 78586775f7 Rename ParseTypeFromDWO to ParseTypeFromClangModule (NFC)
Because that is what this function really does. The old name is
misleading.
2019-11-13 13:37:43 -08:00
Jonas Devlieghere ad882774fe [LLDB] Fix a bunch of -Wdocumentation warnings 2019-11-13 12:28:10 -08:00
Jonas Devlieghere 7ba28644a1 [Reproducer] Discard reproducer directory if not generated.
If lldb was run in capture mode, but no reproducer was generated, make
sure we clean up the reproducer directory.
2019-11-12 20:16:33 -08:00
Muhammad Omair Javaid 9b95835698 [LLDB] Add core definition for armv8l and armv7l
This patch adds core definitions in lldb ArchSpecs for armv8l and armv7l cores.

This was needed because on Linux running on 32-bit Arm v8 we are returned
armv8l in case we are running 32-bit sysroot on 64bit kernel. In case of 32-bit
kernel and 32-bit sysroot running on arm v8 hardware we are returned armv7l.
This is quite common when we run 32 bit arm using docker container.

Signed-off-by: Muhammad Omair Javaid <omair.javaid@linaro.org>

Differential Revision: https://reviews.llvm.org/D69904
2019-11-13 05:40:09 +05:00
Jonas Devlieghere 056c319769 [LLDB] Only set FRAMEWORK when we're actually building a framework. 2019-11-12 15:42:07 -08:00
Jonas Devlieghere a247bd1f27 [LLDB] Fix/silence CMake developer warning for LLDB framework.
This fixes the following warning for developers:

  Target 'liblldb' was changed to a FRAMEWORK sometime after install().  This
  may result in the wrong install DESTINATION.  Set the FRAMEWORK property
  earlier.

The solution is to pass the FRAMEWORK flag to add_lldb_library and set
the target property before install(). For now liblldb is the only
customer.
2019-11-12 14:17:19 -08:00
shafik 91e94a7015 [LLDB][Formatters] Re-enable std::function formatter with fixes to improve non-cached lookup performance
Performance issues lead to the libc++ std::function formatter to be disabled. We addressed some of those performance issues by adding caching see D67111
This PR fixes the first lookup performance by not using FindSymbolsMatchingRegExAndType(...) and instead finding the compilation unit the std::function wrapped callable should be in and then searching for the callable directly in the CU.

Differential Revision: https://reviews.llvm.org/D69913
2019-11-12 11:30:18 -08:00
Davide Italiano 96915495f9 [ObjectFileMachO] Fix the build for __arm64__.
Catch up with an API change.
2019-11-12 11:10:36 -08:00
Adrian Prantl 3b73dcdc96 Performance: Add a set of visited SymbolFiles to the other FindFiles variant.
This is basically the same bug as in r260434.

SymbolFileDWARF::FindTypes has exponential worst-case when digging
through dependency DAG of .pcm files because each object file and .pcm
file may depend on an already-visited .pcm file, which may again have
dependencies. Fixed here by carrying a set of already visited
SymbolFiles around.

rdar://problem/56993424

Differential Revision: https://reviews.llvm.org/D70106
2019-11-12 09:38:37 -08:00
Muhammad Omair Javaid a6c40f56ae Revert "Fix lookup of symbols at the same address with no size vs. size"
This reverts commit 3f594ed168.

This change has cause LLDB expression evaluation to fail on Arm Linux.

Differential Revision: https://reviews.llvm.org/D63540
2019-11-12 19:02:17 +05:00
Pavel Labath 6aa60b0514 [lldb] Fix more -Wdeprecated-copy warnings
This warning triggers when a class defines a copy constructor but not a
copy-assignment operator (which then gets auto-generated by the
compiler). Fix the warning by deleting the other operator too, as the
default implementation works just fine.
2019-11-12 14:39:47 +01:00
Pavel Labath 1dfb1a85e7 [lldb] Fix some warnings in the python plugin 2019-11-12 14:39:34 +01:00
Michał Górny 77cc246412 [lldb] [Process/NetBSD] Use PT_STOP to stop the process [NFCI]
Differential Revision: https://reviews.llvm.org/D70060
2019-11-12 12:35:02 +01:00
Raphael Isemann ec4c96d685 [lldb][NFC] Simplify a return in ThreadPlanStepInRange::DefaultShouldStopHereCallback
We know should_stop_here is false here, so we might as well return false directly.
2019-11-12 10:58:54 +01:00
Raphael Isemann 874b6495b5 [lldb] Add missing include to ObjCLanguage.cpp to fix build 2019-11-12 10:21:49 +01:00
Raphael Isemann 52f3a2faf9 [lldb][NFC] Move LLVM RTTI implementation from enum to static ID variable
Summary:
swift-lldb currently has to patch the ExpressionKind enum to add support for Swift expressions. If we implement LLVM's RTTI
with a static ID variable instead of a centralised enum we can drop that patch.

Reviewers: labath, davide

Reviewed By: labath

Subscribers: JDevlieghere, lldb-commits

Tags: #upstreaming_lldb_s_downstream_patches, #lldb

Differential Revision: https://reviews.llvm.org/D70070
2019-11-12 10:04:32 +01:00
Raphael Isemann bd7d9a85b8 [lldb] Check if we actually have a Clang type in ObjCLanguage::GetPossibleFormattersMatches
We call IsPossibleDynamicType but we also need to check if this is a Clang type,
otherwise other languages with dynamic types (like Swift) might end up being interpreted
as potential Obj-C dynamic types.
2019-11-12 09:59:04 +01:00
Jonas Devlieghere 0cf86da174 [Reproducer] Quit the debugger after generating a reproducer
Currently nothing prevents you from continuing your debug session after
generating the reproducer. This can cause the reproducer to end up in an
inconsistent state. Most of the time this doesn't matter, but I want to
prevent this from causing bugs in the future.
2019-11-11 14:29:53 -08:00
Adrian Prantl da83e96273 Fix a regression in macOS-style path remapping.
When we switched to the LLVM .debug_line parser, the .dSYM-style path
remapping logic stopped working for relative paths because of how
RemapSourceFile silently fails for relative paths. This patch both
makes the code more readable and fixes this particular bug.

One interesting thing I learned is that Module::RemapSourceFile() is a
macOS-only code path that operates on on the lldb::Module level and is
completely separate from target.source-map, which operates on a
per-Target level.

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

rdar://problem/56924558
2019-11-11 12:21:38 -08:00
Pavel Labath a14eb8f47d lldb: Fix some -Wdeprecated-copy warnings
gcc-9 started warning when a class defined a copy constructor without a
copy assignment operator (or vice-versa).

This fixes those warnings by deleting the other special member too
(after verifying it doesn't do anything non-trivial).
2019-11-11 17:55:49 +01:00
Jason Molenda 60ab30ebce Temporarily change the default for use-g-packet-for-reading to false,
until we can automatically fall back to p/P if g/G are not supported;
it looks like there is a bug in debugserver's g/G packets taht needs
to be fixed, or debugserver should stop supporting g/G until that bug
is fixed.  But we need lldb to be able to fall back to p/P correctly
for that to be a viable workaround.
2019-11-08 18:21:57 -08:00
Adrian Prantl 8204d9ff7e Properly propagate is_variadic.
This fixes a copy&paste error made when adapting to new clang API
which was promptly caught by the bots.
2019-11-08 09:53:51 -08:00
Adrian Prantl 454acae97c Adapt LLDB to clang API change in ObjCMethodDecl::create(). 2019-11-08 08:59:22 -08:00
Raphael Isemann 5a1bac4d1d [lldb] Make Target* a Target& in CommandObjectExpression::DoExecute REPL logic
Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70002
2019-11-08 12:28:49 +01:00
Raphael Isemann 79b3cce7f1 [lldb][NFC] Refactor some IsClangType checks in ClangASTContext
Summary:
All type in these functions need be valid and Clang types, so
we might as well replace these checks with IsClangType.

Also lets IsClangType explicitly check for validity instead of
assuming that the TypeSystem is a nullptr.

Subscribers: abidh, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D70001
2019-11-08 12:03:28 +01:00
Jason Molenda 6602e1fb0e Reordering KextImageInfo::LoadImageUsingMemoryModule
so we only call ModulesDidLoad at the end of the method
after the new module has been added to the target and
the sections have all been adjusted to their actual
load addresses.  Solves a problem where an operating
system plugin in the kernel could be loaded multiple
times; the first before the binary had even been
added to the target.

<rdar://problem/50523558>
2019-11-07 19:34:09 -08:00
Jim Ingham f1539b9db3 BreakpointDummyOptionGroup was using g_breakpoint_modify_options rather than g_breakpoint_dummy_options
causing the -D option for breakpoint set command to be incorrectly parsed.

Patch by Martin Svensson.

Differential Revision: https://reviews.llvm.org/D69425
2019-11-07 14:25:04 -08:00
Jonas Devlieghere c62a9f180c [lldb] Improve assert in GDBRemoteCommunicationReplayServer
While investigating an issue where a different packet was sent during
replay I noticed how annoying it is that the existing assert doesn't
specify what packet is actually different. It's printed to the log, but
enabling logging has the potential to change LLDB's behavior. The same
is true when debugging LLDB while it's replaying the reproducer.

I replaced the assert with a printf of the unexpected packet followed by
a fatal_error wrapped in ifndef NDEBUG. The behavior is the same as the
previous assert, just with more/better context.
2019-11-07 12:43:59 -08:00
Jan Kratochvil 44f43461c0 [lldb] Comment typo fix 2019-11-07 17:48:25 +01:00
Raphael Isemann 87bc320b51 [lldb] Add -m option to 'target modules dump symtab' to disable demangling
Summary: This option was added downstream in swift-lldb. This upstreams this option as it seems useful and also adds the missing tests.

Reviewers: #lldb, kwk, labath

Reviewed By: kwk, labath

Subscribers: labath, kwk, abidh, JDevlieghere, lldb-commits

Tags: #lldb, #upstreaming_lldb_s_downstream_patches

Differential Revision: https://reviews.llvm.org/D69944
2019-11-07 15:47:01 +01:00
Guilherme Andrade b1b70f6761 [lldb-server] Add setting to force 'g' packet use
Following up on https://reviews.llvm.org/D62221, this change introduces
the settings plugin.process.gdb-remote.use-g-packet-for-reading.  When
they are on, 'g' packets are used for reading registers.

Using 'g' packets can improve performance by reducing the number of
packets exchanged between client and server when a large number of
registers needs to be fetched.

Differential revision: https://reviews.llvm.org/D62931
2019-11-07 10:48:54 +01:00