-
Notifications
You must be signed in to change notification settings - Fork 414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImportError – name clash when debugging MacOS Kernel with LLDB #295
Comments
This seems like However, looking at the other imports in the traceback, it seems like lldbmacros expects itself to be the first in path anyway (otherwise the other imports would be IOW, |
So I snuck a print statement in the start of
For reference, here's
So, LLDB (or some of the scripts?) seems to tweak Also, it should be noted that the KDK lldbmacros are converted from Python 2 to Python 3 by myself:
...this is because LLDB doesn't seem to support Python 2 anymore, but the KDKs for older kernels are just that. It's slightly cursed, but it used to somehow work before I installed Voltron. Checking the code, it seems that |
Yeah,
should absolutely not be on It's enough that If you can find out why it's there, that'd be the next step.
|
My
and manually tweaking
so the voltron path is already there before the voltron entry script is called. Also, no .pth files in |
For one, I don't think that linked segment in voltron/entry.py should be there at all in 2022, since it's all just Python 2.7 fluff. What if you do |
We're getting closer!
So, it seems like the culprit is LLDB...? |
Ohhhhh, now I get it! Yep - so clearly
or similar should fix that up... 😁 |
That would work, if it would accept any kind of python statements, but seems the expression you can use there has some rather haphazard limitations. First of all,
But that depends on the order of the path and feels like it's from a code golf competition. I also tried calling a script that deletes the path, but that doesn't seems to affect the path outside of the said script. It would help if voltron could be imported not as a script file
And it ALMOST works, no
But no cigar:
WHY? \:D/ I have no idea. (The same thing happens both with the wrapper, and the path deletion method.) |
Could it be that it caches something? And now that you mention it, how does it even find |
Oh, right, yeah, you'd maybe also need |
There is someone upadate? |
I'm trying to remote debug MacOS kernel with LLDB. I have Voltron and Apple's Kernel Debug Kit installed.
In LLDB, first I create the target:
After that, once I set it to load scripts:
Then, it crashes with
The problem seems to be that a file
/Library/Developer/KDKs/KDK_11.6.5_20G527.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/kevent.py
tries to import stuff frommemory
, where the intended file for that is/Library/Developer/KDKs/KDK_11.6.5_20G527.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/memory.py
However, for some reason, it actually accesses Voltron's
memory.py
:/Users/me/Library/Python/3.8/lib/python/site-packages/voltron/plugins/api/memory.py
I am not very well-versed in Pythons modules and import rules, and especially I don't know how LLDB loads scripts, but to me, this seems like something that is not normally supposed to happen. Is this just unfortunate name clash, or is something broken in my system?
The text was updated successfully, but these errors were encountered: