llvm / llvm-project

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

Print value to adjust by rather than final line value for verbose DW_LNS_advance_line #43606

Open jh7370 opened 4 years ago

jh7370 commented 4 years ago
Bugzilla Link 44261
Version trunk
OS Windows NT
CC @pogo59

Extended Description

Currently, when llvm-dwarfdump prints the debug line table with --verbose, any DW_LNS_advance_line opcodes are printed as:

: 03 DW_LNS_advance_line () I think this should be changed to: : 03 DW_LNS_advance_line () This would be in keeping with the various operations that change the PC value, e.g. DW_LNS_advance_pc, which print the value to adjust by. This inconsistency can easily lead to confusion. Additionally, nothing really is lost: the next time a line is emitted using e.g. DW_LNS_copy or a special opcode, the new line value is printed there. Without this change, there is no direct way of seeing what is actually written in the line program, which is the point of verbose printing.
jh7370 commented 4 years ago

Actually, I was writing tests for some basic llvm-dwarfdump switches (see D71276), and as part of that was exercising a few odd things (like unknown values for forms/attributes/tags). During this, I stumbled on a few issues. Given that I was aiming to test that the normal features were actually working, and only incidentally testing other parts, fuzzing wouldn't be the right approach here (but could be for other cases).

pogo59 commented 4 years ago

Incidentally, my impression is that you are hand-writing tests for bogus inputs. Wouldn't fuzzing be more efficient?

pogo59 commented 4 years ago

I think this should be changed to:

: 03 DW_LNS_advance_line ()

IMO, verbose mode in general should show operands as they are in the line-number program, so I agree. FTR, DW_LNS_advance_line takes a signed LEB so there should be a +/- in front of the value.