Commit Graph

29376 Commits

Author SHA1 Message Date
GeorgeHuyubo
e2fb816c4f
Add new API in SBTarget for loading core from SBFile (#71769)
Add a new API in SBTarget to Load Core from a SBFile.
This will enable a target to load core from a file descriptor.
So that in coredumper, we don't need to write core file to disk, instead
we can pass the input file descriptor to lldb directly.


Test:
```
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> file_object = open("/home/hyubo/210hda79ms32sr0h", "r")
>>> fd=file_object.fileno()
>>> file = lldb.SBFile(fd,'r', True)
>>> error = lldb.SBError()
>>> target = lldb.debugger.CreateTarget(None)
>>> target.LoadCore(file,error)
SBProcess: pid = 56415, state = stopped, threads = 1
```
2023-11-17 09:53:12 -08:00
Jonas Devlieghere
ec6a34e2a7
[lldb] Pass important options to dsymForUUID (#72669)
On macOS, we usually use the DebugSymbols framework to find dSYMs, but
we have a few places (including crashlog.py) that calls out directly to
dsymForUUID. Currently, this invocation is missing two important
options:

* `--ignoreNegativeCache`: Poor network connectivity or lack of VPN can
lead to a negative cache hit. Avoiding those issues is worth the penalty
of skipping these caches.
* `--copyExecutable`: Ensure we copy the executable as it might not be
available at its original location.

rdar://118480731
2023-11-17 08:00:07 -08:00
santhoshe447
06effaf43e
[lldb][test] Add the ability to extract the variable value out of the summary. (#72631)
Fix for https://github.com/llvm/llvm-project/issues/71897
When it comes to test infrastructure the test (TestDAP_variables.py:
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries)
will fail if the variable has a summary along with value.

I just tried to add a summary to a variable before we set a value to the
variable using below expression from “request_setVariable” function.
RunLLDBCommands(llvm::StringRef(), {std::string("type summary add
--summary-string "{sample summary}" (const char **) argv")});

As value has nonnumeric characters where we are trying to convert into
integer, python is throwing an error. We did not see this issue in
upstream as we are not adding summary explicitly, by default we are
getting empty summary & value for all children’s of argv parameter (even
after auto summary).

The test is failing with below error:
ERROR:
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries
(TestDAP_variables.TestDAP_variables)
Traceback (most recent call last):
File
"/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py",
line 372, in
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries
enableAutoVariableSummaries=True
File
"/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py",
line 266, in do_test_scopes_variables_setVariable_evaluate
argv = self.get_local_as_int("argv")
File
"//llvm/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py",
line 199, in get_local_as_int
return int(value, 16)
ValueError: invalid literal for int() with base 16: '0x0000000000001234
sample summary'
Config=x86_64-//llvm/llvm-build/bin/clang

Co-authored-by: Santhosh Kumar Ellendula <sellendu@hu-sellendu-hyd.qualcomm.com>
2023-11-17 10:15:23 -05:00
Augusto Noronha
46396108de
[lldb] Add interface to check if UserExpression::Parse() is cacheable (#66826)
When setting conditional breakpoints, we currently assume that a call to
UserExpression::Parse() can be cached and resued multiple times. This
may not be true for every user expression. Add a new method so
subclasses of UserExpression can customize if they are parseable or not.
2023-11-16 14:20:14 -08:00
Jason Molenda
5f64b94076
Clarify error messages on corefiles that no plugin handles (#72559)
These error messages are written in a way that makes sense to an lldb
developer, but not to an end user who asks lldb to run on a compressed
corefile or whatever. Simplfy the messages.
2023-11-16 13:58:07 -08:00
Alex Langford
a322d50804 [lldb] Add forward declaration for SBWatchpointOptions in SBDefines.h 2023-11-16 12:13:44 -08:00
Michael Buch
70900ec799
[lldb][DWARFASTParserClang][NFC] Clarify comment around static member variable handling (#72495) 2023-11-16 16:09:47 +00:00
Jordan Rupprecht
212a60ec37
[lldb][test] Remove self references from decorators (#72416)
This is partial step toward removing the vendored `unittest2` dep in
favor of the `unittest` library in standard python. One of the large
differences is when xfail decorators are evaluated. With the `unittest2`
vendored dep, this can happen at the moment of calling the test case,
and with LLDB's decorator wrappers, we are passed the test class in the
decorator arg. With the `unittest` framework, this is determined much
earlier; we cannot decide when the test is about to start that we need
to xfail.

Fortunately, almost none of these checks require any state that can't be
determined statically. For this patch, I moved the impl for all the
checks to `lldbplatformutil` and pointed the decorators to that,
removing as many `self` (i.e. test class object) references as possible.
I left wrappers within `TestBase` that forward to `lldbplatformutil` for
convenience, but we should probably remove those later.

The remaining check that can't be moved statically is the check for the
debug info type (e.g. to xfail only for dwarf). Fixing that requires a
different approach, so I will postpone that to the next patch.
2023-11-15 17:51:25 -08:00
Jason Molenda
a3fe9221ab
Remove hardware index from watchpoints and breakpoints (#72012)
The Watchpoint and Breakpoint objects try to track the hardware index
that was used for them, if they are hardware wp/bp's. The majority of
our debugging goes over the gdb remote serial protocol, and when we set
the watchpoint/breakpoint, there is no (standard) way for the remote
stub to communicate to lldb which hardware index was used. We have an
lldb-extension packet to query the total number of watchpoint registers.

When a watchpoint is hit, there is an lldb extension to the stop reply
packet (documented in lldb-gdb-remote.txt) to describe the watchpoint
including its actual hardware index,

<addr within wp range> <wp hw index> <actual accessed address>

(the third field is specifically needed for MIPS). At this point, if the
stub reported these three fields (the stub is only required to provide
the first), we can know the actual hardware index for this watchpoint.

Breakpoints are worse; there's never any way for us to be notified about
which hardware index was used. Breakpoints got this as a side effect of
inherting from StoppointSite with Watchpoints.

We expose the watchpoint hardware index through "watchpoint list -v" and
through SBWatchpoint::GetHardwareIndex.

With my large watchpoint support, there is no *single* hardware index
that may be used for a watchpoint, it may need multiple resources. Also
I don't see what a user is supposed to do with this information, or an
IDE. Knowing the total number of watchpoint registers on the target, and
knowing how many Watchpoint Resources are currently in use, is helpful.
Knowing how many Watchpoint Resources
a single user-specified watchpoint needed to be implemented is useful.
But knowing which registers were used is an implementation detail and
not available until we hit the watchpoint when using gdb remote serial
protocol.

So given all that, I'm removing watchpoint hardware index numbers. I'm
changing the SB API to always return -1.
2023-11-15 13:32:42 -08:00
Michael Buch
35b10acf20
[lldb][DWARFASTParserClang] DWARFv5: support DW_TAG_variable static data members declarations (#72236)
The accepted DWARFv5 issue 161118.1: "DW_TAG for C++ static data
members" specifies that static data member declaration be described by
DW_TAG_variable. Make sure we recognize such members.

Depends on:
* https://github.com/llvm/llvm-project/pull/72234
* https://github.com/llvm/llvm-project/pull/72235
2023-11-15 11:01:52 +00:00
Greg Clayton
beb702c0ad
Add support for arm64 registers in minidump core file saving. (#72315)
This patch adds support for saving minidumps with the arm64
architecture. It also will cause unsupported architectures to emit an
error where before this patch it would emit a minidump with partial
information. This new code is tested by the arm64 windows buildbot that
was failing:

https://lab.llvm.org/buildbot/#/builders/219/builds/6868

This is needed following this PR:
https://github.com/llvm/llvm-project/pull/71772
2023-11-14 16:49:44 -08:00
Walter Erquinigo
1654d7dc38
[lldb-dap] Add an option to provide a format for threads (#72196)
When this option gets enabled, descriptions of threads will be generated
using the format provided in the launch configuration instead of
generating it manually in the dap code. This allows lldb-dap to show an
output similar to the one in the CLI.
This is very similar to https://github.com/llvm/llvm-project/pull/71843
2023-11-14 13:23:55 -05:00
Michael Buch
27c5a9bbb0 [lldb][test] TestConstStaticIntegralMember.py: fix on older clang versions
`638a8393615e911b729d5662096f60ef49f1c65e` removed the `dsym`
condition for older compiler versions which caused the `dwarf`
variants tests to XPASS. This patch reverts to only XFAIL-ing
the `dsym` variant.

`15c80852028ff4020b3f85ee13ad3a2ed4bce3be` added
`test_shadowed_static_inline_members` which isn't supported
on older compiler versions.
2023-11-14 10:31:07 +00:00
Haojian Wu
b837361b80
[LLDB] Display artificial __promise and __coro_frame variables. (#71928)
See the discussion in #69309.
2023-11-14 09:06:40 +01:00
Walter Erquinigo
d9ec4b24a8
[lldb-dap] Add an option to provide a format for stack frames (#71843)
When this option gets enabled, descriptions of stack frames will be
generated using the format provided in the launch configuration instead
of simply calling `SBFrame::GetDisplayFunctionName`. This allows
lldb-dap to show an output similar to the one in the CLI.
2023-11-13 21:10:16 -05:00
Michael Buch
743c4fe43c
[lldb][DWARFASTParserClang][NFC] Extract static data member decl creation into helper (#72109)
This patch extracts the logic to create a static variable member decl
into a helper. We will use this in an upcoming patch which will need to
call exactly the same logic from a separate part of the DWARF parser.
2023-11-13 19:30:28 +00:00
Alex Langford
ad20a9e1a1
[lldb] Remove StructuredData::Array::GetItemAtIndexAsArray (#71994)
This method is completely unused.
2023-11-13 10:12:36 -08:00
Haojian Wu
0515ccc0c4 [lldb] Fix a typo in the comment, NFC 2023-11-13 10:12:55 +01:00
Michael Buch
f86770aa07 Reland "[lldb][DWARFASTParserClang] Make MemberAttributes const when parsing member DIEs (#71921)"
Changed the recently added `FindConstantOnVariableDefinition` to
not rely on MemberAttributes being non-const.

Original commit message:
"""
This patch removes the Objective-C accessibility workaround added in
5a477cfd90
(rdar://8492646). This allows us to make the local `MemberAttributes`
variable immutable, which is useful for some other work around this
function I was planning on doing.

We don't need the workaround anymore since compiler-support for giving
debuggers access to private ivars was done couple of years later in
d6cb4a858d
(rdar://10997647).

**Testing**

* Test-suite runs cleanly
"""
2023-11-13 06:38:57 +00:00
Michael Buch
c501bf4334 Revert "[lldb][DWARFASTParserClang] Make MemberAttributes const when parsing member DIEs (#71921)"
This reverts commit 576f7ccfa4.

Causes build bot failure because new code started depending
on the non-constness of the MemberAttributes.
2023-11-13 06:16:32 +00:00
Michael Buch
9d587480dc [lldb][DWARFASTParserClang][NFC] Fix build failure
Caused by a badly resolved merge conflict
2023-11-13 06:14:23 +00:00
Michael Buch
576f7ccfa4
[lldb][DWARFASTParserClang] Make MemberAttributes const when parsing member DIEs (#71921)
This patch removes the Objective-C accessibility workaround added in
5a477cfd90
(rdar://8492646). This allows us to make the local `MemberAttributes`
variable immutable, which is useful for some other work around this
function I was planning on doing.

We don't need the workaround anymore since compiler-support for giving
debuggers access to private ivars was done couple of years later in
d6cb4a858d
(rdar://10997647).

**Testing**

* Test-suite runs cleanly
2023-11-13 06:11:05 +00:00
Michael Buch
15c8085202
Reland "[lldb][DWARFASTParserClang] Fetch constant value from variable defintion if available" (#71800)
This patch relands https://github.com/llvm/llvm-project/pull/71004 which
was reverted because the clang change it depends on was reverted.

In addition to the original patch, this PR includes a change to
`SymbolFileDWARF::ParseVariableDIE` to support CU-level variable
definitions that don't have locations, but represent a constant value.
Previously, when debug-maps were available, we would assume that a
variable with "static lifetime" (which in this case means "has a linkage
name") has a valid address, which isn't the case for non-locationed
constants. We could omit this additional change if we stopped attaching
linkage names to global non-locationed constants.

Original commit message:
"""
https://github.com/llvm/llvm-project/pull/71780 proposes moving the
`DW_AT_const_value` on inline static members from the declaration DIE to
the definition DIE. This patch makes sure the LLDB's expression
evaluator can continue to support static initialisers even if the
declaration doesn't have a `DW_AT_const_value` anymore.

Previously the expression evaluator would find the constant for a
VarDecl from its declaration `DW_TAG_member` DIE. In cases where the
initialiser was specified out-of-class, LLDB could find it during symbol
resolution.

However, neither of those will work for constants, since we don't have a
constant attribute on the declaration anymore and we don't have
constants in the symbol table.
"""

Depends on:
* https://github.com/llvm/llvm-project/pull/71780
2023-11-13 06:09:58 +00:00
Michael Buch
638a839361
Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (#71780)
This patch relands https://github.com/llvm/llvm-project/pull/70639

It was reverted because under certain conditions we triggered an
assertion
in `DIBuilder`. Specifically, in the original patch we called
`EmitGlobalVariable`
at the end of `CGDebugInfo::finalize`, after all the temporary `DIType`s
have
been uniqued. With limited debug-info such temporary nodes would be
created
more frequently, leaving us with non-uniqued nodes by the time we got to
`DIBuilder::finalize`; this violated its pre-condition and caused
assertions to trigger.

To fix this, the latest iteration of the patch moves
`EmitGlobalVariable` to the
beginning of `CGDebugInfo::finalize`. Now, when we create a temporary
`DIType` node as a result of emitting a variable definition, it will get
uniqued
in time. A test-case was added for this scenario.

We also now don't emit a linkage name for non-locationed constants since
LLDB doesn't make use of it anyway.

Original commit message:
"""
When an LLDB user asks for the value of a static data member, LLDB
starts
by searching the Names accelerator table for the corresponding variable
definition DIE. For static data members with out-of-class definitions
that
works fine, because those get represented as global variables with a
location
and making them eligible to be added to the Names table. However,
in-class
definitions won’t get indexed because we usually don't emit global
variables
for them. So in DWARF we end up with a single `DW_TAG_member` that
usually holds the constant initializer. But we don't get a corresponding
CU-level `DW_TAG_variable` like we do for out-of-class definitions.

To make it more convenient for debuggers to get to the value of inline
static data
members, this patch makes sure we emit definitions for static variables
with
constant initializers the same way we do for other static variables.
This also aligns
Clang closer to GCC, which produces CU-level definitions for inline
statics and also
emits these into `.debug_pubnames`.

The implementation keeps track of newly created static data members.
Then in `CGDebugInfo::finalize`, we emit a global `DW_TAG_variable` with
a
`DW_AT_const_value` for any of those declarations that didn't end up
with a
definition in the `DeclCache`.

The newly emitted `DW_TAG_variable` will look as follows:
```
0x0000007b:   DW_TAG_structure_type
                DW_AT_calling_convention        (DW_CC_pass_by_value)
                DW_AT_name      ("Foo")
                ...

0x0000008d:     DW_TAG_member
                  DW_AT_name    ("i")
                  DW_AT_type    (0x00000062 "const int")
                  DW_AT_external        (true)
                  DW_AT_declaration     (true)
                  DW_AT_const_value     (4)

Newly added
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

0x0000009a:   DW_TAG_variable
                DW_AT_specification     (0x0000008d "i")
                DW_AT_const_value       (4)
                DW_AT_linkage_name      ("_ZN2t2IiE1iIfEE")
```

This patch also drops the `DW_AT_const_value` off of the declaration
since we
now always have it on the definition. This ensures that the
`DWARFParallelLinker`
can type-merge class with static members where we couldn't attach the
constant
on the declaration in some CUs.
"""

Dependent changes:
* https://github.com/llvm/llvm-project/pull/71800
2023-11-13 06:04:27 +00:00
Brad Smith
9ba5b52c13
[lldb][test] Implement getting thread ID on OpenBSD (#71129) 2023-11-12 14:38:09 -05:00
Greg Clayton
215bacb5dc
Centralize the code that figures out which memory ranges to save into core files (#71772)
Prior to this patch, each core file plugin (ObjectFileMachO.cpp and
ObjectFileMinindump.cpp) would calculate the address ranges to save in
different ways. This patch adds a new function to Process.h/.cpp:

```
Status Process::CalculateCoreFileSaveRanges(lldb::SaveCoreStyle core_style, CoreFileMemoryRanges &ranges);
```

The patch updates the ObjectFileMachO::SaveCore(...) and
ObjectFileMinindump::SaveCore(...) to use same code. This will allow
core files to be consistent with the lldb::SaveCoreStyle across
different core file creators and will allow us to add new core file
saving features that do more complex things in future patches.
2023-11-11 11:21:32 -08:00
Walter Erquinigo
309596f249
[LLDB] Ensure the data of apple accelerator tables is kept around (#71828)
lldb's AppleDWARFIndex is created with a few
`llvm::AppleAcceleratorTable` variables, but they only hold pointers to
the underlying data, which doesn't prevent the data owner (lldb's
DataBufferHeap) from being disposed.

Because of this, an asan build of lldb was showing an error in which a
jitted accelerator table was being fred before read, which made my lldb
fall in an infinite loop trying to parse corrupted accel table data.
This issue only happens when I'm using a jitted execution and not when
debugging a precompiled binary, probably because in the jit case the
underlying data has to necessarily be copied via gdb-remote instead of
mmaping a debug info file.

The correct fix seems to also store the underlying storage along with
the accelerator tables in AppleDWARFIndex.
2023-11-10 21:53:58 -05:00
jimingham
0f8d3e62d3
Fix a little thinko in sending events to secondary listeners. (#71997)
If `unique` is true, I was redoing the uniqueness check for the
secondary listeners, which is racy since a "duplicate" event could come
in between deciding to send the event to the main listener and checking
for the shadow listener, and then the two streams would get out of sync.

There's not a good way to write a direct test for this, but the
test_shadow_listeners test has been flakey and this is the only racy
part of that system I can find. So the test would be that that
test_shadow_listeners becomes not flakey.
2023-11-10 16:12:51 -08:00
Jonas Devlieghere
64f62de966
[lldb] Read Checksum from DWARF line tables (#71458)
Read the MD5 checksum from DWARF line tables and store it in the
corresponding support files.

This is a re-land after fixing an off-by-one error in LLDB's
ParseSupportFilesFromPrologue (fixed in #71984).
2023-11-10 14:43:47 -08:00
Jonas Devlieghere
fa7e07ed99
[lldb] Fix a off-by-one error in ParseSupportFilesFromPrologue (#71984)
This fixes a subtle and previously harmless off-by-one bug in
ParseSupportFilesFromPrologue. The function accounts for the start index
being one-based for DWARF v4 and earlier and zero-based for DWARF v5 and
later. However, the same care wasn't taken for the end index.

This bug existed unnoticed because GetFileByIndex gracefully handles an
invalid index. However, the bug manifested itself after #71458, which
added a call to getFileNameEntry which requires the index to be valid.

No test as the bug cannot be observed without the changes from #71458.
Once that PR is merged, this will be covered by all the DWARF v5 tests.
2023-11-10 14:03:29 -08:00
Alex Langford
133bcacecf
[lldb] Change interface of StructuredData::Array::GetItemAtIndexAsDictionary (#71961)
Similar to my previous patch (#71613) where I changed
`GetItemAtIndexAsString`, this patch makes the same change to
`GetItemAtIndexAsDictionary`.

`GetItemAtIndexAsDictionary` now returns a std::optional that is either
`std::nullopt` or is a valid pointer. Therefore, if the optional is
populated, we consider the pointer to always be valid (i.e. no need to
check pointer validity).
2023-11-10 12:47:43 -08:00
Haojian Wu
81a76902ae [lldb] Only run ignored_artificial_fields.test when gcc is available. 2023-11-10 20:56:27 +01:00
David Spickett
d96ea27973 Revert "[lldb] Remove the newly-added test in 66acd1e4dc1080015fe6b234226f1d30d6577f04"
This reverts commit 343eb4b425.

This test should work now that the build script doesn't add -m(32|64) on Arm/AArch64
builders.
2023-11-10 13:47:41 +00:00
David Spickett
6b4ac76504 Reland "[lldb][test] Only add -m(64|32) for GCC on non Arm/AArch64 platforms"
This reverts commit fd5206cc55.

Fixing the test case would require some awkard %if use that I'm not
sure would even work, or splitting it into 2 copies that are almost
identical.

Instead, always add -m for clang, which allows it for all targets,
but not for gcc which does not.
2023-11-10 13:36:23 +00:00
David Spickett
fd5206cc55 Revert "[lldb][test] Only add -m(64|32) for GCC on non Arm/AArch64 platforms"
This reverts commit 7c3603e1c1.

Turns out when you ask for "clang" it also uses the GCC Builder class,
so I need to update some tests.
2023-11-10 13:17:01 +00:00
David Spickett
7c3603e1c1 [lldb][test] Only add -m(64|32) for GCC on non Arm/AArch64 platforms
This option is definitely needed for x86_64, and is valid for PowerPC
and s390x too.

I'm using "in" because on Armv8 Linux the uname is actually "armv8l"
not just "arm".
2023-11-10 12:52:36 +00:00
Haojian Wu
343eb4b425 [lldb] Remove the newly-added test in 66acd1e4dc
The test added causes some buildbot failures:
- https://lab.llvm.org/buildbot/#/builders/17/builds/45077
https://lab.llvm.org/buildbot/#/builders/96/builds/48277

Remove the test for now to make the builtbots happy, and will re-add it after
investigation.
2023-11-10 13:46:36 +01:00
David Spickett
bd61126499 [lldb][docs] Update Discord invite link
The previous one must have been an expiring one, this new
one is a non-expiring one that Chandler generated some time ago.
2023-11-10 11:18:30 +00:00
Haojian Wu
66acd1e4dc
[LLDB] Ignore actual-needed artificial members in DWARFASTParserClang::ParseSingleMember (#70779)
Address the FIXME, this will allow lldb to print all fields of the
generated coroutine frame structure.

Fixes #69309.
2023-11-10 10:53:03 +01:00
David Spickett
9ad25f2352
[lldb][AArch64][Linux] Add register field information for SME's SVCR register (#71809)
This register is a pseudo register but mirrors the architectural
register's contents. See:
https://developer.arm.com/documentation/ddi0616/latest/

For the full details. Example output:
```
(lldb) register read svcr
    svcr = 0x0000000000000002
         = (ZA = 1, SM = 0)
```
2023-11-10 09:30:11 +00:00
David Spickett
2f8e3d55da
[lldb][AArch64][Linux] Add field information for the mte_ctrl register (#71808)
This is a Linux pseudo register provided by the NT_ARM_TAGGED_ADDR_CTRL
register set. It reflects the value passed to prctl
PR_SET_TAGGED_ADDR_CTRL.

https://docs.kernel.org/arch/arm64/memory-tagging-extension.html

The fields are made from the #defines the kernel provides for setting
the value. Its contents are constant so no runtime detection is needed
(once we've decided we have this register in the first place).

The permitted generated tags is technically a bitfield but at this time
we don't have a way to mark a field as preferring hex formatting.

```
(lldb) register read mte_ctrl
mte_ctrl = 0x000000000007fffb
         = (TAGS = 65535, TCF_ASYNC = 0, TCF_SYNC = 1, TAGGED_ADDR_ENABLE = 1)
```

(4 bit tags mean 16 possible tags, 16 bit bitfield)

Testing has been added to TestMTECtrlRegister.py, which needed a more
granular way to check for XML support, so I've added hasXMLSupport that
can be used within a test case instead of skipping whole tests if XML
isn't supported.

Same for the core file tests.
2023-11-10 09:01:22 +00:00
Alex Langford
1486264d5f
[lldb] Change interface of StructuredData::Array::GetItemAtIndexAsString (#71613)
This patch changes the interface of
StructuredData::Array::GetItemAtIndexAsString to return a
`std::optional<llvm::StringRef>` instead of taking an out parameter.
More generally, this commit serves as proposal that we change all of the
sibling APIs (`GetItemAtIndexAs`) to do the same thing. The reason this
isn't one giant patch is because it is rather unwieldy changing just one
of these, so if this is approved, I will do all of the other ones as
individual follow-ups.
2023-11-09 13:35:35 -08:00
Alex Langford
fe98cce6a9
[lldb] Change Breakpoint::AddName return value (#71236)
The return value is completely unused. Let's just return nothing.
2023-11-09 13:34:59 -08:00
Jonas Devlieghere
73519ba27a
Revert "[lldb] Read Checksum from DWARF line tables" (#71864)
Reverts llvm/llvm-project#71458 as it might have caused
cross-project-test failures.
2023-11-09 12:43:53 -08:00
Jonas Devlieghere
5da98dec7a
[lldb] Read Checksum from DWARF line tables (#71458)
Read the MD5 checksum from DWARF line tables and store it in the
corresponding support files.
2023-11-09 08:59:03 -08:00
David Spickett
220abb02cb [lldb][Utility] Fix GCC suggest braces warning for checksum value
[4314/5686] Building CXX object tools/lldb/sou...lity/CMakeFiles/lldbUtility.dir/Checksum.cpp.o
<...>/Checksum.cpp:43:46: warning: suggest braces around initialization of subobject [-Wmissing-braces]
llvm::MD5::MD5Result Checksum::g_sentinel = {0, 0, 0, 0, 0, 0, 0, 0,
                                             ^~~~~~~~~~~~~~~~~~~~~~~
                                             {
2023-11-09 12:38:01 +00:00
David Spickett
c51a8968a4 [lldb][AArch64][Linux] Fix HWCAP constant sizes when built on 32 bit
One of them is << 32 which means it must be a 64 bit value.

Fixes e3d750cc40.
2023-11-09 10:55:43 +00:00
David Spickett
e3d750cc40
[lldb][AArch64][Linux] Add fields for FPCR register (#71694)
Follows the format laid out in the Arm manual, AArch32 only fields are
ignored.

```
(lldb) register read fpcr
    fpcr = 0x00000000
         = (AHP = 0, DN = 0, FZ = 0, RMMode = 0, FZ16 = 0, IDE = 0, IXE = 0, UFE = 0, OFE = 0, DZE = 0, IOE = 0)
```

Tests use the first 4 fields that we know are always present.

Converted all the HCWAP defines to `UL` because I'm bound to
forget one if I don't do it now.
2023-11-09 09:32:24 +00:00
David Spickett
14b5abbfe2
[lldb][AArch64][Linux] Add field information for the fpsr register (#71651)
This one is easy because none of the fields depend on extensions. Only
thing to note is that I've ignored some AArch32 only fields.

```
(lldb) register read fpsr
    fpsr = 0x00000000
         = (QC = 0, IDC = 0, IXC = 0, UFC = 0, OFC = 0, DZC = 0, IOC = 0)
```
2023-11-09 08:18:44 +00:00
Jonas Devlieghere
919f5ef462
[lldb] Add Checksum to FileSpec (#71457)
Store a Checksum in FileSpec. Its purpose is to store the MD5 hash that
was added to the DWARF 5 line table.

This increases the size of a FileSpec from 24 to 40 bytes. The
alternative is to introduce a new SupportFile abstraction for a FileSpec
+ Checksum but that would require a corresponding SupportFileList class.
During review we decided that wasn't worth it, but that's something we
can revisit in the future.
2023-11-08 20:11:48 -08:00
Med Ismail Bennani
0adbde6541
[lldb] Fix assert in ScriptedProcess destructor (#71744)
This patch should fix a test failure in
`Expr/TestIRMemoryMapWindows.test`:

https://lab.llvm.org/buildbot/#/builders/219/builds/6786

The problem here is that since 7991412 landed, all the
`ScriptInterpreter::CreateScripted*Interface` now return a `nullptr`
when using the base `ScriptInterpreter` instance, instead of
`ScriptInterpreterPython` for instance.

This nullptr is actually well handled in the various places where we
create a Scripted Interface, however, because of the way to instanciate
a process, the process plugin manager have to iterate over every process
plugin and call the `CreateInstance` static function that should
instanciate the right object.

So in the ScriptedProcess case, because we are getting a `nullptr` when
trying to create a `ScriptedProcessInterface`, we try to discard the
process object, which calls the Process destructor, which in turns calls
the `ScriptedProcess` plugin `IsAlive` method. That method will fire an
assertion if the scripted interface pointer is not allocated.

This patch address that issue by setting a flag when destroying the
ScriptedProcess object, and checks that flag when calling `IsAlive`.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-11-08 17:18:40 -08:00
jeffreytan81
f175b9647c
Improve VSCode DAP logpoint value summary (#71723)
Currently VSCode logpoint uses `SBValue::GetValue` to get the value for
printing. This is not providing an intuitive result for std::string or
char * -- it shows the pointer value instead of the string content.

This patch improves by prefers `SBValue::GetSummary()` before using
`SBValue::GetValue()`.

---------

Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2023-11-08 16:48:55 -08:00
Jonas Devlieghere
7ef7a92ead
[lldb] Add Checksum class to lldbUtility (#71456)
This commit adds an MD5 checksum (`Checksum`) class to LLDB. Its purpose
is to store the MD5 hash added to the DWARF 5 line table.
2023-11-08 10:11:58 -08:00
Adrian Prantl
767ce07c2d
Simplify ValueObject::GetQualifiedRepresentationIfAvailable(). (#71559)
I received a couple of nullptr-deref crash reports with no line numbers
in this function. The way the function was written it was a bit
diffucult to keep track of when result_sp could be null, so this patch
simplifies the function to make it more obvious when a nullptr can be
contained in the variable.
2023-11-08 09:54:41 -08:00
David Spickett
ea82853499 [lldb][test] Skip ScriptedProcess missing methods test on Windows
No dylib on Windows, so the test fails to build.
2023-11-08 15:23:03 +00:00
David Spickett
e28157e778
[lldb][AArch64][Linux] Add field information for the CPSR register (#70300)
The contents of which are mostly SPSR_EL1 as shown in the Arm manual,
with a few adjustments for things Linux says userspace shouldn't concern
itself with.

```
(lldb) register read cpsr
    cpsr = 0x80001000
         = (N = 1, Z = 0, C = 0, V = 0, SS = 0, IL = 0, ...
```

Some fields are always present, some depend on extensions. I've checked
for those extensions using HWCAP and HWCAP2.

To provide this for core files and live processes I've added a new class
LinuxArm64RegisterFlags. This is a container for all the registers we'll
want to have fields and handles detecting fields and updating register
info.

This is used by the native process as follows:
* There is a global LinuxArm64RegisterFlags object.
* The first thread takes a mutex on it, and updates the fields.
* Subsequent threads see that detection is already done, and skip it.
* All threads then update their own copy of the register information
with pointers to the field information contained in the global object.

This means that even though every thread will have the same fields, we
only detect them once and have one copy of the information.

Core files instead have a LinuxArm64RegisterFlags as a member, because
each core file could have different saved capabilities. The logic from
there is the same but we get HWACP values from the corefile note.

This handler class is Linux specific right now, but it can easily be
made more generic if needed. For example by using LLVM's FeatureBitset
instead of HWCAPs.

Updating register info is done with string comparison, which isn't
ideal. For CPSR, we do know the register number ahead of time but we do
not for other registers in dynamic register sets. So in the interest of
consistency, I'm going to use string comparison for all registers
including cpsr.

I've added tests with a core file and live process. Only checking for
fields that are always present to account for CPU variance.
2023-11-08 10:17:38 +00:00
David Spickett
d3fb05ba10
[lldb][AArch64][Linux] Add SME2 release notes and usage docs (#70935)
ZT0 is much like ZA apart from not being scalable, so there's not much
new to cover.
2023-11-08 09:23:02 +00:00
Med Ismail Bennani
c9bfe0411f [lldb/test] Fix TestScriptedProcess.py failures on arm linux bots
This patch tentatively fixes TestScriptedProcess.py which has been
failing on the `lldb-arm-ubuntu` & `lldb-aarch64-ubuntu` bots:

- https://lab.llvm.org/buildbot/#/builders/17/builds/44965
- https://lab.llvm.org/buildbot/#/builders/96/builds/48152

According to the test log, on those systems, the clang driver that build
the test binary doesn't have the `-m` flag to specify the architure so
this patch replaces it with the `-target` flag using `clang -dumpmachine`
to get the host triple.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-11-07 23:24:02 -08:00
Med Ismail Bennani
0a21144614 [lldb] Check for abstract methods implementation in Scripted Plugin Objects (#71260)
This patch enforces that every scripted object implements all the
necessary abstract methods.

Every scripted affordance language interface can implement a list of
abstract methods name that checked when the object is instanciated.

Since some scripting affordances implementations can be derived from
template base classes, we can't check the object dictionary since it
will contain the definition of the base class, so instead, this checks
the scripting class dictionary.

Previously, for the various python interfaces, we used
`ABC.abstractmethod` decorators but this is too language specific and
doesn't work for scripting affordances that are not derived from
template base classes (i.e OperatingSystem, ScriptedThreadPlan, ...), so
this patch provides generic/language-agnostic checks for every scripted
affordance.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-11-07 22:01:41 -08:00
Med Ismail Bennani
c2ad9f8b60 Revert "[lldb] Check for abstract methods implementation in Scripted Plugin Objects (#71260)"
This reverts commit cc9ad72713 since it
breaks some tests upstream:

https://lab.llvm.org/buildbot/#/builders/68/builds/63112

********************
Failed Tests (4):
  lldb-api :: functionalities/gdb_remote_client/TestThreadSelectionBug.py
  lldb-api :: functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py
  lldb-api :: functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py
  lldb-api :: functionalities/postmortem/mach-core/TestMachCore.py
2023-11-07 13:04:01 -08:00
Med Ismail Bennani
cc9ad72713
[lldb] Check for abstract methods implementation in Scripted Plugin Objects (#71260)
This patch enforces that every scripted object implements all the
necessary abstract methods.

Every scripted affordance language interface can implement a list of
abstract methods name that checked when the object is instanciated.

Since some scripting affordances implementations can be derived from
template base classes, we can't check the object dictionary since it
will contain the definition of the base class, so instead, this checks
the scripting class dictionary.

Previously, for the various python interfaces, we used
`ABC.abstractmethod` decorators but this is too language specific and
doesn't work for scripting affordances that are not derived from
template base classes (i.e OperatingSystem, ScriptedThreadPlan, ...), so
this patch provides generic/language-agnostic checks for every scripted
affordance.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-11-07 12:07:16 -08:00
Alex Langford
03a92f0eca
[lldb] BreakpointResolver{*}::CreateFromStructuredData should return shared pointers (#71477)
BreakpointResolver::CreateFromStructuredData returns a
BreakpointResolverSP, but all of the subclasses return raw pointers.
Instead of creating a raw pointer and shoving it into a shared pointer,
it seems reasonable to just create the shared pointer directly.
2023-11-07 11:22:23 -08:00
Med Ismail Bennani
7991412270
[lldb/Interpreter] Make Scripted*Interface base class abstract (#71465)
This patch makes the various Scripted Interface base class abstract by
making the `CreatePluginObject` method pure virtual.

This means that we cannot construct a Scripted Interface base class
instance, so this patch also updates the various
`ScriptedInterpreter::CreateScripted*Interface` methods to return a
`nullptr` instead.`

This patch also removes the `ScriptedPlatformInterface` member from the
`ScriptInterpreter` class since it the interpreter can be owned by the
`ScriptedPlatform` instance itself, like we do for `ScriptedProcess`
objects.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-11-07 09:56:22 -08:00
Paulo Matos
3267cd3fa1
[lldb] Fix calls to Type::getInt8PtrTy (#71561)
These have been removed in 7b9d73c2f9.
This is a followup patch to apply the changes to lldb.
2023-11-07 18:49:11 +01:00
Hans Wennborg
066eea75d3 Revert "Reland "clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (#70639)""
This casued asserts:

  llvm/lib/IR/Metadata.cpp:689:
  void llvm::MDNode::resolve(): Assertion `isUniqued() && "Expected this to be uniqued"' failed.

See comments on the PR.

This also reverts the dependent follow-up commits, see below.

> When an LLDB user asks for the value of a static data member, LLDB
> starts by searching the Names accelerator table for the corresponding
> variable definition DIE. For static data members with out-of-class
> definitions that works fine, because those get represented as global
> variables with a location and making them eligible to be added to the
> Names table. However, in-class definitions won<E2><80><99>t get indexed because
> we usually don't emit global variables for them. So in DWARF we end
> up with a single `DW_TAG_member` that usually holds the constant
> initializer.  But we don't get a corresponding CU-level
> `DW_TAG_variable` like we do for out-of-class definitions.
>
> To make it more convenient for debuggers to get to the value of
> inline static data members, this patch makes sure we emit definitions
> for static variables with constant initializers the same way we do
> for other static variables. This also aligns Clang closer to GCC,
> which produces CU-level definitions for inline statics and also
> emits these into `.debug_pubnames`.
>
> The implementation keeps track of newly created static data members.
> Then in `CGDebugInfo::finalize`, we emit a global `DW_TAG_variable`
> with a `DW_AT_const_value` for any of those declarations that didn't
> end up with a definition in the `DeclCache`.
>
> The newly emitted `DW_TAG_variable` will look as follows:
> ```
> 0x0000007b:   DW_TAG_structure_type
>                 DW_AT_calling_convention        (DW_CC_pass_by_value)
>                 DW_AT_name      ("Foo")
>                 ...
>
> 0x0000008d:     DW_TAG_member
>                   DW_AT_name    ("i")
>                   DW_AT_type    (0x00000062 "const int")
>                   DW_AT_external        (true)
>                   DW_AT_declaration     (true)
>                   DW_AT_const_value     (4)
>
> Newly added
> vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
>
> 0x0000009a:   DW_TAG_variable
>                 DW_AT_specification     (0x0000008d "i")
>                 DW_AT_const_value       (4)
>                 DW_AT_linkage_name      ("_ZN2t2IiE1iIfEE")
> ```
>
> This patch also drops the `DW_AT_const_value` off of the declaration
> since we now always have it on the definition. This ensures that the
> `DWARFParallelLinker` can type-merge class with static members where
> we couldn't attach the constant on the declaration in some CUs.

This reverts commit 7c3707aea8.
This reverts commit cab0a19467.
This reverts commit 317481b3c8.
This reverts commit 15fc809404.
This reverts commit 470de2bbec.
2023-11-07 15:52:19 +01:00
David Spickett
cab0a19467 [lldb][test] Remove xfail for integral member test on Windows
Juding by https://lab.llvm.org/buildbot/#/builders/219/builds/6774/steps/6/logs/stdio
this is passing now.
2023-11-07 09:37:21 +00:00
David Spickett
ea9d44f5ec Reland "[lldb] Add template method for getting const or mutable regs from DynamicRegisterInfo (#71402)"
This reverts commit 75b195cc4c.

I've moved the specialisations out of the class to fix the g++ compilation.
2023-11-07 09:35:25 +00:00
David Spickett
75b195cc4c Revert "[lldb] Add template method for getting const or mutable regs from DynamicRegisterInfo (#71402)"
This reverts commit 4989c62b31 as it fails to build with g++.
2023-11-07 09:07:35 +00:00
David Spickett
4989c62b31
[lldb] Add template method for getting const or mutable regs from DynamicRegisterInfo (#71402)
GDBRemoteRegisterContext only needs to iterate them, ArchitectureAArch64
needs to mutate them if scalable registers change size.
2023-11-07 09:01:36 +00:00
Michael Buch
317481b3c8
[lldb][test] TestConstStaticIntegralMember.py: un-XFAIL on Linux (#71486)
This is a newly added test which XPASSes on Linux
2023-11-07 05:23:46 +00:00
Michael Buch
d08d9cf556 [lldb][test] TestVTableValue.py: skip base_class_ptr test case on older Clang versions
This failed on the public LLDB matrix build bots on Clang versions <
9.0:
```
======================================================================
FAIL: test_base_class_ptr (TestVTableValue.TestVTableValue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/functionalities/vtable/TestVTableValue.py", line 90, in test_base_class_ptr
    self.assertEquals(shape_ptr_vtable.GetNumChildren(), 5)
AssertionError: 6 != 5
```
2023-11-07 05:18:23 +00:00
Michael Buch
15fc809404 Reland "[lldb][test] Add FindGlobalVariables tests for C++ inline static data members (#70641)"
Tests that LLDB can find inline static data members.

Relies on the debug-info change in:
https://github.com/llvm/llvm-project/pull/70639
2023-11-07 04:54:04 +00:00
Michael Buch
470de2bbec Reland "[lldb][DWARFASTParserClang] Fetch constant value from variable defintion if available (#71004)"
https://github.com/llvm/llvm-project/pull/70639 proposes moving the
 `DW_AT_const_value` on inline static members from the declaration DIE to
 the definition DIE. This patch makes sure the LLDB's expression
 evaluator can continue to support static initialisers even if the
 declaration doesn't have a `DW_AT_const_value` anymore.

 Previously the expression evaluator would find the constant for a
 VarDecl from its declaration `DW_TAG_member` DIE. In cases where the
 initialiser was specified out-of-class, LLDB could find it during symbol
 resolution.

 However, neither of those will work for constants, since we don't have a
 constant attribute on the declaration anymore and we don't have
 constants in the symbol table.

 **Testing**

 * If https://github.com/llvm/llvm-project/pull/70639 were to land
 without this patch then most of the `TestConstStaticIntegralMember.py`
 would start failing
2023-11-07 04:54:01 +00:00
Michael Buch
7c3707aea8 Reland "clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (#70639)"
When an LLDB user asks for the value of a static data member, LLDB
starts by searching the Names accelerator table for the corresponding
variable definition DIE. For static data members with out-of-class
definitions that works fine, because those get represented as global
variables with a location and making them eligible to be added to the
Names table. However, in-class definitions won’t get indexed because
we usually don't emit global variables for them. So in DWARF we end
up with a single `DW_TAG_member` that usually holds the constant
initializer.  But we don't get a corresponding CU-level
`DW_TAG_variable` like we do for out-of-class definitions.

To make it more convenient for debuggers to get to the value of
inline static data members, this patch makes sure we emit definitions
for static variables with constant initializers the same way we do
for other static variables. This also aligns Clang closer to GCC,
which produces CU-level definitions for inline statics and also
emits these into `.debug_pubnames`.

The implementation keeps track of newly created static data members.
Then in `CGDebugInfo::finalize`, we emit a global `DW_TAG_variable`
with a `DW_AT_const_value` for any of those declarations that didn't
end up with a definition in the `DeclCache`.

The newly emitted `DW_TAG_variable` will look as follows:
```
0x0000007b:   DW_TAG_structure_type
                DW_AT_calling_convention        (DW_CC_pass_by_value)
                DW_AT_name      ("Foo")
                ...

0x0000008d:     DW_TAG_member
                  DW_AT_name    ("i")
                  DW_AT_type    (0x00000062 "const int")
                  DW_AT_external        (true)
                  DW_AT_declaration     (true)
                  DW_AT_const_value     (4)

Newly added
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

0x0000009a:   DW_TAG_variable
                DW_AT_specification     (0x0000008d "i")
                DW_AT_const_value       (4)
                DW_AT_linkage_name      ("_ZN2t2IiE1iIfEE")
```

This patch also drops the `DW_AT_const_value` off of the declaration
since we now always have it on the definition. This ensures that the
`DWARFParallelLinker` can type-merge class with static members where
we couldn't attach the constant on the declaration in some CUs.
2023-11-07 04:53:54 +00:00
Walter Erquinigo
555a71be45
[LLDB] Don't forcefully initialize the process trace plugin (#71455)
This was causing some process to wrongfully be handled by ProcessTrace.
    
The only place this was being used is in the intel pt plugin, but it
doesn't even build anymore, so I'm sure no one is using it.
2023-11-06 19:45:52 -05:00
Alex Langford
f4df0c48e9
[lldb][NFCI] Change parameter type in Target::AddNameToBreakpoint (#71241)
By itself this change does very little, but I plan on refactoring
something from StructuredData and it gets much easier with this change.
2023-11-06 12:45:02 -08:00
Michael Buch
876bd794fc
[lldb][test] TestVTableValue.py: skip test for older versions of clang (#71372)
This fails on the matrix build bot for Clang versions < 9.0


https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-matrix/7309/execution/node/102/log/?consoleFull

```
FAIL: LLDB :: test_vtable (TestVTableValue.TestVTableValue)
<bound method SBProcess.Kill of SBProcess: pid = 35338, state = stopped, threads = 1, executable = a.out>: success

======================================================================
FAIL: test_base_class_ptr (TestVTableValue.TestVTableValue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/functionalities/vtable/TestVTableValue.py", line 90, in test_base_class_ptr
    self.assertEquals(shape_ptr_vtable.GetNumChildren(), 5)
AssertionError: 6 != 5
======================================================================
FAIL: test_vtable (TestVTableValue.TestVTableValue)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "lldb/test/API/functionalities/vtable/TestVTableValue.py", line 67, in test_vtable
    self.assertEquals(vtable.GetNumChildren(), 5)
AssertionError: 6 != 5
----------------------------------------------------------------------
Ran 4 tests in 2.799s

RESULT: FAILED (2 passes, 2 failures, 0 errors, 0 skipped, 0 expected failures, 0 unexpected successes)
```
2023-11-06 19:15:39 +00:00
GeorgeHuyubo
10ec3bc977
[TraceIntelPT]Migrate to new function template for TraceIntelPT (#71258)
Easy change. Migrate to new template function call.
More context:
6f8b33f6df
2023-11-06 09:49:29 -08:00
David Spickett
3f5fd4b3c1
[lldb][AArch64] Move register info reconfigure into architecture plugin (#70950)
This removes AArch64 specific code from the GDB* classes.

To do this I've added 2 new methods to Architecture:
* RegisterWriteCausesReconfigure to check if what you are about to do
  will trash the register info.
* ReconfigureRegisterInfo to do the reconfiguring. This tells you if
  anything changed so that we only invalidate registers when needed.

So that ProcessGDBRemote can call ReconfigureRegisterInfo in
SetThreadStopInfo,
I've added forwarding calls to GDBRemoteRegisterContext and the base
class
RegisterContext.

(which removes a slightly sketchy static cast as well)

RegisterContext defaults to doing nothing for both the methods
so anything other than GDBRemoteRegisterContext will do nothing.
2023-11-06 11:30:19 +00:00
Michael Buch
333124cfd6 Revert "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (#70639)"
This reverts commit 4909814c08.

Following LLDB patch had to be reverted due to Linux test failures:
```
ef3febadf6
```

Since without that LLDB patch the LLDB tests would fail, revert
this clang patch for now.
2023-11-06 10:58:02 +00:00
Michael Buch
5f86b49146 Revert "[lldb][DWARFASTParserClang] Fetch constant value from variable defintion if available (#71004)"
This reverts commit ef3febadf6.

This caused an LLDB test failure on Linux for `lang/cpp/symbols/TestSymbols.test_dwo`:

```
make: Leaving directory '/home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/lang/cpp/symbols/TestSymbols.test_dwo'
runCmd: expression -- D::i
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	HandleCommand(command = "expression -- D::i")
1.	<user expression 0>:1:4: current parser token 'i'
2.	<lldb wrapper prefix>:44:1: parsing function body '$__lldb_expr'
3.	<lldb wrapper prefix>:44:1: in compound statement ('{}')
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  _lldb.cpython-39-x86_64-linux-gnu.so 0x00007fbcfcb08b87
1  _lldb.cpython-39-x86_64-linux-gnu.so 0x00007fbcfcb067ae
2  _lldb.cpython-39-x86_64-linux-gnu.so 0x00007fbcfcb0923f
3  libpthread.so.0                      0x00007fbd07ab7140
```

And a failure in `TestCallStdStringFunction.py` on Linux aarch64:
```
--
Exit Code: -11

Command Output (stdout):
--
lldb version 18.0.0git (https://github.com/llvm/llvm-project.git revision ef3febadf6)
  clang revision ef3febadf6
  llvm revision ef3febadf6

--
Command Output (stderr):
--
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      HandleCommand(command = "expression str")
1.      <lldb wrapper prefix>:45:34: current parser token ';'
2.      <lldb wrapper prefix>:44:1: parsing function body '$__lldb_expr'
3.      <lldb wrapper prefix>:44:1: in compound statement ('{}')
  #0 0x0000ffffb72a149c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_[lldb.cpython-38-aarch64-linux-gnu.so](http://lldb.cpython-38-aarch64-linux-gnu.so/)+0x58c749c)
  #1 0x0000ffffb729f458 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_[lldb.cpython-38-aarch64-linux-gnu.so](http://lldb.cpython-38-aarch64-linux-gnu.so/)+0x58c5458)
  #2 0x0000ffffb72a1bd0 SignalHandler(int) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_[lldb.cpython-38-aarch64-linux-gnu.so](http://lldb.cpython-38-aarch64-linux-gnu.so/)+0x58c7bd0)
  #3 0x0000ffffbdd9e7dc (linux-vdso.so.1+0x7dc)
  #4 0x0000ffffb71799d8 lldb_private::plugin::dwarf::SymbolFileDWARF::FindGlobalVariables(lldb_private::ConstString, lldb_private::CompilerDeclContext const&, unsigned int, lldb_private::VariableList&) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_[lldb.cpython-38-aarch64-linux-gnu.so](http://lldb.cpython-38-aarch64-linux-gnu.so/)+0x579f9d8)
  #5 0x0000ffffb7197508 DWARFASTParserClang::FindConstantOnVariableDefinition(lldb_private::plugin::dwarf::DWARFDIE) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_[lldb.cpython-38-aarch64-linux-gnu.so](http://lldb.cpython-38-aarch64-linux-gnu.so/)+0x57bd508)
```
2023-11-06 10:56:49 +00:00
Michael Buch
947a32aed8 Revert "[lldb][test] Add FindGlobalVariables tests for C++ inline static data members (#70641)"
This reverts commit 934c573b7d.

We had to revert dependencies of this patch due to test failures
on Linux:
```
4909814c08
ef3febadf6
```
2023-11-06 10:55:27 +00:00
Michael Buch
ef3febadf6
[lldb][DWARFASTParserClang] Fetch constant value from variable defintion if available (#71004)
https://github.com/llvm/llvm-project/pull/70639 proposes moving the
`DW_AT_const_value` on inline static members from the declaration DIE to
the definition DIE. This patch makes sure the LLDB's expression
evaluator can continue to support static initialisers even if the
declaration doesn't have a `DW_AT_const_value` anymore.

Previously the expression evaluator would find the constant for a
VarDecl from its declaration `DW_TAG_member` DIE. In cases where the
initialiser was specified out-of-class, LLDB could find it during symbol
resolution.

However, neither of those will work for constants, since we don't have a
constant attribute on the declaration anymore and we don't have
constants in the symbol table.

**Testing**

* If https://github.com/llvm/llvm-project/pull/70639 were to land
without this patch then most of the `TestConstStaticIntegralMember.py`
would start failing
2023-11-06 10:24:05 +00:00
Michael Buch
934c573b7d
[lldb][test] Add FindGlobalVariables tests for C++ inline static data members (#70641)
Tests that LLDB can find inline static data members.

Relies on the debug-info change in:
https://github.com/llvm/llvm-project/pull/70639
2023-11-06 10:23:47 +00:00
Michael Buch
4909814c08
[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (#70639)
When an LLDB user asks for the value of a static data member, LLDB
starts by
searching the Names accelerator table for the corresponding variable
definition
DIE. For static data members with out-of-class definitions that works
fine,
because those get represented as global variables with a location and
making them
eligible to be added to the Names table. However, in-class definitions
won’t get
indexed because we usually don't emit global variables for them. So in
DWARF
we end up with a single `DW_TAG_member` that usually holds the constant
initializer.
But we don't get a corresponding CU-level `DW_TAG_variable` like we do
for
out-of-class definitions.

To make it more convenient for debuggers to get to the value of inline
static data members,
this patch makes sure we emit definitions for static variables with
constant initializers
the same way we do for other static variables. This also aligns Clang
closer to GCC, which
produces CU-level definitions for inline statics and also emits these
into `.debug_pubnames`.

The implementation keeps track of newly created static data members.
Then in
`CGDebugInfo::finalize`, we emit a global `DW_TAG_variable` with a
`DW_AT_const_value` for
any of those declarations that didn't end up with a definition in the
`DeclCache`.

The newly emitted `DW_TAG_variable` will look as follows:
```
0x0000007b:   DW_TAG_structure_type
                DW_AT_calling_convention        (DW_CC_pass_by_value)
                DW_AT_name      ("Foo")
                ...

0x0000008d:     DW_TAG_member
                  DW_AT_name    ("i")
                  DW_AT_type    (0x00000062 "const int")
                  DW_AT_external        (true)
                  DW_AT_declaration     (true)
                  DW_AT_const_value     (4)

Newly added
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

0x0000009a:   DW_TAG_variable
                DW_AT_specification     (0x0000008d "i")
                DW_AT_const_value       (4)
                DW_AT_linkage_name      ("_ZN2t2IiE1iIfEE")
```

This patch also drops the `DW_AT_const_value` off of the declaration since we now always have it on the definition. This ensures that the `DWARFParallelLinker` can type-merge class with static members where we couldn't attach the constant on the declaration in some CUs.
2023-11-06 10:23:26 +00:00
Jonas Devlieghere
745e8bfd1a
[lldb] Remove LocateSymbolFile (#71301)
This completes the conversion of LocateSymbolFile into a SymbolLocator
plugin. The only remaining function is DownloadSymbolFileAsync which
doesn't really fit into the plugin model, and therefore moves into the
SymbolLocator class, while still relying on the plugins to do the
underlying work.
2023-11-05 08:26:42 -08:00
Jonas Devlieghere
e7c61479ce
[lldb] Move DownloadObjectAndSymbolFile to SymbolLocator plugin (#71267)
This builds on top of the work started in c3a302d to convert
LocateSymbolFile to a SymbolLocator plugin. This commit moves
DownloadObjectAndSymbolFile.
2023-11-04 17:58:35 -07:00
Jonas Devlieghere
19df9aa3f4
[lldb] Move LocateExecutableSymbolFile to SymbolLocator plugin (#71266)
This builds on top of the work started in c3a302d to convert
LocateSymbolFile to a SymbolLocator plugin. This commit moves
LocateExecutableSymbolFile.
2023-11-03 19:48:36 -07:00
Jonas Devlieghere
9b2246d9fa
[lldb] Move FindSymbolFileInBundle to SymbolLocator plugin (#71247)
This builds on top of the work started in c3a302d to convert
LocateSymbolFile to a SymbolLocator plugin. This commit moves
FindSymbolFileInBundle.
2023-11-03 18:07:57 -07:00
Jason Molenda
de24b0ef94
Strip authentication bits from vtable load address (#71128)
The current Darwin arm64e ABI on AArch64 systems using ARMv8.3 & newer
cores, adds authentication bits to the vtable pointer address. The
vtable address must be in addressable memory, so running it through
Process::FixDataAddress will be a no-op on other targets.

This was originally a downstream change that I hadn't upstreamed yet,
and it was surfaced by Greg's changes in
https://github.com/llvm/llvm-project/pull/67599
so I needed to update the local patch, and was reminded that I should
upstream this.
2023-11-03 16:26:12 -07:00
Jonas Devlieghere
c3a302d399
[lldb] Convert LocateSymbolFile into a plugin (#71151)
This commit contains the initial scaffolding to convert the
    functionality currently implemented in LocateSymbolFile to a plugin
    architecture. The plugin approach allows us to easily add new ways to
    find symbols and fixes some issues with the current implementation.

    For instance, currently we (ab)use the host OS to include support for
    querying the DebugSymbols framework on macOS. The plugin approach
    retains all the benefits (including the ability to compile this out on
    other platforms) while maintaining a higher level of separation with the
    platform independent code.

    To limit the scope of this patch, I've only converted a single function:
    LocateExecutableObjectFile. Future commits will convert the remaining
    LocateSymbolFile functions and eventually remove LocateSymbolFile. To
    make reviewing easier, that will done as follow-ups.
2023-11-03 15:42:23 -07:00
Vlad Serebrennikov
edd690b02e
[clang][NFC] Refactor TagTypeKind (#71160)
This patch converts TagTypeKind into scoped enum. Among other benefits,
this allows us to forward-declare it where necessary.
2023-11-03 21:45:39 +04:00
Daniel Thornburgh
17798ad7c3
[lldb] Use get-task-allow entitlement on macOS too (#71112)
Running the LLDB test suite in a GUI-less macOS environment (say, ssh)
requires that the debugged tasks be signed with the get-task-allow
entitlement.
2023-11-03 09:26:47 -07:00
David Spickett
68fbc8eec3 [lldb][NFC] Use UNUSED_IF_ASSERT_DISABLED instead of (void) cast
Uses of (void) remain where they are for purposes other than an
assert variable.
2023-11-03 14:20:05 +00:00
David Spickett
4be8a7bda5 [lldb] Fix TestVTableValue on 32 bit
7fbd427f5e added a test that overwrites
a vtable entry but it uses and expects a 64 bit value. Add the 32 bit
equivalents.
2023-11-03 10:36:39 +00:00
Walter Erquinigo
61964f1747
[LLDB][easy] Fix a bug in DummySyntheticFrontEnd (#71143)
DummySyntheticFrontEnd is implementing correctly CalculateNumChildren
but not MightHaveChildren, where instead of delegating its action, it
was returning true.
This fixes that simple bug.
2023-11-03 01:16:35 -04:00
River Riddle
8750239256
[lldb][windows] Allow exporting plugin symbols in LLDB_EXPORT_ALL_SYMBOLS (#71087)
Plugins aren't exported by default in the msvc path because we
explicitly limit the symbols exported to prevent hitting the symbol export limit.
Some plugins, however, can still be useful for downstream projects to
build on, e.g. the Mojo language uses parts of the dwarf plugin to
implement dwarf handling within its debugger plugin.

This PR adds a cmake variable in the MSVC path,
LLDB_EXPORT_ALL_SYMBOLS_PLUGINS, that allows for providing the set
of plugins to export symbols from.
2023-11-02 15:06:16 -07:00
Tom Yang
9e0a5be0de
[lldb][split-dwarf] Add --errors-only argument separate-debug-info list (#71000)
Often, we only care about the split-dwarf files that have failed to
load. This can be useful when diagnosing binaries with many separate
debug info files where only some have errors.

```
(lldb) help image dump separate-debug-info
List the separate debug info symbol files for one or more target modules.

Syntax: target modules dump separate-debug-info <cmd-options> [<filename> [<filename> [...]]]

Command Options Usage:
  target modules dump separate-debug-info [-ej] [<filename> [<filename> [...]]]

       -e ( --errors-only )
            Filter to show only debug info files with errors.

       -j ( --json )
            Output the details in JSON format.

     This command takes options and free-form arguments.  If your arguments
     resemble option specifiers (i.e., they start with a - or --), you must use
     ' -- ' between the end of the command options and the beginning of the
     arguments.

'image' is an abbreviation for 'target modules'
```

I updated the following tests
```
# on Linux
bin/lldb-dotest -p TestDumpDwo

# on Mac
bin/lldb-dotest -p TestDumpOso
```

This change applies to both the table and JSON outputs.

---------

Co-authored-by: Tom Yang <toyang@fb.com>
2023-11-02 11:36:24 -07:00
Chelsea Cassanova
d483abd0fd
[lldb][docs] Update reference to test directory location (#71081)
The instructions for running single tests in the LLDB test suite used an
older directory structure from before the LLVM project became a
monorepo. This commit updates the references to these directories.
2023-11-02 10:35:42 -07:00
David Spickett
0d0ca51ffe
[lldb][AArch64] Read SME2's ZT0 register from Linux core files (#70934)
The ZT0 register is always 64 bytes in size so it is a lot easier to
handle than ZA which is scalable. In addition, reading an inactive ZT0
via ptrace returns all 0s, unlike ZA which returns no register data.

This means that a corefile from a process where ZA and ZT0 were inactive
still contains an NT_ARM_ZT note and we can simply say that if it's
there, then we should be able to read from it.

Along the way I removed a redundant check on the size of the ZA note. If
that note's size is < the ZA header size, we do not have SME, and
therefore could not have SME2 either.

I have added ZT0 to the existing SME core files tests. This means that
you need an SME2 system to generate them (Arm's FVP at this point). I
think this is a fair tradeoff given that this is all running in
simulation anyway and seperate ZT0 tests would be 99% identical copies
of the ZA only tests.
2023-11-02 15:56:46 +00:00
David Spickett
805a36aaf5
[lldb][AArch64] Simplify handing of scalable registers using vg and svg (#70914)
This removes explicit invalidation of vg and svg that was done in
`GDBRemoteRegisterContext::AArch64Reconfigure`. This was in fact
covering up a bug elsehwere.

Register information says that a write to vg also invalidates svg (it
does not unless you are in streaming mode, but we decided to keep it
simple and say it always does).

This invalidation was not being applied until *after* AArch64Reconfigure
was called. This meant that without those manual invalidates this
happened:
* vg is written
* svg is not invalidated
* Reconfigure uses the written vg value
* Reconfigure uses the *old* svg value

I have moved the AArch64Reconfigure call to after we've processed the
invalidations caused by the register write, so we no longer need the
manual invalidates in AArch64Reconfigure.

In addition I have changed the order in which expedited registers as
parsed. These registers come with a stop notification and include,
amongst others, vg and svg.

So now we:
* Parse them and update register values (including vg and svg)
* AArch64Reconfigure, which uses those values, and invalidates every
register, because offsets may have changed.
* Parse the expedited registers again, knowing that none of the values
will have changed due to the scaling.

This means we use the expedited registers during the reconfigure, but
the invalidate does not mean we throw all of them away.

The cost is we parse them twice client side, but this is cheap compared
to a network packet, and is limited to AArch64 targets only.

On a system with SVE and SME, these are the packets sent for a step:
```
(lldb) b-remote.async>  < 803> read packet:
$T05thread:p1f80.1f80;name:main.o;threads:1f80;thread-pcs:000000000040056c<...>a1:0800000000000000;d9:0400000000000000;reason:trace;#fc
intern-state     <  21> send packet: $xfffffffff200,200#5e
intern-state     < 516> read packet:
$e4f2ffffffff000000<...>#71
intern-state     <  15> send packet: $Z0,400568,4#4d
intern-state     <   6> read packet: $OK#9a
dbg.evt-handler  <  16> send packet: $jThreadsInfo#c1
dbg.evt-handler  < 224> read packet:
$[{"name":"main.o","reason":"trace","registers":{"161":"0800000000000000",<...>}],"signal":5,"tid":8064}]]#73
```

You can see there are no extra register reads which means we're using
the expedited registers.

For a write to vg:
```
(lldb) register write vg 4
lldb             <  37> send packet:
$Pa1=0400000000000000;thread:1f80;#4a
lldb             <   6> read packet: $OK#9a
lldb             <  20> send packet: $pa1;thread:1f80;#29
lldb             <  20> read packet: $0400000000000000#04
lldb             <  20> send packet: $pd9;thread:1f80;#34
lldb             <  20> read packet: $0400000000000000#04
```

There is the initial P write, and lldb correctly assumes that SVG is
invalidated by this also so we read back the new vg and svg values
afterwards.
2023-11-02 10:27:37 +00:00
Jason Molenda
66b92830c9
[lldb] [debugserver] Shut down the exception thread when clearing (#70979)
MachProcess has a MachTask as an ivar. In the MachProcess dtor, we call
MachTask::Clear() to clear its state, before running the dtor of all our
ivars, including the MachTask one.

When we attach on darwin, MachProcess calls
MachTask::StartExceptionThread which does the task_for_pid and then
starts a thread to listen for mach messages. Then MachProcess calls
ptrace(PT_ATTACHEXC). If that ptrace() fails, MachProcess will call
MachTask::Clear. But the exception thread is now up & running and is not
stopped; its ivars will be reset by the Clear() method, and its object
will be freed after the dtor runs.

Actually eliciting a crash in this scenario is very timing sensitive; I
hand-modified debugserver to fail to PT_ATTACHEXC trying to simulate it
on my desktop and was unable. But looking at the source, and an
occasional crash report we've received, it's clear that this is
possible.

rdar://117521198
2023-11-01 16:14:36 -07:00
Vlad Serebrennikov
a8ead56068
[clang][NFC] Rename ArgPassingKind to RecordArgPassingKind (#70955)
During the recent refactoring (b120fe8d32) this enum was moved out of `RecordDecl`. During post-commit review it was found out that its association with `RecordDecl` should be expressed in the name.
2023-11-01 20:38:28 +04:00
Vlad Serebrennikov
65761200ce [clang][NFC] Refactor LinkageSpecDecl::LanguageIDs
This patch converts `LinkageSpecDecl::LanguageIDs` into scoped enum, and moves it to namespace scope, so that it can be forward-declared where required.
2023-11-01 16:44:34 +03:00
Stefan Gränitz
43db8ac8ae
[lldb] Fix missing comsumeError() with LLDB_LOG in ObjectFileCOFF/PECOFF (#70793)
All `llvm::Error`s must be checked/consumed before destruction. Previously,
the errors in this patch were only consumed when logging was enabled.
Using `LLDB_LOG_ERROR` instead of `LLDB_LOG` fixes that, because it
calls `llvm::consumeError()` explicitly when logging is disabled.
2023-11-01 12:09:12 +01:00
Michael Buch
bc41b0ac2b
[lldb][Symtab][NFCI] Replace vector::swap with shrink_to_fit (#70918)
Replaces the old idiom (of swapping the container to shrink it) with the
newer STL alternative.

Similar transition in LLDB was done in: https://reviews.llvm.org/D47492
2023-11-01 10:43:55 +00:00
David Spickett
b8150c8f12
[lldb][AArch64] Add SME2's ZT0 register (#70205)
SME2 is documented as part of the main SME supplement:
https://developer.arm.com/documentation/ddi0616/latest/

The one change for debug is this new ZT0 register. This register
contains data to be used with new table lookup instructions.
It's size is always 512 bits (not scalable) and can be
interpreted in many different ways depending on the instructions
that use it. 

The kernel has implemented this as a new register set containing
this single register. It always returns register data (with no header,
unlike ZA which does have a header).

https://docs.kernel.org/arch/arm64/sme.html

ZT0 is only active when ZA is active (when SVCR.ZA is 1). In the 
inactive state the kernel returns 0s for its contents. Therefore
lldb doesn't need to create 0s like it does for ZA. 

However, we will skip restoring the value of ZT0 if we know that
ZA is inactive. As writing to an inactive ZT0 sets SVCR.ZA to 1,
which is not desireable as it would activate ZA also. Whether
SVCR.ZA is set will be determined only by the ZA data we restore.

Due to this, I've added a new save/restore kind SME2. This is easier
than accounting for the variable length ZA in the SME data. We'll only
save an SME2 data block if ZA is active. If it's not we can get fresh
0s back from the kernel for ZT0 anyway so there's nothing for us to
restore.

This new register will only show up if the system has SME2 therefore
the SME set presented to the user may change, and I've had to account
for that in in a few places.

I've referred to it internally as simply "ZT" as the kernel does in
NT_ARM_ZT, but the architecture refers to the specific register as "ZT0"
so that's what you'll see in lldb.

```
(lldb) register read -s 6
Scalable Matrix Extension Registers:
      svcr = 0x0000000000000000
       svg = 0x0000000000000004
        za = {0x00 <...> 0x00}
       zt0 = {0x00 <...> 0x00}
```
2023-11-01 10:40:25 +00:00
Vlad Serebrennikov
aaba3761db [clang][NFC] Refactor ObjCMethodDecl::ImplementationControl
This patch moves `ObjCMethodDecl::ImplementationControl` to a DeclBase.h so that it's complete at the point where corresponsing bit-field is declared. This patch also converts it to a scoped enum `clang::ObjCImplementationControl`.
2023-11-01 13:40:11 +03:00
Vlad Serebrennikov
b120fe8d32 [clang][NFC] Refactor ArgPassingKind
This patch moves `RecordDecl::ArgPassingKind` to DeclBase.h to namespace scope, so that it's complete at the time bit-field is declared.
2023-11-01 11:49:59 +03:00
Med Ismail Bennani
455098d807 Revert "[lldb/Target] Delay image loading after corefile process creation (#70351)"
This reverts commit 3c727a959d because it
introduced some test failures:

https://lab.llvm.org/buildbot/#/builders/68/builds/62638

```
********************
Failed Tests (5):
  lldb-api :: functionalities/postmortem/elf-core/TestLinuxCore.py
  lldb-api :: functionalities/postmortem/mach-core/TestMachCore.py
  lldb-api :: functionalities/postmortem/netbsd-core/TestNetBSDCore.py
  lldb-api :: functionalities/unwind/noreturn/module-end/TestNoReturnModuleEnd.py
  lldb-api :: tools/lldb-dap/coreFile/TestDAP_coreFile.py
```

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-31 20:35:25 -07:00
Med Ismail Bennani
3c727a959d
[lldb/Target] Delay image loading after corefile process creation (#70351) 2023-10-31 19:56:02 -07:00
Adrian Prantl
15733fe5f3
Also log the error output from xcrun, if it fails. (#70716)
In the rare case that an Xcode installation is damaged, this output
could contain clues to further diagnose the issue.

rdar://117698630
2023-10-31 15:36:06 -07:00
Tulio Magno Quites Machado Filho
2260ebf7b6
[lldb] Replace the usage of module imp with module importlib (#70443)
imp got removed in Python 3.12 [1] and the community recommends using
importlib in newer Python versions.

[1] https://docs.python.org/3.12/whatsnew/3.12.html#imp
2023-10-31 17:08:55 -03:00
Jason Molenda
d4026458d4
[LLDB] On AArch64, reconfigure register context first (#70742)
On an SVE/SME the register context configuration may change after the
inferior process has executed. This was handled via
https://reviews.llvm.org/D159504 but it is reconfiguring and clearing
the register context after we've parsed any expedited reigster values
from the stop reply packet. That results in lldb having to read each
register value one at a time while at that stop location, which will be
a performance problem on non-local debug setups.

The configuration & clearing needs to happen first. Also, update the
names of the local variables for a little clarity.
2023-10-31 15:38:42 +00:00
Vlad Serebrennikov
f5f4c5b313 [clang][NFC] Follow up to ArraySizeModifier refactoring
This addresses issues found by https://lab.llvm.org/buildbot/#/builders/68/builds/62599 introduced in d71ac4b05bcf2804368ec7217a13c2c47fce7479
2023-10-31 18:21:36 +03:00
Greg Clayton
7fbd427f5e
Add the ability to get a C++ vtable ValueObject from another ValueObj… (#67599)
Add the ability to get a C++ vtable ValueObject from another
ValueObject.

This patch adds the ability to ask a ValueObject for a ValueObject that
represents the virtual function table for a C++ class. If the
ValueObject is not a C++ class with a vtable, a valid ValueObject value
will be returned that contains an appropriate error. If it is successful
a valid ValueObject that represents vtable will be returned. The
ValueObject that is returned will have a name that matches the demangled
value for a C++ vtable mangled name like "vtable for <class-name>". It
will have N children, one for each virtual function pointer. Each
child's value is the function pointer itself, the summary is the
symbolication of this function pointer, and the type will be a valid
function pointer from the debug info if there is debug information
corresponding to the virtual function pointer.

The vtable SBValue will have the following:
- SBValue::GetName() returns "vtable for <class>"
- SBValue::GetValue() returns a string representation of the vtable
address
- SBValue::GetSummary() returns NULL
- SBValue::GetType() returns a type appropriate for a uintptr_t type for
the current process
- SBValue::GetLoadAddress() returns the address of the vtable adderess
- SBValue::GetValueAsUnsigned(...) returns the vtable address
- SBValue::GetNumChildren() returns the number of virtual function
pointers in the vtable
- SBValue::GetChildAtIndex(...) returns a SBValue that represents a
virtual function pointer

The child SBValue objects that represent a virtual function pointer has
the following values:
- SBValue::GetName() returns "[%u]" where %u is the vtable function
pointer index
- SBValue::GetValue() returns a string representation of the virtual
function pointer
- SBValue::GetSummary() returns a symbolicated respresentation of the
virtual function pointer
- SBValue::GetType() returns the function prototype type if there is
debug info, or a generic funtion prototype if there is no debug info
- SBValue::GetLoadAddress() returns the address of the virtual function
pointer
- SBValue::GetValueAsUnsigned(...) returns the virtual function pointer
- SBValue::GetNumChildren() returns 0
- SBValue::GetChildAtIndex(...) returns invalid SBValue for any index

Examples of using this API via python:

```
(lldb) script vtable = lldb.frame.FindVariable("shape_ptr").GetVTable()
(lldb) script vtable
vtable for Shape = 0x0000000100004088 {
  [0] = 0x0000000100003d20 a.out`Shape::~Shape() at main.cpp:3
  [1] = 0x0000000100003e4c a.out`Shape::~Shape() at main.cpp:3
  [2] = 0x0000000100003e7c a.out`Shape::area() at main.cpp:4
  [3] = 0x0000000100003e3c a.out`Shape::optional() at main.cpp:7
}
(lldb) script c = vtable.GetChildAtIndex(0)
(lldb) script c
(void ()) [0] = 0x0000000100003d20 a.out`Shape::~Shape() at main.cpp:3
```
2023-10-30 17:46:18 -07:00
Med Ismail Bennani
6eafe2cb7a Revert "[lldb] Make use of Scripted{Python,}Interface for ScriptedThreadPlan (#70392)"
This reverts commit 4b3cd379cc since it
introduces some test failures:

https://lab.llvm.org/buildbot/#/builders/68/builds/62556
2023-10-30 17:40:11 -07:00
Med Ismail Bennani
2b7ba0155d Revert "[lldb] Fix build failure introduced in 484038416d06 (NFC)"
This reverts commit ed5faa475b since it
introduces test failures:

https://lab.llvm.org/buildbot/#/builders/68/builds/62556
2023-10-30 17:38:36 -07:00
Med Ismail Bennani
ed5faa475b [lldb] Fix build failure introduced in 484038416d06 (NFC)
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-30 17:24:35 -07:00
Med Ismail Bennani
4b3cd379cc
[lldb] Make use of Scripted{Python,}Interface for ScriptedThreadPlan (#70392)
This patch makes ScriptedThreadPlan conforming to the ScriptedInterface
& ScriptedPythonInterface facilities by introducing 2
ScriptedThreadPlanInterface & ScriptedThreadPlanPythonInterface classes.

This allows us to get rid of every ScriptedThreadPlan-specific SWIG
method and re-use the same affordances as other scripting offordances,
like Scripted{Process,Thread,Platform} & OperatingSystem.

To do so, this adds new transformer methods for `ThreadPlan`, `Stream` &
`Event`, to allow the bijection between C++ objects and their python
counterparts.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-30 16:52:17 -07:00
Med Ismail Bennani
8a786be384
[lldb] Fix misleading indentiation warning in ScriptInterpreterPython (NFC) (#70732)
This should silence the "misleading indentiation" warnings introduced by
b2929be, by adding an no-op if-statement, if the surrounding
if-statement have been compiled out.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-30 16:29:46 -07:00
Pete Lawrence
92d8a28cc6
[lldb] Part 2 of 2 - Refactor CommandObject::DoExecute(...) return void (not bool) (#69991)
[lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` to return
`void` instead of ~~`bool`~~

Justifications:
- The code doesn't ultimately apply the `true`/`false` return values.
- The methods already pass around a `CommandReturnObject`, typically
with a `result` parameter.
- Each command return object already contains:
	- A more precise status
	- The error code(s) that apply to that status

Part 1 refactors the `CommandObject::Execute(...)` method.
- See
[https://github.com/llvm/llvm-project/pull/69989](https://github.com/llvm/llvm-project/pull/69989)

rdar://117378957
2023-10-30 13:21:00 -07:00
Michael Buch
c3f7ca7810
[lldb][Test] TestDataFormatterLibcxxChrono.py: skip test on older clang versions (#70544)
These tests were failing on the LLDB public matrix build-bots for older
clang versions:
```
clang-7: warning: argument unused during compilation: '-nostdlib++' [-Wunused-command-line-argument]
error: invalid value 'c++20' in '-std=c++20'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard
make: *** [main.o] Error 1
```

The test fails because we try to compile it with `-std=c++20` (which is
required for std::chrono::{days,weeks,months,years}) on clang versions
that don't support the `-std=c++20` flag.

We could change the test to conditionally compile the C++20 parts of the
test based on the `-std=` flag and have two versions of the python
tests, one for the C++11 chrono features and one for the C++20 features.

This patch instead just disables the test on older clang versions
(because it's simpler and we don't really lose important coverage).
2023-10-30 17:08:25 +00:00
Adrian Prantl
c42b640208
Fix the DEVELOPER_DIR computation (#70528)
The code was incorrectly going into the wrong direction by removing one
component instead of appendeing /Developer to it. Due to fallback
mechanisms in xcrun this never seemed to have caused any issues.
2023-10-30 10:00:40 -07:00
David Spickett
bb9dced2d3
[lldb][AArch64][Linux] Rename Is<ext>Enabled to Is<ext>Present (#70303)
For most register sets, if it was enabled this meant you could use it,
it was present in the process. There was no present but turned off
state. So "enabled" made sense.

Then ZA came along (and soon to be ZT0) where ZA can be present in the
hardware when you have SME, but ZA itself can be made inactive. This
means that "IsZAEnabled()" doesn't mean is it active, it means do you
have SME. Which is very confusing when we actually want to know if ZA is
active.

So instead say "IsZAPresent", to make these checks more specific. For
things that can't be made inactive, present will imply "active" as
they're never inactive.
2023-10-30 15:45:40 +00:00
Tulio Magno Quites Machado Filho
b2929bebb6
[lldb] Adapt code to Python 3.13 (#70445)
1. Remove usage of PyEval_ThreadsInitialized and PyEval_InitThreads

Both of these functions were removed in Python 3.13 [1] after being
deprecated since Python 3.9.

According to "What's new in Python 3.13" document [1]:

    Since Python 3.7, Py_Initialize() always creates the GIL: calling
    PyEval_InitThreads() did nothing and PyEval_ThreadsInitialized()
    always returned non-zero.

2. Replace _Py_IsFinalizing() with Py_IsFinalizing().

[1] https://docs.python.org/3.13/whatsnew/3.13.html
2023-10-30 08:55:34 -03:00
Sergei Barannikov
4e4433f629
[lldb] Remove some declarations without definitions (#70514)
The corresponding definitions were removed in 7dcbe3d3 and 2a8fa2a8.
Also remove a couple of variables made dead by those changes.
2023-10-28 02:33:50 +03:00
Jonas Devlieghere
d3cbf9fb64
[lldb] Add logging to ObjectFileMachO::ParseSymtab (#70490)
I have a crash when parsing the dyld trie data and I want to ask the
originator to send me the (possibly corrupted) binary that's causing
this. This patch adds some logging to help pinpoint that file.
2023-10-27 14:50:21 -07:00
Med Ismail Bennani
11b3b3834c [lldb] Make ScriptedInterface::CreateObjectPlugin less strict
This patches changes the implementation of `CreateObjectPlugin` in the
various base ScriptedInterface classes, to return an `UnimplementedError`
instead of triggering an assertion.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-27 11:58:59 -07:00
David Spickett
d8003d021b [lldb][lldb-dap] Remove extra spaces at the end of --help examples 2023-10-27 15:35:15 +00:00
David Spickett
02ef12dd80 [lldb] Return unimplemented error from ScriptedProcessInterface::CreatePluginObject
After https://github.com/llvm/llvm-project/pull/68052 this function changed from returning
a nullptr with `return {};` to returning Expected and hitting `llvm_unreachable` before it could
do so.

I gather that we're never supposed to call this function, but on Windows we actually do call
this function because `interpreter->CreateScriptedProcessInterface()` returns
`ScriptedProcessInterface` not `ScriptedProcessPythonInterface`. Likely because
`target_sp->GetDebugger().GetScriptInterpreter()` also does not return a Python related class.

The previously XFAILed test crashed with:
```
 # .---command stderr------------
 # | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
 # | Stack dump:
 # | 0.  Program arguments: c:\\users\\tcwg\\david.spickett\\build-llvm\\bin\\lldb-test.exe ir-memory-map C:\\Users\\tcwg\\david.spickett\\build-llvm\\tools\\lldb\\test\\Shell\\Expr\\Output\\TestIRMemoryMapWindows.test.tmp C:\\Users\\tcwg\\david.spickett\\llvm-project\\lldb\\test\\Shell\\Expr/Inputs/ir-memory-map-basic
 # | 1.  HandleCommand(command = "run")
 # | Exception Code: 0xC000001D
 # | #0 0x00007ff696b5f588 lldb_private::ScriptedProcessInterface::CreatePluginObject(class llvm::StringRef, class lldb_private::ExecutionContext &, class std::shared_ptr<class lldb_private::StructuredData::Dictionary>, class lldb_private::StructuredData::Generic *) C:\Users\tcwg\david.spickett\llvm-project\lldb\include\lldb\Interpreter\Interfaces\ScriptedProcessInterface.h:28:0
 # | #1 0x00007ff696b1d808 llvm::Expected<std::shared_ptr<lldb_private::StructuredData::Generic> >::operator bool C:\Users\tcwg\david.spickett\llvm-project\llvm\include\llvm\Support\Error.h:567:0
 # | #2 0x00007ff696b1d808 lldb_private::ScriptedProcess::ScriptedProcess(class std::shared_ptr<class lldb_private::Target>, class std::shared_ptr<class lldb_private::Listener>, class lldb_private::ScriptedMetadata const &, class lldb_private::Status &) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Plugins\Process\scripted\ScriptedProcess.cpp:115:0
 # | #3 0x00007ff696b1d124 std::shared_ptr<lldb_private::ScriptedProcess>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1478:0
 # | #4 0x00007ff696b1d124 lldb_private::ScriptedProcess::CreateInstance(class std::shared_ptr<class lldb_private::Target>, class std::shared_ptr<class lldb_private::Listener>, class lldb_private::FileSpec const *, bool) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Plugins\Process\scripted\ScriptedProcess.cpp:61:0
 # | #5 0x00007ff69699c8f4 std::_Ptr_base<lldb_private::Process>::_Move_construct_from C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1237:0
 # | #6 0x00007ff69699c8f4 std::shared_ptr<lldb_private::Process>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1534:0
 # | #7 0x00007ff69699c8f4 std::shared_ptr<lldb_private::Process>::operator= C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1594:0
 # | #8 0x00007ff69699c8f4 lldb_private::Process::FindPlugin(class std::shared_ptr<class lldb_private::Target>, class llvm::StringRef, class std::shared_ptr<class lldb_private::Listener>, class lldb_private::FileSpec const *, bool) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Target\Process.cpp:396:0
 # | #9 0x00007ff6969bd708 std::_Ptr_base<lldb_private::Process>::_Move_construct_from C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1237:0
 # | #10 0x00007ff6969bd708 std::shared_ptr<lldb_private::Process>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1534:0
 # | #11 0x00007ff6969bd708 std::shared_ptr<lldb_private::Process>::operator= C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1594:0
 # | #12 0x00007ff6969bd708 lldb_private::Target::CreateProcess(class std::shared_ptr<class lldb_private::Listener>, class llvm::StringRef, class lldb_private::FileSpec const *, bool) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Target\Target.cpp:215:0
 # | #13 0x00007ff696b13af0 std::_Ptr_base<lldb_private::Process>::_Ptr_base C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1230:0
 # | #14 0x00007ff696b13af0 std::shared_ptr<lldb_private::Process>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1524:0
 # | #15 0x00007ff696b13af0 lldb_private::PlatformWindows::DebugProcess(class lldb_private::ProcessLaunchInfo &, class lldb_private::Debugger &, class lldb_private::Target &, class lldb_private::Status &) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Plugins\Platform\Windows\PlatformWindows.cpp:495:0
 # | #16 0x00007ff6969cf590 std::_Ptr_base<lldb_private::Process>::_Move_construct_from C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1237:0
 # | #17 0x00007ff6969cf590 std::shared_ptr<lldb_private::Process>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1534:0
 # | #18 0x00007ff6969cf590 std::shared_ptr<lldb_private::Process>::operator= C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1594:0
 # | #19 0x00007ff6969cf590 lldb_private::Target::Launch(class lldb_private::ProcessLaunchInfo &, class lldb_private::Stream *) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Target\Target.cpp:3274:0
 # | #20 0x00007ff696fff82c CommandObjectProcessLaunch::DoExecute(class lldb_private::Args &, class lldb_private::CommandReturnObject &) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Commands\CommandObjectProcess.cpp:258:0
 # | #21 0x00007ff696fab6c0 lldb_private::CommandObjectParsed::Execute(char const *, class lldb_private::CommandReturnObject &) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Interpreter\CommandObject.cpp:751:0
 # `-----------------------------
 # error: command failed with exit status: 0xc000001d
```

That might be a bug on the Windows side, or an artifact of how our build is setup,
but whatever it is, having `CreatePluginObject` return an error and
the caller check it, fixes the failing test.

The built lldb can run the script command to use Python, but I'm not sure if that means
anything.
2023-10-27 11:24:03 +00:00
Med Ismail Bennani
4ec9cda656 [lldb/test] Fix failures following ec456ba9ca
This patch fixes the various crashlog test failures following
ec456ba9ca, which renamed the process member variable in the Scripted
Thread python base class.

This patch updates the crashlog scripted process implementation to
reflect that change.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-26 21:21:54 -07:00
Med Ismail Bennani
ec456ba9ca [lldb] Add OperatingSystem base class to the lldb python module
This patch introduces an `OperatingSystem` base implementation in the
`lldb` python module to make it easier for lldb users to write their own
implementation.

The `OperatingSystem` base implementation is derived itself from the
`ScriptedThread` base implementation since they share some common grounds.

To achieve that, this patch makes changes to the `ScriptedThread`
initializer since it gets called by the `OperatingSystem` initializer.

I also took the opportunity to document the `OperatingSystem` base
class and methods.

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-26 15:12:22 -07:00
Med Ismail Bennani
7a1e878358 [lldb] Introduce OperatingSystem{,Python}Interface and make use it
This patch aims to consolidate the OperatingSystem scripting affordance
by introducing a stable interface that conforms to the
Scripted{,Python}Interface.

This unify the way we call into python methods from lldb while
also improving its capabilities by allowing us to pass lldb_private
objects are arguments.

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-26 15:12:22 -07:00
David Spickett
45ccc1666c [lldb][test][Windows] XFAIL IR memory map test
Since https://github.com/llvm/llvm-project/pull/68052 this has been failing.

https://lab.llvm.org/buildbot/#/builders/219/builds/6545

Follow up changes have not fixed it, XFAIL while I debug it.
2023-10-26 16:17:14 +00:00
Nico Weber
53096f910c [lldb] Try to fix build after d1556e5efb
Getting lots of `error: unknown type name 'uint64_t'` and `uint32_t`
in this file on Linux.
2023-10-26 07:37:42 -07:00
David Spickett
d1556e5efb
[lldb][lldb-server] Enable sending RegisterFlags as XML (#69951)
This adds ToXML methods to encode RegisterFlags and its fields into XML
according to GDB's target XML format:

https://sourceware.org/gdb/onlinedocs/gdb/Target-Description-Format.html#Target-Description-Format

lldb-server does not use libXML to build XML, so this follows the
existing code that uses strings. Indentation is used so the result is
still human readable.

```
<flags id=\"Foo\" size=\"4\">
  <field name=\"abc\" start=\"0\" end=\"0\"/>
</flags>
```

This is used by lldb-server when building target XML, though no one sets
any fields yet. That'll come in a later commit.
2023-10-26 08:33:30 +01:00
Med Ismail Bennani
2abf997f82 [lldb] Fix assertions caused by un-checked errors in ScriptedProcess
This patch should fix some assertion that started getting hit after f22d82c.

That commit changed the scripted object plugin creation to use
`llvm::Expected<T>` as a return type to enforce error handling, however
I forgot to handle the error which caused the assert.

The interesting  part about this, is that since that assert was triggered
in the ScriptedProcess constructor (where the `llvm::Error` wasn't
handled), that impacted every test that launched any kind of process,
since the process plugin manager would eventually also iterate over the
`ScriptedProcess::Create` factory method.

This patch should fix the assertions by handling the errors.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-25 17:31:02 -07:00
Adrian Prantl
b82c629786 Fix log format strings 2023-10-25 16:42:37 -07:00
Jonas Devlieghere
dfa357026b
[lldb] Add test dependency on the runtimes instead of the cxx target
Instead of adding individual dependencies on the enabled runtimes, make
the `lldb-test-depends` target depend on the `runtimes` target. The
`cxx` target broke after 0fc8f0b.
2023-10-25 16:03:51 -07:00
Pete Lawrence
463a02bc22
[lldb] Part 1 of 2 - Refactor CommandObject::Execute(...) return void (not bool) (#69989)
[lldb] Part 1 of 2 - Refactor `CommandObject::Execute(...)` to return
`void` instead of ~~`bool`~~

Justifications:
- The code doesn't ultimately apply the `true`/`false` return values.
- The methods already pass around a `CommandReturnObject`, typically
with a `result` parameter.
- Each command return object already contains:
	- A more precise status
	- The error code(s) that apply to that status

Part 2 refactors the `CommandObject::DoExecute(...)` method.
- See
[https://github.com/llvm/llvm-project/pull/69991](https://github.com/llvm/llvm-project/pull/69991)

rdar://117378957
2023-10-25 15:55:27 -07:00
Walter Erquinigo
10508b6db7
[LLDB][NFC] Remove DWARFASTParserClang as friend from SymbolFileDWARF (#70157)
This effectively moves a few functions from protected to public. In any
case, for the sake of having a cleaner SymbolFileDWARF API, it's better
if it's not a friend of a one of its consumers, DWARFASTParserClang.
Another effect of this change is that I can use SymbolFileDWARF for the
out-of-tree mojo dwarf parser, which relies on pretty much the same
functions that DWARFASTParserClang needs from SymbolFileDWARF.
2023-10-25 18:04:25 -04:00
Usama Hameed
77edd9b773
[lldb] Refactor InstrumentationRuntimeAsan and add a new plugin (#69388)
[lldb] Refactor InstrumentationRuntimeAsan and add a new plugin
InstrumentationRuntimeLibsanitizers.

This commit refactors InstrumentationRuntimeASan by pulling out reusable
code into a separate ReportRetriever class. The purpose of the
refactoring is to allow reuse of the ReportRetriever class in another
plugin.

The commit also adds InstrumentationRuntimeASanLibsanitizers, a new runtime
plugin for ASan. The plugin provides the same
functionality as InstrumentationRuntimeASan, but provides a different
set of symbols/library names to search for while activating the plugin.

rdar://112491689
2023-10-25 12:52:52 -07:00
jeffreytan81
d4e6e40337
Improve debug names index fetching global variables performance (#70231)
While using dwarf5 `.debug_names` in internal large targets, we noticed
a performance issue (around 10 seconds delay) while `lldb-vscode` tries
to show `scopes` for a compile unit. Profiling shows the bottleneck is
inside `DebugNamesDWARFIndex::GetGlobalVariables` which linearly search
all index entries belongs to a compile unit.

This patch improves the performance by using the compile units list to
filter first before checking index entries. This significantly improves
the performance (drops from 10 seconds => under 1 second) in the split
dwarf situation because each compile unit has its own named index.

---------

Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2023-10-25 11:46:11 -07:00
Mark de Wever
0e4264ab1e [lldb][libc++] Adds chrono data formatters.
This adds the data formatters for chrono duration typedefs.

Reviewed By: Michael137

Differential Revision: https://reviews.llvm.org/D159127
2023-10-25 19:36:47 +02:00
Med Ismail Bennani
7b8e686115 [lldb] Fix build failure introduced by f22d82c
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-25 10:31:43 -07:00
Med Ismail Bennani
f22d82cef2
[lldb/Interpreter] Make ScriptedInterface Object creation more generic (#68052)
This patch changes the way plugin objects used with Scripted Interfaces
are created.

Instead of implementing a different SWIG method to create the object for
every scripted interface, this patch makes the creation more generic by
re-using some of the ScriptedPythonInterface templated Dispatch code.

This patch also improves error handling of the object creation by
returning an `llvm::Expected`.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-25 10:05:54 -07:00
David Spickett
42c25fddcb [lldb][docs][AArch64] Update example in SME docs
This output has now changed because I moved the za register
into the main SME register set.
2023-10-25 13:12:37 +00:00
David Spickett
dddd0c2501 [lldb][AArch64] Simplify AArch64SMEFA64 check
So we only have to read cpuinfo once.
2023-10-25 11:19:37 +01:00
David Spickett
ff67b68e43
[lldb] On POSIX, check for duplicate interpreter modules without loading them (#69932)
Fixes #68987

Early on we load the interpreter (most commonly ld-linux) in
LoadInterpreterModule. Then later when we get the first DYLD rendezvous
we get a list of libraries that commonly includes ld-linux again.

Previously we would load this duplicate, see that it was a duplicate,
and unload it.

Problem was that this unloaded the section information of the first copy
of ld-linux. On platforms where you can place a breakpoint using only an
address, this wasn't an issue.

On ARM you have ARM and Thumb modes. We must know which one the section
we're breaking in is, otherwise we'll go there in the wrong mode and
SIGILL. This happened on ARM when lldb tried to call mmap during
expression evaluation.

To fix this, I am making the assumption that the base address we see in
the module prior to loading can be compared with what we know the
interpreter base address is. Then we don't have to load the module to
know we can ignore it.

This fixes the lldb test suite on Ubuntu versions where
https://bugs.launchpad.net/ubuntu/+source/gdb/+bug/1927192 has been
fixed. Which was recently done on Jammy.
2023-10-25 10:12:45 +01:00
David Spickett
e7012ba8d3
[lldb][AArch64] Add isAArch64SMEFA64 check to SME testing (#68094)
FEAT_SME_FA64 (smefa64 in Linux cpuinfo) allows the use of the full A64
instruction set while in streaming SVE mode.

See https://developer.arm.com/documentation/ddi0616/latest/ for details.

This means for example if we want to write to the ffr register during or
use floating point registers while in streaming mode, we need this
extension.

I initially was using QEMU which has it by default, and switched to
Arm's FVP which does not. So this change adds a more strict check and
converts most of the tests to use that. It would be possible in some
cases to avoid the offending instructions but it would be a lot of
effort and liable to fail randomly as the C library changes.

It is also my assumption that the majority of systems will have smefa64
as QEMU has chosen to have. If I turn out to be wrong, we can make the
effort to get the tests working without smefa64.

`isAArch64SME` remains for some tests, which are as follows:
* `test_aarch64_dynamic_regset_config` merely checks for the presence of
a register set, which appears for any SME system not just one with
smefa64.
* `test_aarch64_dynamic_regset_config_sme_za_disabled` only needs the ZA
register and does not enter streaming mode.
* `test_sme_not_present` tests for the absence of the SME register set,
so must be skipped if any form of SME is present.
* Various tests in `TestSVERegisters.py` need to know if SME is present
at all to generate an expected SVCR value. Earlier in the callstack
something else checked `isAArch64SMEFA64` already.
* `TestAArch64LinuxTLSRegisters.py` needs to test the `tpidr2` register
if any form of SME is present. msr/mrs instructions are used to do this
and are allowed even if smefa64 is not present.
2023-10-25 09:56:00 +01:00
David Spickett
d8abce1181
[lldb][AArch64] Read mte_ctrl register from core files (#69689)
This register reports the configuration of the AArch64 Linux tagged
address ABI, part of which is the memory tagging (MTE) settings.

It will always be present in core files because even without MTE, there
are parts of the tagged address ABI that can be configured (these parts
use the Top Byte Ignore feature).

I missed adding this when I previously worked on MTE support. Until now
you could read memory tags from a core file but not this register.
2023-10-25 09:54:34 +01:00
David Spickett
1d10369f53 Reland "[lldb][AArch64] Invalidate SVG prior to reconfiguring ZA regdef (#66768)""
This reverts commit 8d80a452b8.

The pointer to the invalidates lists needs to be non-const. Though in this case
I don't think it's ever modified.

Also I realised that the invalidate list was being set on svg not vg.
Should be the other way around.
2023-10-25 08:40:17 +00:00
David Spickett
8d80a452b8 Revert "[lldb][AArch64] Invalidate SVG prior to reconfiguring ZA regdef (#66768)"
This reverts commit f2c09e5e16, due to compilation
failures on buildbots.
2023-10-25 08:27:27 +00:00
David Spickett
f2c09e5e16
[lldb][AArch64] Invalidate SVG prior to reconfiguring ZA regdef (#66768)
This fixes a bug where writing vg during streaming mode
could prevent you reading za directly afterwards.

vg is invalidated just prior to us reading it in AArch64Reconfigure,
but svg was not. This lead to some situations where vg would be
updated or cleared and re-read, but svg would not be.

This meant it had some undefined value which lead to errors
that prevented us reading ZA. Likely we received a lot more
data than we were expecting.

There are at least 2 ways to get into this situation:
* Explicit write by the user to vg.
* We have just stopped and need to get the potentially new svg and vg.

The first is handled by invalidating svg client side before fetching the
new one. This also
covers some but not all of the second scenario. For the second, I've
made writes to vg
invalidate svg by noting this in the register information.

Whichever one of those kicks in, we'll get the latest value of svg.

The bug may depend on timing, I could not find a consistent way
to trigger it. I originally found it when checking whether za
is disabled after a vg change, so I've added checks for that
to TestZAThreadedDynamic.

The SVE VG version of the bug did show up on the buildbot,
but not consistently. So it's possible that TestZAThreadedDynamic
does in fact cover this, but I haven't run it enough times to know.
2023-10-25 09:16:58 +01:00
David Spickett
a770098557
[lldb][AArch64] Correct type of 32 bit GPR RegisterValues when using core files (#70054)
As ReadRegister always read into a uint64_t, when it called operator=
with uint64_t it was setting the RegisterValue's type to eTypeUInt64
regardless of its size.

This mostly works because most registers are 64 bit, and very few bits
of code rely on the type being correct. However, cpsr, fpsr and fpcr are
in fact 32 bit, and my upcoming register fields code relies on this type
being correct.

Which is how I found this bug and unfortunately is the only way to test
it. As RegisterValue::Type never makes it out via the API anywhere. So
this change will be tested once I start adding register field
information.
2023-10-25 09:08:01 +01:00
Walter Erquinigo
10664813fc
[lldb-vscode] Allow specifying a custom escape prefix for LLDB commands (#69238)
We've been using the backtick as our escape character, however that
leads to a weird experience on VS Code, because on most hosts, as soon
as you type the backtick on VS Code, the IDE will introduce another
backtick. As changing the default escape character might be out of
question because other plugins might rely on it, we can instead
introduce an option to change this variable upon lldb-vscode
initialization.
FWIW, my users will be using : instead ot the backtick.
2023-10-25 00:05:54 -04:00
Adrian Prantl
49504674db
Expose DWARFDIE::GetDeclContext() in lldb_private::Function. (#69981)
I need this API in the Swift plugin, but it seems generally useful
enough to expose it in the main branch.
2023-10-24 10:55:23 -07:00
Augusto Noronha
e3476f68af
[lldb][gardening] Remove full name of "DWARFDIE" type in GetTypeForDIE (#70062)
When moving the GetTypeForDIE function from DWARFASTParserClang to
DWARFASTParser, I kept the signature as-is. To match the rest of the
function signatures in DWARFASTParser, remove the full name
(lldb_private::plugin::dwarf::DWARFDIE -> DWARFDIE) in the signature of
DWARFASTParser::GetTypeForDIE.
2023-10-24 09:49:08 -07:00
Augusto Noronha
3b89794304
Reintroduce accidentally deleted "protected" keyword in SymbolFileDWARF (#69990)
The "protected" was accidentally removed during refactoring of
SymbolFileDWARF. Reintroduce it and also make DWARFASTParser a friend
class since 040c4f4d98f3306e068521e3c218bdbc170f81f3 was merged and
won't build without it, as it dependeds on a method which was made
public by accident.
2023-10-24 09:27:08 -07:00
jeffreytan81
00d3ed6dea
[Reland] Detect against invalid variant index for LibStdC++ std::variant data formatters (#69614)
This is relanding of https://github.com/llvm/llvm-project/pull/69253.
`TestTemplatePackArgs.py` is passing now.

https://github.com/llvm/llvm-project/pull/68012/files added new data
formatters for LibStdC++ std::variant.

However, this formatter can crash if std::variant's index field has
invalid value (exceeds the number of template arguments).
This can happen if the current IP stops at a place std::variant is not
initialized yet.

This patch fixes the crash by ensuring the index is a valid value and
fix GetNthTemplateArgument() to make sure it is not crashing.

Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2023-10-24 08:44:34 -07:00
David Spickett
febc4ff74a [lldb][AArch64][NFC] Fix typo in get trap handler function 2023-10-24 10:36:20 +00:00
David Spickett
2325b3cfda [lldb] Add test for reserved XML chars in register field names
Replacements like &amp; were already handled by libXML but we have
no tests to confirm that, this adds some.
2023-10-24 09:39:44 +00:00
Augusto Noronha
e6b3a2753b
[lldb][NFC] Move DWARFASTParserClang::GetTypeForDIE to DWARFASTParser (#69764) 2023-10-23 17:22:16 -07:00
Augusto Noronha
e45356910f
[lldb][NFC] Remote reference to Swift in DWARFASTParser::Kind enum (#69984) 2023-10-23 16:37:45 -07:00
Augusto Noronha
61c4ee9449
[lldb][NFC] Implement llvm-style RTTI for DWARFASTParser (#69762) 2023-10-23 16:25:18 -07:00
Jonas Devlieghere
83a6b02c3d
[lldb] Move comments and add missing periods (NFC)
Move comments to the line before the member variables and add missing
periods.
2023-10-23 15:29:01 -07:00
Aiden Grossman
2f15082b15
[LLDB] Update docs on building documentation (#69858)
This patch updates the documentation to match recent changes and make it
more clear. More specifically, the process for installing sphinx has
changed with the transition to myst with the requirements.txt in
llvm/docs being the preferred method for installation now. In addition,
the docs-lldb-html target is never generated if swig isn't installed, so
having something expliti in the documentation section (even if it is
mentioned as a dependency of lldb itself above) probably doesn't hurt.
2023-10-23 12:59:39 -07:00
David Spickett
aab0626c2e
[lldb][docs] Update contributing links (#69726)
Patches now go to PRs, mention the Discord server as well as the forum.
2023-10-23 18:20:27 +01:00
David Spickett
fe929770f4
[lldb] Add a single bit constructor for RegisterFlags::Field (#69315)
This means you don't have to do RegisterField("", 0, 0), you can do
RegisterField("", 0).

Which is useful for testing and even more useful when we are writing
definitions of real registers which have 10s of single bit fields.
2023-10-23 18:16:03 +01:00
Med Ismail Bennani
6bff2d51dc [lldb] Move template python files to separate directory
This patch moves the template files for the various scripting
affordances to a separate directory.

This is a preparatory work for upcoming improvements and consolidations
to other scripting affordances.

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-23 09:51:25 -07:00
Med Ismail Bennani
77374d3b53 [lldb] Move ScriptInterpreter Interfaces to subdirectory (NFC)
As we're consolidating and  streamlining the various scripting
affordances of lldb, we keep creating new interface files.

This patch groups all the current interface files into a separate sub
directory called `Interfaces` both in the core `Interpreter` directory
and the `ScriptInterpreter` plugin directory.

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-10-23 09:51:01 -07:00
David Spickett
70306238cf [lldb][docs] Add strace example to Debugging doc
This has been very useful lately debugging remote
connections. In some cases it's probably better
than our own logging.
2023-10-23 17:04:34 +01:00
Kazu Hirata
66a797102d [lldb] Use llvm::is_contained (NFC) 2023-10-22 21:18:25 -07:00
cmtice
efb0e9c0bd
[LLDB] Update breakpoint-command.test to use string instead of number. (#69796)
lldb/test/Shell/Breakpoint/breakpoint-command.test adds a python
command, to be executed when a breakpoint hits, that writes out a
number. It then runs, hits the breakpoint and checks that the number is
present exactly once.

The problem is that on some systems the test can be run in a filepath
that happens to contain the number (e.g. auto-generated directory
names). The number is then detected multiple times and the test fails.

This patch fixes the issue by using a string instead, particularly a
string with spaces, which is very unlikely to be auto-generated by any
system.
2023-10-22 15:42:55 -07:00
Kazu Hirata
aaa5f34b61 [lldb] Remove an unused using decl (NFC) 2023-10-22 11:57:23 -07:00
Tom Yang
74ca07295f
[lldb] improve dwo path in missing dwo error when relative (#69783)
When the debug info refers to a dwo with relative `DW_AT_comp_dir` and
`DW_AT_dwo_name`, we only print the `DW_AT_comp_dir` in our error
message if we can't find it. This often isn't very helpful, especially
when the `DW_AT_comp_dir` is ".":
```
(lldb) fr v
error: unable to locate .dwo debug file "." for skeleton DIE 0x000000000000003c
```

I'm updating the error message to include both `DW_AT_comp_dir` (if it
exists) and `DW_AT_dwo_name` when the `DW_AT_dwo_name` is relative. The
behavior when `DW_AT_dwo_name` is absolute should be the same.
2023-10-21 16:59:44 -07:00
Jason Molenda
ed0bb9476c
[lldb] Update qRegisterInfo docs to recommend target.xml (#69853)
Before target.xml, lldb had its own method for querying the remote stub
of the registers it supports, qRegisterInfo. The gdb standard method of
using a target.xml file to describe the available registers has become
commonplace, and the lldb method for doing this is no longer needed.

Stubs should describe their registers to lldb, but it should be with the
target.xml file.
2023-10-21 11:58:29 -07:00
Dave Lee
3b5d59ab55
[lldb][test] Turn ObjC string literals to C-style literals (NFC) (#69793)
The underlying timezone classes are being reimplemented in Swift, and these 
strings will be Swift strings, without the ObjC `@` prefix. Leaving off the `@` 
makes these tests usable both before and after the reimplmentation of 
Foundation in Swift.
2023-10-20 19:24:53 -07:00
David Spickett
2a32afddf5
[lldb] Remove more references to lldb-vscode (#69696)
There are some uses of "vscode" in
`lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py` where
I'm not sure if it's referring to the adapter or VS Code itself, so
those remain.
2023-10-20 15:08:37 +01:00
David Spickett
bb826951dc
[lldb][AArch64] Add release notes and documentation for SME (#66767)
This adds a release note for all the SME support now in LLDB and a page
where I have documented the user experience (for want of a better term)
when using SVE and SME.

This includes things like which mode transitions can or cannot be
triggered from within LLDB. I hope this will serve to A: document what
I've implemented and B: be a user's guide to these extensions.

(though it is not a design document, read the commits and code for that
sort of detail)
2023-10-20 14:06:06 +01:00
Kazu Hirata
6e3572ccd8 [lldb] Use llvm::erase_if (NFC) 2023-10-20 00:20:30 -07:00
Jonas Devlieghere
969ba9ff14
[lldb] Remove FileSpecList::GetFilesMatchingPartialPath (NFC)
This function is unused and unimplemented.
2023-10-19 15:17:36 -07:00
Felipe de Azevedo Piovezan
ea9e116e5a
[lldb][NFCI] Remove duplicated code in DWARFParser (#69531)
The method DWARFDebugInfoEntry::Extract needs to skip over all the data
in the debug_info / debug_types section for each DIE. It had the logic
to do so hardcoded inside a loop, when it already exists in a neatly
isolated function.
2023-10-19 14:10:31 -07:00
Jonas Devlieghere
f9632cee30
[lldb] Remove FileSpecList::GetFileSpecPointerAtIndex (NFC)
There's only one use and it eventually converts the pointer into a
reference. Simplify things and always use references.
2023-10-19 13:13:31 -07:00
Jonas Devlieghere
5bae3a0b0c
[lldb] Remove CompileUnit::SetSupportFiles overload (NFC)
CompileUnit::SetSupportFiles had two overloads, one that took and lvalue
reference and one that takes an rvalue reference. This removes both and
replaces it with an overload that takes the FileSpecList by value and
moves it into the member variable.

Because we're storing the value as a member, this covers both cases. If
the new FileSpecList was passed by lvalue reference, we'd copy it into
the member anyway. If it was passed as an rvalue reference, we'll have
created a new instance using its move and then immediately move it again
into our member. In either case the number of copies remains unchanged.
2023-10-19 11:14:25 -07:00
Jonas Devlieghere
bd21efe24c
[lldb] Fix ASCII art in CommandObjectSource.h (NFC) 2023-10-19 10:30:38 -07:00
Jonas Devlieghere
01263c6c6f
[lldb] Rename lldb-vscode to lldb-dap (#69264)
Rename lldb-vscode to lldb-dap. This change is largely mechanical. The
following substitutions cover the majority of the changes in this
commit:

  s/VSCODE/DAP/
  s/VSCode/DAP/
  s/vscode/dap/
  s/g_vsc/g_dap/

Discourse RFC:
https://discourse.llvm.org/t/rfc-rename-lldb-vscode-to-lldb-dap/74075/
2023-10-19 09:48:54 -07:00
Harmen Stoppels
0a9bdc276d
[lldb] Fix linking to libtinfo (#69458)
LLVM detects when ncurses has a separate terminfo library, but linking to it
was broken in lldb since b66339575a (LLVM14)
due to a change of variables. This commit fixes that oversight.
2023-10-18 16:06:50 +01:00
David Spickett
0dca56603b Revert "Detect against invalid variant index for LibStdC++ std::variant data formatters (#69253)"
This reverts commit 659a48f25a.

This caused another test to fail on Windows AArch64 and x86_64, and AArch64 Linux.
2023-10-18 10:25:41 +00:00
jeffreytan81
659a48f25a
Detect against invalid variant index for LibStdC++ std::variant data formatters (#69253)
https://github.com/llvm/llvm-project/pull/68012/files added new data
formatters for LibStdC++ std::variant.

However, this formatter can crash if std::variant's index field has
invalid value (exceeds the number of template arguments).
This can happen if the current IP stops at a place std::variant is not
initialized yet.

This patch fixes the crash by ensuring the index is a valid value.

---------

Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2023-10-17 17:26:05 -07:00
walter erquinigo
7d1bf1c5cf [LLDB][NFC] Move some constructors to their cpp file
CompilerType constructors rely on the NDEBUG macro, so it's better to move them to their cpp file so that the header doesn't get confused when this macro is used differently for other compilation units.
2023-10-17 18:50:18 -04:00
Alex Langford
170b552136
[lldb] Scalar::GetValue() should take a Stream by reference (#69231)
This function always expects the pointer to be valid, a reference seems
more appropriate.
2023-10-17 15:40:51 -07:00
walter erquinigo
59908504cd [LLDB][NFC] Add a missing namespace
This adds back a namespace to the value of a #define statement. This is needed to prevent collision with other types with the same name.
2023-10-17 18:15:29 -04:00
David Spickett
4606712ef5
[lldb][lldb-vscode] Add example configuration for connecting to a remote gdbserver (#68866)
This can be used to have VS Code debug various emulators, remote
systems, hardware probes, etc.

In my case I was doing this for the Gameboy Advance,
https://github.com/stuij/gba-llvm-devkit/blob/main/docs/Debugging.md#debugging-using-visual-studio-code.

It's not very complex if you know LLDB well, but when using another
plugin, CodeLLDB, I was very glad that they had an example for it. So we
should have one too.
2023-10-17 09:01:07 +01:00
David Spickett
3b23704f16 [lldb][PDB] Fix test build after plugin namespace change
This was failing to build on Windows after 1673a1ba5d.
2023-10-16 10:23:45 +00:00
David Spickett
17fce28683 [lldb][DYLD][NFC] Dedupe calls to CreateBreakpoint
These only differ in the modules passed to them. Also I've
swapped the if order so we have the "positive" check first.
2023-10-16 10:15:46 +00:00
Vlad Serebrennikov
93229c7bfd
[lldb] Add SBType::FindDirectNestedType() function (#68705)
This patch adds a `SBType::FindDirectNestedType(name)` function which performs a non-recursive search in given class for a type with specified name. The intent is to perform a fast search in debug info, so that it can be used in formatters, and let them remain responsive.

This is driven by my work on formatters for Clang and LLVM types. In particular, by [`PointerIntPairInfo::MaskAndShiftConstants`](cde9f9df79/llvm/include/llvm/ADT/PointerIntPair.h (L174C16-L174C16)), which is required to extract pointer and integer from `PointerIntPair`.

Related Discourse thread: https://discourse.llvm.org/t/traversing-member-types-of-a-type/72452
2023-10-14 10:52:34 +04:00
walter erquinigo
a669a237c4 [LLDB] Fix buildbots
https://lab.llvm.org/buildbot/#/builders/96/builds/46935 https://lab.llvm.org/buildbot/#/builders/68/builds/61651 are failing because of some namespace changes introduced by https://reviews.llvm.org/rG1673a1ba5dec
2023-10-13 17:22:49 -04:00
Walter Erquinigo
1673a1ba5d
[LLDB][NFC] Create a namespace for the DWARF plugin (#68150)
As a followup of https://github.com/llvm/llvm-project/pull/67851, I'm
defining a new namespace `lldb_plugin::dwarf` for the classes in this
Plugins/SymbolFile/DWARF folder. This change is very NFC and helped me
with exporting the necessary symbols for my out-of-tree language plugin.
The only class that I didn't change is ClangDWARFASTParser, because that
shouldn't be in the same namespace as the generic language-agnostic
dwarf parser.
It would be a good idea if other plugins follow the same namespace
scheme.
2023-10-13 16:51:24 -04:00
Michael Buch
0dfcfb53d7
[lldb][DataFormatter] VectorType: fix format for arrays with size not a power-of-2 (#68907)
To get the number of children for a VectorType (i.e.,
a type declared with a `vector_size`/`ext_vector_type` attribute)
LLDB previously did following calculation:
1. Get byte-size of the vector container from Clang (`getTypeInfo`).
2. Get byte-size of the element type we want to interpret the array as.
   (e.g., sometimes we want to interpret an `unsigned char vec[16]`
   as a `float32[]`).
3. `numChildren = containerSize / reinterpretedElementSize`

However, for step 1, clang will return us the *aligned* container
byte-size.
So for a type such as `float __attribute__((ext_vector_type(3)))`
(which is an array of 3 4-byte floats), clang will round up the
byte-width of the array to `16`.
(see
[here](ab6a66dbec/clang/lib/AST/ASTContext.cpp (L1987-L1992)))

This means that for vectors where the size isn't a power-of-2, LLDB
will miscalculate the number of elements.

**Solution**

This patch changes step 1 such that we calculate the container size
as `numElementsInSource * byteSizeOfElement`.
2023-10-13 20:07:41 +01:00
Walter Erquinigo
ed0a14144b
[LLDB] Fix type formatting empty c-strings (#68924)
The type formatter code is effectively considering empty strings as read
errors, which is wrong. The fix is very simple. We should rely on the
error object and stop checking the size. I also added a test.
2023-10-13 14:14:23 -04:00
Walter Erquinigo
158c052990
[LLDB][NFC] Remove dead code (#68927)
I found some type/typesystem code that is dead and some of it seems to
have been replaced by the ValueObjectPrinter.
2023-10-13 13:54:03 -04:00
Pete Lawrence
8e2bd05c4e
[lldb] Fix po alias by printing fix-its to the console. (#68755)
The `po` alias now matches the behavior of the `expression` command when
the it can apply a Fix-It to an expression.
Modifications

- Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a
`protected` member that stores the post Fix-It expression, just like the
`CommandObjectExpression` class.
- Converted messages to present tense.
- Add test cases that confirms a Fix-It for a C++ expression for both
`po` and `expressions`

rdar://115317419
2023-10-13 10:06:50 -07:00
Michael Buch
7493d45408
[lldb][DataFormatter] unordered_map: account for new libc++ __hash_node layout (#68574)
Since D101206 (`ba79fb2e1ff7130cde02fbbd325f0f96f8a522ca`) the `__hash_node::__value_`
member is wrapped in an anonymous union. `ValueObject::GetChildMemberWithName` doesn't see
through the union.

This patch accounts for this possible new layout by getting a handle to
the union before doing the by-name `__value_` lookup.
2023-10-13 16:44:11 +01:00
Michael Buch
74c5e47404
[lldb][test] Temporarily disable TestQueueFromStdModule.py (#68970)
Started failing since D101206, but root-cause is unclear. It's
definitely not an issue with th libc++ patch itself however. So disable
the test until we know what's going on.
2023-10-13 16:26:51 +01:00
Mikhail Goncharov
5d35273a32
[lldb] fix release build (#68979)
due to 64d78d8b3c that used side effects
in assert()
2023-10-13 13:53:31 +02:00
Kazu Hirata
4a0ccfa865 Use llvm::endianness::{big,little,native} (NFC)
Note that llvm::support::endianness has been renamed to
llvm::endianness while becoming an enum class as opposed to an
enum. This patch replaces support::{big,little,native} with
llvm::endianness::{big,little,native}.
2023-10-12 21:21:45 -07:00
Tom Yang
cd0d478e7c quick fix for TestDumpDwo
PR#66035 introduced a test failure that causes windows build bots to
fail. These unit tests shouldn't be running on Windows.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
2023-10-12 16:28:56 -07:00
Tom Yang
64d78d8b3c
Add target modules dump separate-debug-info (#66035)
Add a new command
```
target modules dump separate-debug-info [-j] [<filename> [<filename> [...]]]
```
or
```
image dump separate-debug-info [-j] [<filename> [<filename> [...]]]
```
(since `image` is an alias for `target modules`).
This lists the separate debug info files and their current status
(loaded or not loaded) for the specified modules. This diff implements
this command for mach-O files with OSO and ELF files with dwo.
Example dwo:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID             Err Dwo Path
------------------ --- -----------------------------------------
0x9a429da5abb6faae     /home/toyang/workspace/scratch-dwo/a-main.dwo
0xbcc129959e76ff33     /home/toyang/workspace/scratch-dwo/a-foo.dwo

(lldb) image dump separate-debug-info -j
[
  {
    "separate-debug-info-files": [
      {
        "comp_dir": "/home/toyang/workspace/dwo-scratch",
        "dwo_id": 11115620165179865774,
        "dwo_name": "a-main.dwo",
        "loaded": true,
        "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-main.dwo"
      },
      {
        "comp_dir": "/home/toyang/workspace/dwo-scratch",
        "dwo_id": 13601198072221073203,
        "dwo_name": "a-foo.dwo",
        "loaded": true,
        "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a-foo.dwo"
      }
    ],
    "symfile": "/home/toyang/workspace/dwo-scratch/a.out",
    "type": "dwo"
  }
]
```
Example dwo with missing dwo:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID             Err Dwo Path
------------------ --- -----------------------------------------
0x9a429da5abb6faae E   unable to locate .dwo debug file "/home/toyang/workspace/scratch-dwo/b.out-main.dwo" for skeleton DIE 0x0000000000000014
0xbcc129959e76ff33 E   unable to locate .dwo debug file "/home/toyang/workspace/scratch-dwo/b.out-foo.dwo" for skeleton DIE 0x000000000000003c

(lldb) image dump separate-debug-info -j
[
  {
    "separate-debug-info-files": [
      {
        "comp_dir": "/home/toyang/workspace/dwo-scratch",
        "dwo_id": 11115620165179865774,
        "dwo_name": "a-main.dwo",
        "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-main.dwo\" for skeleton DIE 0x0000000000000014",
        "loaded": false
      },
      {
        "comp_dir": "/home/toyang/workspace/dwo-scratch",
        "dwo_id": 13601198072221073203,
        "dwo_name": "a-foo.dwo",
        "error": "unable to locate .dwo debug file \"/home/toyang/workspace/dwo-scratch/a-foo.dwo\" for skeleton DIE 0x000000000000003c",
        "loaded": false
      }
    ],
    "symfile": "/home/toyang/workspace/dwo-scratch/a.out",
    "type": "dwo"
  }
]
```
Example output with dwp:
```
(lldb) image dump separate-debug-info
Symbol file: /home/toyang/workspace/dwo-scratch/a.out
Type: "dwo"
Dwo ID             Err Dwo Path
------------------ --- -----------------------------------------
0x9a429da5abb6faae     /home/toyang/workspace/dwo-scratch/a.out.dwp(a-main.dwo)
0xbcc129959e76ff33     /home/toyang/workspace/dwo-scratch/a.out.dwp(a-foo.dwo)
(lldb) image dump separate-debug-info -j
[
  {
    "separate-debug-info-files": [
      {
        "comp_dir": "/home/toyang/workspace/dwo-scratch",
        "dwo_id": 11115620165179865774,
        "dwo_name": "a-main.dwo",
        "loaded": true,
        "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp"
      },
      {
        "comp_dir": "/home/toyang/workspace/dwo-scratch",
        "dwo_id": 13601198072221073203,
        "dwo_name": "a-foo.dwo",
        "loaded": true,
        "resolved_dwo_path": "/home/toyang/workspace/dwo-scratch/a.out.dwp"
      }
    ],
    "symfile": "/home/toyang/workspace/dwo-scratch/a.out",
    "type": "dwo"
  }
]
```
Example oso on my Mac:
```
(lldb) image dump separate-debug-info
Symbol file: /Users/toyang/workspace/scratch/a.out
Type: "oso"
Mod Time           Err Oso Path
------------------ --- ---------------------
0x0000000064e64868     /Users/toyang/workspace/scratch/foo.a(foo.o)
0x0000000064e64868     /Users/toyang/workspace/scratch/foo.a(main.o)

(lldb) image dump separate-debug-info -j
[
  {
    "separate-debug-info-files": [
      {
        "loaded": true,
        "oso_mod_time": 1692813416,
        "oso_path": "/Users/toyang/workspace/scratch/foo.a(foo.o)",
        "so_file": "/Users/toyang/workspace/scratch/foo.cpp"
      },
      {
        "loaded": true,
        "oso_mod_time": 1692813416,
        "oso_path": "/Users/toyang/workspace/scratch/foo.a(main.o)",
        "so_file": "/Users/toyang/workspace/scratch/main.cpp"
      }
    ],
    "symfile": "/Users/toyang/workspace/scratch/a.out",
    "type": "oso"
  }
]
```

Test Plan:
Tested on Mac OS and Linux.
```
lldb-dotest -p TestDumpDwo
lldb-dotest -p TestDumpOso
```

---------

Co-authored-by: Tom Yang <toyang@fb.com>
2023-10-12 11:21:53 -07:00
Walter Erquinigo
098c92777e
[lldb-vscode] Update installation instructions (#68234)
lldb-vscode had installation instructions based on creating a folder
inside ~/.vscode/extensions, which no longer works. A different
installation mechanism is needed based on a VSCode command. More can be
read in the contents of this patch.

Closes https://github.com/llvm/llvm-project/issues/63655
2023-10-11 16:39:35 -04:00
Kazu Hirata
b8885926f8 Use llvm::endianness::{big,little,native} (NFC)
Note that llvm::support::endianness has been renamed to
llvm::endianness while becoming an enum class as opposed to an enum.
This patch replaces llvm::support::{big,little,native} with
llvm::endianness::{big,little,native}.
2023-10-10 22:54:51 -07:00
Kazu Hirata
a9d5056862 Use llvm::endianness (NFC)
Now that llvm::support::endianness has been renamed to
llvm::endianness, we can use the shorter form.  This patch replaces
support::endianness with llvm::endianness.
2023-10-10 21:54:15 -07:00
Adrian Prantl
2e59b7550e Revert "[lldb] Fix po alias by printing fix-its to the console. (#68452)"
This reverts commit 606f89ab7d while investigating bot failures.
2023-10-10 14:56:00 -07:00
Pete Lawrence
606f89ab7d
[lldb] Fix po alias by printing fix-its to the console. (#68452)
The `po` alias now matches the behavior of the `expression` command when
the it can apply a Fix-It to an expression.
Modifications

- Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a
`protected` member that stores the post Fix-It expression, just like the
`CommandObjectExpression` class.
- Converted messages to present tense.
- Add test cases that confirms a Fix-It for a C++ expression for both
`po` and `expressions`

rdar://115317419

Co-authored-by: Pete Lawrence <plawrence@apple.com>
2023-10-10 13:59:58 -07:00
José Lira Junior
ac0dda8942
[lldb] add stop-at-user-entry option to process launch (#67019)
## Description
This pull request adds a new `stop-at-user-entry` option to LLDB
`process launch` command, allowing users to launch a process and pause
execution at the entry point of the program (for C-based languages,
`main` function).

## Motivation
This option provides a convenient way to begin debugging a program by
launching it and breaking at the desired entry point.

## Changes Made
- Added `stop-at-user-entry` option to `Options.td` and the
corresponding case in `CommandOptionsProcessLaunch.cpp` (short option is
'm')
- Implemented `GetUserEntryPointName` method in the Language plugins
available at the moment.
- Declared the `CreateBreakpointAtUserEntry` method in the Target API.
- Create Shell test for the command
`command-process-launch-user-entry.test`.

## Usage
`process launch --stop-at-user-entry` or `process launch -m` launches
the process and pauses execution at the entry point of the program.
2023-10-09 16:43:59 -07:00
Alex Langford
2e82696909
[lldb][NFCI] Remove use of ConstString from FilterRule in StructuredDataDarwinLog (#68347)
There are only ever 2 FilterRules and their operations are either
"regex" or "match". This does not benefit from deduplication since the
strings have static lifetime and we can just compare StringRefs pointing
to them. This is also not on a fast path, so it doesn't really benefit
from the pointer comparisons of ConstStrings.
2023-10-09 10:36:56 -07:00
Kazu Hirata
d7b18d5083 Use llvm::endianness{,::little,::native} (NFC)
Now that llvm::support::endianness has been renamed to
llvm::endianness, we can use the shorter form.  This patch replaces
llvm::support::endianness with llvm::endianness.
2023-10-09 00:54:47 -07:00
David Spickett
f47914a7cd [lldb][Docs] Use RST link format in IntelPT doc 2023-10-09 08:21:21 +01:00
David Spickett
cf5639dd2d [lldb][Docs] Fix typo in debugging lldb doc 2023-10-09 08:18:13 +01:00
Jonas Devlieghere
8f378ff7a0
[lldb] Expose SBPlatform::GetAllProcesses to the SB API (#68378)
Add the ability to list all processes through the SB API.

rdar://116188959
2023-10-06 10:43:31 -07:00
Michael Buch
d579a1a24a
[lldb[test] TestCppUnionStaticMembers.py: XFAIL assertions on windows (#68408)
Split out the assertions that fail on Windows in preparation to
XFAILing them.

Drive-by change:
* Add a missing `self.build()` call in `test_union_in_anon_namespace`
* Fix formatting
* Add expectedFailureWindows decorator
2023-10-06 16:05:40 +01:00
David Spickett
21030b9ab4 [lldb][Docs] Add section on using QEMU without bridge networking
Bridge network means that you can get to any port on the VM,
from the host, which is great. However it is quite involved to
setup in some cases, and I've certainly messed it up in the past.

An alternative is forwarding a block of ports and using some
hidden options to lldb-server to limit what it uses. This
commit documents that and the pitfall that the port list isn't shared.

The theory also works for Arm's FVP (which inspired me to write
this up) but since QEMU is the preferred option upstream, it goes
in that document.

Along the way I fixed a link to the QEMU page that used the URL
not a relative link to the document.
2023-10-06 15:28:10 +01:00
Michael Buch
a233a49b60
[lldb][DWARFASTParserClang][NFC] Fix comment regarding static data member detection (#68405)
Fixes misleading comment introduced in
`f74aaca63202cabb512c78fe19196ff348d436a8`
2023-10-06 11:41:37 +01:00
Michael Buch
f74aaca632
[lldb][DWARFASTParserClang] Check DW_AT_declaration to determine static data members (#68300)
**Background**

Prior to DWARFv4, there was no clear normative text on how to handle
static data members. Non-normative text suggested that compilers should
use `DW_AT_external` to mark static data members of structrues/unions.
Clang does this consistently. However, GCC doesn't, e.g., when the
structure/union is in an anonymous namespace (which is C++ standard
conformant). Additionally, GCC never emits `DW_AT_data_member_location`s
for union members (regardless of storage linkage and storage duration).

Since DWARFv5 (issue 161118.1), static data members get emitted as
`DW_TAG_variable`.

LLDB used to differentiate between static and non-static members by
checking the `DW_AT_external` flag and the absence of
`DW_AT_data_member_location`. With
[D18008](https://reviews.llvm.org/D18008) LLDB started to pretend that
union members always have a `0` `DW_AT_data_member_location` by default
(because GCC never emits these locations).

In [D124409](https://reviews.llvm.org/D124409) LLDB stopped checking the
`DW_AT_external` flag to account for the case where GCC doesn't emit the
flag for types in anonymous namespaces; instead we only check for
presence of `DW_AT_data_member_location`s.

The combination of these changes then meant that LLDB would never
correctly detect that a union has static data members.

**Solution**

Instead of unconditionally initializing the `member_byte_offset` to `0`
specifically for union members, this patch proposes to check for both
the absence of `DW_AT_data_member_location` and `DW_AT_declaration`,
which consistently gets emitted for static data members on GCC and
Clang.

We initialize the `member_byte_offset` to `0` anyway if we determine it
wasn't a static. So removing the special case for unions makes this code
simpler to reason about.

Long-term, we should just use DWARFv5's new representation for static
data members.

Fixes #68135
2023-10-06 09:07:20 +01:00
Walter Erquinigo
87c6ff6da8
[LLDB] Allow specifying a custom exports file (#68013)
LLDB has the cmake flag `LLDB_EXPORT_ALL_SYMBOLS` that exports the lldb,
lldb_private namespaces, as well as other symbols like python and lua
(see `lldb/source/API/liblldb-private.exports`). However, not all
symbols in lldb fall into these categories and in order to get access to
some symbols that live in plugin folders (like dwarf parsing symbols),
it's useful to be able to specify a custom exports file giving more
control to the developer using lldb as a library.

This adds the new cmake flag `LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE` that
is used when `LLDB_EXPORT_ALL_SYMBOLS` is enabled to specify that custom
exports file.

This is a follow up of https://github.com/llvm/llvm-project/pull/67851
2023-10-05 20:17:48 -04:00
Michael Buch
3a35ca01fc
[lldb][DWARFASTParserClang][NFCI] Extract DW_AT_data_member_location calculation logic (#68231)
Currently this non-trivial calculation is repeated multiple times,
making it hard to reason about when the
`byte_offset`/`member_byte_offset` is being set or not.

This patch simply moves all those instances of the same calculation into
a helper function.

We return an optional to remain an NFC patch. Default initializing the
offset would make sense but requires further analysis and can be done in
a follow-up patch.
2023-10-05 10:49:42 +01:00
Samira Bazuzi
19141c4172
[lldb] Mark operator== const to avoid ambiguity in C++20. (#68224)
C++20 will automatically generate an operator== with reversed operand
order, which is ambiguous with the written operator== when one argument
is marked const and the other isn't.

These operators currently trigger -Wambiguous-reversed-operator at usage
sites lldb/source/Symbol/SymbolFileOnDemand.cpp:68 and
lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp:1286.
2023-10-04 09:04:13 -07:00
David Spickett
ceec9a7874 [lldb][test] Skip platform attach test on Windows
This can pass but every so often times out:
https://lab.llvm.org/buildbot/#/builders/219/builds/6092
2023-10-04 12:46:35 +00:00
aokblast
e00f2272d6
[lldb][FreeBSD] fix i386 size_t error when using LLDB_LOGF (#68210) 2023-10-04 08:12:27 -04:00
Martin Storsjö
d918b813c8 [lldb] [debugserver] Add spaces between sentences in a CMake warning. NFC. 2023-10-04 14:34:12 +03:00
antoine moynault
75f295c245
[lldb][test] Remove expected failure marker for TestPlatformAttach on windows (#68193)
Looks like this test passes since #68050.
2023-10-04 12:13:31 +02:00
Kazu Hirata
8641cdf397 [lldb] Use std::enable_if_t (NFC) 2023-10-03 21:25:29 -07:00
Dave Lee
40653b6d66
[lldb] Fix --persistent-result description (#68128)
The default is not static, it depends on context. For `expression`, the
default is true, but for `dwim-print`, the default is false.

rdar://116320377
2023-10-03 16:21:52 -07:00
Alex Langford
91223c92f7 [lldb] Unbreak debian build after dd76375c80
From the lldb-x86_64-debian buildbot:
```
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:984:16: error: call to deleted constructor of 'llvm::Error'
        return err;
               ^~~
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/llvm/include/llvm/Support/Error.h:189:3: note: 'Error' has been explicitly marked deleted here
  Error(const Error &Other) = delete;
  ^
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/llvm/include/llvm/Support/Error.h:496:18: note: passing argument to parameter 'Err' here
  Expected(Error Err)
                 ^
1 error generated.
```
2023-10-03 16:11:02 -07:00
jeffreytan81
40c1f5b2fb
Fix std::variant test failure on certain buildbot (#68139)
https://github.com/llvm/llvm-project/pull/68012 works on my CentOS Linux
and Macbook but seems to fail for certain build bots. The error log
complains "No Value" check failure for `std::variant` but not very
actionable without a reproduce.

To unblock the build bots, I am commenting out the "No Value" checks.

Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2023-10-03 15:37:41 -07:00
walter erquinigo
3674a0610a [NFC][LLDB] Remove an unnecessary virtual destructor
DWARFExpression has a virtual destructor but no other virtual methods, so we can safely remove the virtual keyword.
2023-10-03 15:43:22 -04:00
aokblast
b3cc4804d4
[lldb][FreeBSD] Add dynamic loader handle class for FreeBSD Kernel (#67106)
The implemtation support parsing kernel module for FreeBSD Kernel and
has been test on x86-64 and arm64.
In summary, this class parse the linked list resides in the kernel
memory that record all kernel module and load the debug symbol file to
facilitate debug process
2023-10-03 14:16:32 -04:00
Jonas Devlieghere
2da99a1119
[lldb] Expose Platform::Attach through the SB API (#68050)
Expose Platform::Attach through the SB API.

rdar://116188959
2023-10-03 10:34:00 -07:00
Alex Langford
dd76375c80 [lldb][NFCI] Apply IndexEntry to DWARFUnitHeader outside of extraction
I plan on replacing LLDB's DWARFUnitHeader implementation with LLVM's.
LLVM's DWARFUnitHeader::extract applies the DWARFUnitIndex::Entry to a
given DWARFUnitHeader outside of the extraction because the index entry
is only relevant to one place where we may parse DWARFUnitHeaders
(specifically when we're creating a DWARFUnit in a DWO context). To ease
the transition, I've reshaped LLDB's implementation to look closer to
LLVM's.

Reviewed By: aprantl, fdeazeve

Differential Revision: https://reviews.llvm.org/D151919
2023-10-03 10:27:18 -07:00
jeffreytan81
1ec4330f7e
Implement data formatters for LibStdC++ std::variant (#68012)
This patch implements the data formatters for LibStdC++ `std::variant`.

---------

Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2023-10-02 17:46:41 -07:00
Alex Langford
cdd3e964f2
[lldb] Replace lldb's DWARFDebugAbbrev implementation with llvm's (#67841)
The implementations are now close enough that replacing it is trivial.
2023-10-02 10:46:16 -07:00
River Riddle
dc1a2cb971 [lldb][windows] Cover more symbols in LLDB_EXPORT_ALL_SYMBOLS
Followup to #67628 that relaxes the symbol regex a bit to cover more
lldb_private symbols.
2023-09-30 16:06:19 -07:00
Med Ismail Bennani
466ea89fc6 [lldb] Fix failures when evaluating C++ expression and loading modules
This patch tentatively fixes the various test failures introduced
following 0ea3d88bdb:

https://green.lab.llvm.org/green/view/LLDB/job/as-lldb-cmake/6316/

From my understanding, the main issue here is that we can't find some headers
when evaluating C++ expressions since those headers have been promoted
to be system modules, and to be shipped as part of the toolchain.

Prior to 0ea3d88bdb, the `BuiltinHeadersInSystemModules` flag for in
the clang `LangOpts` struct was always set, however, after it landed,
the flag becomes opt-in, depending on toolchain that is used with the
compiler instance. This gets set in `clang::createInvocation` down to
`Darwin::addClangTargetOptions`, as this is used mostly on Apple platforms.

However, since `ClangExpressionParser` makes a dummy `CompilerInstance`,
and sets the various language options arbitrarily, instead of using the
`clang::createInvocation`, the flag remains unset, which causes the
various error messages:

```
AssertionError: 'error: module.modulemap:96:11: header 'stdarg.h' not found
   96 |    header "stdarg.h" // note: supplied by the compiler
      |           ^
```

Given that this flag was opt-out previously, this patch brings back that
behavior by setting it in lldb's `ClangExpressionParser` constructor,
until we actually decide to pull the language options from the compiler driver.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-09-29 18:56:02 -07:00
Alex Langford
12f4e11386 [lldb][NFCI] Remove unneeded use of ConstString from StructuredDataDarwinLog 2023-09-29 14:09:22 -07:00
Alex Langford
2e12fc3d04 [lldb][NFCI] Remove unused constructors from BreakpointName
There is only one constructor in use so the rest can be removed.
2023-09-29 12:06:13 -07:00
River Riddle
a514c30a7c
[lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (#67628)
LLDB_EXPORT_ALL_SYMBOLS is useful when building out-of-tree plugins and
extensions that rely on LLDB's internal symbols. For example, this is
how the Mojo language provides its REPL and debugger support.

Supporting this on windows is kind of tricky because this is normally
expected to be done using dllexport/dllimport, but lldb uses these with
the public api. This PR takes an approach similar to what LLVM does with
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, and what chromium does for
[abseil](253d14e20f/third_party/abseil-cpp/generate_def_files.py),
and uses a python script to extract the necessary symbols by looking at
the symbol table for the various lldb libraries.
2023-09-29 10:33:11 -07:00
Jan Svoboda
2fc90afdac [lldb] Fix build after 2da8f30c 2023-09-29 10:01:37 -07:00
Benjamin Kramer
c87b2c9c82 [RISC-V] Remove unnecessary VLA
They're still non-standard in C++17.
2023-09-29 18:45:05 +02:00
Ted Woodward
b141534901 Remove unused #include
Differential Revision: https://reviews.llvm.org/D159550
2023-09-29 11:07:38 -05:00