* RFA: match source code, not line numbers
@ 2003-04-10 23:05 Jim Blandy
2003-04-10 23:39 ` David Carlton
0 siblings, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2003-04-10 23:05 UTC (permalink / raw)
To: gdb-patches
This makes these tests more robust when the .cc files are edited.
2003-04-10 Jim Blandy <jimb@qa1a.devel.redhat.com>
* gdb.c++/derivation.exp, gdb.c++/overload.exp,
gdb.c++/userdef.exp: Match against the program text, not line
numbers, to check that we've returned to the right place.
Index: gdb/testsuite/gdb.c++/derivation.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/derivation.exp,v
retrieving revision 1.11
diff -c -r1.11 derivation.exp
*** gdb/testsuite/gdb.c++/derivation.exp 9 Apr 2003 23:21:14 -0000 1.11
--- gdb/testsuite/gdb.c++/derivation.exp 10 Apr 2003 23:01:08 -0000
***************
*** 310,316 ****
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*derivation.cc:21\[79\].*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
--- 310,316 ----
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*derivation.cc:.*(marker1\\(\\);|a_instance\\.a = 20;).*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
Index: gdb/testsuite/gdb.c++/overload.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/overload.exp,v
retrieving revision 1.11
diff -c -r1.11 overload.exp
*** gdb/testsuite/gdb.c++/overload.exp 9 Apr 2003 23:21:14 -0000 1.11
--- gdb/testsuite/gdb.c++/overload.exp 10 Apr 2003 23:01:08 -0000
***************
*** 129,135 ****
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*overload.cc:7\[78\].*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
--- 129,135 ----
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*overload.cc:.*(marker1\\(\\);|return 0;).*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
Index: gdb/testsuite/gdb.c++/userdef.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/userdef.exp,v
retrieving revision 1.7
diff -c -r1.7 userdef.exp
*** gdb/testsuite/gdb.c++/userdef.exp 9 Apr 2003 23:21:14 -0000 1.7
--- gdb/testsuite/gdb.c++/userdef.exp 10 Apr 2003 23:01:08 -0000
***************
*** 75,81 ****
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*userdef.cc:27\[67\].*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
--- 75,81 ----
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*userdef.cc:.*(marker1\\(\\);|cout << one;).*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: RFA: match source code, not line numbers
2003-04-10 23:05 RFA: match source code, not line numbers Jim Blandy
@ 2003-04-10 23:39 ` David Carlton
2003-04-11 19:38 ` Jim Blandy
0 siblings, 1 reply; 5+ messages in thread
From: David Carlton @ 2003-04-10 23:39 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: RFA: match source code, not line numbers
2003-04-10 23:39 ` David Carlton
@ 2003-04-11 19:38 ` Jim Blandy
2003-04-11 19:55 ` David Carlton
[not found] ` <ro1istkakec.fsf@jackfruit.Stanford.EDU>
0 siblings, 2 replies; 5+ messages in thread
From: Jim Blandy @ 2003-04-11 19:38 UTC (permalink / raw)
To: David Carlton; +Cc: gdb-patches
David Carlton <carlton@math.stanford.edu> writes:
> 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.
I think that's a great idea. How's this:
gdb/testsuite/ChangeLog:
2003-04-11 Jim Blandy <jimb@qa1a.devel.redhat.com>
* gdb.c++/derivation.exp, gdb.c++/overload.exp,
gdb.c++/userdef.cc: Place comments on the lines to which the
marker function might return.
* gdb.c++/derivation.exp, gdb.c++/overload.exp,
gdb.c++/userdef.exp: Look for those comments to check that we've
returned to the right place, instead of checking line numbers.
Index: gdb/testsuite/gdb.c++/derivation.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/derivation.cc,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 derivation.cc
*** gdb/testsuite/gdb.c++/derivation.cc 16 Apr 1999 01:34:32 -0000 1.1.1.1
--- gdb/testsuite/gdb.c++/derivation.cc 11 Apr 2003 19:36:33 -0000
***************
*** 214,222 ****
#endif
! marker1();
! a_instance.a = 20;
a_instance.aa = 21;
b_instance.b = 22;
b_instance.bb = 23;
--- 214,222 ----
#endif
! marker1(); // marker1-returns-here
! a_instance.a = 20; // marker1-returns-here
a_instance.aa = 21;
b_instance.b = 22;
b_instance.bb = 23;
Index: gdb/testsuite/gdb.c++/derivation.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/derivation.exp,v
retrieving revision 1.11
diff -c -r1.11 derivation.exp
*** gdb/testsuite/gdb.c++/derivation.exp 9 Apr 2003 23:21:14 -0000 1.11
--- gdb/testsuite/gdb.c++/derivation.exp 11 Apr 2003 19:36:33 -0000
***************
*** 310,316 ****
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*derivation.cc:21\[79\].*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
--- 310,316 ----
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*derivation.cc:.*// marker1-returns-here.*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
Index: gdb/testsuite/gdb.c++/overload.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/overload.cc,v
retrieving revision 1.2
diff -c -r1.2 overload.cc
*** gdb/testsuite/gdb.c++/overload.cc 4 Feb 2003 21:19:27 -0000 1.2
--- gdb/testsuite/gdb.c++/overload.cc 11 Apr 2003 19:36:33 -0000
***************
*** 80,87 ****
// Verify that intToChar should work:
intToChar(1);
! marker1();
! return 0;
}
foo::foo (int i) { ifoo = i; ccpfoo = NULL; }
--- 80,87 ----
// Verify that intToChar should work:
intToChar(1);
! marker1(); // marker1-returns-here
! return 0; // marker1-returns-here
}
foo::foo (int i) { ifoo = i; ccpfoo = NULL; }
Index: gdb/testsuite/gdb.c++/overload.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/overload.exp,v
retrieving revision 1.11
diff -c -r1.11 overload.exp
*** gdb/testsuite/gdb.c++/overload.exp 9 Apr 2003 23:21:14 -0000 1.11
--- gdb/testsuite/gdb.c++/overload.exp 11 Apr 2003 19:36:33 -0000
***************
*** 129,135 ****
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*overload.cc:7\[78\].*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
--- 129,135 ----
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*overload.cc:.*// marker1-returns-here.*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
Index: gdb/testsuite/gdb.c++/userdef.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/userdef.cc,v
retrieving revision 1.2
diff -c -r1.2 userdef.cc
*** gdb/testsuite/gdb.c++/userdef.cc 8 Jan 2002 16:00:16 -0000 1.2
--- gdb/testsuite/gdb.c++/userdef.cc 11 Apr 2003 19:36:33 -0000
***************
*** 273,280 ****
A1 three(0,0);
int val;
! marker1();
! cout << one;
cout << two;
three = one + two;
cout << "+ " << three;
--- 273,280 ----
A1 three(0,0);
int val;
! marker1(); // marker1-returns-here
! cout << one; // marker1-returns-here
cout << two;
three = one + two;
cout << "+ " << three;
Index: gdb/testsuite/gdb.c++/userdef.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/userdef.exp,v
retrieving revision 1.7
diff -c -r1.7 userdef.exp
*** gdb/testsuite/gdb.c++/userdef.exp 9 Apr 2003 23:21:14 -0000 1.7
--- gdb/testsuite/gdb.c++/userdef.exp 11 Apr 2003 19:36:34 -0000
***************
*** 75,81 ****
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*userdef.cc:27\[67\].*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
--- 75,81 ----
-re "#0 marker1.*$gdb_prompt $" {
setup_kfail "gdb/1155" s390-*-linux-gnu
fail "re-selected 'main' frame after inferior call"
! gdb_test "finish" ".*main.*at .*userdef.cc:.*// marker1-returns-here.*" \
"finish call to marker1"
}
-re "#1 ($hex in )?main.*$gdb_prompt $" {
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: RFA: match source code, not line numbers
2003-04-11 19:38 ` Jim Blandy
@ 2003-04-11 19:55 ` David Carlton
[not found] ` <ro1istkakec.fsf@jackfruit.Stanford.EDU>
1 sibling, 0 replies; 5+ messages in thread
From: David Carlton @ 2003-04-11 19:55 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
On 11 Apr 2003 14:39:52 -0500, Jim Blandy <jimb@redhat.com> said:
> David Carlton <carlton@math.stanford.edu> writes:
>> 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.
> I think that's a great idea. How's this:
Lovely.
David Carlton
carlton@math.stanford.edu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: RFA: match source code, not line numbers
[not found] ` <ro1istkakec.fsf@jackfruit.Stanford.EDU>
@ 2003-04-11 19:58 ` Jim Blandy
0 siblings, 0 replies; 5+ messages in thread
From: Jim Blandy @ 2003-04-11 19:58 UTC (permalink / raw)
To: David Carlton; +Cc: gdb-patches
David Carlton <carlton@math.stanford.edu> writes:
> On 11 Apr 2003 14:39:52 -0500, Jim Blandy <jimb@redhat.com> said:
> > I think that's a great idea. How's this:
>
> Lovely.
Great --- committed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-04-11 19:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-10 23:05 RFA: match source code, not line numbers Jim Blandy
2003-04-10 23:39 ` David Carlton
2003-04-11 19:38 ` Jim Blandy
2003-04-11 19:55 ` David Carlton
[not found] ` <ro1istkakec.fsf@jackfruit.Stanford.EDU>
2003-04-11 19:58 ` Jim Blandy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox