[RFA]: Fix gdb.base/printcmds.exp for targets that initialize data during crt0

Michael Snyder msnyder@cygnus.com
Mon May 21 10:59:00 GMT 2001


Stephane Carrez wrote:
> 
> Hi!
> 
> For targets that initialize the data section during the crt0, the data
> section is not loaded and therefore not valid until we reach the main.
> This is typically what happens when you have a ROM, the data section has
> its image in ROM, and the ROM data image is copied in RAM before the main
> (by the crt0) (see GNU ld for linker script details).
> 
> The gdb.base/printcmds.exp test checks the 'ctable1' table which is in data
> section before running the program to the main.  This causes a failure
> for the targets that behave as described above.
> 
> In the patch, I propose to add a configuration variable 'gdb,noloaddata'
> (see also my previous patches), that indicates the data section is not loaded
> until we reach the main.  The test checks for that and looks at the ctable1
> array after the main if that's the case.
> 
> OK to commit?

It should not be necessary to add the test for ctable1[120] after hitting
main, since that variable is already tested in the procedure "test_print_all_chars".
Otherwise, I don't see any problem.



> 2001-05-20  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
> 
>         * gdb.base/printcmds.exp: Print ctable1 before the main only for
>         targets not marked with gdb,noloaddata; Print ctable1 when we
>         reach the main.
> 
>   ----------------------------------------------------------------------------------------------------
> Index: gdb.base/printcmds.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/printcmds.exp,v
> retrieving revision 1.4
> diff -u -p -r1.4 printcmds.exp
> --- printcmds.exp       2001/03/06 08:21:51     1.4
> +++ printcmds.exp       2001/05/20 15:29:39
> @@ -1,4 +1,4 @@
> -# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000
> +# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001
>  # Free Software Foundation, Inc.
> 
>  # This program is free software; you can redistribute it and/or modify
> @@ -707,9 +707,14 @@ gdb_test "set print address off" ""
>  gdb_test "set width 0" ""
> 
>  if [set_lang_c] then {
> -    gdb_test "p ctable1\[120\]" "120 'x'" "p ctable1\[120\] #1"
> -
> +    # Don't check ctable1 for targets that set the data section in
> +    # the crt0 (before main).  For these targets, we must go to the
> +    # main do to this (next tests).
> +    if ![target_info exists gdb,noloaddata] then {
> +        gdb_test "p ctable1\[120\]" "120 'x'" "p ctable1\[120\] #1"
> +    }
>      if [runto_main] then {
> +       gdb_test "p ctable1\[120\]" "120 'x'" "p ctable1\[120\] #1"
>         test_integer_literals_accepted
>         test_integer_literals_rejected
>         test_character_literals_accepted



More information about the Gdb-patches mailing list