Commit Graph

29221 Commits

Author SHA1 Message Date
Felipe de Azevedo Piovezan
9982f8ee02
[lldb][SymbolFileDWARF][NFC] Remove unnecessary calls to GetDWARFDeclContext (#74523)
The function FindDefinitionTypeForDWARFDeclContext loops over all DIEs
corresponding to types with a certain name and compares the context of
each found DIE with the context of a target DIE. However, the target DIE
never changes throughout this search, and yet we recompute its
DeclContext on every iteration of the search. This is wasteful because
the method is not exactly free (see
DWARFDebugInfoEntry::GetDWARFDeclContextStatic).
2023-12-06 10:42:42 -08:00
Augusto Noronha
901bc5129d
[NFC][lldb] Implement DiagnosticManager::Consume (#74011)
In some situations it may be useful to have a separate DiagnosticManager
instance, and then later of move the contents of that instance back to
the "main" DiagnosticManager. For example, when silently retrying some
operation with different parameters, depending on whether the retry
succeeded or failed, LLDB may want to present a different set of
diagnostics to the user (the ones generated on the first try vs the
retry). Implement DiagnosticManager::Consume to allow for this use case.
2023-12-05 12:26:10 -08:00
Brad Smith
5c70c181a3
[lldb] Sync OpenBSD GetOSVersion() closer to NetBSD function (#74396)
Also eliminate an unused variable while here.
2023-12-05 02:50:21 -05:00
Brad Smith
98b4c1ee21 [lldb][NFC] Minor formatting nits with some of the NetBSD code 2023-12-04 23:21:45 -05:00
Brad Smith
961d943e39 [lldb] Remove unused variable
lldb/source/Host/netbsd/HostInfoNetBSD.cpp:48:8: warning: unused variable 'osrev_str' [-Wunused-variable]
  char osrev_str[12];
       ^
1 warning generated.
2023-12-04 19:51:31 -05:00
Brad Smith
a2e61bc2f3
[lldb] Additional pieces towards OpenBSD support (#74198) 2023-12-04 15:14:49 -05:00
Kevin Frei
c43c86c285
DEBUGINFOD based DWP acquisition for LLDB (#70996)
I've plumbed the LLVM DebugInfoD client into LLDB, and added automatic
downloading of DWP files to the SymbolFileDWARF.cpp plugin. If you have
DEBUGINFOD_URLS set to a space delimited set of web servers, LLDB will
try to use them as a last resort when searching for DWP files. If you do
*not* have that environment variable set, nothing should be changed.
There's also a setting, per @clayborg 's suggestion, that will override
the environment variable, or can be used instead of the environment
variable. The setting is why I also needed to add an API to the
llvm-debuginfod library

### Test Plan:

Suggestions are welcome here. I should probably have some positive and
negative tests, but I wanted to get the diff up for people who have a
clue what they're doing to rip it to pieces before spending too much
time validating the initial implementation.

---------

Co-authored-by: Kevin Frei <freik@meta.com>
Co-authored-by: Alex Langford <nirvashtzero@gmail.com>
2023-12-04 11:45:40 -08:00
Felipe de Azevedo Piovezan
d24d7edaef [lldb][NFC] Delete unreachable code and dead variable in OptionArgParser
With the combination of an early return and removing an else-after-return, it
becomes evident that there is unreachable code in the function being changed.
2023-12-04 10:23:05 -08:00
Felipe de Azevedo Piovezan
3e98a28513 [lldb][NFC] Remove else after return in OptionArgParse
This will enable us to prove that there is unreachable code in this function in
a subsequent commit.
2023-12-04 10:23:05 -08:00
Felipe de Azevedo Piovezan
7a86cc6c4c [lldb][NFC] Remove unnecessary std::string temporaries
The existing code was taking three substrings from a regex match and converting
to std::strings prior to using them. This may have been done to address
null-termination concerns, but this is not the case:

1. `name` was being used to call `c_str()` and then implicitly converted back to
a `StringRef` on the call to `ToAddress`. While the path `const char *` ->
`StringRef` requires null-termination, we can simply use the original StringRef.
2. `str_offset` was being converted back to a StringRef in order to call a
member method. Member methods can't handle non-null termination.
3. `sign` simply had it's 0-th element accessed.
2023-12-04 10:23:04 -08:00
Brad Smith
b96bae2887
[lldb] Fix building on NetBSD 8.x (#74191)
PT_STOP was introduced with NetBSD 9.0.
2023-12-04 03:02:13 -05:00
Brad Smith
c1e2457a14
[lldb] Fix build on NetBSD (#74190)
lldb/source/Host/netbsd/HostNetBSD.cpp:112:32: error: reinterpret_cast from 'const uint8_t *' (aka 'const unsigned char *') to 'char *' casts away qualifiers
                              {reinterpret_cast<char *>(buffer_sp->GetBytes()),
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
2023-12-04 03:01:38 -05:00
Brad Smith
25ea0e9d9a
[lldb] Make use of LD_LIBRARY_PATH on OpenBSD (#74017) 2023-12-01 16:06:22 -05:00
Brad Smith
c3f0932c18
[lldb] Simplify pipe2(2) handling on FreeBSD (#74019)
FreeBSD 10.x and 11.x support has been dropped leaving 12.x as the
minimum version. This FreeBSD check can be simplified.


812dad536e
2023-12-01 16:05:38 -05:00
Brad Smith
81cd283f06
[lldb/test] Add OpenBSD to _get_platform_os (#74036) 2023-12-01 16:04:19 -05:00
Brad Smith
a37c69ec31
[lldb] Remove pre GCC 4.8 workaround (#73981)
The minimum GCC version was bumped up from 4.8 to 5.1 and then even newer
awhile ago so garbage collect the pre 4.8 workaround.

https://reviews.llvm.org/D66188
2023-11-30 23:14:46 -05:00
Brad Smith
668a4a2380
[lldb] pipe2(2) is also supported by OpenBSD (#74012) 2023-11-30 20:19:36 -05:00
Jason Molenda
9e77d666d8 Correctly disable hardware watchpoints after a fork event
Fix a failure on Linux system where follow-fork-mode
exists, which caused the large watchpoint NFC patch
to be reverted earlier this week.
2023-11-30 14:59:10 -08:00
Nico Weber
22f72642fe [lldb] try to fix build on linux after fc6b72523f
Tries to fix:

    ../../lldb/source/Breakpoint/WatchpointResource.cpp:59:12:
    error: no member named 'find' in namespace 'std'; did you mean 'fill'?
          std::find(m_constituents.begin(), m_constituents.end(), wp_sp);
          ~~~~~^~~~
               fill

(cherry picked from commit a6c62bf1a4)
2023-11-30 14:59:10 -08:00
Jason Molenda
162e4b8c49 Include <vector> in WatchpointResource.h
On macOS <vector> was already included via another
header file, but this failed on the CI bots.  I'd
tested on linux earlier in this patch's life when
the headers were differently arranged.

(cherry picked from commit a0a1ff3ab4)
2023-11-30 14:59:10 -08:00
Jason Molenda
c73a3f16f8 [lldb] [mostly NFC] Large WP foundation: WatchpointResources (#68845)
This patch is rearranging code a bit to add WatchpointResources to
Process. A WatchpointResource is meant to represent a hardware
watchpoint register in the inferior process. It has an address, a size,
a type, and a list of Watchpoints that are using this
WatchpointResource.

This current patch doesn't add any of the features of
WatchpointResources that make them interesting -- a user asking to watch
a 24 byte object could watch this with three 8 byte WatchpointResources.
Or a Watchpoint on 1 byte at 0x1002 and a second watchpoint on 1 byte at
0x1003, these must both be served by a single WatchpointResource on that
doubleword at 0x1000 on a 64-bit target, if two hardware watchpoint
registers were used to track these separately, one of them may not be
hit. Or if you have one Watchpoint on a variable with a condition set,
and another Watchpoint on that same variable with a command defined or
different condition, or ignorecount, both of those Watchpoints need to
evaluate their criteria/commands when their WatchpointResource has been
hit.

There's a bit of code movement to rearrange things in the direction I'll
need for implementing this feature, so I want to start with reviewing &
landing this mostly NFC patch and we can focus on the algorithmic
choices about how WatchpointResources are shared and handled as they're
triggeed, separately.

This patch also stops printing "Watchpoint <n> hit: old value: <x>, new
vlaue: <y>" for Read watchpoints. I could make an argument for print
"Watchpoint <n> hit: current value <x>" but the current output doesn't
make any sense, and the user can print the value if they are
particularly interested. Read watchpoints are used primarily to
understand what code is reading a variable.

This patch adds more fallbacks for how to print the objects being
watched if we have types, instead of assuming they are all integral
values, so a struct will print its elements. As large watchpoints are
added, we'll be doing a lot more of those.

To track the WatchpointSP in the WatchpointResources, I changed the
internal API which took a WatchpointSP and devolved it to a Watchpoint*,
which meant touching several different Process files. I removed the
watchpoint code in ProcessKDP which only reported that watchpoints
aren't supported, the base class does that already.

I haven't yet changed how we receive a watchpoint to identify the
WatchpointResource responsible for the trigger, and identify all
Watchpoints that are using this Resource to evaluate their conditions
etc. This is the same work that a BreakpointSite needs to do when it has
been tiggered, where multiple Breakpoints may be at the same address.

There is not yet any printing of the Resources that a Watchpoint is
implemented in terms of ("watchpoint list", or
SBWatchpoint::GetDescription).

"watchpoint set var" and "watchpoint set expression" take a size
argument which was previously 1, 2, 4, or 8 (an enum). I've changed this
to an unsigned int. Most hardware implementations can only watch 1, 2,
4, 8 byte ranges, but with Resources we'll allow a user to ask for
different sized watchpoints and set them in hardware-expressble terms
soon.

I've annotated areas where I know there is work still needed with
LWP_TODO that I'll be working on once this is landed.

I've tested this on aarch64 macOS, aarch64 Linux, and Intel macOS.

https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116
(cherry picked from commit fc6b72523f)
2023-11-30 14:59:10 -08:00
John Harrison
c8f72856db
[lldb-dap] Fixing a type encoding issue with dap Stopped events. (#72292)
Previously the type of the breakpoint id in the Stopped event was a
uint64_t, however thats the wrong type for a breakpoint id, which can
cause encoding issues when internal breakpoints are hit.
2023-11-30 15:17:12 -05:00
jimingham
d1bf1947e4
Send an explicit interrupt to cancel an attach waitfor. (#72565)
Currently when you interrupt a:

(lldb) process attach -w -n some_process

lldb just closes the connection to the stub and kills the
lldb_private::Process it made for the attach. The stub at the other end
notices the connection go down and exits because of that. But when
communication to a device is handled through some kind of proxy server
which isn't as well behaved as one would wish, that signal might not be
reliable, causing debugserver to persist on the machine, waiting to
steal the next instance of that process.

We can work around those failures by sending an explicit interrupt
before closing down the connection. The stub will also have to be
waiting for the interrupt for this to make any difference. I changed
debugserver to do that.

I didn't make the equivalent change in lldb-server. So long as you
aren't faced with a flakey connection, this should not be necessary.
2023-11-30 09:48:04 -08:00
Michael Buch
effaf41d20
[lldb][DWARFASTParserClang][NFCI] Make ParsedDWARFTypeAttributes parameter const (#73833) 2023-11-30 05:16:23 +00:00
Michael Buch
bcb621f0a1
[lldb][DWARFASTParserClang][NFC] Remove redundant parameter to AddMethodToObjCObjectType (#73832) 2023-11-30 05:15:57 +00:00
Greg Clayton
ce00133e5f
Allow lldb to load .dwp files with large .debug_info or .debug_types. (#73736)
A previous patch to llvm allowed the DWARFUnitIndex class to handle
.debug_info.dwo and .debug_types.dwo sections to go over 4GB by checking
for this case and fixing up the DWARFUnitIndex. LLDB's DWARF parser
tries to use the llvm's DWARF parser when it can, and LLDB's DWARF
parser uses the llvm::DWARFUnitIndex which should allow us to load large
.dwp files, but there were a few things missing on the LLDB front:
- support for parsing DWARFUnit objects when the offset exceeds 4GB due
to a 32 bit truncation issue
- not populating the required DWARF sections when we call
DWARFContext::GetAsLLVM() which didn't allow the fixups to happen as the
data was missing.

This patch fixes these issues and now allows LLDB to parse large .dwp
files without issues. The issue was discovered when running the "target
modules dump separate-debug-info" command on one of these binaries that
used a large .dwp file.

This is unfortunately hard to test without creating a huge .dwp file, so
there are currently no tests for this that I can think of adding that
wouldn't cause disk space constraints or making testing times longer by
producing a huge .dwp file.
2023-11-29 11:19:50 -08:00
Jordan Rupprecht
3d7e6db120
[lldb][test] Remove reason from unittest2.expectedFailure usage (#73028) 2023-11-28 23:36:05 -06:00
Michael Buch
4eb4211924
[lldb][test] TestConstStaticIntegralMember: relax assertion on number of global variables (#73707)
In https://github.com/llvm/llvm-project/pull/73626 we started attaching
`DW_AT_const_value`s on a static data-member's declaration again. In
DWARFv5, those static members are represented with a `DW_TAG_variable`.
When LLDB builds the `ManualDWARFIndex`, it simply iterates over all
DIEs in a CU and puts *any* `DW_TAG_variable` with a constant or
location into the index. So when using the manual index, we can end up
having 2 entries for a static data member in the index, one for the
declaration and one for the definition.

This caused a test failure on Linux (where DWARFv5 is the default and
the tests use the manual index).

This patch loosens the restriction that we find exactly 1 variable.
2023-11-28 17:04:19 -08:00
Greg Clayton
3661eb150e
Add support for parsing type unit entries in .debug_names. (#72952)
This is a follow up patch after .debug_names can now emit local type
unit entries when we compile with type units + DWARF5 + .debug_names.
The pull request that added this functionality was:

https://github.com/llvm/llvm-project/pull/70515

This patch makes sure that the DebugNamesDWARFIndex in LLDB will not
manually need to parse type units if they have a valid index. It also
fixes the index to be able to correctly extract name entries that
reference type unit DIEs. Added a test to verify things work as
expected.
2023-11-28 13:56:45 -08:00
Chelsea Cassanova
c846f8ba10
[lldb][progress] Always report progress upon Progress object destruction (#73605)
This commit allows a final progress report upon the destruction of the
`Progress` object to happen at all times as opposed to when the progress
was not completed.
2023-11-28 10:45:02 -08:00
Haojian Wu
439b16e2b3
[LLDB] Respect the DW_AT_alignment attribute. (#73307)
Part of fixes for #72913.

clang emits `DW_AT_alignment` attribute, however LLDB didn't respect it,
resulting in incorrect RecordDecls built by lldb.

This only fixes non-inheritance cases. The inheritance case will be
handled in a follow-up patch.
2023-11-28 12:27:55 +01:00
David Spickett
b0af8a1ede Revert "[lldb] [mostly NFC] Large WP foundation: WatchpointResources (#68845)"
...and follow ups.

As it has caused test failures on Linux Arm and AArch64:
https://lab.llvm.org/buildbot/#/builders/96/builds/49126
https://lab.llvm.org/buildbot/#/builders/17/builds/45824

```
  lldb-shell :: Subprocess/clone-follow-child-wp.test
  lldb-shell :: Subprocess/fork-follow-child-wp.test
  lldb-shell :: Subprocess/vfork-follow-child-wp.test
```

This reverts commit a6c62bf1a4,
commit a0a1ff3ab4 and commit
fc6b72523f.
2023-11-28 09:39:37 +00:00
David Spickett
1459c627f0 [lldb][PDB] Fix message order in test case
Launch/stopped ordering was fixed by bd8f1068ca
but the Windows on Arm bot wasn't running at the time it landed.
2023-11-28 09:15:51 +00:00
Nico Weber
a6c62bf1a4 [lldb] try to fix build on linux after fc6b72523f
Tries to fix:

    ../../lldb/source/Breakpoint/WatchpointResource.cpp:59:12:
    error: no member named 'find' in namespace 'std'; did you mean 'fill'?
          std::find(m_constituents.begin(), m_constituents.end(), wp_sp);
          ~~~~~^~~~
               fill
2023-11-28 08:53:05 +09:00
Jason Molenda
a0a1ff3ab4 Include <vector> in WatchpointResource.h
On macOS <vector> was already included via another
header file, but this failed on the CI bots.  I'd
tested on linux earlier in this patch's life when
the headers were differently arranged.
2023-11-27 13:39:24 -08:00
Jason Molenda
fc6b72523f
[lldb] [mostly NFC] Large WP foundation: WatchpointResources (#68845)
This patch is rearranging code a bit to add WatchpointResources to
Process. A WatchpointResource is meant to represent a hardware
watchpoint register in the inferior process. It has an address, a size,
a type, and a list of Watchpoints that are using this
WatchpointResource.

This current patch doesn't add any of the features of
WatchpointResources that make them interesting -- a user asking to watch
a 24 byte object could watch this with three 8 byte WatchpointResources.
Or a Watchpoint on 1 byte at 0x1002 and a second watchpoint on 1 byte at
0x1003, these must both be served by a single WatchpointResource on that
doubleword at 0x1000 on a 64-bit target, if two hardware watchpoint
registers were used to track these separately, one of them may not be
hit. Or if you have one Watchpoint on a variable with a condition set,
and another Watchpoint on that same variable with a command defined or
different condition, or ignorecount, both of those Watchpoints need to
evaluate their criteria/commands when their WatchpointResource has been
hit.

There's a bit of code movement to rearrange things in the direction I'll
need for implementing this feature, so I want to start with reviewing &
landing this mostly NFC patch and we can focus on the algorithmic
choices about how WatchpointResources are shared and handled as they're
triggeed, separately.

This patch also stops printing "Watchpoint <n> hit: old value: <x>, new
vlaue: <y>" for Read watchpoints. I could make an argument for print
"Watchpoint <n> hit: current value <x>" but the current output doesn't
make any sense, and the user can print the value if they are
particularly interested. Read watchpoints are used primarily to
understand what code is reading a variable.

This patch adds more fallbacks for how to print the objects being
watched if we have types, instead of assuming they are all integral
values, so a struct will print its elements. As large watchpoints are
added, we'll be doing a lot more of those.

To track the WatchpointSP in the WatchpointResources, I changed the
internal API which took a WatchpointSP and devolved it to a Watchpoint*,
which meant touching several different Process files. I removed the
watchpoint code in ProcessKDP which only reported that watchpoints
aren't supported, the base class does that already.

I haven't yet changed how we receive a watchpoint to identify the
WatchpointResource responsible for the trigger, and identify all
Watchpoints that are using this Resource to evaluate their conditions
etc. This is the same work that a BreakpointSite needs to do when it has
been tiggered, where multiple Breakpoints may be at the same address.

There is not yet any printing of the Resources that a Watchpoint is
implemented in terms of ("watchpoint list", or
SBWatchpoint::GetDescription).

"watchpoint set var" and "watchpoint set expression" take a size
argument which was previously 1, 2, 4, or 8 (an enum). I've changed this
to an unsigned int. Most hardware implementations can only watch 1, 2,
4, 8 byte ranges, but with Resources we'll allow a user to ask for
different sized watchpoints and set them in hardware-expressble terms
soon.

I've annotated areas where I know there is work still needed with
LWP_TODO that I'll be working on once this is landed.

I've tested this on aarch64 macOS, aarch64 Linux, and Intel macOS.

https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116
2023-11-27 13:28:59 -08:00
David Spickett
772f296214 [lldb][AArch64][Linux] Correct name of FPCR field
It should be "RMode" as in "rounding mode" not "RMMode".
2023-11-27 09:10:56 +00:00
David Spickett
8167934480
[lldb] Improve error message for script commands when there's no interpreter (#73321)
It was:
```
error: there is no embedded script interpreter in this mode.
```

1. What does "mode" mean?
2. It implies there might be an embedded script interpreter for some
other "mode", whatever that would be.

So I'm simplifying it and noting the most common reason for this which
is that lldb wasn't built with a scripting language enabled in the first
place.

There are other tips for dealing with this, but I'm not sure this
message is the best place for them.
2023-11-27 09:10:39 +00:00
Caroline Tice
af3c5a7cf1 Revert "[LLDB] Add more helper functions to CompilerType class."
PR 73467 was committed by accident. This undoes the premature commit.
2023-11-26 17:03:35 -08:00
cmtice
42d669f82c
[LLDB] Add more helper functions to CompilerType class. (#73467)
This adds 23 new helper functions to LLDB's CompilerType class, things
like IsSmartPtrType, IsPromotableIntegerType,
GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a
few).

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-11-26 16:37:39 -08:00
José Lira Junior
bd8f1068ca
[lldb] correct inconsistent order of messages on process launch (#73173)
Fixes [#68035](https://github.com/llvm/llvm-project/issues/68035), where
an inconsistency in the order of "Process launched" and "Process
stopped" messages occurs during `process launch`.

The fix involves adjusting the message output sequence in
`CommandObjectProcessLaunch::DoExecute` within
`source/Commands/CommandObjectProcess.cpp`. This ensures "Process
launched" consistently precedes "Process stopped" when executing
commands with the '-o' flag, i.e., non-interactive mode.

Upon implementing this change, two tests failed:
`lldb/test/Shell/Breakpoint/jit-loader_jitlink_elf.test` and
`lldb/test/Shell/Breakpoint/jit-loader_rtdyld_elf.test`. These failures
were expected as they relied on the previous, now-corrected message
order. Updating these tests to align with the new message sequence is
part of this PR's scope.
2023-11-24 15:48:16 +00:00
jeffreytan81
85ee3fc7ec
Fix command escape bug in lldb-dap (#72902)
https://github.com/llvm/llvm-project/pull/69238 caused breakage in
VSCode debug console usage -- the user's input is always treated as
commands instead of expressions (the same behavior as if empty command
escape prefix is specified).

The bug is in one overload of `GetString()` which did not respect the
default value of "\`". But more important, I am puzzled to find out why
the regression is not caught by lldb test (testdap_evaluate). Turns out
https://github.com/llvm/llvm-project/pull/69238 specifies
commandEscapePrefix default value in test framework to be "\`" while
VSCode will default not specify any commandEscapePrefix at all. Changing
it to None will fail `testdap_evaluate`. We should align the default
behavior between DAP client and testcase.

This patches fixes the bug in `GetString()` and changed the default
value of commandEscapePrefix in testcases to be None (be consistent with
IDE).

Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2023-11-20 15:57:14 -08:00
Tom Yang
69a5869da4
[lldb][split-dwarf] implement GetSeparateDebugInfo for SymbolFileOnDemand (#71230)
Small change to get `image dump separate-debug-info` working when using
`symbols.load-on-demand`.

Added tests to `TestDumpDwo`, and enabled the test for all platforms. If we fail to build, we skip the test, so this shouldn't cause the test to fail on unsupported platforms.
```
bin/lldb-dotest -p TestDumpDwo
```

It's easy to verify this manually by running 
```
lldb --one-line-before-file "settings set symbols.load-on-demand true" <some_target>
(lldb) image dump separate-debug-info
...
```

---------

Co-authored-by: Tom Yang <toyang@fb.com>
2023-11-20 12:17:15 -08:00
Muhammad Omair Javaid
c1fe190049 Revert "Add new API in SBTarget for loading core from SBFile (#71769)"
This reverts commit e2fb816c4f.
It breaks TestLinuxCore.py on lldb-*-windows. See buildbot below:
https://lab.llvm.org/buildbot/#/builders/219/builds/7014
2023-11-20 11:12:34 +05:00
Jonas Devlieghere
94ce378ec0
[lldb] Remove unused Status::SetMachError (NFC) (#72668)
This function is never used, neither here nor downstream in the Swift
fork. As far as I can tell, the same is true for the corresponding
eErrorTypeMachKernel but as that's part of the SB API we cannot remove
that.
2023-11-17 10:17:48 -08:00
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