This is an archive of the discontinued LLVM Phabricator instance.

Emit the correct flags for the PROC CodeView Debug Symbol
ClosedPublic

Authored by dpaoliello on Apr 19 2023, 5:02 PM.

Details

Summary

The S_LPROC32_ID and S_GPROC32_ID CodeView Debug Symbols have a flags field which LLVM has had the values for (in the ProcSymFlags enum) but has never actually set.

These flags are used by Microsoft-internal tooling that leverages debug information to do binary analysis.

Modified LLVM to set the correct flags:

  • ProcSymFlags::HasOptimizedDebugInfo - always set, as this indicates that debug info is present for optimized builds (if debug info is not emitted for optimized builds, then LLVM won't emit a debug symbol at all).
  • ProcSymFlags::IsNoReturn and ProcSymFlags::IsNoInline - set if the function has the NoReturn or NoInline attributes respectively.
  • ProcSymFlags::HasFP - set if the function requires a frame pointer (per TargetFrameLowering::hasFP).

Diff Detail

Event Timeline

dpaoliello created this revision.Apr 19 2023, 5:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2023, 5:02 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
dpaoliello requested review of this revision.Apr 19 2023, 5:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2023, 5:02 PM

Fixed test failures

aaron.ballman added a subscriber: aaron.ballman.

Adding a few extra reviewers to try to get this unstuck (I'm not particularly qualified to review this myself but saw a request for review help in the wild).

tiagoma added subscribers: rnk, tiagoma.

@rnk Do you know who would be a good person to review this?

efriedma added a subscriber: efriedma.

Maybe add a bit of info to the commit message explaining why these flags are useful?

dpaoliello edited the summary of this revision. (Show Details)Apr 28 2023, 1:52 PM
efriedma accepted this revision.May 1 2023, 2:04 PM

LGTM

Note that noreturn can be inferred, and clang marks every function noinline at -O0. Since there isn't any public documentation, it's hard to say what impact that has on the expected uses, but just noting it in case you need something different.

This revision is now accepted and ready to land.May 1 2023, 2:04 PM

Can we please get this merged in?

I somehow assumed you had commit access; I'll take care of it.

This revision was automatically updated to reflect the committed changes.

I suspect these changes have broken SymbolFile/PDB/function-nested-block.test. The first failure here: https://lab.llvm.org/buildbot/#/builders/219/builds/2520. And it's hardly due to my changes.

I suspect these changes have broken SymbolFile/PDB/function-nested-block.test. The first failure here: https://lab.llvm.org/buildbot/#/builders/219/builds/2520. And it's hardly due to my changes.

I don't understand how this change would have led to that test failing, but I'll have a look when I'm back from vacation on the 12th.

Thanks! Honestly, I don't know how to reproduce that test results on my Win-x86-64 platform to reveal failure reason.

Thanks! Honestly, I don't know how to reproduce that test results on my Win-x86-64 platform to reveal failure reason.

CC @zturner and @clayborg -- this lldb builder has been down for 11 days and there are several failures unrelated to the one in this patch, otherwise I would have reverted this instead of waiting for the author to get back from vacation. Do either of you want to fix or revert to get the bot back into a good state?

FWIW, I also ran into that LLDB test failure on Windows, and reverting this patch does resolve it. (Haven't dug further.)

omjavaid reopened this revision.May 15 2023, 12:12 PM
omjavaid added a subscriber: omjavaid.

This caused test failure on lldb-aarch64-windows buildbot
https://lab.llvm.org/buildbot/#/builders/219/builds/2520

ldb-shell :: SymbolFile/PDB/function-nested-block.test

kindly revisit the patch, I am going to revert it for now.

Thanks!

This revision is now accepted and ready to land.May 15 2023, 12:12 PM

@omjavaid this change DID NOT CAUSE THE TEST FAILURE, please see the previous comments where we were discussing this:

Thanks! Honestly, I don't know how to reproduce that test results on my Win-x86-64 platform to reveal failure reason.

CC @zturner and @clayborg -- this lldb builder has been down for 11 days and there are several failures unrelated to the one in this patch, otherwise I would have reverted this instead of waiting for the author to get back from vacation. Do either of you want to fix or revert to get the bot back into a good state?

@omjavaid this change DID NOT CAUSE THE TEST FAILURE, please see the previous comments where we were discussing this:

Thanks! Honestly, I don't know how to reproduce that test results on my Win-x86-64 platform to reveal failure reason.

CC @zturner and @clayborg -- this lldb builder has been down for 11 days and there are several failures unrelated to the one in this patch, otherwise I would have reverted this instead of waiting for the author to get back from vacation. Do either of you want to fix or revert to get the bot back into a good state?

I am the owner of lldb-aarch64-windows and i have verified that exactly this commit caused the test to fail. The builder was failing a few test earlier thats why this particular failure got masked.

efriedma reopened this revision.May 15 2023, 12:50 PM
This revision is now accepted and ready to land.May 15 2023, 12:50 PM

@omjavaid this change DID NOT CAUSE THE TEST FAILURE, please see the previous comments where we were discussing this:

Thanks! Honestly, I don't know how to reproduce that test results on my Win-x86-64 platform to reveal failure reason.

CC @zturner and @clayborg -- this lldb builder has been down for 11 days and there are several failures unrelated to the one in this patch, otherwise I would have reverted this instead of waiting for the author to get back from vacation. Do either of you want to fix or revert to get the bot back into a good state?

I am the owner of lldb-aarch64-windows and i have verified that exactly this commit caused the test to fail. The builder was failing a few test earlier thats why this particular failure got masked.

Did you verify that the failure was because the changes were incorrect? These changes are correcting a bug and it's expected that downstreams like lldb may have to react to that sort of thing breaking their tests. A revert ~10 days after the failure landed is not exactly a timely revert -- now all the downstreams that did react to this change will have to react again, which is why I'm curious what amount of analysis was done prior to reverting and what details you can share about the problem.

@omjavaid this change DID NOT CAUSE THE TEST FAILURE, please see the previous comments where we were discussing this:

Thanks! Honestly, I don't know how to reproduce that test results on my Win-x86-64 platform to reveal failure reason.

CC @zturner and @clayborg -- this lldb builder has been down for 11 days and there are several failures unrelated to the one in this patch, otherwise I would have reverted this instead of waiting for the author to get back from vacation. Do either of you want to fix or revert to get the bot back into a good state?

I am the owner of lldb-aarch64-windows and i have verified that exactly this commit caused the test to fail. The builder was failing a few test earlier thats why this particular failure got masked.

Did you verify that the failure was because the changes were incorrect? These changes are correcting a bug and it's expected that downstreams like lldb may have to react to that sort of thing breaking their tests. A revert ~10 days after the failure landed is not exactly a timely revert -- now all the downstreams that did react to this change will have to react again, which is why I'm curious what amount of analysis was done prior to reverting and what details you can share about the problem.

HI AAron
I do apologise for the inconvenience this may have caused.
We normally try to be proactive with reverts but this was delayed as I was holidays past 10 days.
Regarding revert decision I believe the general community guideline is to revert any patches that cause a regression thats why I have reverted the change and I do agree with correctness of the patch.
Let me debug the issue further and get back to you with more information on why the test is failing.
Thanks

Hi Aaron,

The problem seems to be appearing in lldb-test tool which in this case is being used to fetch symbol information. Specifically it fails to find function name inside a nested block with your patch applied. More investigation on LLDB side is needed to find the exact cause of this failure.

You may re-land your changes as they are already approved and kindly mark the LLDB test as xfail.

I am the owner of lldb-aarch64-windows and i have verified that exactly this commit caused the test to fail. The builder was failing a few test earlier thats why this particular failure got masked.

Did you verify that the failure was because the changes were incorrect? These changes are correcting a bug and it's expected that downstreams like lldb may have to react to that sort of thing breaking their tests. A revert ~10 days after the failure landed is not exactly a timely revert -- now all the downstreams that did react to this change will have to react again, which is why I'm curious what amount of analysis was done prior to reverting and what details you can share about the problem.

HI AAron
I do apologise for the inconvenience this may have caused.
We normally try to be proactive with reverts but this was delayed as I was holidays past 10 days.
Regarding revert decision I believe the general community guideline is to revert any patches that cause a regression thats why I have reverted the change and I do agree with correctness of the patch.

Our revert policy is at: https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy and it does encourage timely reverts to regressions, but 1) this change doesn't appear to be a regression, 2) this revert was not timely. Correct, conforming changes to Clang or LLVM that break lldb are not a reason to revert the changes in Clang or LLVM. lldb is a downstream consumer of these tools and will sometimes need to react to changes that break their tests (Clang and LLVM developers will of course try not to be disruptive though!). Just something to keep in mind for next time, not the end of the world. :-)

Hi Aaron,

The problem seems to be appearing in lldb-test tool which in this case is being used to fetch symbol information. Specifically it fails to find function name inside a nested block with your patch applied. More investigation on LLDB side is needed to find the exact cause of this failure.

You may re-land your changes as they are already approved and kindly mark the LLDB test as xfail.

Thank you for doing the investigation! @efriedma, can you re-land this for @dpaoliello?

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 10:59 AM