1
Fork 0

Auto merge of #38109 - tromey:main-subprogram, r=michaelwoerister

Emit DW_AT_main_subprogram

This changes rustc to emit DW_AT_main_subprogram on the "main" program.
This lets gdb suitably stop at the user's main in response to
"start" (rather than the library's main, which is what happens
currently).

Fixes #32620
r? michaelwoerister
This commit is contained in:
bors 2017-02-09 17:09:50 +00:00
commit 4053276354
5 changed files with 74 additions and 1 deletions

View file

@ -352,6 +352,7 @@ enum class LLVMRustDIFlags : uint32_t {
FlagStaticMember = (1 << 12),
FlagLValueReference = (1 << 13),
FlagRValueReference = (1 << 14),
FlagMainSubprogram = (1 << 21),
// Do not add values that are not supported by the minimum LLVM
// version we support!
};
@ -438,6 +439,11 @@ static unsigned fromRust(LLVMRustDIFlags Flags) {
if (isSet(Flags & LLVMRustDIFlags::FlagRValueReference)) {
Result |= DINode::DIFlags::FlagRValueReference;
}
#if LLVM_RUSTLLVM || LLVM_VERSION_GE(4, 0)
if (isSet(Flags & LLVMRustDIFlags::FlagMainSubprogram)) {
Result |= DINode::DIFlags::FlagMainSubprogram;
}
#endif
return Result;
}