This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readelf] Fix emitting incorrect number of spaces in '--hex-dump'.
ClosedPublic

Authored by Higuoxing on Jul 27 2020, 5:20 AM.

Details

Summary

This patch helps teach llvm-readelf to emit a correct number spaces when
dumping in hex format.

Before this patch, when the hex data doesn't fill the 4th column, some
spaces are missing.

Hex dump of section '.sec':
0x00000000 00000000 00000000 00000000 00000000 ................
0x00000010 00000000 00000000 00000000 0000 ..............

After this patch:

Hex dump of section '.sec':
0x00000000 00000000 00000000 00000000 00000000 ................
0x00000010 00000000 00000000 00000000 0000     ..............

Diff Detail

Event Timeline

Higuoxing created this revision.Jul 27 2020, 5:20 AM
Higuoxing updated this revision to Diff 280870.Jul 27 2020, 5:24 AM

Fix test case label.

grimar accepted this revision.Jul 27 2020, 6:46 AM

LGTM!

This revision is now accepted and ready to land.Jul 27 2020, 6:46 AM
Higuoxing retitled this revision from [llvm-readelf] Fix emitting a wrong number of spaces in '--hex-dump'. to [llvm-readelf] Fix emitting incorrect number of spaces in '--hex-dump'..Jul 27 2020, 7:15 AM
This revision was automatically updated to reflect the committed changes.

Some comment fixes. Please create a new commit for these and submit.

llvm/test/tools/llvm-readobj/ELF/hex-dump.test
52

Nits:
a correct -> the correct
amount -> number

55

This comment is clunky. Try:

"the column whose index isn't 4" -> "a column other than the last one"

64

Similarly:

"doesn't fill the last column"

73

fills the -> fills a

Higuoxing marked 4 inline comments as done.Jul 28 2020, 7:03 PM

Some comment fixes. Please create a new commit for these and submit.

Hi James, these comments are addressed in c12394fef3edc74207801adc6f778a0fb422f195.


Thank you both for reviewing!