Commit Graph

30997 Commits

Author SHA1 Message Date
Alex Langford
abb6919a63 [lldb] Add additional assertions to TestVTableValue.test_overwrite_vtable (#118719)
If this test fails, you're likely going to see something like "Assertion
Error: A != B" which doesn't really give much explanation for why this
failed.

Instead of ignoring the error, we should assert that it succeeded. This
will lead to a better error message, for example:
`AssertionError: 'memory write failed for 0x102d7c018' is not success`
2024-12-05 10:38:23 -08:00
John Harrison
0964328c29 [lldb] Fix the SocketTest failure on unsupported hosts (#118673)
The test `SocketTest::TCPListen0MultiListenerGetListeningConnectionURI`
is failing on hosts that do not map `localhost` to both an ipv4 and ipv6
address. For example this build
https://lab.llvm.org/buildbot/#/builders/195/builds/1909.

To fix this, I added a helper to validate if the host has an /etc/hosts
entry for both ipv4 and ipv6, otherwise we skip the test.
2024-12-05 09:08:17 -08:00
Pavel Labath
15de77db91 [lldb] (Prepare to) speed up dwarf indexing (#118657)
Indexing a single DWARF unit is a fairly small task, which means the
overhead of enqueueing a task for each unit is not negligible (mainly
because introduces a lot of synchronization points for queue management,
memory allocation etc.). This is particularly true if the binary was
built with type units, as these are usually very small.

This essentially brings us back to the state before
https://reviews.llvm.org/D78337, but the new implementation is built on
the llvm ThreadPool, and I've added a small improvement -- we now
construct one "index set" per thread instead of one per unit, which
should lower the memory usage (fewer small allocations) and make the
subsequent merge step faster.

On its own this patch doesn't actually change the performance
characteristics because we still have one choke point -- progress
reporting. I'm leaving that for a separate patch, but I've tried that
simply removing the progress reporting gives us about a 30-60% speed
boost.
2024-12-05 10:38:29 +01:00
Zequan Wu
2e425bf629 Reapply "[lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (#117071)"
9de73b2040 lands a fix to DWARFTypePrinter that is used by lldb in this change.
2024-12-04 13:05:36 -08:00
Jonas Devlieghere
9302043bef [lldb-dap] Fix links to LLVM issue tracker and pull requests (#118681)
Currently, the link to the issue tracker takes you to the Github source
repository, rather than the Github issue tracker. This fixes the link
and includes the lldb-dap label in both the issue and PR URL.
2024-12-04 11:04:05 -08:00
cmtice
095c3c9d6e [LLDB] Fix crash in TypeSystemClang::GetIndexofChildMemberWithName. (#117808)
LLDB can crash in TypeSystemClang::GetIndexOfChildMemberWithName, at a
point where it pushes an index onto the child_indexes vector, tries to
call itself recursively, then tries to pop the entry from child_indexes.
The problem is that the recursive call can clear child_indexes, so that
this code ends up trying to pop an already empty vector. This change
saves the old vector before the push, then restores the saved vector
rather than trying to pop.
2024-12-04 10:49:12 -08:00
Jonas Devlieghere
ff5953804e [lldb-dap] Support finding the lldb-dap binary (#118547)
Support finding the lldb-dap binary with `xcrun` on Darwin or in PATH on
all other platforms.

Unfortunately, this PR is larger than I would like because it removes
the `lldbDapOptions`. I believe these options are not necessary, and as
previously implemented, they caused a spurious warning with this change.
The problem was that the options were created before the custom factory.
By moving the creation logic into the factory, we make sure it's only
called after the factory has been registered. The upside is that this
simplifies the code and removes a level of indirection.
2024-12-04 09:43:49 -08:00
John Harrison
d5ba143a6d [lldb] Correct an issue when using Socket to listen on localhost:0 on ipv4 and ipv6. (#118565)
On systems supporting ting ipv4 and ipv6 the second socket to initialize 
will not update the listening address correctly after the call to `bind`.

This results in the second address listed in
`Socket::GetListeningConnectionURI` to have port `:0`, which is
incorrect.

To fix this, correct which address is used to detect the port and update
the unit tests to cover this use case.

Additionally, I updated the SocketTest's to only parameterize tests that
can work on ipv4 or ipv6. This means tests like
`SocketTest::DecodeHostAndPort` are only run once, instead of twice
since they do not change behavior based on parameters.

I also included a new unit test to cover listening on `localhost:0`,
validating both sockets correctly list the updated port.
2024-12-04 08:47:18 -08:00
cmtice
ba43a102a9 [LLDB] Fix error returns in CastToBasicType and CastToEnumType in ValueObject. (#117401)
Update the error returns in ValueObject::CastToBasicType and
ValueObject::CastToEnumType to create new errors and return a
ValueObjectConstResult with the error, rather tnan updating the error in
(and returning) the input ValueObject.
2024-12-04 08:11:10 -08:00
Vladislav Dzhidzhoev
4e80c532c6 [lldb][tests] Fix passing pthread library to a linker for some API tests (#118530)
Specify ENABLE_THREADS := YES within test's Makefile instead of passing
-lpthread explicitly via the compiler's CFLAGS options.

Refactoring fix.

Co-authored-by: Vladimir Vereschaka <vvereschaka@accesssoftek.com>
2024-12-04 16:55:28 +01:00
Jonas Devlieghere
442ee78cb4 [lldb-dap] Fix Markdown tables in README.md
The markdown tables in the README aren't getting rendered correctly on
the LLDB-DAP page in the Visual Studio arketplace [1]. This is a
somewhat speculative fix as the table itself appears to be correct. Even
if this change doesn't fix it, the new formatting significantly improves
the readability.

[1] https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.lldb-dap
2024-12-03 20:59:02 -08:00
John Harrison
384562495b [lldb] For a host socket, add a method to print the listening address. (#118330)
This is most useful if you are listening on an address like
'localhost:0' and want to know the resolved ip + port of the socket
listener.
2024-12-03 11:11:32 -08:00
Jonas Devlieghere
f715124857 [lldb-dap] Fix the vscode-uninstall command
The command was using the wrong publisher name ("llvm" rather than
"llvm-vs-code-extensions") resulting in the command complaining:

```
npm run vscode-uninstall

> lldb-dap@0.2.6 vscode-uninstall
> code --uninstall-extension llvm.lldb-dap

Extension 'llvm.lldb-dap' is not installed.
Make sure you use the full extension ID, including the publisher, e.g.: ms-dotnettools.csharp
```
2024-12-03 11:03:28 -08:00
Alex Langford
0ca8a593e5 [lldb][NFC] Remove unused field Platform::m_remote_url (#118411)
Related:
https://discourse.llvm.org/t/rfc-lldb-a-proposal-to-refactor-platform/82697
2024-12-03 10:31:38 -08:00
Luke Riddle
2a1a02461a Make SBMemoryRegionInfoList iterable with Python SWIG (#117358)
This PR fixes a simple SWIG issue with SBMemoryRegionInfoList not being
iterable out-of-the-box. This is mostly because of limitations to the
`lldb_iter` function, which doesn't allow for specifying arguments to
the size / iter functions passed.

Before:
```
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> for region in lldb.process.GetMemoryRegions():
...   print(region)
...
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/opt/llvm/stable/Toolchains/llvm-sand.xctoolchain/usr/lib/python3.10/site-packages/lldb/__init__.py", line 114, in lldb_iter
    yield elem(i)
TypeError: SBMemoryRegionInfoList.GetMemoryRegionAtIndex() missing 1 required positional argument: 'region_info'
```

After:
```
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> for region in lldb.process.GetMemoryRegions():
...   print(region)
... 
[0x0000000000200000-0x00000000002cf000 R--]
[0x00000000002cf000-0x0000000000597000 R-X]
[0x0000000000597000-0x00000000005ad000 R--]
[0x00000000005ad000-0x00000000005b1000 RW-]
[0x00000000005b1000-0x0000000000b68000 RW-]
[0x000000007fff7000-0x000000008fff7000 RW-]
[0x000002008fff7000-0x000010007fff8000 RW-]
[0x0000503000000000-0x0000503000010000 RW-]
[0x0000503e00000000-0x0000503e00010000 RW-]
[0x0000504000000000-0x0000504000010000 RW-]
[0x0000504e00000000-0x0000504e00010000 RW-]
[0x000050d000000000-0x000050d000010000 RW-]
[0x000050de00000000-0x000050de00010000 RW-]
[0x000050e000000000-0x000050e000010000 RW-]
[0x000050ee00000000-0x000050ee00010000 RW-]
[0x0000511000000000-0x0000511000010000 RW-]
[0x0000511e00000000-0x0000511e00010000 RW-]
[0x0000513000000000-0x0000513000010000 RW-]
...
```
2024-12-03 10:29:12 -08:00
Greg Clayton
f44bee78c4 [lldb] Fix the DWARF index cache when index is partial. (#118390)
The ManualDWARFIndex class can create a index cache if the LLDB index
cache is enabled. This used to save the index to the same file,
regardless of wether the cache was a full index (no .debug_names) or a
partial index (have .debug_names, but not all .o files were had
.debug_names). So we could end up saving an index cache that was
partial, and then later load that partial index as if it were a full
index if the user set the 'settings set
plugin.symbol-file.dwarf.ignore-file-indexes true'. This would cause us
to ignore the .debug_names section, and if the index cache was enabled,
we could end up loading the partial index as if it were a full DWARF
index.

This patch detects when the ManualDWARFIndex is being used with
.debug_names, and saves out a cache file with a suffix of "-full" or
"-partial" to avoid this issue.
2024-12-03 10:09:40 -08:00
Pavel Labath
8c749ff8aa [lldb] Fix "exact match" debug_names type queries (#118465)
.. in the global namespace

The problem was the interaction of #116989 with an optimization in
GetTypesWithQuery. The optimization was only correct for non-exact
matches, but that didn't matter before this PR due to the "second layer
of defense". After that was removed, the query started returning more
types than it should.
2024-12-03 15:18:59 +01:00
Michael Buch
9a4c5a59d4 Revert "Re-apply [lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created (#117079)"
This reverts commit ba668eb99c.

Below test started failing again on x86_64 macOS CI. We're unsure
if this patch is the exact cause, but since this patch has broken
this test before, we speculatively revert it to see if it was indeed
the root cause.
```
FAIL: lldb-shell :: Unwind/trap_frame_sym_ctx.test (1692 of 2162)
******************** TEST 'lldb-shell :: Unwind/trap_frame_sym_ctx.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 7: /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/bin/clang --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-apple-darwin22.6.0 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -fmodules-cache-path=/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/lldb-test-build.noindex/module-cache-clang/lldb-shell /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/Inputs/call-asm.c /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/Inputs/trap_frame_sym_ctx.s -o /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/tools/lldb/test/Shell/Unwind/Output/trap_frame_sym_ctx.test.tmp
+ /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/bin/clang --target=specify-a-target-or-use-a-_host-substitution --target=x86_64-apple-darwin22.6.0 -isysroot /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -fmodules-cache-path=/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/lldb-test-build.noindex/module-cache-clang/lldb-shell /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/Inputs/call-asm.c /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/Inputs/trap_frame_sym_ctx.s -o /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/tools/lldb/test/Shell/Unwind/Output/trap_frame_sym_ctx.test.tmp
clang: warning: argument unused during compilation: '-fmodules-cache-path=/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/lldb-test-build.noindex/module-cache-clang/lldb-shell' [-Wunused-command-line-argument]
RUN: at line 8: /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/bin/lldb --no-lldbinit -S /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/tools/lldb/test/Shell/lit-lldb-init-quiet /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/tools/lldb/test/Shell/Unwind/Output/trap_frame_sym_ctx.test.tmp -s /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/trap_frame_sym_ctx.test -o exit | /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/bin/FileCheck /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/trap_frame_sym_ctx.test
+ /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/bin/lldb --no-lldbinit -S /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/tools/lldb/test/Shell/lit-lldb-init-quiet /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/tools/lldb/test/Shell/Unwind/Output/trap_frame_sym_ctx.test.tmp -s /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/trap_frame_sym_ctx.test -o exit
+ /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/lldb-build/bin/FileCheck /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/trap_frame_sym_ctx.test
/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/trap_frame_sym_ctx.test:21:10: error: CHECK: expected string not found in input
         ^
<stdin>:26:64: note: scanning from here
 frame #1: 0x0000000100003ee9 trap_frame_sym_ctx.test.tmp`tramp
                                                               ^
<stdin>:27:2: note: possible intended match here
 frame #2: 0x00007ff7bfeff6c0
 ^

Input file: <stdin>
Check file: /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/Shell/Unwind/trap_frame_sym_ctx.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            .
            .
            .
           21:  0x100003ed1 <+0>: pushq %rbp
           22:  0x100003ed2 <+1>: movq %rsp, %rbp
           23: (lldb) thread backtrace -u
           24: * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
           25:  * frame #0: 0x0000000100003ecc trap_frame_sym_ctx.test.tmp`bar
           26:  frame #1: 0x0000000100003ee9 trap_frame_sym_ctx.test.tmp`tramp
check:21'0                                                                    X error: no match found
           27:  frame #2: 0x00007ff7bfeff6c0
check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:21'1      ?                             possible intended match
           28:  frame #3: 0x0000000100003ec6 trap_frame_sym_ctx.test.tmp`main + 22
check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           29:  frame #4: 0x0000000100003ec6 trap_frame_sym_ctx.test.tmp`main + 22
check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           30:  frame #5: 0x00007ff8193cc41f dyld`start + 1903
check:21'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           31: (lldb) exit
check:21'0     ~~~~~~~~~~~~
>>>>>>
```
2024-12-03 11:04:04 +00:00
Pavel Labath
51b74bb9f6 Reapply "[lldb] Use the function block as a source for function ranges (#117996)"
This reverts commit 2526d5b168, reapplying
ba14dac481 after fixing the conflict with
 #117532. The change is that Function::GetAddressRanges now recomputes
the returned value instead of returning the member. This means it now
returns a value instead of a reference type.
2024-12-03 11:58:36 +01:00
Pavel Labath
2526d5b168 Revert "[lldb] Use the function block as a source for function ranges (#117996)"
This reverts commit ba14dac481. I guess
"has no conflicts" doesn't mean "it will build".
2024-12-03 10:27:31 +01:00
Pavel Labath
ba14dac481 [lldb] Use the function block as a source for function ranges (#117996)
This is a follow-up/reimplementation of #115730. While working on that
patch, I did not realize that the correct (discontinuous) set of ranges
is already stored in the block representing the whole function. The
catch -- ranges for this block are only set later, when parsing all of
the blocks of the function.

This patch changes that by populating the function block ranges eagerly
-- from within the Function constructor. This also necessitates a
corresponding change in all of the symbol files -- so that they stop
populating the ranges of that block. This allows us to avoid some
unnecessary work (not parsing the function DW_AT_ranges twice) and also
results in some simplification of the parsing code.
2024-12-03 10:21:04 +01:00
Pavel Labath
59bb9b915e [lldb] Expose discontinuous functions through SBFunction::GetRanges (#117532)
SBFunction::GetEndAddress doesn't really make sense for discontinuous
functions, so I'm declaring it deprecated. GetStartAddress sort of makes
sense, if one uses it to find the functions entry point, so I'm keeping
that undeprecated.

I've made the test a Shell tests because these make it easier to create
discontinuous functions regardless of the host os and architecture. They
do make testing the python API harder, but I think I've managed to come
up with something not entirely unreasonable.
2024-12-03 10:14:33 +01:00
Dave Lee
0a96161beb [lldb] Simplify DumpValueObjectOptions::PointerDepth (NFC) (#117504)
`Mode::Always` and `Mode::Default` are handled identically.
`Mode::Never` is the same as having a count of 0.
2024-12-02 16:23:26 -08:00
Dave Lee
1250a1db1a [lldb] Update dwim-print to support limited variable expression paths (#117452)
`frame variable` supports nested variable access, which the API calls "variable
expression paths". This change updates `dwim-print` to support a subset of supported
variable expression paths.

Consider the expression `a->b`. In C++, the arrow operator can be overloaded, and where
that is the case, expression evaluation must be used to evaluate it, not frame variable.
Likewise, the subscript operator can be overloaded.

To avoid those cases, this change introduces a limited support for variable expression
paths. Use of the dot operator is allowed.

Additionally, this change allows `dwim-print` to directly access children of `this` and
`self` (see AllowDirectIVarAccess). This functionality is also provided by the same
`GetValueForVariableExpressionPath` method.

rdar://104348908
2024-12-02 13:55:35 -08:00
Dmitry Vasilyev
a951e76fbe [lldb] Added an exponential algorithm for the sleep time in connect_to_debug_monitor() (#118222)
Reduced MAX_ATTEMPTS to 10.
The sleep time will be 3, 3.6, 4.3, ..., 13, 15.
The total sleep time is 78 + 0.5 * MAX_CONNECT_ATTEMPTS * MAX_ATTEMPTS = 128.
Note the timeout is 600, so the rest time must be enough.
Increased the port range (12000..20000).
2024-12-02 20:51:44 +04:00
dlav-sc
9a34a4f8d6 [lldb] fix fd leak during lldb testsuite (#118093)
During lldb testing dotest.py opens files to dump testcase results, but
doesn't close them.

This patch makes necessary changes to fix the file descriptors leak.
2024-12-02 14:51:22 +03:00
Jonas Devlieghere
1c7e4074b1 [lldb] Fix warning: 'sprintf' is deprecated in RNBSocketTest
Fixes warning: 'sprintf' is deprecated: This function is provided for
compatibility reasons only.  Due to security concerns inherent in the
design of sprintf(3), it is highly recommended that you use snprintf(3)
instead.
2024-11-30 17:40:00 -08:00
Jason Molenda
448ac7d341 [lldb][Mach-O] Handle shared cache binaries correctly (#117832)
The Mach-O load commands have an LC_SYMTAB / struct symtab_command which
represents the offset of the symbol table (nlist records) and string
table for this binary. In a mach-o binary on disk, these are file
offsets. If a mach-o binary is loaded in memory with all segments
consecutive, the `symoff` and `stroff` are the offsets from the TEXT
segment (aka the mach-o header) virtual address to the virtual address
of the start of these tables.

However, if a Mach-O binary is a part of the shared cache, then the
segments will be separated -- they will have different slide values. And
it is possible for the LINKEDIT segment to be greater than 4GB away from
the TEXT segment in the virtual address space, so these 32-bit offsets
cannot express the offset from TEXT segment to these tables.

Create separate uint64_t variables to track the offset to the symbol
table and string table, instead of reusing the 32-bit ones in the
symtab_command structure.

rdar://140432279
2024-11-28 10:31:57 -08:00
Pavel Labath
871e3dc8d8 [lldb] Fixup #117699 for windows builds 2024-11-28 11:13:29 +01:00
Pavel Labath
c1dff71525 [lldb] Remove child_process_inherit from the socket classes (#117699)
It's never set to true. Also, using inheritable FDs in a multithreaded
process pretty much guarantees descriptor leaks. It's better to
explicitly pass a specific FD to a specific subprocess, which we already
mostly can do using the ProcessLaunchInfo FileActions.
2024-11-28 08:27:36 +01:00
Saleem Abdulrasool
24593f1814 [lldb] build: cleanup extraneous include paths (#117615)
Clean up some unnecessary include paths. The use of `LibXml2::LibXml2`
with `target_link_libraries` on `libLLDBHost` ensures that the header
search path is properly propagated.
2024-11-27 08:39:15 -08:00
Pavel Labath
284d4e0a7a [lldb] Fix RNBSocketTest for #117691 2024-11-27 13:16:41 +01:00
Pavel Labath
17b87853c3 [lldb] Fix premature MainLoop wakeup on windows (#117756)
The windows system APIs only take milliseconds. Make sure we round the
sleep interval (in nanoseconds) upwards.
2024-11-27 09:34:53 +00:00
Pavel Labath
e8a01e75e6 [lldb] Make sure Blocks always have a parent (#117683)
It's basically true already (except for a brief time during
construction). This patch makes sure the objects are constructed with a
valid parent and enforces this in the type system, which allows us to
get rid of some nullptr checks.
2024-11-27 09:51:59 +01:00
Pavel Labath
0723870420 [lldb] Add timeout argument to Socket::Accept (#117691)
Allows us to stop waiting for a connection if it doesn't come in a
certain amount of time. Right now, I'm keeping the status quo (infitnite
wait) in the "production" code, but using smaller (finite) values in
tests. (A lot of these tests create "loopback" connections, where a
really short wait is sufficient: on linux at least even a poll (0s wait)
is sufficient if the other end has connect()ed already, but this doesn't
seem to be the case on Windows, so I'm using a 1s wait in these cases).
2024-11-27 09:50:33 +01:00
Jason Molenda
f2129ca94c [lldb][NFC] Whitespace fix for mis-indented block
This mis-indented block makes a FC change I'm about
to propose look larger than it is when clang-formatted.
2024-11-26 17:00:35 -08:00
Jacob Lalonde
4ab298b5fb [LLDB][ThreadELFCore] Set all the properties of ELFLinuxSigInfo to a non build dependent size (#117604)
On #110065 the changes to LinuxSigInfo Struct introduced some variables
that will differ in size on 32b or 64b. I've rectified this by setting
them all to build independent types.
2024-11-26 10:20:52 -08:00
Miro Bucko
86f7f089ee Fix return value of 'PluginManager::RegisterPlugin()'. (#114120) 2024-11-26 11:29:24 -05:00
Pavel Labath
5e3f6150b1 [lldb/NativePDB] Don't create parentless blocks (#117581)
In case of an error GetBlock would return a reference to a Block without
adding it to a parent. This doesn't seem like a good idea, and none of
the other plugins do that.

This patch fixes that by propagating errors (well, null pointers...) up
the stack.

I don't know of any specific problem that this solves, but given that
this occurs only when something goes very wrong (e.g. a corrupted PDB
file), it's quite possible noone has run into this situation, so we
can't say the code is correct either. It also gets in the way of a
refactor I'm contemplating.
2024-11-26 07:40:34 +01:00
David Spickett
84fec7757e [lldb][docs] Clarify unit for SVE P register size 2024-11-25 09:53:15 +00:00
Pavel Labath
1bc98957c8 [lldb/DWARF] Remove duplicate type filtering (#116989)
In #108907, the index classes started filtering the DIEs according to
the full type query (instead of just the base name). This means that the
checks in SymbolFileDWARF are now redundant.

I've also moved the non-redundant checks so that now all checking is
done in the DWARFIndex class and the caller can expect to get the final
filtered list of types.
2024-11-25 09:52:19 +01:00
Dave Lee
0bfc951471 [lldb] Remove lldbutil.get_stack_frames (NFC) (#117505)
`SBThread.frames` can be used instead of `get_stack_frames`.
2024-11-24 19:02:47 -08:00
Kazuki Sakamoto
c2ffb42893 [lldb] Fix TestLoadUnload.py (#117416)
ELF core debugging fix #117070 broke TestLoadUnload.py tests due to
GetModuleSpec call, ProcessGDBRemote fetches modules from remote. Revise
the original PR, renamed FindBuildId to FindModuleUUID.
2024-11-24 11:04:47 -08:00
Kazuki Sakamoto
1290e95849 [lldb] Fix ELF core debugging (#117070)
DynamicLoader does not use ProcessElfCore NT_FILE entries to get
UUID. Use GetModuleSpec to get UUID from Process.
2024-11-22 13:55:55 -08:00
Dave Lee
f170f5fa80 [lldb] Add stop_reason_data property to SBThread python extensions (#117266)
Add a pythonic `stop_reason_data` property to `SBThread`. The property
produces a list of ints.
2024-11-22 10:30:44 -08:00
Ilia Kuklin
4be09f0624 [lldb][test] DW_OP_piece-O3.c: Disable on Windows (#117355)
#117168
2024-11-22 23:16:08 +05:00
Ilia Kuklin
dc637e940c Revert "[lldb] Fix DW_OP_piece-O3 test on AArch64 Windows" (#117354)
Reverts llvm/llvm-project#117336
2024-11-22 22:51:11 +05:00
Ilia Kuklin
720a4c70ed [lldb] Fix DW_OP_piece-O3 test on AArch64 Windows (#117336)
Making a breakpoint on a line causes an error on aarch64-pc-windows.
This patch changes the test so that a breakpoint can be made on a
function name.
#117168
2024-11-22 20:30:55 +05:00
Mikhail Goncharov
11ee21671f Revert " [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (#117071)"
This reverts commit f06c187799.

Temporary revert: there is https://github.com/llvm/llvm-project/pull/117239 that is suppose to fix the issue.
Reverting to keep things rolling.
2024-11-22 13:49:37 +01:00
Pavel Labath
d71fa331df [lldb] Fix inline function resolution for discontinuous functions (#116777)
The problem here is the assumption that the entire function will be
placed in a single section. This will ~never be the case for a
discontinuous function, as the point of splitting the function is to let
the linker group parts of the function according to their "hotness".

The fix is to change the offset computation to use file addresses
instead.
2024-11-22 08:32:47 +01:00