Skip to content

Add a new affordance that the Python module in a dSYM #10462

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

jimingham
Copy link

so the dSYM can be told what target it has been loaded into.

When lldb is loading modules, while creating a target, it will run
"command script import" on any Python modules in Resources/Python in the
dSYM. However, this happens WHILE the target is being created, so it is
not yet in the target list. That means that these scripts can't act on
the target that they a part of when they get loaded.

This patch adds a new python API that lldb will call:

__lldb_module_added_to_target

if it is defined in the module, passing in the Target the module was
being added to, so that code in these dSYM's don't have to guess.

jimingham and others added 2 commits April 8, 2025 17:35
So the dSYM can be told what target it has been loaded into.

When lldb is loading modules, while creating a target, it will run
"command script import" on any Python modules in Resources/Python in the
dSYM. However, this happens WHILE the target is being created, so it is
not yet in the target list. That means that these scripts can't act on
the target that they a part of when they get loaded.

This patch adds a new python API that lldb will call:

__lldb_module_added_to_target

if it is defined in the module, passing in the Target the module was
being added to, so that code in these dSYM's don't have to guess.

(cherry picked from commit 347c5a7)
Update the ScriptInterpreterLua::LoadScriptingModule signature after the
TargetSP argument was added in llvm#133290.

(cherry picked from commit 28b300d)
@jimingham jimingham requested a review from a team as a code owner April 9, 2025 00:39
@jimingham jimingham requested a review from medismailben April 9, 2025 00:39
@jimingham
Copy link
Author

This is a cherry-pick of my original patch, plus Jonas' fix for the Lua build.

@jimingham jimingham requested a review from JDevlieghere April 9, 2025 00:40
@JDevlieghere
Copy link

@swift-ci test

@jimingham
Copy link
Author

I have to update the static bindings. I take back everything I ever said publicly about the static bindings being a good solution for anything...

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
@medismailben
Copy link

@swift-ci test

@jimingham
Copy link
Author

I think I had bad luck. The Linux test passed. The Windows test just got some timeout, but not in the test that I added which is the only place the new code is currently exercised, and the MacOS test failed in TestDataFormatters.py which also has no intersection with this change.

@jimingham
Copy link
Author

@swift-ci please test

@adrian-prantl adrian-prantl merged commit 73daaea into swiftlang:swift/release/6.2 Apr 11, 2025
3 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants