Skip to content

Support JIT-compiled code debugging for Release builds #62815

@c0d1f1ed

Description

@c0d1f1ed

The current support for debugging JIT-compiled code depends on GDB or LLDB to be able to observe the __jit_debug_register_code() function and __jit_debug_descriptor data structure. This only works when LLVM was built using the Debug or RelWithDebInfo configuration.

It would be great if it could also be made to work with a Release build, which would dramatically reduce the binary size. The JIT of a project I'm working on is 45 MB for a Release build, but over 1 GB for a RelWithDebInfo build.

The above two symbols are both defined in the llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp file, so in theory it should suffice to generate debug info for just that file, and ensure it gets preserved during linking and doesn't get stripped afterwards. Alternatively if we had a build flag to optionally not define them in this file but just declare them extern, a project which links in LLVM's JIT can define them in one of its own source files and ensure they're available in the debug info.

Does either of these options sound reasonable, or is there a better way to handle this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions