Skip to content

Fix GDB JIT interface exports and ELF output - #137237

Open
am11 wants to merge 3 commits into
dotnet:mainfrom
am11:gdbjit-fixes
Open

am11 wants to merge 3 commits into
dotnet:mainfrom
am11:gdbjit-fixes

Conversation

@am11

@am11 am11 commented Nov 10, 2026

Copy link
Copy Markdown
Member

With FEATURE_GDBJIT enabled, libcoreclr.so did not export
__jit_debug_register_code / __jit_debug_descriptor, so GDB never
picked up JIT'd code:

  • generate_exports_file passed every .src to the version script
    generator, which reads only the first file (the second argument is
    a symbol prefix). Multiple inputs are now concatenated first.
  • The generator scripts dropped a final line without a newline.
  • Both symbols were hidden by -fvisibility=hidden; mark them
    DLLEXPORT.

ELF output fixes:

  • .debug_frame CIE return address column was 0 on every arch
    (now rip/lr).
  • .symtab sh_info was 0 (now 1).

Tested on linux-x64 with GDB 17.1: method names resolve, pending
breakpoints arm when a method is JIT'd, and bt unwinds through
managed frames. Software breakpoints need
DOTNET_EnableWriteXorExecute=0 (or hbreak), since JIT'd code is
mapped shared read-execute.

With FEATURE_GDBJIT enabled, GDB never saw the JIT interface:

- generate_exports_file passed all .src files to the version script
  generator, which only reads the first one (the second argument is
  a prefix). Concatenate multiple inputs first.
- The generator scripts dropped a last line without a trailing
  newline, which gdbjit_unixexports.src had.
- __jit_debug_register_code and __jit_debug_descriptor were hidden
  under -fvisibility=hidden, so the version script could not export
  them.

Also fix the emitted ELF: the .debug_frame CIE return address column
was 0 on all architectures, and .symtab had sh_info of 0.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 10, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Nov 10, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@am11 am11 added area-VM-coreclr and removed area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Nov 10, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

@am11
am11 requested review from a team, janvorli and jkotas November 10, 2026 02:23
Comment thread eng/native/functions.cmake Resolved

@janvorli janvorli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@am11

am11 commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

osx-x64 dead-lettered.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants