test: Fix coff-dump section array indicies to 1 based to match file format.
[oota-llvm.git] / test / Scripts / common_dump.py
1 def dataToHex(d):
2     """ Convert the raw data in 'd' to an hex string with a space every 4 bytes.
3     """
4     bytes = []
5     for i,c in enumerate(d):
6         byte = ord(c)
7         hex_byte = hex(byte)[2:]
8         if byte <= 0xf:
9             hex_byte = '0' + hex_byte
10         if i % 4 == 3:
11             hex_byte += ' '
12         bytes.append(hex_byte)
13     return ''.join(bytes).strip()