This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] Emit comments for debug_loc bytes as integers
Needs ReviewPublic

Authored by dstenb on Feb 4 2021, 9:08 AM.

Details

Summary

The DebugLocDwarfExpression::emitData1() function would emit the
assembly file comments using raw characters. As emitting non-printable
characters or characters >127 can lead to issues, just emit the comments
as integers instead.

Diff Detail

Event Timeline

dstenb created this revision.Feb 4 2021, 9:08 AM
dstenb requested review of this revision.Feb 4 2021, 9:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 4 2021, 9:08 AM

Perhaps we shouldn't use a comment here? It doesn't seem to add any value - duplicating the literal that's already readable. (ideally we could pass down a comment from a higher level with more semantic information - like the DW_OP_implicit_value comment.

I'd say removing this Twine creation, passing down an empty string would suffice here. If you'd like to add value/maybe in a separate commit, adding an optional Comment parameter to emitUnsigned and emitData1 and using that from in this case DwarfExpression::addConstantFP to pass down something like emitUnsigned(NumBytes, ) and then maybe on the first call to emitData1 a comment with the APF and the original (unswapped) API values, and some text saying that this is the start of a ULEB encoding of the API value, LSB first.