This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA/testsuite: Add MIPS to gdb.asm


Andrew Cagney wrote:
> 
> FYI, MichaelS tends to handle these.
> 
> Andrew
> 
>   -------------------------------------------------------------------------------
> 
> Subject: RFA/testsuite: Add MIPS to gdb.asm
> Date: Sat, 12 Oct 2002 15:37:26 -0400
> From: Daniel Jacobowitz <drow@mvista.com>
> To: gdb-patches@sources.redhat.com
> CC: fnasser@redhat.com
> 
> I was squashing MIPS GNU/Linux failures this morning and the 24 fails from
> gdb.asm finally annoyed me... so I squashed them.  The ChangeLog is pretty
> explanatory; the only subtle part was a change from "selected stack frame"
> to "(foo2|selected stack frame)".  Because of the .ent information, GDB
> knows which function the frame belongs to.  The .ent information is
> necessary to write PIC code on MIPS, and all user code is PIC.
> 
> Is this OK?

You added one unnecessary blank line at the beginning of asmsrc1.s, 
which was the only thing that necessitated some of your line-number changes
in the expect strings.  If you take that out, the rest is approved.



> 
> --
> Daniel Jacobowitz
> MontaVista Software                         Debian GNU/Linux Developer
> 
> 2002-10-12  Daniel Jacobowitz  <drow@mvista.com>
> 
>         * gdb.asm/asm-source.exp: Add "mips*-*" pattern.  Update line
>         numbers.  Allow "foo2|selected stack frame".
>         * gdb.asm/asmsrc1.s: Use gdbasm_declare and gdbasm_end.
>         * gdb.asm/asmsrc2.s: Likewise.
>         * gdb.asm/common.inc: Define gdbasm_declare and gdbasm_end.  Update
>         comments.
>         * gdb.asm/mips.inc: New file.
> 
> Index: testsuite/gdb.asm/asm-source.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/asm-source.exp,v
> retrieving revision 1.25
> diff -u -p -r1.25 asm-source.exp
> --- testsuite/gdb.asm/asm-source.exp    6 Jun 2002 15:19:17 -0000       1.25
> +++ testsuite/gdb.asm/asm-source.exp    12 Oct 2002 19:32:06 -0000
> @@ -57,6 +57,9 @@ if [istarget "i\[3456\]86-*-*"] then {
>  if [istarget "m32r*-*"] then {
>      set asm-arch m32r
>  }
> +if [istarget "mips*-*"] then {
> +    set asm-arch mips
> +}
>  if [istarget "powerpc*-*"] then {
>      set asm-arch powerpc
>  }
> @@ -138,10 +141,10 @@ if ![runto_main] then {
>  }
> 
>  # Execute the `f' command and see if the result includes source info.
> -gdb_test "f" "asmsrc1\[.\]s:29.*several_nops" "f at main"
> +gdb_test "f" "asmsrc1\[.\]s:30.*several_nops" "f at main"
> 
>  # See if we properly `next' over a macro with several insns.
> -gdb_test "n" "33\[     \]*.*foo2" "next over macro"
> +gdb_test "n" "34\[     \]*.*foo2" "next over macro"
> 
>  # See if we can properly `step' into a subroutine call.
>  gdb_test "s" "8\[      \]*.*" "step into foo2"
> @@ -194,7 +197,7 @@ gdb_test "list $entry_symbol" ".*gdbasm_
> 
>  # Now try a source file search
>  gdb_test "search A routine for foo2 to call" \
> -       "39\[ \t\]+comment \"A routine for foo2 to call.\"" "search"
> +       "41\[ \t\]+comment \"A routine for foo2 to call.\"" "search"
> 
>  # See if `f' prints the right source file.
>  gdb_test "f" ".*asmsrc2\[.\]s:8.*" "f in foo2"
> @@ -206,11 +209,11 @@ gdb_test "n" "12\[        \]*.*foo3" "n in foo
>  # doesn't fall off the stack.
> 
>  gdb_test "bt 10" \
> -       "\#0.*foo2.*asmsrc2\[.\]s:12.*\#1.*main.*asmsrc1\[.\]s:33(.*\#2.*start\[^\r\n\]*)?" \
> +       "\#0.*foo2.*asmsrc2\[.\]s:12.*\#1.*main.*asmsrc1\[.\]s:34(.*\#2.*start\[^\r\n\]*)?" \
>         "bt ALL in foo2"
> 
>  # See if a capped `bt' prints the right source files.
> -gdb_test "bt 2" "\#0.*foo2.*asmsrc2\[.\]s:12.*\#1.*main.*asmsrc1\[.\]s:33.*" "bt 2 in foo2"
> +gdb_test "bt 2" "\#0.*foo2.*asmsrc2\[.\]s:12.*\#1.*main.*asmsrc1\[.\]s:34.*" "bt 2 in foo2"
> 
>  # Step into another subroutine which lives back in the first source file.
>  gdb_test "s" "" "s 2"
> @@ -219,7 +222,7 @@ gdb_test "s" "" "s 2"
>  gdb_test "n" "" "n 2"
> 
>  # Now see if a capped `bt' is correct.
> -gdb_test "bt 3" "\#0.*foo3.*asmsrc1\[.\]s:44.*\#1.*foo2.*asmsrc2\[.\]s:12.*\#2.*main.*asmsrc1\[.\]s:33.*" "bt 3 in foo3"
> +gdb_test "bt 3" "\#0.*foo3.*asmsrc1\[.\]s:46.*\#1.*foo2.*asmsrc2\[.\]s:12.*\#2.*main.*asmsrc1\[.\]s:34.*" "bt 3 in foo3"
> 
>  # Try 'info source' from asmsrc1.s
>  gdb_test "info source" \
> @@ -276,8 +279,8 @@ gdb_test "info line" \
>  gdb_test "next" "17\[ \t\]+gdbasm_leave" "next over foo3"
> 
>  # Try 'return' from foo2
> -gdb_test "return" "\#0  main .*37\[ \t\]+gdbasm_exit0" "return from foo2" \
> -       "Make selected stack frame return now\?.*" "y"
> +gdb_test "return" "\#0  main .*38\[ \t\]+gdbasm_exit0" "return from foo2" \
> +       "Make (foo2|selected stack frame) return now\?.*" "y"
> 
>  # See if we can look at a global variable
>  gdb_test "print globalvar" ".* = 11" "look at global variable"
> Index: testsuite/gdb.asm/asmsrc1.s
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/asmsrc1.s,v
> retrieving revision 1.4
> diff -u -p -r1.4 asmsrc1.s
> --- testsuite/gdb.asm/asmsrc1.s 4 Dec 2001 19:45:57 -0000       1.4
> +++ testsuite/gdb.asm/asmsrc1.s 12 Oct 2002 19:32:06 -0000
> @@ -9,19 +9,20 @@ comment "asm-source.exp."
>  comment        "This file is not linked with crt0."
>  comment        "Provide very simplistic equivalent."
> 
> +
>         .global _start
> -_start:
> +gdbasm_declare _start
>         gdbasm_startup
>         gdbasm_call main
>         gdbasm_exit0
> -
> +       gdbasm_end _start
> 
>  comment "main routine for assembly source debugging test"
>  comment "This particular testcase uses macros in <arch>.inc to achieve"
>  comment "machine independence."
> 
>         .global main
> -main:
> +gdbasm_declare main
>         gdbasm_enter
> 
>  comment "Call a macro that consists of several lines of assembler code."
> @@ -35,23 +36,27 @@ comment "Call a subroutine in another fi
>  comment "All done."
> 
>         gdbasm_exit0
> +       gdbasm_end main
> 
>  comment "A routine for foo2 to call."
> 
>         .global foo3
> -foo3:
> +gdbasm_declare foo3
>         gdbasm_enter
>         gdbasm_leave
> +       gdbasm_end foo3
> 
>         .global exit
> -exit:
> +gdbasm_declare exit
>         gdbasm_exit0
> +       gdbasm_end exit
> 
>  comment "A static function"
> 
> -foostatic:
> +gdbasm_declare foostatic
>         gdbasm_enter
>         gdbasm_leave
> +       gdbasm_end foostatic
> 
>  comment "A global variable"
> 
> Index: testsuite/gdb.asm/asmsrc2.s
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/asmsrc2.s,v
> retrieving revision 1.3
> diff -u -p -r1.3 asmsrc2.s
> --- testsuite/gdb.asm/asmsrc2.s 4 Dec 2001 19:45:57 -0000       1.3
> +++ testsuite/gdb.asm/asmsrc2.s 12 Oct 2002 19:32:06 -0000
> @@ -4,7 +4,7 @@
>  comment "Second file in assembly source debugging testcase."
> 
>         .global foo2
> -foo2:
> +gdbasm_declare foo2
>         gdbasm_enter
> 
>  comment "Call someplace else (several times)."
> @@ -15,3 +15,4 @@ comment "Call someplace else (several ti
>  comment "All done, return."
> 
>         gdbasm_leave
> +       gdbasm_end foo2
> Index: testsuite/gdb.asm/common.inc
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/common.inc,v
> retrieving revision 1.2
> diff -u -p -r1.2 common.inc
> --- testsuite/gdb.asm/common.inc        4 Dec 2001 19:45:57 -0000       1.2
> +++ testsuite/gdb.asm/common.inc        12 Oct 2002 19:32:06 -0000
> @@ -14,6 +14,15 @@
>         .word \value
>         .endm
> 
> +       comment "Declare a subroutine"
> +       .macro gdbasm_declare name
> +\name:
> +       .endm
> +
> +       comment "End a subroutine"
> +       .macro gdbasm_end name
> +       .endm
> +
>  comment "arch.inc is responsible for defining the following macros:"
>  comment "enter - subroutine prologue"
>  comment "leave - subroutine epilogue"
> @@ -23,6 +32,5 @@ comment "exit0 - exit (0)"
> 
>  comment "arch.inc may also override the default definitions of:"
>  comment "datavar - define a data variable"
> -
> -comment "macros to label a subroutine may also eventually be needed"
> -comment "i.e. .global foo\nfoo:\n"
> +comment "declare - declare the start of a subroutine"
> +comment "end - end a subroutine"
> Index: testsuite/gdb.asm/mips.inc
> ===================================================================
> RCS file: testsuite/gdb.asm/mips.inc
> diff -N testsuite/gdb.asm/mips.inc
> --- /dev/null   1 Jan 1970 00:00:00 -0000
> +++ testsuite/gdb.asm/mips.inc  12 Oct 2002 19:32:06 -0000
> @@ -0,0 +1,64 @@
> +       comment "subroutine declare"
> +       .macro gdbasm_declare name
> +       .align  2
> +       .ent    \name
> +       .type   \name,@function
> +\name:
> +       .endm
> +
> +       comment "subroutine prologue"
> +       .macro gdbasm_enter
> +       .frame  $fp, 32, $31
> +       .mask   0xd0000000,-4
> +       .set    noreorder
> +       .cpload $25
> +       .set    reorder
> +       subu    $sp, $sp, 32
> +       .cprestore 16
> +       sw      $31, 28($sp)
> +       sw      $fp, 24($sp)
> +       sw      $28, 20($sp)
> +       move    $fp, $sp
> +       .endm
> +
> +       comment "subroutine epilogue"
> +       .macro gdbasm_leave
> +       lw      $31, 28($sp)
> +       lw      $fp, 24($sp)
> +       .set    noreorder
> +       .set    nomacro
> +       j       $31
> +       addu    $sp, $sp, 32
> +       .set    macro
> +       .set    reorder
> +       .endm
> +
> +       comment "subroutine end"
> +       .macro gdbasm_end name
> +       .end    \name
> +       .endm
> +
> +       .macro gdbasm_call subr
> +       la      $25, \subr
> +       jal     $31, $25
> +       .endm
> +
> +       .macro gdbasm_several_nops
> +       nop
> +       nop
> +       nop
> +       nop
> +       .endm
> +
> +       comment "exit (0)"
> +       .macro gdbasm_exit0
> +       comment "Don't know how to exit, but this will certainly halt..."
> +       lw      $2, 0($0)
> +       .endm
> +
> +       comment "crt0 startup"
> +       .macro gdbasm_startup
> +       .global __start
> +__start:
> +       move    $fp, $sp
> +       .endm


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]