This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: match source code, not line numbers
- From: David Carlton <carlton at math dot stanford dot edu>
- To: Jim Blandy <jimb at redhat dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: 10 Apr 2003 16:39:37 -0700
- Subject: Re: RFA: match source code, not line numbers
- References: <vt28yuiosuf.fsf@zenia.red-bean.com>
On 10 Apr 2003 18:06:32 -0500, Jim Blandy <jimb at redhat dot 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 at math dot stanford dot edu