1
2
3
4
5
6
7 :(before "Pack Operands(segment code)")
8 warn_on_raw_hex(code);
9 if (trace_contains_errors()) return;
10 :(code)
11 void warn_on_raw_hex(const segment& code) {
12 trace(99, "transform") << "-- warn on raw hex instructions" << end();
13 for (int i = 0; i < SIZE(code.lines); ++i) {
14 const line& inst = code.lines.at(i);
15 if (all_hex_bytes(inst) && has_operands(inst)) {
16 warn << "'" << to_string(inst) << "': using raw hex is not recommended\n" << end();
17 break;
18 }
19 }
20 }
21
22 :(scenarios transform)
23 :(scenario warn_on_hex_bytes_without_operands)
24 == 0x1
25 bb 2a 00 00 00
26 +warn: 'bb 2a 00 00 00': using raw hex is not recommended
27
28 :(scenario warn_on_non_operand_metadata)
29 == 0x1
30 bb 2a 00/foo 00/bar 00
31 +warn: 'bb 2a 00/foo 00/bar 00': using raw hex is not recommended
32
33 :(scenario no_warn_on_instructions_without_operands)
34 == 0x1
35 55
36 -warn: '55': using raw hex is not recommended