Commit Graph

29305 Commits

Author SHA1 Message Date
Alex Langford
07d6fbf8d8
[lldb][NFCI] Remove BreakpointIDList::InsertStringArray (#77161)
This abstraction is leaky and BreakpointIDList does not need to know
about CommandReturnObject.
Additionally, setting the CommandReturnObject inout param to a success
state does very little. The function returns immediately if the input
ArrayRef is empty, and reading
CommandObjectMultiwordBreakpoint::VerifyIDs more closely, the input is
always empty if the previous call to
BreakpointIDList::FindAndReplaceIDRanges failed. If the call was
successful, then the CommandReturnObject is already in a success state.

I have opted to remove the function altogether and inline the
functionality where it was used.
2024-01-08 10:51:00 -08:00
Felipe de Azevedo Piovezan
b4ee7d6119
[lldb][DWARFIndex][nfc] Factor out fully qualified name query (#76977)
This moves the functionally of finding a DIE based on a fully qualified
name from SymbolFileDWARF into DWARFIndex itself, so that
specializations of DWARFIndex can implement faster versions of this
query.
2024-01-08 11:16:22 -03:00
Michael Buch
2bf01d73f6
[lldb][DWARFASTParserClang] GetClangDeclForDIE: don't create VarDecl for static data members (#77155)
With DWARFv5, C++ static data members are represented as
`DW_TAG_variable`s (see `faa3a5ea9ae481da757dab1c95c589e2d5645982`).

In GetClangDeclForDIE, when trying to parse the `DW_AT_specification`
that a static data member's CU-level `DW_TAG_variable` points to, we
would try to `CreateVariableDeclaration`. Whereas previously it was a
no-op (for `DW_TAG_member`s). However, adding `VarDecls` to RecordDecls
for static data members should always be done in
`CreateStaticMemberVariable`. The test-case is an exapmle where we would
crash if we tried to create a `VarDecl` from within `GetClangDeclForDIE`
for a static data member.

This patch simply checks whether the `DW_TAG_variable` being parsed is a
static data member, and if so, trivially returns from
`GetClangDeclForDIE` (as we previously did for `DW_TAG_member`s).
2024-01-08 14:10:02 +00:00
David Spickett
ba4cf31fac [lldb][test] Skip part of nested expressions test on Windows
This was added by e42edb5547 and
has been failing: https://lab.llvm.org/buildbot/#/builders/219/builds/8012
2024-01-08 12:17:16 +00:00
David Spickett
8b49ed8ba1 [lldb][test] Skip DWARF inline source file test on Windows
This was added by 917b404e2c
and fails for unknown reasons.
2024-01-08 12:11:52 +00:00
Greg Clayton
e42edb5547
[lldb] Fix expressions that involve nested structs/classes/unions. (#77029)
The LLDB expression parser relies on using the external AST source
support in LLDB. This allows us to find a class at the root namespace
level, but it wouldn't allow us to find nested classes all of the time.
When LLDB finds a class via this mechanism, it would be able to complete
this class when needed, but during completion, we wouldn't populate
nested types within this class which would prevent us from finding
contained types when needed as clang would expect them to be present if
a class was completed. When we parse a type for a class, struct or
union, we make a forward declaration to the class which can be
completed. Now when the class is completed, we also add any contained
types to the class' declaration context which now allows these types to
be found. If we have a struct that contains a struct, we will add the
forward declaration of the contained structure which can be c ompleted
later. Having this forward declaration makes it possible for LLDB to
find everything it needs now.

This should fix an existing issue:
https://github.com/llvm/llvm-project/issues/53904

Previously, contained types could be parsed by accident and allow
expression to complete successfully. Other times we would have to run an
expression multiple times because our old type lookup from our
expressions would cau se a type to be parsed, but not used in the
current expression, but this would have parsed a type into the
containing decl context and the expression might succeed if it is run
again.
2024-01-05 09:26:54 -08:00
Jonas Devlieghere
5fd18bdef9
Revert "XFAIL test with dsymutil"
This reverts commit c041fa1093 as Adrian
added support to dsymutil.
2024-01-04 16:47:16 -08:00
Felipe de Azevedo Piovezan
8f40783944
[lldb][nfc] Mark function as const (#76974)
This function has no mutable behavior
2024-01-04 16:30:49 -03:00
Adrian Prantl
c041fa1093 XFAIL test with dsymutil 2024-01-04 10:25:47 -08:00
Zequan Wu
4004f655ce [LLDB][NativePDB] Fix use-after-free error detected by asan. 2024-01-04 12:32:40 -05:00
Adrian Prantl
9f9dd6be0d Wrap local type declarations in anonymous namespace to fix modules build. 2024-01-04 09:30:00 -08:00
Adrian Prantl
917b404e2c
Add support for inline DWARF source files. (#75880)
LLVM supports DWARF 5 linetable extension to store source files inline
in DWARF. This is particularly useful for compiler-generated source
code. This implementation tries to materialize them as temporary files
lazily, so SBAPI clients don't need to be aware of them.

rdar://110926168
2024-01-04 09:04:05 -08:00
gmh
f3f4387e02
[lldb][NFC] Fix compilation issue on windows (#76453) 2024-01-04 08:39:50 +00:00
Alex Langford
bdaedffc43 [lldb] Speculatively fix TestBreakpointSerialization on Windows
See: https://lab.llvm.org/buildbot/#/builders/219/builds/7961/steps/6/logs/stdio
2024-01-03 15:50:25 -08:00
Alex Langford
49029f926d
[lldb] Fix breakpoint resolver serialization bug (#76766)
BreakpointResolverAddress optionally can include the module name related
to the address that gets resolved. Currently this will never work
because it sets the name to itself (which is empty).
2024-01-03 15:02:37 -08:00
David Spickett
43a5c4a10d [lldb][test] Skip other Global Module Cache tests on Arm/AArch64 Linux
These are expected to fail but sometimes crash during the test leaving them
as unresolved.

Same failure message and likely same cause as the other test in this file.
2024-01-03 11:24:58 +00:00
Nico Weber
54378a7c2f
[lldb][Windows] Fix -Wmissing-field-initializers warnings after 54981bb75d (#76255) 2024-01-03 10:12:30 +00:00
walter erquinigo
0d19a8983c Fix builtbot
https://lab.llvm.org/buildbot/#/builders/96/builds/50702/steps/6/logs/stdio requires checking for multiple error messages
2024-01-02 13:30:44 -05:00
Walter Erquinigo
ffd173ba0b
[lldb-dap] Emit more structured info along with variables (#75244)
In order to allow smarter vscode extensions, it's useful to send
additional structured information of SBValues to the client.
Specifically, I'm now sending error, summary, autoSummary and
inMemoryValue in addition to the existing properties being sent. This is
cheap because these properties have to be calculated anyway to generate
the display value of the variable, but they are now available for
extensions to better analyze variables. For example, if the error field
is not present, the extension might be able to provide cool features,
and the current way to do that is to look for the `"<error: "` prefix,
which is error-prone.

This also incorporates a tiny feedback from
https://github.com/llvm/llvm-project/pull/74865#issuecomment-1850695477
2024-01-02 13:06:13 -05:00
Nico Weber
04c473bea3 [lldb] Fix two deprecation warnings
No behavior change.
2023-12-22 12:11:07 -05:00
Martin Storsjö
f70b229e96
[LLDB] Define _BSD_SOURCE globally, to get optreset available in mingw's getopt.h (#76137)
We previously were defining _BSD_SOURCE right before including getopt.h.
However, on mingw-w64, getopt.h is also transitively included by
unistd.h, and unistd.h can be transitively included by many headers
(recently, by some libc++ headers).

Therefore, to be safe, we need to define _BSD_SOURCE before including
any header. Thus do this in CMake.

This fixes https://github.com/llvm/llvm-project/issues/76050.
2023-12-22 00:40:12 +02:00
cmtice
1830fadb78
[LLDB] Fix write permission error in TestGlobalModuleCache.py (#76171)
TestGlobalModuleCache.py, a recently added test, tries to update a
source file in the build directory, but it assumes the file is writable.
In our distributed build and test system, this is not always true, so
the test often fails with a write permissions error.

This change fixes that by setting the permissions on the file to be
writable before attempting to write to it.
2023-12-21 12:05:36 -08:00
David Spickett
f54249e79a [lldb][test] Link to PlatformWindows in thread tests
Clearly I need my eyes checked, it wasn't linking to a non-existent
library at all, I had the name wrong.
2023-12-21 14:07:27 +00:00
David Spickett
55985db5fe [lldb][test] Remove non-existent Windows lib from thread tests
I assumed since it was in the PR and seemed like a logical
library to have, it would exist, but only `...Common` exists.
2023-12-21 14:05:08 +00:00
David Spickett
dddb9d1ee3 [lldb][test] Fix missing-braces warnings in unit tests
```
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/unittests/Utility/ChecksumTest.cpp:15:38: warning: suggest braces around initialization of subobject [-Wmissing-braces]
static llvm::MD5::MD5Result hash1 = {0, 1, 2,  3,  4,  5,  6,  7,
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                     {
```
And others.
2023-12-21 13:36:04 +00:00
David Spickett
513c2151cd [lldb][test] Only link Windows libraries on Windows
ld.lld: error: unable to find library -llldbPluginProcessWindowsCommon

https://lab.llvm.org/buildbot/#/builders/96/builds/50407

Fixes 95e5839e06.
2023-12-21 13:11:34 +00:00
oltolm
95e5839e06
[lldb] add support for thread names on Windows (#74731)
This PR adds support for thread names in lldb on Windows.

```
(lldb) thr list
Process 2960 stopped
  thread #53: tid = 0x03a0, 0x00007ff84582db34 ntdll.dll`NtWaitForMultipleObjects + 20
  thread #29: tid = 0x04ec, 0x00007ff845830a14 ntdll.dll`NtWaitForAlertByThreadId + 20, name = 'SPUW.6'
  thread #89: tid = 0x057c, 0x00007ff845830a14 ntdll.dll`NtWaitForAlertByThreadId + 20, name = 'PPU[0x1000019] physics[main]'
  thread #3: tid = 0x0648, 0x00007ff843c2cafe combase.dll`InternalDoATClassCreate + 39518
  thread #93: tid = 0x0688, 0x00007ff845830a14 ntdll.dll`NtWaitForAlertByThreadId + 20, name = 'PPU[0x100501d] uMovie::StreamingThread'
  thread #1: tid = 0x087c, 0x00007ff842e7a104 win32u.dll`NtUserMsgWaitForMultipleObjectsEx + 20
  thread #96: tid = 0x0890, 0x00007ff845830a14 ntdll.dll`NtWaitForAlertByThreadId + 20, name = 'PPU[0x1002020] HLE Video Decoder'
<...>
```
2023-12-21 12:42:22 +00:00
Felipe de Azevedo Piovezan
cf0be7b492
[lldb] Add actionable feedback when overwriting a command fails (#76030)
If adding a user commands fails because a command with the same name
already exists, we only say that "force replace is not set" without
telling the user _how_ to set it. There are two ways to do so; this
commit changes the error message to mention both.
2023-12-21 09:04:24 -03:00
David Spickett
7767c5856d
[lldb][DWARF] Search for symbols in all external modules (#75927)
The way this code was updated in
dd95877958 meant that if the first module
did not have the symbol, the iteration stopped as returning true means
stop. So only if every module had the symbol would we find it, in the
last module.

Invert the condition to break when we find the first instance, which is
what the previous code did.
2023-12-20 14:48:01 +00:00
David Spickett
a8af51dfa5 [lldb][test] Skip global module cache on Arm/AArch64 Linux (again)
This reverts commit 01c4ecb7ae,
d14d52158b and
a756dc4724.

This removes the logging and workaround I added earlier,
and puts back the skip for Arm/AArch64 Linux.

I've not seen it fail on AArch64 since, but let's not create
more noise if it does.

I've written up the issue as https://github.com/llvm/llvm-project/issues/76057.
It's something to do with trying to destroy a process while
a thread is doing a single sep. So my workaround wouldn't have
worked in any case. It needs a more involved fix.
2023-12-20 13:56:40 +00:00
David Spickett
83f8caeab4 [lldb][test] Skip runlocker test on AArch64 Linux
This has been flaky for a while, for example
https://lab.llvm.org/buildbot/#/builders/96/builds/50350

```
Command Output (stdout):
--
lldb version 18.0.0git (https://github.com/llvm/llvm-project.git revision 3974d89bde)
  clang revision 3974d89bde
  llvm revision 3974d89bde
"can't evaluate expressions when the process is running."
```

```
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
   #0 0x0000ffffa46191a0 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+0x529a1a0)
   #1 0x0000ffffa4617144 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x5298144)
   #2 0x0000ffffa46198d0 SignalHandler(int) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x529a8d0)
   #3 0x0000ffffab25b7dc (linux-vdso.so.1+0x7dc)
   #4 0x0000ffffab13d050 /build/glibc-Q8DG8B/glibc-2.31/string/../sysdeps/aarch64/multiarch/memcpy_advsimd.S:92:0
   #5 0x0000ffffa446f420 lldb_private::process_gdb_remote::GDBRemoteRegisterContext::PrivateSetRegisterValue(unsigned int, llvm::ArrayRef<unsigned char>) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x50f0420)
   #6 0x0000ffffa446f7b8 lldb_private::process_gdb_remote::GDBRemoteRegisterContext::GetPrimordialRegister(lldb_private::RegisterInfo const*, lldb_private::process_gdb_remote::GDBRemoteCommunicationClient&) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x50f07b8)
   #7 0x0000ffffa446f308 lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegisterBytes(lldb_private::RegisterInfo const*) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x50f0308)
   #8 0x0000ffffa446ec1c lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegister(lldb_private::RegisterInfo const*, lldb_private::RegisterValue&) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x50efc1c)
   #9 0x0000ffffa412eaa4 lldb_private::RegisterContext::ReadRegisterAsUnsigned(lldb_private::RegisterInfo const*, unsigned long) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x4dafaa4)
  #10 0x0000ffffa420861c ReadLinuxProcessAddressMask(std::shared_ptr<lldb_private::Process>, llvm::StringRef) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x4e8961c)
  #11 0x0000ffffa4208430 ABISysV_arm64::FixCodeAddress(unsigned long) (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lib/python3.8/site-packages/lldb/_lldb.cpython-38-aarch64-linux-gnu.so+0x4e89430)
```

Judging by the backtrace something is trying to read the pointer authentication address/code mask
registers. This explains why I've not seen this issue locally, as the buildbot runs on Graviton
3 with has the pointer authentication extension.

I will try to reproduce, fix and re-enable the test.
2023-12-20 11:05:52 +00:00
David Spickett
01c4ecb7ae [lldb][test] Remove Arm/AArch64 Linux skip for global modules test
So we can see it failing and get the extra logged information.
2023-12-20 09:42:07 +00:00
David Spickett
d14d52158b [lldb][test] Add extra logging for module cache test
And remove the workaround I was trying, as this logging may prove what
the actual issue is.

Which I think is that the thread plan map in Process is cleared before
the threads are destroyed. So Thread::ShouldStop could be getting
the current plan, then the plan map is cleared, then Thread::ShouldStop
is deciding based on that plan to pop a plan from the now empty stack.
2023-12-20 09:41:33 +00:00
David Spickett
a756dc4724 [lldb][test] Try a workaround for module cache test on Arm/AArch64 Linux
If this works it'll give me a clue for the underlying issue.
2023-12-20 08:46:10 +00:00
Pete Lawrence
8ddf98ad4b
[lldb] Remove unused GetChildAtIndexPath(...) methods from ValueObject.cpp (#75870)
This a follow-up PR from this other one:
https://github.com/llvm/llvm-project/pull/74413

Nothing calls into these two methods, so we (@DavidSpickett,
@adrian-prantl, and I) agreed to remove them once we merged the previous
PR.
2023-12-19 15:00:56 -08:00
Adrian Prantl
45657e81a1
Remove unused FileSPec::IsResolved() functionality. (#75840)
This API seems to be completely unused. Should we just remove it?
2023-12-19 08:49:12 -08:00
David Spickett
970152bec1 [lldb] Add issue link for TestUniqueTypes4.py Windows skip
The changes to this test uncovered a pre-existing issue that I've
documented in the linked issue.
2023-12-19 14:25:23 +00:00
Pavel Labath
3068d277fd
[lldb] Fix TestSBValueSynthetic on windows (#75908)
We don't have a std::vector formatter on windows, so use a custom
formatter in this test to avoid relying on std::vector.
2023-12-19 09:58:25 +01:00
David Spickett
87bf1afbbf
[lldb][PDB] Update max matches test for type queries (#75813)
NestedClass will be found via Class::NestedClass and
ClassTypedef::NestedClass. So the first part of the test gets 2 results
as the default is to find all matching types.

In the next part, we ask for only the first match and expect to get only
1 of those two possible results.
2023-12-19 08:54:03 +00:00
Pavel Labath
927926b8af
[lldb] Fix a quirk in SBValue::GetDescription (#75793)
The function was using the default version of ValueObject::Dump, which
has a default of using the synthetic-ness of the top-level value for
determining whether to print _all_ values as synthetic. This resulted in
some unusual behavior, where e.g. a std::vector is stringified as
synthetic if its dumped as the top level object, but in its raw form if
it is a member of a struct without a pretty printer.

The SBValue class already has properties which determine whether one
should be looking at the synthetic view of the object (and also whether
to use dynamic types), so it seems more natural to use that.
2023-12-18 21:23:03 +01:00
Kazu Hirata
364d7e775f [lldb] Use StringRef::starts_with (NFC)
This patch replaces uses of StringRef::startswith with
StringRef::starts_with for consistency with
std::{string,string_view}::starts_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
2023-12-17 15:51:48 -08:00
Kazu Hirata
ee667db4b8 [lldb] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
2023-12-16 15:02:15 -08:00
Kazu Hirata
744f38913f [lldb] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
2023-12-16 14:39:37 -08:00
Alex Langford
7113c80289
[lldb][NFCI] Remove unused parameter from BreakpointResolver*::CreateFromStructuredData (#75374)
These appear to be unused.
2023-12-15 10:26:01 -08:00
Greg Clayton
8959cef135
[lldb] Trying to fix windows buildbots after #74786 (#75566)
This patch fixes the SymbolFilePDBTests::TestMaxMatches(...) by making
it test what it was testing before, see comments in the test case for
details.

It also disables TestUniqueTypes4.py for now until we can debug or fix
why it isn't working.
2023-12-15 11:55:40 +00:00
Michael Christensen
4051942575
Add option to pass thread ID to thread select command (#73596)
We'd like a way to select the current thread by its thread ID (rather
than its internal LLDB thread index).

This PR adds a `-t` option (`--thread_id` long option) that tells the
`thread select` command to interpret the `<thread-index>` argument as a
thread ID.

Here's an example of it working:
```
michristensen@devbig356 llvm/llvm-project (thread-select-tid) » ../Debug/bin/lldb ~/scratch/cpp/threading/a.out
(lldb) target create "/home/michristensen/scratch/cpp/threading/a.out"
Current executable set to '/home/michristensen/scratch/cpp/threading/a.out' (x86_64).
(lldb) b 18
Breakpoint 1: where = a.out`main + 80 at main.cpp:18:12, address = 0x0000000000000850
(lldb) run
Process 215715 launched: '/home/michristensen/scratch/cpp/threading/a.out' (x86_64)
This is a thread, i=1
This is a thread, i=2
This is a thread, i=3
This is a thread, i=4
This is a thread, i=5
Process 215715 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555400850 a.out`main at main.cpp:18:12
   15     for (int i = 0; i < 5; i++) {
   16       pthread_create(&thread_ids[i], NULL, foo, NULL);
   17     }
-> 18     for (int i = 0; i < 5; i++) {
   19       pthread_join(thread_ids[i], NULL);
   20     }
   21     return 0;
(lldb) thread select 2
* thread #2, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x7ffff68f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e <+78>: ja     0x7ffff68f9952 ; <+130>
    0x7ffff68f9920 <+80>: movl   %edx, %edi
    0x7ffff68f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread info
thread #2: tid = 216047, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'

(lldb) thread list
Process 215715 stopped
  thread #1: tid = 215715, 0x0000555555400850 a.out`main at main.cpp:18:12, name = 'a.out', stop reason = breakpoint 1.1
* thread #2: tid = 216047, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #3: tid = 216048, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #4: tid = 216049, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #5: tid = 216050, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
  thread #6: tid = 216051, 0x00007ffff68f9918 libc.so.6`__nanosleep + 72, name = 'a.out'
(lldb) thread select 215715
error: invalid thread #215715.
(lldb) thread select -t 215715
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x0000555555400850 a.out`main at main.cpp:18:12
   15     for (int i = 0; i < 5; i++) {
   16       pthread_create(&thread_ids[i], NULL, foo, NULL);
   17     }
-> 18     for (int i = 0; i < 5; i++) {
   19       pthread_join(thread_ids[i], NULL);
   20     }
   21     return 0;
(lldb) thread select -t 216051
* thread #6, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x7ffff68f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e <+78>: ja     0x7ffff68f9952 ; <+130>
    0x7ffff68f9920 <+80>: movl   %edx, %edi
    0x7ffff68f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread select 3
* thread #3, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x7ffff68f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e <+78>: ja     0x7ffff68f9952 ; <+130>
    0x7ffff68f9920 <+80>: movl   %edx, %edi
    0x7ffff68f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread select -t 216048
* thread #3, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x7ffff68f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e <+78>: ja     0x7ffff68f9952 ; <+130>
    0x7ffff68f9920 <+80>: movl   %edx, %edi
    0x7ffff68f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread select --thread_id 216048
* thread #3, name = 'a.out'
    frame #0: 0x00007ffff68f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x7ffff68f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
    0x7ffff68f991e <+78>: ja     0x7ffff68f9952 ; <+130>
    0x7ffff68f9920 <+80>: movl   %edx, %edi
    0x7ffff68f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) help thread select
Change the currently selected thread.

Syntax: thread select <cmd-options> <thread-index>

Command Options Usage:
  thread select [-t] <thread-index>

       -t ( --thread_id )
            Provide a thread ID instead of a thread index.

     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.
(lldb) c
Process 215715 resuming
Process 215715 exited with status = 0 (0x00000000)
```
2023-12-14 15:19:38 -08:00
cmtice
e692d08360
[LLDB] Add more helper functions to CompilerType class (second try). (#73472)
This adds 23 new helper functions to LLDB's CompilerType class, things
like IsSmartPtrType, IsPromotableIntegerType,
GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a
few).

It also has run clang-format on the files CompilerType.{h,cpp}.

These helper functions are needed as part of the implementation for the
Data Inspection Language, (see
https://discourse.llvm.org/t/rfc-data-inspection-language/69893).
2023-12-14 14:10:19 -08:00
Walter Erquinigo
aa207674f9
[lldb-dap] Implement command directives (#74808)
This adds support for optionally prefixing any command with `?` and/or
`!`.
- `?` prevents the output of a commands to be printed to the console
unless it fails.
- `!` aborts the dap if the command fails.

They come in handy when programmatically running commands on behalf of
the user without wanting them to know unless they fail, or when a
critical setup is required as part of launchCommands and it's better to
abort on failures than to silently skip.
2023-12-14 15:04:35 -05:00
David Spickett
1bce61e6b0 [lldb] Remove PopPlan asserts and skip test on Arm/AArch64 Linux
This reverts commit 481bb62e50 and
71b4d7498f, along with the logging
and assert I had added to the test previously.

Now that I've caught it failing on Arm:
https://lab.llvm.org/buildbot/#/builders/17/builds/46598

Now I have enough to investigate, skip the test on the effected
platforms while I do that.
2023-12-14 19:17:49 +00:00
Kevin Frei
0544c78172
Fix a crash from character type confusion interaction with libedit (#75388)
If you type `settings show <tab>` LLDB might crash, depending on the
version of libedit you're compiled with, and whether you're compiled
with `-DLLDB_EDITLINE_USE_WCHAR=0` (and depending on how the optimizer
lays out the stack...)

The issue has to do with trying to figure out whether the libedit
`getchar` callback is supposed to read a wide or 8 bit character. In
order to maintain backward compatibility, there's really no 'clean' way
to do it. We just have to make sure that we're invoking el_[w]getc with
a buffer that is as wide as the getchar callback (registered by the
`SetGetCharacterFunction` function further down in `Editline.cpp`.

So, it's 'fixed' with a comment, and a wider version of the 'reply'
variable.

Co-authored-by: Kevin Frei <freik@meta.com>
2023-12-14 11:10:51 -08:00