[RFA] [PATCH] gdb.base/break.exp
Fernando Nasser
fnasser@cygnus.com
Thu Nov 23 12:49:00 GMT 2000
Sounds reasonable to me.
Thanks.
Fernando
Michael Elizabeth Chastain wrote:
>
> On Red Hat Linux 6.2 native, I see these test failures:
>
> FAIL: gdb.base/break.exp: break main #1
> FAIL: gdb.base/break.exp: break main #2
> FAIL: gdb.base/break.exp: clear main
>
> I have an analysis and a patch.
>
> First, the analysis. This test case sets multiple breakpoints on a single
> location and then clears all of them at once. The location for the test
> is the well-known function 'main'.
>
> Unfortunately, at that point of the test execution, the program counter
> is in a library function __libc_start_main which has a parameter named
> 'main'. This parameter name shadows the global function name 'main',
> so that gdb-under-test resolves the name 'main' to this parameter, not
> to the global function 'main'. This is normal C scoping. And of course,
> it is illegal to set a breakpoint on a parameter.
>
> Here is an excerpt from gdb.log. Note where the 'finish' command
> leaves the target program; and note the names of the parameters to
> __libc_start_main.
>
> finish
> Run till exit from #0 main (argc=1, argv=0xbffff5d4, envp=0xbffff5dc) at ../../../../src/gdb/testsuite/gdb.base/break.c:75
> 720
> 0x4004d9cb in __libc_start_main (main=0x80484a8 <main>, argc=1, argv=0xbffff5d4, init=0x8048318 <_init>, fini=0x80485ac <_fini>, rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffff5cc) at ../sysdeps/generic/libc-start.c:92
> 92 ../sysdeps/generic/libc-start.c: No such file or directory.
> Value returned is $2 = 0
> (gdb) PASS: gdb.base/break.exp: finish from outermost frame disallowed
> break main
> "main" is not a function
> (gdb) FAIL: gdb.base/break.exp: break main #1
> break main
> "main" is not a function
> (gdb) FAIL: gdb.base/break.exp: break main #2
> clear main
> "main" is not a function
> (gdb) FAIL: gdb.base/break.exp: clear main
> ---
>
> My fix is trivial: use a different function name for the
> set-multiple-breakpoints-and-clear-them-all test.
>
> Michael Chastain
> chastain@redhat.com
> "love without fear"
>
> ---
>
> 2000-11-23 Michael Chastain <chastain@redhat.com>
>
> * break.exp (test_clear_command): use a different function
> than 'main' for the test function. On glibc based systems,
> __libc_start_main is the current function at this point in
> execution, and __libc_start_main has a parameter named 'main'.
>
> Index: gdb/testsuite/gdb.base/break.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.exp,v
> retrieving revision 1.6
> diff -c -3 -p -r1.6 break.exp
> *** gdb/testsuite/gdb.base/break.exp 2000/11/17 16:24:48 1.6
> --- gdb/testsuite/gdb.base/break.exp 2000/11/23 18:45:14
> *************** if [istarget "hppa*-*-hpux*"] then {
> *** 707,718 ****
>
>
> proc test_clear_command {} {
> ! gdb_test "break main" "Breakpoint.*at.*" "break main #1"
> ! gdb_test "break main" "Breakpoint.*at.*" "break main #2"
>
> # We don't test that it deletes the correct breakpoints. We do at
> # least test that it deletes more than one breakpoint.
> ! gdb_test "clear main" {Deleted breakpoints [0-9]+ [0-9]+.*}
> }
>
> #
> --- 707,718 ----
>
>
> proc test_clear_command {} {
> ! gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #1"
> ! gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #2"
>
> # We don't test that it deletes the correct breakpoints. We do at
> # least test that it deletes more than one breakpoint.
> ! gdb_test "clear factorial" {Deleted breakpoints [0-9]+ [0-9]+.*}
> }
>
> #
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
More information about the Gdb-patches
mailing list