[llvm-readelf] Fix emitting incorrect number of spaces in '--hex-dump'.
authorXing GUO <higuoxing@gmail.com>
Tue, 28 Jul 2020 01:53:59 +0000 (09:53 +0800)
committerXing GUO <higuoxing@gmail.com>
Tue, 28 Jul 2020 01:54:33 +0000 (09:54 +0800)
commit6bf989b9474ace6a35021e6123d13b7fd59bf9f4
treee1ac582cdd96b91ec2d3a350335a96599ca16b84
parent930fc0b300b01890d3cafabfa85a8a50b2ca890e
[llvm-readelf] Fix emitting incorrect number of spaces in '--hex-dump'.

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     ..............
```

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D84640
llvm/test/tools/llvm-readobj/ELF/hex-dump.test
llvm/tools/llvm-readobj/ObjDumper.cpp