* [RFA] Accept compiler internal use of memcpy/bcopy for structs
@ 2002-01-08 9:00 Fred Fish
2002-01-08 15:15 ` Michael Snyder
2002-01-10 16:03 ` Michael Snyder
0 siblings, 2 replies; 6+ messages in thread
From: Fred Fish @ 2002-01-08 9:00 UTC (permalink / raw)
To: gdb-patches; +Cc: fnf
For cases where the compiler uses memcpy/bcopy to copy structs around,
and those calls are found in a library for which debugging line number
information is available, attempting to step into a function where a
large struct is passed by value will first stop at the memcpy/bcopy
call that the compiler calls prior to the user function.
The comment in step-test.exp says that "opinion is bitterly divided
about whether this is the right behavior for GDB or not". Regardless
of which opinion you have, you would probably have to agree that gdb
is currently behaving as designed, in the absence of additional
code to not stop in functions used internally by the compiler. Thus
I believe the correct behavior of the test suite is to accept the
cases where gdb stops in memcpy/bcopy.
Here is a patch to fix the testsuite.
-Fred
2002-01-08 Fred Fish <fnf@redhat.com>
* gdb.base/step-test.exp: Accept stopping in memcpy/bcopy when we
have debugging info for those functions and the compiler uses them
internally to copy structs around.
Index: gdb.base/step-test.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/step-test.exp,v
retrieving revision 1.3
diff -c -p -r1.3 step-test.exp
*** step-test.exp 2001/03/06 08:21:51 1.3
--- step-test.exp 2002/01/08 16:51:30
*************** gdb_test \
*** 212,220 ****
gdb_test "continue" \
".*Breakpoint ${decimal},.*large_struct_by_value.*" \
"run to pass large struct"
! gdb_test "step" \
! ".*step-test.exp: arrive here 1.*" \
! "large struct by value"
gdb_continue_to_end "step-test.exp"
--- 212,244 ----
gdb_test "continue" \
".*Breakpoint ${decimal},.*large_struct_by_value.*" \
"run to pass large struct"
! send_gdb "step\n"
! gdb_expect {
! -re ".*step-test.exp: arrive here 1.*$gdb_prompt $" {
! pass "large struct by value"
! }
! -re ".*(memcpy|bcopy).*$gdb_prompt $" {
! send_gdb "finish\n" ; gdb_expect -re "$gdb_prompt $"
! send_gdb "step\n"
! gdb_expect {
! -re ".*step-test.exp: arrive here 1.*$gdb_prompt $" {
! pass "large struct by value"
! }
! -re ".*$gdb_prompt $" {
! fail "large struct by value"
! }
! timeout {
! fail "large struct by value (timeout)"
! }
! }
! }
! -re ".*$gdb_prompt $" {
! fail "large struct by value"
! }
! timeout {
! fail "large struct by value (timeout)"
! }
! }
gdb_continue_to_end "step-test.exp"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] Accept compiler internal use of memcpy/bcopy for structs
2002-01-08 9:00 [RFA] Accept compiler internal use of memcpy/bcopy for structs Fred Fish
@ 2002-01-08 15:15 ` Michael Snyder
2002-01-10 16:03 ` Michael Snyder
1 sibling, 0 replies; 6+ messages in thread
From: Michael Snyder @ 2002-01-08 15:15 UTC (permalink / raw)
To: gdb-patches; +Cc: fnf
Fred Fish wrote:
>
> For cases where the compiler uses memcpy/bcopy to copy structs around,
> and those calls are found in a library for which debugging line number
> information is available, attempting to step into a function where a
> large struct is passed by value will first stop at the memcpy/bcopy
> call that the compiler calls prior to the user function.
>
> The comment in step-test.exp says that "opinion is bitterly divided
> about whether this is the right behavior for GDB or not". Regardless
> of which opinion you have, you would probably have to agree that gdb
> is currently behaving as designed, in the absence of additional
> code to not stop in functions used internally by the compiler. Thus
> I believe the correct behavior of the test suite is to accept the
> cases where gdb stops in memcpy/bcopy.
>
> Here is a patch to fix the testsuite.
>
> -Fred
I like the fix -- but could you maybe use exp_continue instead of
duplicating the code for the pass condition?
>
> 2002-01-08 Fred Fish <fnf@redhat.com>
>
> * gdb.base/step-test.exp: Accept stopping in memcpy/bcopy when we
> have debugging info for those functions and the compiler uses them
> internally to copy structs around.
>
> Index: gdb.base/step-test.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/step-test.exp,v
> retrieving revision 1.3
> diff -c -p -r1.3 step-test.exp
> *** step-test.exp 2001/03/06 08:21:51 1.3
> --- step-test.exp 2002/01/08 16:51:30
> *************** gdb_test \
> *** 212,220 ****
> gdb_test "continue" \
> ".*Breakpoint ${decimal},.*large_struct_by_value.*" \
> "run to pass large struct"
> ! gdb_test "step" \
> ! ".*step-test.exp: arrive here 1.*" \
> ! "large struct by value"
>
> gdb_continue_to_end "step-test.exp"
>
> --- 212,244 ----
> gdb_test "continue" \
> ".*Breakpoint ${decimal},.*large_struct_by_value.*" \
> "run to pass large struct"
> ! send_gdb "step\n"
> ! gdb_expect {
> ! -re ".*step-test.exp: arrive here 1.*$gdb_prompt $" {
> ! pass "large struct by value"
> ! }
> ! -re ".*(memcpy|bcopy).*$gdb_prompt $" {
> ! send_gdb "finish\n" ; gdb_expect -re "$gdb_prompt $"
> ! send_gdb "step\n"
> ! gdb_expect {
> ! -re ".*step-test.exp: arrive here 1.*$gdb_prompt $" {
> ! pass "large struct by value"
> ! }
> ! -re ".*$gdb_prompt $" {
> ! fail "large struct by value"
> ! }
> ! timeout {
> ! fail "large struct by value (timeout)"
> ! }
> ! }
> ! }
> ! -re ".*$gdb_prompt $" {
> ! fail "large struct by value"
> ! }
> ! timeout {
> ! fail "large struct by value (timeout)"
> ! }
> ! }
>
> gdb_continue_to_end "step-test.exp"
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] Accept compiler internal use of memcpy/bcopy for structs
2002-01-08 9:00 [RFA] Accept compiler internal use of memcpy/bcopy for structs Fred Fish
2002-01-08 15:15 ` Michael Snyder
@ 2002-01-10 16:03 ` Michael Snyder
2002-03-25 19:22 ` Fred Fish
1 sibling, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2002-01-10 16:03 UTC (permalink / raw)
To: fnf; +Cc: gdb-patches, fnf
Fred Fish wrote:
>
> For cases where the compiler uses memcpy/bcopy to copy structs around,
> and those calls are found in a library for which debugging line number
> information is available, attempting to step into a function where a
> large struct is passed by value will first stop at the memcpy/bcopy
> call that the compiler calls prior to the user function.
>
> The comment in step-test.exp says that "opinion is bitterly divided
> about whether this is the right behavior for GDB or not". Regardless
> of which opinion you have, you would probably have to agree that gdb
> is currently behaving as designed, in the absence of additional
> code to not stop in functions used internally by the compiler. Thus
> I believe the correct behavior of the test suite is to accept the
> cases where gdb stops in memcpy/bcopy.
>
> Here is a patch to fix the testsuite.
Fred,
Would you please try the attached modification of your patch,
and let me know if it is acceptable?
> 2002-01-08 Fred Fish <fnf@redhat.com>
>
> * gdb.base/step-test.exp: Accept stopping in memcpy/bcopy when we
> have debugging info for those functions and the compiler uses them
> internally to copy structs around.
Index: step-test.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/step-test.exp,v
retrieving revision 1.3
diff -c -3 -p -r1.3 step-test.exp
*** step-test.exp 2001/03/06 08:21:51 1.3
--- step-test.exp 2002/01/10 23:58:15
*************** gdb_test \
*** 212,220 ****
gdb_test "continue" \
".*Breakpoint ${decimal},.*large_struct_by_value.*" \
"run to pass large struct"
! gdb_test "step" \
! ".*step-test.exp: arrive here 1.*" \
! "large struct by value"
gdb_continue_to_end "step-test.exp"
--- 212,235 ----
gdb_test "continue" \
".*Breakpoint ${decimal},.*large_struct_by_value.*" \
"run to pass large struct"
! send_gdb "step\n"
! gdb_expect {
! -re ".*step-test.exp: arrive here 1.*$gdb_prompt $" {
! pass "large struct by value"
! }
! -re ".*(memcpy|bcopy).*$gdb_prompt $" {
! send_gdb "finish\n" ; gdb_expect -re "$gdb_prompt $"
! send_gdb "step\n"
! exp_continue
! }
! }
! -re ".*$gdb_prompt $" {
! fail "large struct by value"
! }
! timeout {
! fail "large struct by value (timeout)"
! }
! }
gdb_continue_to_end "step-test.exp"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] Accept compiler internal use of memcpy/bcopy for structs
2002-01-10 16:03 ` Michael Snyder
@ 2002-03-25 19:22 ` Fred Fish
2002-03-26 14:46 ` Michael Snyder
0 siblings, 1 reply; 6+ messages in thread
From: Fred Fish @ 2002-03-25 19:22 UTC (permalink / raw)
To: Michael Snyder; +Cc: fnf, gdb-patches, fnf
> Would you please try the attached modification of your patch,
> and let me know if it is acceptable?
Yes, that works. I've attached the actual patch I tried (there was an
extra '}' in the patch you suggested). OK to check in?
-Fred
2002-03-25 Fred Fish <fnf@redhat.com>
* gdb.base/step-test.exp: Accept stopping in memcpy/bcopy when we
have debugging info for those functions and the compiler uses them
internally to copy structs around.
Index: gdb.base/step-test.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/step-test.exp,v
retrieving revision 1.3
diff -c -p -r1.3 step-test.exp
*** step-test.exp 2001/03/06 08:21:51 1.3
--- step-test.exp 2002/03/26 03:20:34
*************** gdb_test \
*** 212,220 ****
gdb_test "continue" \
".*Breakpoint ${decimal},.*large_struct_by_value.*" \
"run to pass large struct"
! gdb_test "step" \
! ".*step-test.exp: arrive here 1.*" \
! "large struct by value"
gdb_continue_to_end "step-test.exp"
--- 212,234 ----
gdb_test "continue" \
".*Breakpoint ${decimal},.*large_struct_by_value.*" \
"run to pass large struct"
! send_gdb "step\n"
! gdb_expect {
! -re ".*step-test.exp: arrive here 1.*$gdb_prompt $" {
! pass "large struct by value"
! }
! -re ".*(memcpy|bcopy).*$gdb_prompt $" {
! send_gdb "finish\n" ; gdb_expect -re "$gdb_prompt $"
! send_gdb "step\n"
! exp_continue
! }
! -re ".*$gdb_prompt $" {
! fail "large struct by value"
! }
! timeout {
! fail "large struct by value (timeout)"
! }
! }
gdb_continue_to_end "step-test.exp"
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] Accept compiler internal use of memcpy/bcopy for structs
2002-03-25 19:22 ` Fred Fish
@ 2002-03-26 14:46 ` Michael Snyder
2002-03-26 15:24 ` Fernando Nasser
0 siblings, 1 reply; 6+ messages in thread
From: Michael Snyder @ 2002-03-26 14:46 UTC (permalink / raw)
To: fnf; +Cc: gdb-patches, fnf
Fred Fish wrote:
>
> > Would you please try the attached modification of your patch,
> > and let me know if it is acceptable?
>
> Yes, that works. I've attached the actual patch I tried (there was an
> extra '}' in the patch you suggested). OK to check in?
OK by me...
>
> -Fred
>
> 2002-03-25 Fred Fish <fnf@redhat.com>
>
> * gdb.base/step-test.exp: Accept stopping in memcpy/bcopy when we
> have debugging info for those functions and the compiler uses them
> internally to copy structs around.
>
> Index: gdb.base/step-test.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/step-test.exp,v
> retrieving revision 1.3
> diff -c -p -r1.3 step-test.exp
> *** step-test.exp 2001/03/06 08:21:51 1.3
> --- step-test.exp 2002/03/26 03:20:34
> *************** gdb_test \
> *** 212,220 ****
> gdb_test "continue" \
> ".*Breakpoint ${decimal},.*large_struct_by_value.*" \
> "run to pass large struct"
> ! gdb_test "step" \
> ! ".*step-test.exp: arrive here 1.*" \
> ! "large struct by value"
>
> gdb_continue_to_end "step-test.exp"
>
> --- 212,234 ----
> gdb_test "continue" \
> ".*Breakpoint ${decimal},.*large_struct_by_value.*" \
> "run to pass large struct"
> ! send_gdb "step\n"
> ! gdb_expect {
> ! -re ".*step-test.exp: arrive here 1.*$gdb_prompt $" {
> ! pass "large struct by value"
> ! }
> ! -re ".*(memcpy|bcopy).*$gdb_prompt $" {
> ! send_gdb "finish\n" ; gdb_expect -re "$gdb_prompt $"
> ! send_gdb "step\n"
> ! exp_continue
> ! }
> ! -re ".*$gdb_prompt $" {
> ! fail "large struct by value"
> ! }
> ! timeout {
> ! fail "large struct by value (timeout)"
> ! }
> ! }
>
> gdb_continue_to_end "step-test.exp"
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFA] Accept compiler internal use of memcpy/bcopy for structs
2002-03-26 14:46 ` Michael Snyder
@ 2002-03-26 15:24 ` Fernando Nasser
0 siblings, 0 replies; 6+ messages in thread
From: Fernando Nasser @ 2002-03-26 15:24 UTC (permalink / raw)
To: Michael Snyder; +Cc: fnf, gdb-patches, fnf
Michael Snyder wrote:
>
> Fred Fish wrote:
> >
> > > Would you please try the attached modification of your patch,
> > > and let me know if it is acceptable?
> >
> > Yes, that works. I've attached the actual patch I tried (there was an
> > extra '}' in the patch you suggested). OK to check in?
>
> OK by me...
>
Thanks for looking into this one Michael.
And thanks for the patch Fred. Please check it in.
Regards to all.
Fernando
> >
> > -Fred
> >
> > 2002-03-25 Fred Fish <fnf@redhat.com>
> >
> > * gdb.base/step-test.exp: Accept stopping in memcpy/bcopy when we
> > have debugging info for those functions and the compiler uses them
> > internally to copy structs around.
> >
> > Index: gdb.base/step-test.exp
> > ===================================================================
> > RCS file: /cvs/src/src/gdb/testsuite/gdb.base/step-test.exp,v
> > retrieving revision 1.3
> > diff -c -p -r1.3 step-test.exp
> > *** step-test.exp 2001/03/06 08:21:51 1.3
> > --- step-test.exp 2002/03/26 03:20:34
> > *************** gdb_test \
> > *** 212,220 ****
> > gdb_test "continue" \
> > ".*Breakpoint ${decimal},.*large_struct_by_value.*" \
> > "run to pass large struct"
> > ! gdb_test "step" \
> > ! ".*step-test.exp: arrive here 1.*" \
> > ! "large struct by value"
> >
> > gdb_continue_to_end "step-test.exp"
> >
> > --- 212,234 ----
> > gdb_test "continue" \
> > ".*Breakpoint ${decimal},.*large_struct_by_value.*" \
> > "run to pass large struct"
> > ! send_gdb "step\n"
> > ! gdb_expect {
> > ! -re ".*step-test.exp: arrive here 1.*$gdb_prompt $" {
> > ! pass "large struct by value"
> > ! }
> > ! -re ".*(memcpy|bcopy).*$gdb_prompt $" {
> > ! send_gdb "finish\n" ; gdb_expect -re "$gdb_prompt $"
> > ! send_gdb "step\n"
> > ! exp_continue
> > ! }
> > ! -re ".*$gdb_prompt $" {
> > ! fail "large struct by value"
> > ! }
> > ! timeout {
> > ! fail "large struct by value (timeout)"
> > ! }
> > ! }
> >
> > gdb_continue_to_end "step-test.exp"
> >
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-03-26 23:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-08 9:00 [RFA] Accept compiler internal use of memcpy/bcopy for structs Fred Fish
2002-01-08 15:15 ` Michael Snyder
2002-01-10 16:03 ` Michael Snyder
2002-03-25 19:22 ` Fred Fish
2002-03-26 14:46 ` Michael Snyder
2002-03-26 15:24 ` Fernando Nasser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox