llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.01k stars 11.56k forks source link

Unknown standard opcodes printed as (null) in prologue #43619

Open jh7370 opened 4 years ago

jh7370 commented 4 years ago
Bugzilla Link 44274
Version trunk
OS Windows NT
CC @JDevlieghere,@walkerkd,@pogo59

Extended Description

If the opcode base of a line table prologue is higher than 13 (i.e. the program defines unknown standard opcodes), the unknown opcodes are printed as "(null)" in the array, which doesn't look great. We should probably print something like "DW_LNS_unknown" instead, which roughly matches what is done for unknown DWAT* and other DWARF constants.

See test/tools/llvm-dwarfdump/X86/debug-line.s for an example:

CHECK-NEXT: opcode_base: 14

CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0

CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1

CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1

CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1

CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1

CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0

CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0

CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0

CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1

CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0

CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0

CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1

CHECK-NEXT: standard_opcode_lengths[(null)] = 0 BAD

The verbose dumping currently prints these as an empty string, probably for the same reason at a guess.

pogo59 commented 4 years ago

We should probably print something like "DW_LNS_unknown" instead

We do tolerate these (without erroring) when reading the line-number program. We should print something reasonable in the opcode_lengths table, although I'd want DW_LNS_unknown_NNN or something similar.