On 2012-11-05 06:54 , Eric Botcazou wrote:
Those compiler generated statements do not have source origins, but
they need to have debug location information attached so that
information collected for them can be correlated with program
constructs (such as CFG). One of the natural way is to use the source
location associated with the program point where they are inserted.
No, there is nothing natural (and this can even be wrong). The statements
must have the source location corresponding to the source construct they are
generated for, which may be totally different from that of the insertion
point. Yes, that can generate jumpiness in GDB, but this is far better that
breaking the coverage info by giving the same source location to instructions
that have different coverage status.
But UNKNOWN_LOCATION is effectively wrong as well. If other
optimizations move the statements above the inserted instruction, then
the new instruction ends up inheriting whatever location happens to be
in the previous statement.
Fixing the location when the statement is inserted will reduce this
randomness. I'm not sure I understand why you think this will break
coverage. The examples given in this thread were helped by this
location fixing.
Do you have any counterexample? I may be missing something here.
Thanks. Diego.