RFA: match source code, not line numbers

David Carlton carlton@math.stanford.edu
Thu Apr 10 23:39:00 GMT 2003


On 10 Apr 2003 18:06:32 -0500, Jim Blandy <jimb@redhat.com> said:

> This makes these tests more robust when the .cc files are edited.

Yeah, I noticed that issue when I was looking over the second version
of the patches; it didn't seem worth commenting at the time, but I'm
glad you're fixing them.

Hmm.  Normally we've been grabbing line numbers via marker comments
and gdb_get_line_number in these sorts of situations.  (See
gdb.c++/m-data.exp, for example; of course, in that example, we
actually need a line number.)  It's a little more complicated here,
because it looks like you're seeing two different target line numbers.
But marker comments have the advantage over your approach that they
leave a residue in the .cc file as well as in the .exp file, lessening
the chance that somebody will inadvertently edit the .cc file in a
fashion that silently breaks the test.

How about you add a comment like "// done-with-marker1" at the end of
both lines in question (in each test), and then put
'done-with-marker1' in your regexp instead of the matches for the
bodies of the two lines?  That would satisfy my concerns, avoid the
need for gdb_get_line_number, and make the regexp a little simpler.

David Carlton
carlton@math.stanford.edu



More information about the Gdb-patches mailing list