1085 Commits

Author SHA1 Message Date
Chelsea Cassanova
9815210db7
[lldb][framework] Remove original framework fixup script (#153052)
The original version of the framework fixup script is no longer being
used and should be able to be removed.
2025-08-11 11:56:03 -07:00
Chelsea Cassanova
cade1e29b2
[lldb][rpc] Only use guard names in framework script (#151391)
Removes the U that comes before the guards passed into the framework
fixup script.
2025-07-30 23:04:22 -07:00
Chelsea Cassanova
d64802d6d9
[lldb][framework] Glob headers from source for framework (#148736)
When gathering the headers to fix up and place in LLDB.framework, we
were previously globbing the header files from a location in the build
directory. This commit changes this to glob from the source directory
instead, as we were globbing from the build directory without ensuring
that the necessary files were actually in that location before globbing.
2025-07-18 15:26:09 -05:00
Chelsea Cassanova
45083dc4d2
[lldb][framework] Correctly place framework files in framework with script (#146425)
There's 2 bugs that this commit fixes:
1. Calculate the correct file path for the output file by appending the
basename of the input header instead of appending the entire input
header's path to the framework path.
2. In the script, create the framework's header directory if it does not
exist.
2025-07-03 15:09:15 -07:00
Chelsea Cassanova
c3811c8474
[lldb][scripts] Use named args in versioning script (#145993)
Using named args means that you don't need to keep track of 5 positional
args.
2025-06-26 17:02:22 -07:00
Chelsea Cassanova
c73e5e3e20
[lldb][scripts] Fix bugs in framework fix script (#145961)
The script used to fix up LLDB's header for use in the macOS framework
contained 2 bugs that this commit addreses:

1. The output contents were appended to the output file multiple times
instead of only being written once.
2. The script was not considering LLDB includes that were *not* from the
SB API.

This commit addresses and fixes both of these bugs and updates the
corresponding test to match.
2025-06-26 15:06:37 -07:00
Chelsea Cassanova
92a7f6fbbe
[lldb][rpc] Fix bug in convert script for RPC (#145419)
In the script that's used by RPC to convert LLDB headers to LLDB RPC
headers, there's a bug with how it converts namespace usage. An
overeager regex pattern caused *all* text before any `lldb::` namespace
usage to get replaced with `lldb_rpc::` instead of just the namespace
itself. This commit changes that regex pattern to be less overeager and
modifies one of the shell tests for this script to actually check that
the namespace usage replacement is working correctly.

rdar://154126268
2025-06-23 15:46:12 -07:00
Chelsea Cassanova
8a8ea8fec0
Reland "[lldb][headers] Create Python script to fix up framework head… (#143945)
…ers" (#143941)

Reland the script that converts lldb headers to RPC headers. The RPC
test was failing due to the incorrect input filepath being used.

Original commit message:
This commit replaces the shell script that fixes up includes for the
LLDB framework with a Python script. This script will also be used when
fixing up includes for the LLDBRPC.framework.
2025-06-12 13:55:44 -07:00
Chelsea Cassanova
06dad352db
Revert "[lldb][headers] Create Python script to fix up framework headers" (#143941)
Reverts llvm/llvm-project#142051
2025-06-12 10:39:53 -07:00
Chelsea Cassanova
1a4cf1d3ed
[lldb][headers] Create Python script to fix up framework headers (#142051)
This commit replaces the shell script that fixes up includes for the
LLDB framework with a Python script. This script will also be used when
fixing up includes for the LLDBRPC.framework.
2025-06-12 10:07:45 -07:00
Chelsea Cassanova
a2d2941830
[lldb][RPC] Upstream LLDB to RPC converstion Python script (#138028)
As part of upstreaming LLDB RPC, this commit adds a python script that
is used by LLDB RPC to modify the public lldb header files for use with
RPC.

https://discourse.llvm.org/t/rfc-upstreaming-lldb-rpc/85804
2025-06-11 13:12:37 -07:00
Chelsea Cassanova
eb76d8332e
Reland "[lldb][headers] Create script to fix up versioning" (#142864)" (#142871)
This relands the original commit for the versioning script in LLDB. This
commit uses '>' for output from `unifdef` for platforms that have that
executable but do not have the `-o` option. It also fixes the Xcode
build by adding a dependency between the liblldb-header-staging target
in the source/API/CMakeLists.txt the `liblldb-resource-headers` target
in LLDBFramework.cmake.

Original patch: https://github.com/llvm/llvm-project/pull/141116
2025-06-10 09:47:11 -07:00
Chelsea Cassanova
e5cfa0a15d
Revert "[lldb][headers] Create script to fix up versioning" (#142864)
Reverts llvm/llvm-project#141116. It's breaking the Xcode build as well
as the build on AIX.
2025-06-04 15:04:36 -07:00
Chelsea Cassanova
d204aa9deb
[lldb][headers] Create script to fix up versioning (#141116)
This commit creates a Python script that fixes up the versioning
information in lldb-defines.h. It also moves the build logic for fixing
up the lldb headers from being in the framework only to being in the
same location that we create the liblldb target.
2025-06-03 13:06:46 -07:00
Pavel Labath
f4fba20726
[lldb] Remove vestigial remnants of reproducers (#135361)
Not touching the SB API.
2025-04-13 08:55:24 +02:00
Chelsea Cassanova
ac3321f104
[lldb] Add missing include to SBLanguages.h (#111763)
SBLanguages.h uses a uint16_t but is missing the include for
`<cstdint>`, if any file includes this without including that it will
cause a build error so this commit adds this include.
2024-10-09 14:41:50 -07:00
Alex Langford
3bde798398
[lldb] Put SBSourceLanguageName in lldb namespace (#91685) 2024-05-10 10:00:36 -07:00
Nicklas Boman
dbcfa2957d
lldb create API folder if it does not exist, before creating SBLangua… (#91128)
Create API folder if it does not exist, before creating SBLanguages.h
2024-05-08 10:57:16 -07:00
Adrian Prantl
b8c301f6e2 Fix the regex in the sbapi python script 2024-05-01 13:41:32 -07:00
Jonas Devlieghere
dcbf0fcd0d
[lldb] Use Python script to generate SBLanguages.h (#90753)
Use a Python script to generate SBLanguages.h instead of piggybacking on
LLDB TableGen. This addresses Nico Weber's post-commit feedback.
2024-05-01 13:02:47 -07:00
Tulio Magno Quites Machado Filho
2260ebf7b6
[lldb] Replace the usage of module imp with module importlib (#70443)
imp got removed in Python 3.12 [1] and the community recommends using
importlib in newer Python versions.

[1] https://docs.python.org/3.12/whatsnew/3.12.html#imp
2023-10-31 17:08:55 -03:00
River Riddle
dc1a2cb971 [lldb][windows] Cover more symbols in LLDB_EXPORT_ALL_SYMBOLS
Followup to #67628 that relaxes the symbol regex a bit to cover more
lldb_private symbols.
2023-09-30 16:06:19 -07:00
River Riddle
a514c30a7c
[lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (#67628)
LLDB_EXPORT_ALL_SYMBOLS is useful when building out-of-tree plugins and
extensions that rely on LLDB's internal symbols. For example, this is
how the Mojo language provides its REPL and debugger support.

Supporting this on windows is kind of tricky because this is normally
expected to be done using dllexport/dllimport, but lldb uses these with
the public api. This PR takes an approach similar to what LLVM does with
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, and what chromium does for
[abseil](253d14e20f/third_party/abseil-cpp/generate_def_files.py),
and uses a python script to extract the necessary symbols by looking at
the symbol table for the various lldb libraries.
2023-09-29 10:33:11 -07:00
David Spickett
602e47c5f9
[lldb] Format Python files in scripts and utils (#66053)
Using:
black --exclude "third_party/" ./lldb/
2023-09-14 08:54:02 +01:00
Alex Langford
e634c2f714 [lldb] Remove use of __future__ in python
These were useful primarily for the Python 2 to 3 transition. Python 2
is no longer supported so these are no longer necessary.

Differential Revision: https://reviews.llvm.org/D157759
2023-08-14 14:14:48 -07:00
David Spickett
01e30b30d0 [lldb][AArch64] Add Scalable Matrix Extension option to QEMU launch script
The Scalable Matrix Extension (SME) does not require extra options
beyond setting the cpu to "max".

https://qemu-project.gitlab.io/qemu/system/arm/cpu-features.html#sme-cpu-property-examples

SME depends on SVE, so that will be enabled too even if you don't ask
for it by name.

--sve --sme -> SVE and SME
--sme       -> SVE and SME
--sve       -> Only SVE

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D152519
2023-06-14 14:33:47 +01:00
David Spickett
70d8c01e45 [lldb] Update QEMU git URL in setup.sh
The old name was maintained for a while but now it has been changed
to gitlab.
2023-04-21 14:31:39 +00:00
David Spickett
5193c4a8b3 [lldb][AArch64] Fix run-qemu.sh when only MTE is enabled.
SVE and MTE both require a CPU with that feature before
you can use the other options, but we only added the "max"
cpu when SVE was enabled too.
2023-03-23 13:48:44 +00:00
Harmen Stoppels
a54f160b3a Prefer /usr/bin/env xxx over /usr/bin/xxx where xxx = perl, python, awk
Allow users to use a non-system version of perl, python and awk, which is useful
in certain package managers.

Reviewed By: JDevlieghere, MaskRay

Differential Revision: https://reviews.llvm.org/D95119
2021-02-25 11:32:27 +01:00
David Spickett
32541685b2 [lldb][AArch64/Linux] Show memory tagged memory regions
This extends the "memory region" command to
show tagged regions on AArch64 Linux when the MTE
extension is enabled.

(lldb) memory region the_page
[0x0000fffff7ff8000-0x0000fffff7ff9000) rw-
memory tagging: enabled

This is done by adding an optional "flags" field to
the qMemoryRegion packet. The only supported flag is
"mt" but this can be extended.

This "mt" flag is read from /proc/{pid}/smaps on Linux,
other platforms will leave out the "flags" field.

Where this "mt" flag is received "memory region" will
show that it is enabled. If it is not or the target
doesn't support memory tagging, the line is not shown.
(since majority of the time tagging will not be enabled)

Testing is added for the existing /proc/{pid}/maps
parsing and the new smaps parsing.
Minidump parsing has been updated where needed,
though it only uses maps not smaps.

Target specific tests can be run with QEMU and I have
added MTE flags to the existing helper scripts.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D87442
2020-11-20 11:21:59 +00:00
David Spickett
749f13e763 [lldb] Correct --help output for qemu rootfs script
It was printing "Usage:" twice.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D90225
2020-10-29 09:57:32 +00:00
Muhammad Omair Javaid
3dffec03b0 [LLDB] Add QEMU testing environment setup guide for SVE testing
This patch adds a HowTo document to lldb docs which gives instruction for
setting up a virtual environment based on QEMU emulator for LLDB testing.

Instruction in this document are tested on Arm and AArch64 targets but
can easily be duplicated for other targets supported by QEMU.

This helps test LLDB in absence for modern AArch64 features not released
in publicly available hardware till date.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D82064
2020-10-06 12:35:08 +05:00
serge-sans-paille
515bc8c155 Harmonize Python shebang
Differential Revision: https://reviews.llvm.org/D83857
2020-07-16 21:53:45 +02:00
Jordan Rupprecht
cf3f100fcb [lldb][test] Prevent infinite loop while looking for use_lldb_suite_root.py.
Several scripts (two copies of use_lldb_suite.py, and an __init__.py) look for use_lldb_suite_root.py by checking parent directories. If for some reason it doesn't exist, it keeps checking parent directories until it finds it.

However, this only breaks when the parent directory is None, but at least on Linux, dirname('/') == '/', so this will never be None.

This changes the lookup to stop if the dirname(lldb_root) is unchanged. This was previously fixed in 67f6d842fab6d3ac8c949721be8e131cf6b17578, but only in one copy of this script.

Additionally, this makes the failure mode more visible -- if the root is not found, it complains loudly instead of silently failing, and having later modules that need lldb_root fail.

Differential Revision: https://reviews.llvm.org/D83840
2020-07-15 09:16:30 -07:00
Pavel Labath
e55a09793d [lldb/Scripts]
Fix analyze-project-deps.py. "lldb/Plugins" (home of Plugins.def) does
not depend on anything. Make sure this does not crash the script.
2020-06-30 17:06:14 +02:00
Jonas Devlieghere
116c2da4b2 [lldb/Scripts] proc.returncode is set in proc.communicate
Make sure proc.returncode has been assigned before we compare it to 0.
2020-04-21 11:30:15 -07:00
Jonas Devlieghere
4cfb71adba [lldb/Scripts] Add verbose and failure only mode to replay script.
Add two modes to the reproducer replay script that make debugging a
little easier. Verbose mode prints stdout and stderr, regardless of
whether replay was successful. When --failure-only is passed, output is
limited to tests that failed to replay.
2020-04-20 09:03:48 -07:00
Jonas Devlieghere
7ce1a93efd [lldb/Scripts] Add script to replay multiple reproducers
Script to replay reproducers in parallel using the command line driver.
This is used for active replay (stage 1 as described in the RFC on
lldb-dev [1]).

[1] http://lists.llvm.org/pipermail/lldb-dev/2020-April/016100.html

Differential revision: https://reviews.llvm.org/D77608
2020-04-15 10:55:41 -07:00
Kazuaki Ishizaki
e9264b746b [lldb] NFC: Fix trivial typo in comments, documents, and messages
Differential Revision: https://reviews.llvm.org/D77460
2020-04-07 01:06:16 +09:00
Jonas Devlieghere
26646761e2 [lldb/Scripts] Remove swig_bot_lib/__init__.py 2020-01-16 09:15:41 -08:00
Jonas Devlieghere
f2bbe8ede0 [lldb/Scripts] Remove SWIG bot
This is no longer used or maintained.

Differential revision: https://reviews.llvm.org/D72539
2020-01-13 09:23:48 -08:00
Jonas Devlieghere
7c47a3719a [lldb/Scripts] Move android script from underneath Python dir
The scripts root directory already contains python scripts. No need to
keep this one nested under a dedicated Python directory.
2020-01-10 13:54:33 -08:00
Jonas Devlieghere
e6d219122d [lldb/Scripts] Remove remote-build.py
With Xcode gone this is no longer relevant.
2020-01-10 13:53:12 -08:00
Jonas Devlieghere
1a8c996a88 [lldb/Scripts] Remove buildbot.py
This file is outdated and still references SVN. Buildbots are configured
through the zorg repository.
2020-01-10 13:44:41 -08:00
Jonas Devlieghere
6498aff249 [lldb/Bindings] Move bindings into their own subdirectory
All the code required to generate the language bindings for Python and
Lua lives under scripts, even though the majority of this code aren't
scripts at all, and surrounded by scripts that are totally unrelated.

I've reorganized these files and moved everything related to the
language bindings into a new top-level directory named bindings. This
makes the corresponding files self contained and much more discoverable.

Differential revision: https://reviews.llvm.org/D72437
2020-01-09 08:44:34 -08:00
Jonas Devlieghere
93a1e9c90c [lldb/SWIG] Add missing '\' in macros again
Making the string conversion operator a macro unintentionally dropped
the backslash before '\n' and '\r' and was therefore incorrectly
stripping 'n' and 'r' from the object description.
2020-01-09 08:15:41 -08:00
Jonas Devlieghere
51bdd98b8a [lldb/SWIG] Refactor extensions to be non Python-specific (3/3)
The current SWIG extensions for the string conversion operator is Python
specific because it uses the PythonObjects. This means that the code
cannot be reused for other SWIG supported languages such as Lua.

This reimplements the extensions in a more generic way that can be
reused. It uses a SWIG macro to reduce code duplication.

Differential revision: https://reviews.llvm.org/D72377
2020-01-08 21:02:59 -08:00
Jonas Devlieghere
ae47a3d810 [lldb/SWIG] Refactor extensions to be non Python-specific (2/2)
The current SWIG extensions for the string conversion operator is Python
specific because it uses the PythonObjects. This means that the code
cannot be reused for other SWIG supported languages such as Lua.

This reimplements the extensions in a more generic way that can be
reused. It uses a SWIG macro to reduce code duplication.

Differential revision: https://reviews.llvm.org/D72377
2020-01-08 16:34:09 -08:00
Jonas Devlieghere
0341c11e08 [lldb/SWIG] Refactor extensions to be non Python-specific
The current SWIG extensions for the string conversion operator is Python
specific because it uses the PythonObjects. This means that the code
cannot be reused for other SWIG supported languages such as Lua.

This reimplements the extensions in a more generic way that can be
reused.

Differential revision: https://reviews.llvm.org/D72377
2020-01-08 13:37:07 -08:00
Jonas Devlieghere
fc6f15d4d2 [lldb/CMake] Only auto-enable Python when SWIG is found
As correctly pointed out by Martin on the mailing list, Python should
only be auto-enabled if SWIG is found as well. This moves the logic of
finding SWIG into FindPythonInterpAndLibs to make that possible.

To make diagnosing easier I've included a status message to convey why
Python support is disabled.
2020-01-07 21:57:32 -08:00