Page MenuHomePhabricator

Add testing for DW_OP_piece and fix a bug with small Scalar values.
ClosedPublic

Authored by aprantl on Jan 16 2020, 2:28 PM.

Details

Summary

By switching to Scalars that are backed by explicitly-sized APInts we can avoid a bug that increases the buffer reserved for a small piece to the next-largest host integer type.

This manifests as "DW_OP_piece for offset foo but top of stack is of size bar".

Diff Detail

Event Timeline

aprantl created this revision.Jan 16 2020, 2:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 16 2020, 2:28 PM
davide accepted this revision.Jan 16 2020, 3:17 PM

Looks great! Thanks Adrian. My understanding is that DW_OP_piece is still incomplete, right?

This revision is now accepted and ready to land.Jan 16 2020, 3:17 PM

My understanding is that DW_OP_piece is still incomplete, right?

DW_OP_piece should work (with the documented caveat about the undefined values) fine, what definitely doesn't yet work is the combination of DW_OP_piece and DW_OP_bit_piece.

aprantl added a reviewer: vsk.Jan 16 2020, 3:38 PM
vsk accepted this revision.Jan 16 2020, 3:53 PM

LGTM. In the future it'd be nice to maybe split out piece/bit_piece handling into their own self-contained functions, and maybe share more code between them. But landing this narrow fix now sounds good.

This revision was automatically updated to reflect the committed changes.