public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: asm-source.exp: add powerpc64 support
@ 2010-11-10  7:30 Edjunior Barbosa Machado
  2010-11-10  7:45 ` Mark Kettenis
  2010-11-20  5:34 ` Joel Brobecker
  0 siblings, 2 replies; 11+ messages in thread
From: Edjunior Barbosa Machado @ 2010-11-10  7:30 UTC (permalink / raw)
  To: gdb-patches

Hi,

this patch intents to add powerpc64 support to the asm-source.exp testcase. It
contains a new include file (powerpc64.inc) which defines macros for ppc64 asm.
As some architectures (like ppc64) can have one or more instructions after the
subroutine call, the testcase was modified in order to expect the caller line
again as well as the next line when issuing "finish" or "return" (as mentioned
at http://sourceware.org/ml/gdb/2010-11/msg00032.html).
It also has other minor changes, such as expect '.' prefixing ppc64's symbols
and call 'sys_exit' sequence on gdbasm_exit0 macro for ppc32.

Tested on x86, ppc32 and ppc64.

Is that ok?

Thanks,
--
Edjunior

gdb/testsuite/
2010-11-10  Edjunior Machado  <emachado@br.ibm.com>

 	* asm-source.exp: Add new target "powerpc64"; expect leading `.'
 	on ppc64's symbols; "finish" and "return" commands must accept to
 	show the caller line again as well as the line after.
 	* powerpc64.inc: New file
 	* powerpc.inc: Use 'sys_exit'

---
 gdb/testsuite/gdb.asm/asm-source.exp |   44 ++++++++++++++++++++++---
 gdb/testsuite/gdb.asm/powerpc.inc    |    6 ++--
 gdb/testsuite/gdb.asm/powerpc64.inc  |   57 ++++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+), 9 deletions(-)
 create mode 100644 gdb/testsuite/gdb.asm/powerpc64.inc

diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index ca342bd..9053711 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -101,7 +101,15 @@ switch -glob -- [istarget] {
         set asm-arch mips
     }
     "powerpc*-*" {
-        set asm-arch powerpc
+        if { [is_lp64_target] } {
+            set asm-arch powerpc64
+            set asm-flags "-a64 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+            append link-flags " -m elf64ppc"
+        } else {
+            set asm-arch powerpc
+            set asm-flags "-a32 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+            append link-flags " -m elf32ppc"
+        }
     }
     "sh*-*-*" {
         set asm-arch sh
@@ -362,8 +370,19 @@ gdb_test "info source" \
 	"info source asmsrc1.s"
 
 # Try 'finishing' from foo3
-gdb_test "finish" "Run till exit from.*\[\r\n\]$line_call_foo3_again\[ \t\]+gdbasm_call foo3" \
-	"finish from foo3"
+# Some architectures will have one or more instructions after the
+# call instruction which still is part of the call sequence, so we
+# must be prepared for a "finish" to show us the caller line
+# again as well as the statement after.
+gdb_test_multiple "finish" "finish from foo3" {
+    -re "Run till exit from.*\[\r\n\]$line_call_foo3\[ \t\]+gdbasm_call foo3.*$gdb_prompt $" {
+        pass "finish from foo3"
+        gdb_test "s" ".*" "s after finish"
+    }
+    -re "Run till exit from.*\[\r\n\]$line_call_foo3_again\[ \t\]+gdbasm_call foo3.*$gdb_prompt $" {
+        pass "finish from foo3"
+    }
+}
 
 # Try 'info source' from asmsrc2.s
 gdb_test "info source" \
@@ -400,15 +419,28 @@ gdb_test_multiple "info sources" "info sources" {
 
 # Try 'info line'
 gdb_test "info line" \
-	"Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<foo2+.*> and ends at.*<foo2+.*>." \
+	"Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<\\.?foo2+.*> and ends at.*<\\.?foo2+.*>." \
 	"info line"
 
 # Try 'nexting' over next call to foo3
 gdb_test "next" "$line_foo2_leave\[ \t\]+gdbasm_leave" "next over foo3"
 
 # Try 'return' from foo2
-gdb_test "return" "\#0  main .*$line_main_exit\[ \t\]+gdbasm_exit0" "return from foo2" \
-	"Make (foo2|selected stack frame) return now\?.*" "y"
+# Like "finish", "return" command also can return to the caller
+# line again or the statement after, depending on the architecture.
+gdb_test_multiple "return" "return from foo2" {
+    -re "Make (foo2|selected stack frame) return now\?.*" {
+        send_gdb "y\n"
+        exp_continue
+    }
+    -re "\#0.*main .*$line_call_foo2\[ \t\]+gdbasm_call foo2.*$gdb_prompt $" {
+        pass "return from foo2"
+        gdb_test "s" ".*" "s after return"
+    }
+    -re "\#0.*main .*$line_main_exit\[ \t\]+gdbasm_exit0.*$gdb_prompt $" {
+        pass "return from foo2"
+    }
+}
 
 # Disassemble something, check the output
 proc test_dis { command var } {
diff --git a/gdb/testsuite/gdb.asm/powerpc.inc b/gdb/testsuite/gdb.asm/powerpc.inc
index a0797bf..ab700c2 100644
--- a/gdb/testsuite/gdb.asm/powerpc.inc
+++ b/gdb/testsuite/gdb.asm/powerpc.inc
@@ -29,9 +29,9 @@
 
 	comment "exit (0)"
 	.macro gdbasm_exit0
-	comment "Don't know how to exit, but this will certainly halt..."
-	li	0, 0
-	lwz 	0, 0(0)
+	comment "sys_exit"
+	li	0, 1
+	sc
 	.endm
 
 	comment "crt0 startup"
diff --git a/gdb/testsuite/gdb.asm/powerpc64.inc b/gdb/testsuite/gdb.asm/powerpc64.inc
new file mode 100644
index 0000000..7265c07
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/powerpc64.inc
@@ -0,0 +1,57 @@
+        comment "subroutine declare"
+        .purgem gdbasm_declare
+        .macro gdbasm_declare name
+	.section	".opd","aw"
+\name:
+	.quad .\name, .TOC.@tocbase, 0
+	.section	".text"
+	.type	\name, @function
+.\name:
+        .endm
+
+	comment "subroutine prologue"
+	.macro gdbasm_enter
+	stdu 1, -112(1)
+	mflr 0
+	std 0, 128(1)
+	.endm
+
+	comment "subroutine epilogue"
+	.macro gdbasm_leave
+	ld 0, 128(1)
+	mtlr 0
+	ld 1, 0(1)
+	blr
+	.endm
+
+	.macro gdbasm_call subr
+	bl \subr
+	nop
+	.endm
+
+	.macro gdbasm_several_nops
+	nop
+	nop
+	nop
+	nop
+	.endm
+
+	comment "exit (0)"
+	.macro gdbasm_exit0
+	comment "sys_exit"
+	li	0, 1
+	sc
+	.endm
+
+	comment "crt0 startup"
+	.macro gdbasm_startup
+	.p2align 2
+	.endm
+
+	comment "Declare a data variable"
+	.purgem gdbasm_datavar
+	.macro gdbasm_datavar name value
+	.section	".data"
+\name:
+	.long \value
+	.endm
-- 
1.7.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] testsuite: asm-source.exp: add powerpc64 support
  2010-11-10  7:30 [PATCH] testsuite: asm-source.exp: add powerpc64 support Edjunior Barbosa Machado
@ 2010-11-10  7:45 ` Mark Kettenis
  2010-11-10 13:01   ` Edjunior Barbosa Machado
  2010-11-20  5:34 ` Joel Brobecker
  1 sibling, 1 reply; 11+ messages in thread
From: Mark Kettenis @ 2010-11-10  7:45 UTC (permalink / raw)
  To: emachado; +Cc: gdb-patches

> From: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
> Date: Wed, 10 Nov 2010 05:29:42 -0200
> 
> Hi,
> 
> this patch intents to add powerpc64 support to the asm-source.exp
> testcase. It contains a new include file (powerpc64.inc) which
> defines macros for ppc64 asm.  As some architectures (like ppc64)
> can have one or more instructions after the subroutine call, the
> testcase was modified in order to expect the caller line again as
> well as the next line when issuing "finish" or "return" (as
> mentioned at http://sourceware.org/ml/gdb/2010-11/msg00032.html).
> It also has other minor changes, such as expect '.' prefixing
> ppc64's symbols and call 'sys_exit' sequence on gdbasm_exit0 macro
> for ppc32.
> 
> Tested on x86, ppc32 and ppc64.
> 
> Is that ok?

Why are you making the distinction based on is_lp64_target and not on
the target tuple (powerpc64*-*-* vs. powerpc*-*-*)?

> gdb/testsuite/
> 2010-11-10  Edjunior Machado  <emachado@br.ibm.com>
> 
>  	* asm-source.exp: Add new target "powerpc64"; expect leading `.'
>  	on ppc64's symbols; "finish" and "return" commands must accept to
>  	show the caller line again as well as the line after.
>  	* powerpc64.inc: New file
>  	* powerpc.inc: Use 'sys_exit'
> 
> ---
>  gdb/testsuite/gdb.asm/asm-source.exp |   44 ++++++++++++++++++++++---
>  gdb/testsuite/gdb.asm/powerpc.inc    |    6 ++--
>  gdb/testsuite/gdb.asm/powerpc64.inc  |   57 ++++++++++++++++++++++++++++++++++
>  3 files changed, 98 insertions(+), 9 deletions(-)
>  create mode 100644 gdb/testsuite/gdb.asm/powerpc64.inc
> 
> diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
> index ca342bd..9053711 100644
> --- a/gdb/testsuite/gdb.asm/asm-source.exp
> +++ b/gdb/testsuite/gdb.asm/asm-source.exp
> @@ -101,7 +101,15 @@ switch -glob -- [istarget] {
>          set asm-arch mips
>      }
>      "powerpc*-*" {
> -        set asm-arch powerpc
> +        if { [is_lp64_target] } {
> +            set asm-arch powerpc64
> +            set asm-flags "-a64 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
> +            append link-flags " -m elf64ppc"
> +        } else {
> +            set asm-arch powerpc
> +            set asm-flags "-a32 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
> +            append link-flags " -m elf32ppc"
> +        }
>      }
>      "sh*-*-*" {
>          set asm-arch sh
> @@ -362,8 +370,19 @@ gdb_test "info source" \
>  	"info source asmsrc1.s"
>  
>  # Try 'finishing' from foo3
> -gdb_test "finish" "Run till exit from.*\[\r\n\]$line_call_foo3_again\[ \t\]+gdbasm_call foo3" \
> -	"finish from foo3"
> +# Some architectures will have one or more instructions after the
> +# call instruction which still is part of the call sequence, so we
> +# must be prepared for a "finish" to show us the caller line
> +# again as well as the statement after.
> +gdb_test_multiple "finish" "finish from foo3" {
> +    -re "Run till exit from.*\[\r\n\]$line_call_foo3\[ \t\]+gdbasm_call foo3.*$gdb_prompt $" {
> +        pass "finish from foo3"
> +        gdb_test "s" ".*" "s after finish"
> +    }
> +    -re "Run till exit from.*\[\r\n\]$line_call_foo3_again\[ \t\]+gdbasm_call foo3.*$gdb_prompt $" {
> +        pass "finish from foo3"
> +    }
> +}
>  
>  # Try 'info source' from asmsrc2.s
>  gdb_test "info source" \
> @@ -400,15 +419,28 @@ gdb_test_multiple "info sources" "info sources" {
>  
>  # Try 'info line'
>  gdb_test "info line" \
> -	"Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<foo2+.*> and ends at.*<foo2+.*>." \
> +	"Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<\\.?foo2+.*> and ends at.*<\\.?foo2+.*>." \
>  	"info line"
>  
>  # Try 'nexting' over next call to foo3
>  gdb_test "next" "$line_foo2_leave\[ \t\]+gdbasm_leave" "next over foo3"
>  
>  # Try 'return' from foo2
> -gdb_test "return" "\#0  main .*$line_main_exit\[ \t\]+gdbasm_exit0" "return from foo2" \
> -	"Make (foo2|selected stack frame) return now\?.*" "y"
> +# Like "finish", "return" command also can return to the caller
> +# line again or the statement after, depending on the architecture.
> +gdb_test_multiple "return" "return from foo2" {
> +    -re "Make (foo2|selected stack frame) return now\?.*" {
> +        send_gdb "y\n"
> +        exp_continue
> +    }
> +    -re "\#0.*main .*$line_call_foo2\[ \t\]+gdbasm_call foo2.*$gdb_prompt $" {
> +        pass "return from foo2"
> +        gdb_test "s" ".*" "s after return"
> +    }
> +    -re "\#0.*main .*$line_main_exit\[ \t\]+gdbasm_exit0.*$gdb_prompt $" {
> +        pass "return from foo2"
> +    }
> +}
>  
>  # Disassemble something, check the output
>  proc test_dis { command var } {
> diff --git a/gdb/testsuite/gdb.asm/powerpc.inc b/gdb/testsuite/gdb.asm/powerpc.inc
> index a0797bf..ab700c2 100644
> --- a/gdb/testsuite/gdb.asm/powerpc.inc
> +++ b/gdb/testsuite/gdb.asm/powerpc.inc
> @@ -29,9 +29,9 @@
>  
>  	comment "exit (0)"
>  	.macro gdbasm_exit0
> -	comment "Don't know how to exit, but this will certainly halt..."
> -	li	0, 0
> -	lwz 	0, 0(0)
> +	comment "sys_exit"
> +	li	0, 1
> +	sc
>  	.endm
>  
>  	comment "crt0 startup"
> diff --git a/gdb/testsuite/gdb.asm/powerpc64.inc b/gdb/testsuite/gdb.asm/powerpc64.inc
> new file mode 100644
> index 0000000..7265c07
> --- /dev/null
> +++ b/gdb/testsuite/gdb.asm/powerpc64.inc
> @@ -0,0 +1,57 @@
> +        comment "subroutine declare"
> +        .purgem gdbasm_declare
> +        .macro gdbasm_declare name
> +	.section	".opd","aw"
> +\name:
> +	.quad .\name, .TOC.@tocbase, 0
> +	.section	".text"
> +	.type	\name, @function
> +.\name:
> +        .endm
> +
> +	comment "subroutine prologue"
> +	.macro gdbasm_enter
> +	stdu 1, -112(1)
> +	mflr 0
> +	std 0, 128(1)
> +	.endm
> +
> +	comment "subroutine epilogue"
> +	.macro gdbasm_leave
> +	ld 0, 128(1)
> +	mtlr 0
> +	ld 1, 0(1)
> +	blr
> +	.endm
> +
> +	.macro gdbasm_call subr
> +	bl \subr
> +	nop
> +	.endm
> +
> +	.macro gdbasm_several_nops
> +	nop
> +	nop
> +	nop
> +	nop
> +	.endm
> +
> +	comment "exit (0)"
> +	.macro gdbasm_exit0
> +	comment "sys_exit"
> +	li	0, 1
> +	sc
> +	.endm
> +
> +	comment "crt0 startup"
> +	.macro gdbasm_startup
> +	.p2align 2
> +	.endm
> +
> +	comment "Declare a data variable"
> +	.purgem gdbasm_datavar
> +	.macro gdbasm_datavar name value
> +	.section	".data"
> +\name:
> +	.long \value
> +	.endm
> -- 
> 1.7.1
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] testsuite: asm-source.exp: add powerpc64 support
  2010-11-10  7:45 ` Mark Kettenis
@ 2010-11-10 13:01   ` Edjunior Barbosa Machado
  0 siblings, 0 replies; 11+ messages in thread
From: Edjunior Barbosa Machado @ 2010-11-10 13:01 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Hi

On 11/10/2010 05:45 AM, Mark Kettenis wrote:
>> From: Edjunior Barbosa Machado<emachado@linux.vnet.ibm.com>
>> Date: Wed, 10 Nov 2010 05:29:42 -0200
>>
>> Hi,
>>
>> this patch intents to add powerpc64 support to the asm-source.exp
>> testcase. It contains a new include file (powerpc64.inc) which
>> defines macros for ppc64 asm.  As some architectures (like ppc64)
>> can have one or more instructions after the subroutine call, the
>> testcase was modified in order to expect the caller line again as
>> well as the next line when issuing "finish" or "return" (as
>> mentioned at http://sourceware.org/ml/gdb/2010-11/msg00032.html).
>> It also has other minor changes, such as expect '.' prefixing
>> ppc64's symbols and call 'sys_exit' sequence on gdbasm_exit0 macro
>> for ppc32.
>>
>> Tested on x86, ppc32 and ppc64.
>>
>> Is that ok?
>
> Why are you making the distinction based on is_lp64_target and not on
> the target tuple (powerpc64*-*-* vs. powerpc*-*-*)?

is_lp64_target is necessary for when you running a 32-bit environment distro (such as RHEL5 and SLES10) in a ppc64 machine (it can not be distinguish by only checking the target tuple).

Thanks,
-- 
Edjunior

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] testsuite: asm-source.exp: add powerpc64 support
  2010-11-10  7:30 [PATCH] testsuite: asm-source.exp: add powerpc64 support Edjunior Barbosa Machado
  2010-11-10  7:45 ` Mark Kettenis
@ 2010-11-20  5:34 ` Joel Brobecker
  2010-11-23 18:44   ` Edjunior Barbosa Machado
  2010-11-23 18:46   ` [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc Edjunior Barbosa Machado
  1 sibling, 2 replies; 11+ messages in thread
From: Joel Brobecker @ 2010-11-20  5:34 UTC (permalink / raw)
  To: Edjunior Barbosa Machado; +Cc: gdb-patches

> gdb/testsuite/
> 2010-11-10  Edjunior Machado  <emachado@br.ibm.com>
> 
>  	* asm-source.exp: Add new target "powerpc64"; expect leading `.'
>  	on ppc64's symbols; "finish" and "return" commands must accept to
>  	show the caller line again as well as the line after.
>  	* powerpc64.inc: New file
>  	* powerpc.inc: Use 'sys_exit'

This looks fine to me.

The powerpc.inc change could have been submitted separately, I think...

-- 
Joel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] testsuite: asm-source.exp: add powerpc64 support
  2010-11-20  5:34 ` Joel Brobecker
@ 2010-11-23 18:44   ` Edjunior Barbosa Machado
  2010-11-23 20:01     ` Joel Brobecker
  2010-11-24 18:20     ` Thiago Jung Bauermann
  2010-11-23 18:46   ` [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc Edjunior Barbosa Machado
  1 sibling, 2 replies; 11+ messages in thread
From: Edjunior Barbosa Machado @ 2010-11-23 18:44 UTC (permalink / raw)
  To: gdb-patches; +Cc: brobecker

Thanks Joel for the feedback. I'm sending the first part of the patch
related to the powerpc64 support on the asm-source.exp testcase.

Thanks,
--
Edjunior

gdb/testsuite/
2010-11-23  Edjunior Machado  <emachado@br.ibm.com>

 	* asm-source.exp: Add new target "powerpc64"; expect leading `.'
 	on ppc64's symbols; "finish" and "return" commands must accept to
 	show the caller line again as well as the line after.
 	* powerpc64.inc: New file

---
 gdb/testsuite/gdb.asm/asm-source.exp |   44 ++++++++++++++++++++++---
 gdb/testsuite/gdb.asm/powerpc64.inc  |   57 ++++++++++++++++++++++++++++++++++
 2 files changed, 95 insertions(+), 6 deletions(-)
 create mode 100644 gdb/testsuite/gdb.asm/powerpc64.inc

diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index ca342bd..9053711 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -101,7 +101,15 @@ switch -glob -- [istarget] {
         set asm-arch mips
     }
     "powerpc*-*" {
-        set asm-arch powerpc
+        if { [is_lp64_target] } {
+            set asm-arch powerpc64
+            set asm-flags "-a64 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+            append link-flags " -m elf64ppc"
+        } else {
+            set asm-arch powerpc
+            set asm-flags "-a32 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+            append link-flags " -m elf32ppc"
+        }
     }
     "sh*-*-*" {
         set asm-arch sh
@@ -362,8 +370,19 @@ gdb_test "info source" \
 	"info source asmsrc1.s"
 
 # Try 'finishing' from foo3
-gdb_test "finish" "Run till exit from.*\[\r\n\]$line_call_foo3_again\[ \t\]+gdbasm_call foo3" \
-	"finish from foo3"
+# Some architectures will have one or more instructions after the
+# call instruction which still is part of the call sequence, so we
+# must be prepared for a "finish" to show us the caller line
+# again as well as the statement after.
+gdb_test_multiple "finish" "finish from foo3" {
+    -re "Run till exit from.*\[\r\n\]$line_call_foo3\[ \t\]+gdbasm_call foo3.*$gdb_prompt $" {
+        pass "finish from foo3"
+        gdb_test "s" ".*" "s after finish"
+    }
+    -re "Run till exit from.*\[\r\n\]$line_call_foo3_again\[ \t\]+gdbasm_call foo3.*$gdb_prompt $" {
+        pass "finish from foo3"
+    }
+}
 
 # Try 'info source' from asmsrc2.s
 gdb_test "info source" \
@@ -400,15 +419,28 @@ gdb_test_multiple "info sources" "info sources" {
 
 # Try 'info line'
 gdb_test "info line" \
-	"Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<foo2+.*> and ends at.*<foo2+.*>." \
+	"Line $line_call_foo3_again of.*asmsrc2.s.*starts at.*<\\.?foo2+.*> and ends at.*<\\.?foo2+.*>." \
 	"info line"
 
 # Try 'nexting' over next call to foo3
 gdb_test "next" "$line_foo2_leave\[ \t\]+gdbasm_leave" "next over foo3"
 
 # Try 'return' from foo2
-gdb_test "return" "\#0  main .*$line_main_exit\[ \t\]+gdbasm_exit0" "return from foo2" \
-	"Make (foo2|selected stack frame) return now\?.*" "y"
+# Like "finish", "return" command also can return to the caller
+# line again or the statement after, depending on the architecture.
+gdb_test_multiple "return" "return from foo2" {
+    -re "Make (foo2|selected stack frame) return now\?.*" {
+        send_gdb "y\n"
+        exp_continue
+    }
+    -re "\#0.*main .*$line_call_foo2\[ \t\]+gdbasm_call foo2.*$gdb_prompt $" {
+        pass "return from foo2"
+        gdb_test "s" ".*" "s after return"
+    }
+    -re "\#0.*main .*$line_main_exit\[ \t\]+gdbasm_exit0.*$gdb_prompt $" {
+        pass "return from foo2"
+    }
+}
 
 # Disassemble something, check the output
 proc test_dis { command var } {
diff --git a/gdb/testsuite/gdb.asm/powerpc64.inc b/gdb/testsuite/gdb.asm/powerpc64.inc
new file mode 100644
index 0000000..7265c07
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/powerpc64.inc
@@ -0,0 +1,57 @@
+        comment "subroutine declare"
+        .purgem gdbasm_declare
+        .macro gdbasm_declare name
+	.section	".opd","aw"
+\name:
+	.quad .\name, .TOC.@tocbase, 0
+	.section	".text"
+	.type	\name, @function
+.\name:
+        .endm
+
+	comment "subroutine prologue"
+	.macro gdbasm_enter
+	stdu 1, -112(1)
+	mflr 0
+	std 0, 128(1)
+	.endm
+
+	comment "subroutine epilogue"
+	.macro gdbasm_leave
+	ld 0, 128(1)
+	mtlr 0
+	ld 1, 0(1)
+	blr
+	.endm
+
+	.macro gdbasm_call subr
+	bl \subr
+	nop
+	.endm
+
+	.macro gdbasm_several_nops
+	nop
+	nop
+	nop
+	nop
+	.endm
+
+	comment "exit (0)"
+	.macro gdbasm_exit0
+	comment "sys_exit"
+	li	0, 1
+	sc
+	.endm
+
+	comment "crt0 startup"
+	.macro gdbasm_startup
+	.p2align 2
+	.endm
+
+	comment "Declare a data variable"
+	.purgem gdbasm_datavar
+	.macro gdbasm_datavar name value
+	.section	".data"
+\name:
+	.long \value
+	.endm
-- 
1.7.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc
  2010-11-20  5:34 ` Joel Brobecker
  2010-11-23 18:44   ` Edjunior Barbosa Machado
@ 2010-11-23 18:46   ` Edjunior Barbosa Machado
  2010-11-24 18:22     ` Thiago Jung Bauermann
  2010-11-25 11:23     ` Mark Kettenis
  1 sibling, 2 replies; 11+ messages in thread
From: Edjunior Barbosa Machado @ 2010-11-23 18:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: brobecker

With this patch, ppc32 uses 'sys_exit' sequence on gdbasm_exit0 macro.

Thanks,
--
Edjunior

gdb/testsuite/
2010-11-23  Edjunior Machado  <emachado@br.ibm.com>

         * powerpc.inc: Use 'sys_exit' on gdbasm_exit0 macro.

---
 gdb/testsuite/gdb.asm/powerpc.inc |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.asm/powerpc.inc b/gdb/testsuite/gdb.asm/powerpc.inc
index a0797bf..ab700c2 100644
--- a/gdb/testsuite/gdb.asm/powerpc.inc
+++ b/gdb/testsuite/gdb.asm/powerpc.inc
@@ -29,9 +29,9 @@
 
 	comment "exit (0)"
 	.macro gdbasm_exit0
-	comment "Don't know how to exit, but this will certainly halt..."
-	li	0, 0
-	lwz 	0, 0(0)
+	comment "sys_exit"
+	li	0, 1
+	sc
 	.endm
 
 	comment "crt0 startup"
-- 
1.7.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] testsuite: asm-source.exp: add powerpc64 support
  2010-11-23 18:44   ` Edjunior Barbosa Machado
@ 2010-11-23 20:01     ` Joel Brobecker
  2010-11-24 18:20     ` Thiago Jung Bauermann
  1 sibling, 0 replies; 11+ messages in thread
From: Joel Brobecker @ 2010-11-23 20:01 UTC (permalink / raw)
  To: Edjunior Barbosa Machado; +Cc: gdb-patches

> Thanks Joel for the feedback. I'm sending the first part of the patch
> related to the powerpc64 support on the asm-source.exp testcase.

Just in case this wasn't clear in my first message: Changes are
approved. Thanks for splitting them in two patches :-)...

-- 
Joel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] testsuite: asm-source.exp: add powerpc64 support
  2010-11-23 18:44   ` Edjunior Barbosa Machado
  2010-11-23 20:01     ` Joel Brobecker
@ 2010-11-24 18:20     ` Thiago Jung Bauermann
  1 sibling, 0 replies; 11+ messages in thread
From: Thiago Jung Bauermann @ 2010-11-24 18:20 UTC (permalink / raw)
  To: Edjunior Barbosa Machado; +Cc: gdb-patches, brobecker

Hi,

On Tue, 2010-11-23 at 16:42 -0200, Edjunior Barbosa Machado wrote:
> Thanks Joel for the feedback. I'm sending the first part of the patch
> related to the powerpc64 support on the asm-source.exp testcase.

I just committed this patch.
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc
  2010-11-23 18:46   ` [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc Edjunior Barbosa Machado
@ 2010-11-24 18:22     ` Thiago Jung Bauermann
  2010-11-25 11:23     ` Mark Kettenis
  1 sibling, 0 replies; 11+ messages in thread
From: Thiago Jung Bauermann @ 2010-11-24 18:22 UTC (permalink / raw)
  To: Edjunior Barbosa Machado; +Cc: gdb-patches, brobecker

Hi,

On Tue, 2010-11-23 at 16:45 -0200, Edjunior Barbosa Machado wrote:
> With this patch, ppc32 uses 'sys_exit' sequence on gdbasm_exit0 macro.

I just committed this patch too.
-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc
  2010-11-23 18:46   ` [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc Edjunior Barbosa Machado
  2010-11-24 18:22     ` Thiago Jung Bauermann
@ 2010-11-25 11:23     ` Mark Kettenis
  2010-11-25 13:56       ` Edjunior Barbosa Machado
  1 sibling, 1 reply; 11+ messages in thread
From: Mark Kettenis @ 2010-11-25 11:23 UTC (permalink / raw)
  To: emachado; +Cc: gdb-patches, brobecker

> From: Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
> Date: Tue, 23 Nov 2010 16:45:39 -0200
> 
> With this patch, ppc32 uses 'sys_exit' sequence on gdbasm_exit0 macro.

Isn't this somewhat OS-dependent?  It'll work on OpenBSD since the
exit system call is indeed #1 there, but there is no guarantee that's
true on all OSes isn't it?

And doesn't this pass random garbage as the argument to the exit system call?

> gdb/testsuite/
> 2010-11-23  Edjunior Machado  <emachado@br.ibm.com>
> 
>          * powerpc.inc: Use 'sys_exit' on gdbasm_exit0 macro.
> 
> diff --git a/gdb/testsuite/gdb.asm/powerpc.inc b/gdb/testsuite/gdb.asm/powerpc.inc
> index a0797bf..ab700c2 100644
> --- a/gdb/testsuite/gdb.asm/powerpc.inc
> +++ b/gdb/testsuite/gdb.asm/powerpc.inc
> @@ -29,9 +29,9 @@
>  
>  	comment "exit (0)"
>  	.macro gdbasm_exit0
> -	comment "Don't know how to exit, but this will certainly halt..."
> -	li	0, 0
> -	lwz 	0, 0(0)
> +	comment "sys_exit"
> +	li	0, 1
> +	sc
>  	.endm
>  
>  	comment "crt0 startup"
> -- 
> 1.7.1
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc
  2010-11-25 11:23     ` Mark Kettenis
@ 2010-11-25 13:56       ` Edjunior Barbosa Machado
  0 siblings, 0 replies; 11+ messages in thread
From: Edjunior Barbosa Machado @ 2010-11-25 13:56 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches, brobecker



On 11/25/2010 09:23 AM, Mark Kettenis wrote:
>> From: Edjunior Barbosa Machado<emachado@linux.vnet.ibm.com>
>> Date: Tue, 23 Nov 2010 16:45:39 -0200
>>
>> With this patch, ppc32 uses 'sys_exit' sequence on gdbasm_exit0 macro.
>
> Isn't this somewhat OS-dependent?  It'll work on OpenBSD since the
> exit system call is indeed #1 there, but there is no guarantee that's
> true on all OSes isn't it?

Good point, you might be right, unfortunately I didn't have the chance to test it against other OSes than linux.

>
> And doesn't this pass random garbage as the argument to the exit system call?

Right, I think we could add 'li 3,0' before calling 'sc', but I'm not sure if this is a problem since we're not checking the exit code on the testcase.

Thanks,
-- 
Edjunior
>
>> gdb/testsuite/
>> 2010-11-23  Edjunior Machado<emachado@br.ibm.com>
>>
>>           * powerpc.inc: Use 'sys_exit' on gdbasm_exit0 macro.
>>
>> diff --git a/gdb/testsuite/gdb.asm/powerpc.inc b/gdb/testsuite/gdb.asm/powerpc.inc
>> index a0797bf..ab700c2 100644
>> --- a/gdb/testsuite/gdb.asm/powerpc.inc
>> +++ b/gdb/testsuite/gdb.asm/powerpc.inc
>> @@ -29,9 +29,9 @@
>>
>>   	comment "exit (0)"
>>   	.macro gdbasm_exit0
>> -	comment "Don't know how to exit, but this will certainly halt..."
>> -	li	0, 0
>> -	lwz 	0, 0(0)
>> +	comment "sys_exit"
>> +	li	0, 1
>> +	sc
>>   	.endm
>>
>>   	comment "crt0 startup"
>> --
>> 1.7.1
>>
>>
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-11-25 13:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-10  7:30 [PATCH] testsuite: asm-source.exp: add powerpc64 support Edjunior Barbosa Machado
2010-11-10  7:45 ` Mark Kettenis
2010-11-10 13:01   ` Edjunior Barbosa Machado
2010-11-20  5:34 ` Joel Brobecker
2010-11-23 18:44   ` Edjunior Barbosa Machado
2010-11-23 20:01     ` Joel Brobecker
2010-11-24 18:20     ` Thiago Jung Bauermann
2010-11-23 18:46   ` [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc Edjunior Barbosa Machado
2010-11-24 18:22     ` Thiago Jung Bauermann
2010-11-25 11:23     ` Mark Kettenis
2010-11-25 13:56       ` Edjunior Barbosa Machado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).