209 Commits

Author SHA1 Message Date
Michael Buch
fac7453d2c
[lldb][Mangled] Move SuffixRange computation into TrackingOutputBuffer (#152483)
This way all the tracking is self-contained in `TrackingOutputBuffer`
and we can test the `SuffixRange` properly.
2025-08-07 14:39:52 +01:00
Michael Buch
406f61fd3a
[lldb][CPlusPlusLanguage] Create public accessors for getting DemangledNameInfo components and use them in tests (#152134)
This way we make sure that the logic to reconstruct demangled names in
the tests is the same as the logic when reconstructing the actual
frame-format variable.

`DemangledNameInfo::SuffixRange` is currently the only one which we
can't test in the same way until we set it from inside the
`TrackingOutputBuffer`. I added TODOs to track this.
2025-08-05 18:12:22 +01:00
Charles Zablit
ab6923b9b7
[lldb] add TemplateRange and NameQualifiersRange to DemangledNameInfo (#150999)
This patch adds 2 new attributes to `DemangledNameInfo`: `TemplateRange`
and `NameQualifiersRange`. It also introduces the
`function.name-qualifiers` entity formatter which allows tracking
qualifiers between the name of a function and its arguments/template.

This will be used downstream in Swift but may have applications in C++:
https://github.com/swiftlang/llvm-project/pull/11068.
2025-08-05 14:07:35 +02:00
beetrees
e15b3ef704
[lldb] Add support for displaying __float128 variables (#98369) 2025-07-31 18:04:48 -07:00
Pavel Labath
b77114b723
[lldb] Remove child_process_inherit argument from Pipe (#145516)
It's not necessary on posix platforms as of #126935 and it's ignored on
windows as of #138896. For both platforms, we have a better way of
inheriting FDs/HANDLEs.
2025-06-26 13:51:14 +02:00
Pavel Labath
cf9546b826
[lldb] Remove GDBRemoteCommunication::ConnectLocally (#145293)
Originally added for reproducers, it is now only used for test code.

While we could make it a test helper, I think that after #145015 it is
simple enough to not be needed.

Also squeeze in a change to make ConnectionFileDescriptor accept a
unique_ptr<Socket>.
2025-06-24 11:11:35 +02:00
Charles Zablit
a0329eaa0c
[lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (#144731)
Upgrade the callees of `HandleFrameFormatVariable`
(`GetDemangledTemplateArguments`, etc), to return a `llvm::Expected`
instead of an `std::optional`.

This patch also bundles the logic of validating the demangled name and
information into a single reusable function to reduce code duplication.
2025-06-23 18:41:48 +02:00
Pavel Labath
c5629f2b60
[lldb] Add Socket::CreatePair (#145015)
It creates a pair of connected sockets using the simplest mechanism for
the given platform (TCP on windows, socketpair(2) elsewhere).

Main motivation is to remove the ugly platform-specific code in
ProcessGDBRemote::LaunchAndConnectToDebugserver, but it can also be used
in other places where we need to create a pair of connected sockets.
2025-06-23 10:51:26 +02:00
Charles Zablit
c079040eea
[lldb] add has methods to all DemangledNameInfo attributes (#144549)
Add `hasX` methods to all the attributes of `DemangledNameInfo`.
2025-06-19 13:44:41 +01:00
David Peixotto
d4fe522eb4
Add commands to list/enable/disable plugins (#134418)
This commit adds three new commands for managing plugins. The `list`
command will show which plugins are currently registered and their
enabled state. The `enable` and `disable` commands can be used to enable
or disable plugins.

A disabled plugin will not show up to the PluginManager when it iterates
over available plugins of a particular type.

The purpose of these commands is to provide more visibility into
registered plugins and allow users to disable plugins for experimental
perf reasons.

There are a few limitations to the current implementation

1. Only SystemRuntime and InstrumentationRuntime plugins are currently
supported. We can easily extend the existing implementation to support
more types. The scope was limited to these plugins to keep the PR size
manageable.

2. Only "statically" know plugin types are supported (i.e. those managed
by the PluginManager and not from `plugin load`). It is possibly we
could support dynamic plugins as well, but I have not looked into it
yet.
2025-06-09 13:30:13 -07:00
Michael Buch
5a918923f3
[lldb][Format] Add [inlined] marker to names of inlined frames (#142952)
This was removed in https://github.com/llvm/llvm-project/pull/135343 in
favour of making it a format variable, which we do here. This follows
the precedent of the `[opt]` and `[artificial]` markers.

Before:
```
 thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
 * frame #0: 0x000000010000037c a.out`inlined1() at inline.cpp:4:3
   frame #1: 0x000000010000037c a.out`regular() at inline.cpp:6:17
   frame #2: 0x00000001000003b8 a.out`inlined2() at inline.cpp:7:43
   frame #3: 0x00000001000003b4 a.out`main at inline.cpp:10:3
   frame #4: 0x0000000186345be4 dyld`start + 7040
```

After (note the `[inlined]` markers):
```
thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.2
* frame #0: 0x000000010000037c a.out`inlined1() at inline.cpp:4:3 [inlined]
  frame #1: 0x000000010000037c a.out`regular() at inline.cpp:6:17
  frame #2: 0x00000001000003b8 a.out`inlined2() at inline.cpp:7:43 [inlined]
  frame #3: 0x00000001000003b4 a.out`main at inline.cpp:10:3
  frame #4: 0x0000000186345be4 dyld`start + 7040
```

rdar://152642178
2025-06-05 17:41:37 +01:00
Jordan Rupprecht
ae8ac77af8
[lldb][test] Provide TrackingOutputBufferDeleter for custom unique_ptr deleter (#142815)
Suggested in #142676 as a way to automatically free the buffer in tests
2025-06-04 22:38:11 -05:00
Jordan Rupprecht
79f298e7e5
[lldb][test] Free buffers in demangling tests to avoid leaks (#142676)
Test case added by f669b9c3eca9438d33259aefb8156f977f1df382 / #137793.
Note that the `DemanglingParts` case above also frees the buffer; this
new test case is inconsistent.
2025-06-04 10:34:16 -05:00
Pavel Labath
2c4f67794b
[lldb/cmake] Implicitly pass arguments to llvm_add_library (#142583)
If we're not touching them, we don't need to do anything special to pass
them along -- with one important caveat: due to how cmake arguments
work, the implicitly passed arguments need to be specified before
arguments that we handle.

This isn't particularly nice, but the alternative is enumerating all
arguments that can be used by llvm_add_library and the macros it calls
(it also relies on implicit passing of some arguments to
llvm_process_sources).
2025-06-04 11:33:37 +02:00
Jonas Devlieghere
6760857bf3
[lldb] Fix data race in statusline format handling (#142489)
This fixes a data race between the main thread and the default event
handler thread. The statusline format option value was protected by a
mutex, but it was returned as a pointer, allowing one thread to access
it while another was modifying it.

Avoid the data race by returning format values by value instead of by
pointer.
2025-06-03 19:12:30 -07:00
Michael Buch
f669b9c3ec
[lldb][test] Test all libcxxabi demangler test-cases against TrackingOutputBuffer (#137793)
To test the infrastructure added in
https://github.com/llvm/llvm-project/pull/131836 in would be nice to
confirm that we can reconstruct all kinds of demangled names. The
libcxxabi test-suite already has all those test-cases.

This patch copies those test-cases (taken from
`libcxxabi/test/test_demangle.pass.cpp`), reconstructs the name like
LLDB would when showing backtraces, and confirms that all demangled
names can be fully reconstructed.

Two open questions:
1. Do we really want a copy of all those test-cases in LLDB? It's
unlikely to be kept in sync with the demangler test-suite. It includes
30,000+ test-cases
2. Do we want to turn the
`GetDemangledBasename`/`GetDemangledScope`/etc. into public APIs (e.g.,
on `TrackingOutputBuffer`) so that we can use the exact same method of
extraction in the tests?
2025-05-31 09:05:53 +01:00
Charles Zablit
711a1779dc
add explicit default initialization to DemangledNameInfo to remove warning (#141790)
https://github.com/llvm/llvm-project/pull/140762 introduces some
compilation warnings in `lldb/unittests/Core/MangledTest.cpp`. This
patch adds explicit default initialization to `DemangledNameInfo` to
suppress those warnings.

We only had the default initialization values to `PrefixRange` and
`SuffixRange` because they are the only _optional_ fields of the
structure.
2025-05-28 21:41:45 +01:00
Jonas Devlieghere
3e235a7c60
[lldb] Support alternatives for scope format entries (#137751)
This PR implements support for specifying multiple alternatives for
scope format entries. Scopes are used to enclose things that should only
be printed when everything in the scope resolves.

For example, the following scope only resolves if both
`${line.file.basename}` and `${line.number}` resolve. `

```
{ at ${line.file.basename}:${line.number}}
```

However, the current implementation doesn't let you specify what to
print when they don't resolve. This PR adds support for specifying
multiple alternative scopes, which are evaluated left-to-right.

For example:

```
{ at ${line.file.basename}:${line.number}| in ${function.name}| <unknown location>}
```

This will resolve to:

- ` at ${line.file.basename}:${line.number}` if the corresponding
variables resolve.
- Otherwise, this resolves to ` in ${function.name}` if
`${function.name}` resolves.
- Otherwise, this resolves to ` <unknown location>` which always
resolves.

This PR makes the `|` character a special character within a scope, but
allows it to be escaped.

I ended up with this approach because it fit quite nicely in the
existing architecture of the format entries and by limiting the
functionality to scopes, it sidesteps some complexity, like dealing with
recursion.
2025-05-05 16:10:57 -07:00
Ivan Tadeu Ferreira Antunes Filho
b85f37a132
[lldb][test] Free buffer to fix memory leak on test (#137979) 2025-04-30 16:02:33 -04:00
Michael Buch
252b095b32 [lldb][test] Add more test-cases to MangledTest 2025-04-29 10:07:04 +01:00
Vy Nguyen
a74e4ac9d5
[LLDB][Telemetry] Collect telemetry from client when allowed. (#129728)
This patch is slightly different from other impl in that we dispatch
client-telemetry via a different helper method. This is to make it
easier for vendor to opt-out (simply by overriding the method to do
nothing). There is also a configuration option to disallow collecting
client telemetry.

---------

Co-authored-by: Pavel Labath <pavel@labath.sk>
2025-04-26 02:19:29 +02:00
Michael Buch
5137587fb1 [lldb][test] MangledTest: don't use designated initializers
It's a C++20 feature and is causing some buildbots to fail:
```
FAILED: tools/lldb/unittests/Core/CMakeFiles/LLDBCoreTests.dir/MangledTest.cpp.obj
ccache C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1443~1.348\bin\Hostx64\x64\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\unittests\Core -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\include -IC:\Python312\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\..\clang\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\..\clang\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\third-party\unittest\googletest\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\third-party\unittest\googlemock\include -D__OPTIMIZE__ /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2  -MD   -wd4018 -wd4068 -wd4150 -wd4201 -wd4251 -wd4521 -wd4530 -wd4589  /EHs-c- /GR- -UNDEBUG -std:c++17 /showIncludes /Fotools\lldb\unittests\Core\CMakeFiles\LLDBCoreTests.dir\MangledTest.cpp.obj /Fdtools\lldb\unittests\Core\CMakeFiles\LLDBCoreTests.dir\ /FS -c C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(416): error C7555: use of designated initializers requires at least '/std:c++20'
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(415): error C7556: cannot mix designated-initializers with non-designated-initializers
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(418): error C7555: use of designated initializers requires at least '/std:c++20'
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(423): error C7555: use of designated initializers requires at least '/std:c++20'
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(422): error C7556: cannot mix designated-initializers with non-designated-initializers
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(424): error C7555: use of designated initializers requires at least '/std:c++20'
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(429): error C7555: use of designated initializers requires at least '/std:c++20'
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(428): error C7556: cannot mix designated-initializers with non-designated-initializers
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(431): error C7555: use of designated initializers requires at least '/std:c++20'
C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\Core\MangledTest.cpp(436): error C7555: use of designated initializers requires at least '/std:c++20'

```
2025-04-26 01:00:17 +01:00
Michael Buch
da14f6d4b9 [lldb] Fix MangledTest build failure
No equality operator was specified. Define one locally.
2025-04-25 11:25:59 +01:00
Michael Buch
a2672250be [lldb][Mangled] Retrieve and cache demangled name info (#131836)
Uses the `TrackingOutputBuffer` to populate the new member `Mangled::m_demangled_info`.

`m_demangled_info` is lazily popluated by `GetDemangledInfo`. To ensure `m_demangled` and `m_demangled_info` are in-sync we clear `m_demangled_info` anytime `m_demangled` is set/cleared.

https://github.com/llvm/llvm-project/pull/131836
2025-04-25 10:04:27 +01:00
Michael Buch
9c830cef3d [lldb] Implement TrackingOutputBuffer to track demangled name information (#131836)
This patch implements a new `TrackingOutputBuffer` which tracks where the scope/basename/arguments begin and end in the demangled string.

The idea that a function name can be decomposed into <scope, base, arguments>. The assumption is that given the ranges of those three elements and the demangled name, LLDB will be able to to reconstruct the full demangled name. The tracking of those ranges is pretty simple. We don’t ever deal with nesting, so whenever we recurse into a template argument list or another function type, we just stop tracking any positions. Once we recursed out of those, and are back to printing the top-level function name, we continue tracking the positions.

We introduce a new structure `FunctionNameInfo` that holds all this information and is stored in the new `TrackingOutputBuffer` class.

Tests are in `ItaniumDemangleTest.cpp`.

https://github.com/llvm/llvm-project/pull/131836
2025-04-25 10:04:27 +01:00
Raul Tambre
c890b7376f
[lldb][Telemetry] Fix unit test compile failure with LLVM_ENABLE_TELEMETRY=0 (#136115)
It needs to be `TEST_F` to access `received_entries`.
Disabling also works based on the test not the fixture name.

Build failure:
```
lldb/unittests/Core/TelemetryTest.cpp:110:17: error: use of undeclared identifier 'received_entries'
  110 |   ASSERT_EQ(1U, received_entries.size());
      |                 ^
lldb/unittests/Core/TelemetryTest.cpp:112:61: error: use of undeclared identifier 'received_entries'
  112 |             llvm::dyn_cast<lldb_private::FakeTelemetryInfo>(received_entries[0])
      |                                                             ^
```

Fixes: 159b872b37363511a359c800bcc9230bb09f2457
2025-04-18 14:48:30 +03:00
Dmitry Vasilyev
e4a672bc17
[LLDB] Reapply refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies (#135033)
The original PR is #132274.

Co-authored-by: @bulbazord Alex Langford
2025-04-14 14:30:09 +04:00
Pavel Labath
f4fba20726
[lldb] Remove vestigial remnants of reproducers (#135361)
Not touching the SB API.
2025-04-13 08:55:24 +02:00
Jonas Devlieghere
2b984fd0e3
[lldb] Support programmatically setting the statusline format (NFC) (#135250)
Support programmatically setting the statusline format. I want to use
this API downstream, to change the statusline format for the Swift REPL.
2025-04-10 15:36:28 -07:00
David Spickett
a29be9f28e
Revert "[LLDB] Refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies" (#134995)
Reverts llvm/llvm-project#132274

Broke a test on LLDB Widows on Arm:
https://lab.llvm.org/buildbot/#/builders/141/builds/7726
```
FAIL: test_dwarf (lldbsuite.test.lldbtest.TestExternCSymbols.test_dwarf)
<...>
    self.assertTrue(self.res.Succeeded(), msg + output)

AssertionError: False is not true : Command 'expression -- foo()' did not return successfully

Error output:

error: Couldn't look up symbols:

  int foo(void)

Hint: The expression tried to call a function that is not present in the target, perhaps because it was optimized out by the compiler.
```
2025-04-09 13:16:23 +01:00
Dmitry Vasilyev
fbc6241d3a
[LLDB] Refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies (#132274)
This patch addresses the issue #129543.
After this patch the size of lldb-server is reduced by 9MB.

Co-authored-by: @bulbazord Alex Langford
2025-04-09 09:11:56 +04:00
David Peixotto
b55bab2292
[lldb] Fix plugin manager test failure on windows (#134173)
This is an attempt to fix a test failure from #133794 when running on
windows builds. I suspect we are running into a case where the
[ICF](https://learn.microsoft.com/en-us/cpp/build/reference/opt-optimizations?view=msvc-170)
optimization kicks in and combines the CreateSystemRuntimePlugin*
functions into a single address. This means that we cannot uniquely
unregister the plugin based on its create function address.

The fix is have each create function return a different (bogus) value.
2025-04-02 17:22:46 -07:00
David Peixotto
2026873fb8
Add enable/disable api for SystemRuntime plugins (#133794)
This commit adds support for enabling and disabling plugins by name. The
changes are made generically in the `PluginInstances` class, but
currently we only expose the ability to SystemRuntime plugins. Other
plugins types can be added easily.

We had a few design goals for how disabled plugins should work

1. Plugins that are disabled should still be visible to the system. This
allows us to dynamically enable and disable plugins and report their
state to the user.
2. Plugin order should be stable across disable and enable changes. We
want avoid changing the order of plugin lookup. When a plugin is
re-enabled it should return to its original slot in the creation order.
3. Disabled plugins should not appear in PluginManager operations.
Clients should be able to assume that only enabled plugins will be
returned from the PluginManager.

For the implementation we modify the plugin instance to maintain a bool
of its enabled state. Existing clients external to the Instances class
expect to iterate over only enabled instance so we skip over disabed
instances in the query and snapshot apis. This way the client does not
have to manually check which instances are enabled.
2025-04-02 13:15:31 -07:00
Vy Nguyen
ca87823438
[LLDB][NFC]Refactor common test setup into SetUp method (#131203) 2025-03-18 10:09:03 -04:00
Jonas Devlieghere
a1b14dbc47
[lldb] Remove progress report coalescing (#130329)
Remove support for coalescing progress reports in LLDB. This
functionality was motivated by Xcode, which wanted to listen for less
frequent, aggregated progress events at the cost of losing some detail.
See the original RFC [1] for more details. Since then, they've
reevaluated this trade-off and opted to listen for the regular, full
fidelity progress events and do any post processing on their end.

rdar://146425487
2025-03-08 09:10:46 -08:00
Vy Nguyen
de9cee1c97
[LLDB][Telemetry]Define telemetry::CommandInfo (#129354)
and collect telemetry about a command's execution.

*NOTE: Please consider this PR a DRAFT ( Waiting on PR/127696 to be
submitted. )

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-03-07 05:59:05 -05:00
Vy Nguyen
275eab91ed
[LLDB]Fix test crash (#129921)
Use the `SubsystemRAII` to unregister the fake manager at end of tests
(Should fix https://github.com/llvm/llvm-project/issues/129910)
2025-03-05 17:36:06 -05:00
Vy Nguyen
a088b0ec76
[LLDB][Telemetry]Define DebuggerTelemetryInfo and related methods (#127696)
This type of entry is used to collect data about the debugger
startup/exit

Also introduced a helper ScopedDispatcher
---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
Co-authored-by: Pavel Labath <pavel@labath.sk>
2025-03-03 10:07:54 -05:00
Vy Nguyen
159b872b37
[llvm][telemetry]Change Telemetry-disabling mechanism. (#128534)
Details:
- Previously, we used the LLVM_BUILD_TELEMETRY flag to control whether
any Telemetry code will be built. This has proven to cause more nuisance
to both users of the Telemetry and any further extension of it. (Eg., we
needed to put #ifdef around caller/user code)

- So the new approach is to:
+ Remove this flag and introduce LLVM_ENABLE_TELEMETRY which would be
true by default.
+ If LLVM_ENABLE_TELEMETRY is set to FALSE (at buildtime), the library
would still be built BUT Telemetry cannot be enabled. And no data can be
collected.

The benefit of this is that it simplifies user (and extension) code
since we just need to put the check on Config::EnableTelemetry. Besides,
the Telemetry library itself is very small, hence the additional code to
be built would not cause any difference in build performance.

---------

Co-authored-by: Pavel Labath <pavel@labath.sk>
2025-02-26 13:01:53 -05:00
Vy Nguyen
62ec7b8de9
[LLDB][NFC]Renaming functions to be consistent with LLDB naming style (#128574) 2025-02-24 20:21:16 -05:00
Kazu Hirata
7a78152768 [lldb] Fix a warning
This patch fixes:

  third-party/unittest/googletest/include/gtest/gtest.h:1379:11:
  error: comparison of integers of different signs: 'const int' and
  'const unsigned long' [-Werror,-Wsign-compare]
2025-02-18 08:10:38 -08:00
Vy Nguyen
e1a393e392
Define Telemetry plugin for LLDB. (#126588)
Details:

Make LLDB's TelemetryManager a "plugin" so that vendor can supply
appropriate implementation.
The rest of LLDB code will simply call `TelemetryManager::getInstance`

---------

Co-authored-by: Pavel Labath <pavel@labath.sk>
2025-02-18 10:44:16 -05:00
Jonas Devlieghere
06c54bc1a2
[lldb] Implement ${target.file} format variable (#123431)
Implements a format variable to print the basename and full path to the
current target.
2025-01-20 15:38:04 -08:00
Jacob Lalonde
774c226863
[LLDB] Add external progress bit category (#120171)
As feedback on #119052, it was recommended I add a new bit to delineate
internal and external progress events. This patch adds this new
category, and sets up Progress.h to support external events via
SBProgress.
2025-01-06 12:49:15 -08:00
Kazu Hirata
11d2911ef1 [lldb] Fix warnings
This patch fixes:

  third-party/unittest/googletest/include/gtest/gtest.h:1379:11:
  error: comparison of integers of different signs: 'const unsigned
  long' and 'const int' [-Werror,-Wsign-compare]
2024-12-16 09:34:08 -08:00
Pavel Labath
0dbdc23e78
[lldb] Add ability to rate-limit progress reports (#119377)
For high-frequency multithreaded progress reports, the contention of
taking the progress mutex and the overhead of generating event can
significantly slow down the operation whose progress we are reporting.

This patch adds an (optional) capability to rate-limit them. It's
optional because this approach has one drawback: if the progress
reporting has a pattern where it generates a burst of activity and then
blocks (without reporting anything) for a large amount of time, it can
appear as if less progress was made that it actually was (because we
only reported the first event from the burst and dropped the other
ones).

I've also made a small refactor of the Progress class to better
distinguish between const (don't need protection), atomic (are used on
the hot path) and other (need mutex protection) members.
2024-12-16 11:35:43 +01:00
Jonas Devlieghere
ab40ae8ff9
[lldb] Store SupportFiles in SourceManager::File (NFC) (#106639)
To support detecting MD5 checksum mismatches, store a SupportFile rather
than a plain FileSpec in SourceManager::File.
2024-08-30 07:18:55 -07:00
royitaqi
47721d4618
[lldb] Realpath symlinks for breakpoints (#102223)
Improve the chance of resolving file/line breakpoints by realpath'ing the support files before doing a second match attempt, with some conditions applied.

A working [hello-world example](https://github.com/royitaqi/lldb_demos/blob/main/realpath/README.md).

See [patch](https://github.com/llvm/llvm-project/pull/102223) for more info about problem/motivation, details of the feature, new settings, telemetries and tests.
2024-08-15 11:26:24 -07:00
royitaqi
12fa4b17dc
[lldb] Make sure that a Progress "completed" update is always reported at destruction (#102097)
Make all `Progress` destructions to cause `progressEnd` events,
regardless of the value of `m_completed` before the destruction.

Currently, a `Progress` instance with `m_completed != 0 && m_complete !=
m_total` will cause a `progressUpdate` event (not `progressEnd`) at
destruction and. This contradicts with the classdoc: "a progress completed
update is reported even if the user doesn't explicitly cause one to be sent."
2024-08-07 07:58:34 -07:00
David Spickett
208a08c3b7
Reland "[lldb] Parse and display register field enums" (#97258)" (#97270)
This reverts commit d9e659c538516036e40330b6a98160cbda4ff100.

I could not reproduce the Mac OS ASAN failure locally but I narrowed it
down to the test `test_many_fields_same_enum`. This test shares an enum
between x0, which is 64 bit, and cpsr, which is 32 bit.

My theory is that when it does `register read x0`, an enum type is
created where the undlerying enumerators are 64 bit, matching the
register size.

Then it does `register read cpsr` which used the cached enum type, but
this register is 32 bit. This caused lldb to try to read an 8 byte value
out of a 4 byte allocation:
READ of size 8 at 0x60200014b874 thread T0
<...>
=>0x60200014b800: fa fa fd fa fa fa fd fa fa fa fd fa fa fa[04]fa

To fix this I've added the register's size in bytes to the constructed
enum type's name. This means that x0 uses:
__lldb_register_fields_enum_some_enum_8
And cpsr uses:
__lldb_register_fields_enum_some_enum_4

If any other registers use this enum and are read, they will use the
cached type as long as their size matches, otherwise we make a new type.
2024-07-01 10:45:56 +01:00