This is an archive of the discontinued LLVM Phabricator instance.

[DWARF] Avoid entry_values production for SCE
ClosedPublic

Authored by djtodoro on Jul 9 2020, 1:10 AM.

Details

Summary

SONY debugger does not prefer debug entry values feature, so the plan is to avoid production of the entry values by default when the tuning is SCE debugger.

The feature still can be enabled with the -debug-entry-values option for the testing/development purposes.

This patch addresses PR46643.

Diff Detail

Event Timeline

djtodoro created this revision.Jul 9 2020, 1:10 AM

Between this code and DwarfDebug, I'm having a hard time understanding the various controls over emitting entry-values.

  • There's an existing tuning check in DwarfDebug, now you're adding the complementary check in TargetOptions. Does this make the DwarfDebug check redundant?
  • There are 3 different flags to sort out whether to emit this stuff. SupportsDebugEntryValues is strictly based on the target, I get that. Then there's EnableDebugEntryValues in the TargetOptions, which seems to be tied to a tool-command-line option; and separately there's EmitDwarfDebugEntryValues in DwarfDebug, with its own command-line option. Can we simplify this at all?

Between this code and DwarfDebug, I'm having a hard time understanding the various controls over emitting entry-values.

I see.. I think we can/should simplify it.

  • There's an existing tuning check in DwarfDebug, now you're adding the complementary check in TargetOptions. Does this make the DwarfDebug check redundant?

It is is redundant now.. Thanks!

  • There are 3 different flags to sort out whether to emit this stuff. SupportsDebugEntryValues is strictly based on the target, I get that. Then there's EnableDebugEntryValues in the TargetOptions, which seems to be tied to a tool-command-line option; and separately there's EmitDwarfDebugEntryValues in DwarfDebug, with its own command-line option. Can we simplify this at all?

I think yes. We needed the first two (SupportsDebugEntryValues and EnableDebugEntryValues from TargetOptions) in order to enable it by default for some targets and to leave an experimental option for developers who want to extend the support for the other architectures. There is a situation when different debuggers come into the game, so we thought to control it on the very end (within DwarfDebug with the EmitDwarfDebugEntryValues), but at that place we can control only caller-side-dwarf-symbols (dw_tag_call_sites) but not the dw_entry_values (callee side; since it is being produced during LiveDebugValues phase). So, having this patch, we can get rid of the DwarfDebug::EmitDwarfDebugEntryValues option, since we can experiment everything with the fields from TargetOptions.

djtodoro updated this revision to Diff 276742.Jul 9 2020, 8:11 AM
  • Remove unnecessary DwarfDebug entry-values option
vsk added a comment.Jul 9 2020, 9:50 AM

+1 for removing EmitDwarfDebugEntryValues, that's a nice cleanup. Thanks!

So the tuning here for SCE is also a "does not support" or something else?

So the tuning here for SCE is also a "does not support" or something else?

I'm told our debugger currently does not support the entry-value opcode. Locations with that opcode would be dropped/ignored (presumably just the individual location-list elements, although I haven't verified).

I am nudging our folks in the direction of supporting it, but need to demonstrate value first; that the additional location descriptions increase availability, and that the expressions can be evaluated usefully. I have to say a few preliminary experiments don't make me feel too positive about that second part, as the entry-value expressions tend to rely on registers that aren't saved by the ABI, so unwinding won't recover them.

In the meantime I'd prefer that they weren't emitted. for the usual size reasons.

djtodoro edited the summary of this revision. (Show Details)Jul 13 2020, 11:55 PM
djtodoro updated this revision to Diff 277690.Jul 14 2020, 12:40 AM
  • Update the comment around ShouldEmitDebugEntryValues()
aprantl added inline comments.Jul 14 2020, 11:19 AM
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
429

Wouldn't we want (tuneForGDB() || tuneForLLDB()) to override the target default? If someone were to debug with a hypothetical GDB port for SCE targets, for example?

llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
18

Wouldn't you want to check for DW_OP_{{.*}}entry_value?

djtodoro marked 2 inline comments as done.Jul 15 2020, 1:12 AM
djtodoro added inline comments.
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
429

We can still do that by using the -debug-entry-values option?

llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
18

It makes sense, thanks! The default @entry encoding for SCE will be GNU in this case, but it is safe to check both in the case the behavior changes.

djtodoro updated this revision to Diff 278100.Jul 15 2020, 1:23 AM
  • Improve the test

Any additional comment on this? :)

probinson accepted this revision.Jul 23 2020, 8:19 AM

LGTM

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
429

The tuning decision is made in TargetOptionsImpl, which is unusual but that's where the tuning option is actually kept, so I think it's okay.

This revision is now accepted and ready to land.Jul 23 2020, 8:19 AM
This revision was automatically updated to reflect the committed changes.