Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Add support for DW_AT_main_subprogram #58

Merged

Conversation

tromey
Copy link

@tromey tromey commented Nov 30, 2016

I'd like the Rust compiler to emit DW_AT_main_subprogram in its DWARF
output, so that debuggers can find the user-provided main entry point.
See rust-lang/rust#32620

This patch adds support for DW_AT_main_subprogram to LLVM to support
this effort.

A variant of this patch was accepted by upstream LLVM; there,
DebugInfoFlags.def already has a flag with value 1<<20, which is why
this patch uses 1<<21 -- this will avoid the need to change the Rust
compiler when a new LLVM is imported.

I could not run the included test case with the rust fork of LLVM. There is a build failure - invalid C++ in some gtest. However, I did manage to run it against upstream LLVM; and I did test this patch by rebuilding my modified rustc against it.

I'd like the Rust compiler to emit DW_AT_main_subprogram in its DWARF
output, so that debuggers can find the user-provided main entry point.
See rust-lang/rust#32620

This patch adds support for DW_AT_main_subprogram to LLVM to support
this effort.

A variant of this patch was accepted by upstream LLVM; there,
DebugInfoFlags.def already has a flag with value 1<<20, which is why
this patch uses 1<<21 -- this will avoid the need to change the Rust
compiler when a new LLVM is imported.
@alexcrichton
Copy link
Member

Awesome! For reference, what's the upstream commit as well?

@tromey
Copy link
Author

tromey commented Dec 1, 2016

@alexcrichton
Copy link
Member

Awesome, thanks!

As a link to my future self -- llvm-mirror/llvm@d86b9f2

@alexcrichton alexcrichton merged commit 3ec14da into rust-lang:rust-llvm-2016-10-29 Dec 1, 2016
@tromey tromey deleted the rust-main-subprogram branch December 1, 2016 12:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants