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

Add an option to include debug information in the Python executable and shared libraries in MacOS #95973

Open
pablogsal opened this issue Aug 14, 2022 · 4 comments
Assignees
Labels
build The build process and cross-build

Comments

@pablogsal
Copy link
Member

pablogsal commented Aug 14, 2022

Because MacOS likes to do things differently, the DWARF debugging information is not included by default in the final executables and shared libraries. Instead, MacOS has a separate linker dsymutil that can link this information in the final binary. Because by default nobody is doing this, all the python installations in MacOS have no debug information at all making debuggers like lldb almost useless.

To solve this problem, add a new --with-dsymutil configure option that ensures that we package the debug information inside. In my M1 macos this makes the Python executable 0.2M bigger.

We should maybe discuss if we want to activate this by default.

@pablogsal
Copy link
Member Author

pablogsal commented Aug 14, 2022

An lldb trace without --with-dsymutil:

...
    frame #18: 0x00000001001ab26c python3.12`Py_RunMain + 2196
    frame #19: 0x00000001001ab4b4 python3.12`pymain_main + 324
    frame #20: 0x00000001001ab554 python3.12`Py_BytesMain + 40
    frame #21: 0x000000010056d08c dyld`start + 520

and --with-dsymutil:

...
    frame #86: 0x00000001001aaefc python.exe`Py_RunMain [inlined] pymain_run_python(exitcode=0x000000016fdfe58c) at main.c:0 [opt]
    frame #87: 0x00000001001aada4 python.exe`Py_RunMain at main.c:689:5 [opt]
    frame #88: 0x00000001001ab4d4 python.exe`pymain_main(args=0x000000016fdfe8f0) at main.c:719:12 [opt]
    frame #89: 0x00000001001ab574 python.exe`Py_BytesMain(argc=<unavailable>, argv=<unavailable>) at main.c:743:12 [opt]
    frame #90: 0x000000010056d08c dyld`start + 520

(Also, inspecting variables, frames, and source works, which doesn't without debug information)

@ned-deily
Copy link
Member

@ronaldoussoren

@pablogsal
Copy link
Member Author

See also: conda-forge/python-feedstock#354

@ronaldoussoren
Copy link
Contributor

I like this. Personally I'd prefer to have this enabled at least for the installer builds as that makes developing C extensions using the installer on python.org more convenient.

pablogsal added a commit to pablogsal/cpython that referenced this issue Aug 15, 2022
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
pablogsal added a commit to pablogsal/cpython that referenced this issue Aug 15, 2022
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
pablogsal added a commit to pablogsal/cpython that referenced this issue Aug 15, 2022
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
pablogsal added a commit to pablogsal/cpython that referenced this issue Aug 15, 2022
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
pablogsal added a commit to pablogsal/cpython that referenced this issue Aug 15, 2022
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
pablogsal added a commit to pablogsal/cpython that referenced this issue Aug 15, 2022
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
pablogsal added a commit to pablogsal/cpython that referenced this issue Aug 27, 2022
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
miss-islington pushed a commit that referenced this issue Aug 27, 2022
jevinskie added a commit to jevinskie/cpython that referenced this issue Oct 15, 2023
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>

Ensure we install the dSYM files

Handle --enable-shared

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>

Handle macos framework builds

MacOS -> macOS
jevinskie added a commit to jevinskie/cpython that referenced this issue Nov 20, 2023
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>

Ensure we install the dSYM files

Handle --enable-shared

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>

Handle macos framework builds

MacOS -> macOS

Don't unset DSYMUTIL and DSYMUTIL_PATH in env vars in autoconf

Signed-off-by: Jevin Sweval <jevinsweval@gmail.com>
jevinskie added a commit to jevinskie/cpython that referenced this issue Nov 20, 2023
…ation in MacOS

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>

Ensure we install the dSYM files

Handle --enable-shared

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>

Handle macos framework builds

MacOS -> macOS

Don't unset DSYMUTIL and DSYMUTIL_PATH in env vars in autoconf

Signed-off-by: Jevin Sweval <jevinsweval@gmail.com>
@iritkatriel iritkatriel added the build The build process and cross-build label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build
Projects
None yet
Development

No branches or pull requests

4 participants