Skip to content
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

spin lldb -- python -mspin test doesn't work anymore #255

Open
seberg opened this issue Nov 22, 2024 · 2 comments
Open

spin lldb -- python -mspin test doesn't work anymore #255

seberg opened this issue Nov 22, 2024 · 2 comments

Comments

@seberg
Copy link

seberg commented Nov 22, 2024

I think this used to work, but I suspect that python -mspin test now runs in a new process so that the debugger/lldb doesn't attach to you.

I am not sure that this can be changed easily, FWIW, python lldb -c ..., etc. all work fine (I just like to run a test that fails if it does).

EDIT: This is not new in 0.13, if it changed (I think it did), it changed a while ago.

@stefanv
Copy link
Member

stefanv commented Mar 17, 2025

@seberg Could you give me an example of what you'd like to see happen here?

@seberg
Copy link
Author

seberg commented Mar 18, 2025

The way spin spawns the actual spawns the test process, lldb doesn't wrap it. Not sure if there is a clear solution though (maybe I need to tell lldb to wrap the child process or just launch the tests more explicitly).

Basically, add a test like:

def test_crash():
    import numpy as np
    from numpy.lib.stride_tricks import as_strided
    a = as_strided(np.arange(10), (10_000_000,), (8,))
    a[...] = 3

which segfaults. If you just run it with spin lldb -- python -mspin test -t ... you should find that it's not running inside lldb and doesn't stop for debugging. (Even disabling the fault handler with PYTEST_ADDOPTS="-p no:faulthandler").

Maybe there is a very simple work-around. I think last time I around I made a minimal example and used spin lldb -c "exec(open('test.py').read())" (to both run in the right process and to be sure to find the right numpy install).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants