aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2006-12-31 14:51:57 +0000
committerJoel Brobecker <brobecker@gnat.com>2006-12-31 14:51:57 +0000
commit5eefc2b7e01f71483663188a9554670e6c4ac5a3 (patch)
tree3072dc45f6db392eb0733436f59b6502e23f3cac /gdb
parentade521568314d0bb2874844e251e77d17e281396 (diff)
downloadgdb-5eefc2b7e01f71483663188a9554670e6c4ac5a3.zip
gdb-5eefc2b7e01f71483663188a9554670e6c4ac5a3.tar.gz
gdb-5eefc2b7e01f71483663188a9554670e6c4ac5a3.tar.bz2
* gdb.arch/i386-prologue.c (stack_align_ecx): Renamed from stack_align.
(stack_align_edx): New function. (stack_align_eax): New function. (main): Add calls to stack_align_edx and stack_align_eax. * gdb.arch/i386-prologue.exp: Replace stack_align with stack_align_ecx. Add testing for the cases where the register used during a stack realignment is edx. Same for eax.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog10
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue.c41
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue.exp78
3 files changed, 116 insertions, 13 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4003556..5973bba 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2006-12-31 Joel Brobecker <brobecker@adacore.com>
+
+ * gdb.arch/i386-prologue.c (stack_align_ecx): Renamed from stack_align.
+ (stack_align_edx): New function.
+ (stack_align_eax): New function.
+ (main): Add calls to stack_align_edx and stack_align_eax.
+ * gdb.arch/i386-prologue.exp: Replace stack_align with stack_align_ecx.
+ Add testing for the cases where the register used during a stack
+ realignment is edx. Same for eax.
+
2006-12-30 Pedro Alves <pedro_alves@portugalmail.pt>
* lib/gdb.exp: Don't pass -fpic to gcc on Cygwin, MinGW
diff --git a/gdb/testsuite/gdb.arch/i386-prologue.c b/gdb/testsuite/gdb.arch/i386-prologue.c
index 1ce8b68..9f05337 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue.c
+++ b/gdb/testsuite/gdb.arch/i386-prologue.c
@@ -34,7 +34,9 @@ int
main (void)
{
standard ();
- stack_align ();
+ stack_align_ecx ();
+ stack_align_edx ();
+ stack_align_eax ();
gdb1253 ();
gdb1718 ();
gdb1338 ();
@@ -114,7 +116,7 @@ asm(".text\n"
asm(".text\n"
" .align 8\n"
- SYMBOL (stack_align) ":\n"
+ SYMBOL (stack_align_ecx) ":\n"
" leal 4(%esp), %ecx\n"
" andl $-16, %esp\n"
" pushl -4(%ecx)\n"
@@ -128,3 +130,38 @@ asm(".text\n"
" popl %ebp\n"
" leal -4(%ecx), %esp\n"
" ret\n");
+
+asm(".text\n"
+ " .align 8\n"
+ SYMBOL (stack_align_edx) ":\n"
+ " leal 4(%esp), %edx\n"
+ " andl $-16, %esp\n"
+ " pushl -4(%edx)\n"
+ " pushl %ebp\n"
+ " movl %esp, %ebp\n"
+ " pushl %edi\n"
+ " pushl %ecx\n"
+ " int $0x03\n"
+ " popl %ecx\n"
+ " popl %edi\n"
+ " popl %ebp\n"
+ " leal -4(%edx), %esp\n"
+ " ret\n");
+
+asm(".text\n"
+ " .align 8\n"
+ SYMBOL (stack_align_eax) ":\n"
+ " leal 4(%esp), %eax\n"
+ " andl $-16, %esp\n"
+ " pushl -4(%eax)\n"
+ " pushl %ebp\n"
+ " movl %esp, %ebp\n"
+ " pushl %edi\n"
+ " pushl %ecx\n"
+ " int $0x03\n"
+ " popl %ecx\n"
+ " popl %edi\n"
+ " popl %ebp\n"
+ " leal -4(%eax), %esp\n"
+ " ret\n");
+
diff --git a/gdb/testsuite/gdb.arch/i386-prologue.exp b/gdb/testsuite/gdb.arch/i386-prologue.exp
index a001a91..acfaf33 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue.exp
@@ -95,32 +95,88 @@ gdb_test "info frame" \
"saved registers in standard"
-# Testcase from breakpoints/2080.
+# Testcase from breakpoints/2080 (when %ecx is used)
-gdb_test "break *(stack_align + 7)" \
+gdb_test "break *(stack_align_ecx + 7)" \
"Breakpoint \[0-9\]* at $hex"
gdb_test "continue" \
- "Breakpoint \[0-9\]*.*stack_align.*" \
- "continue to stack_align + 7"
+ "Breakpoint \[0-9\]*.*stack_align_ecx.*" \
+ "continue to stack_align_ecx + 7"
gdb_test "backtrace 10" \
- "#0\[ \t\]*$hex in stack_align.*\r\n#1\[ \t\]*$hex in main.*" \
- "first backtrace in stack_align"
+ "#0\[ \t\]*$hex in stack_align_ecx.*\r\n#1\[ \t\]*$hex in main.*" \
+ "first backtrace in stack_align_ecx"
gdb_test "continue" \
"Program received signal SIGTRAP.*" \
- "continue in stack_align"
+ "continue in stack_align_ecx"
-skip_breakpoint stack_align
+skip_breakpoint stack_align_ecx
gdb_test "backtrace 10" \
- "#0\[ \t\]*$hex in stack_align.*\r\n#1\[ \t\]*$hex in main.*" \
- "second backtrace in stack_align"
+ "#0\[ \t\]*$hex in stack_align_ecx.*\r\n#1\[ \t\]*$hex in main.*" \
+ "second backtrace in stack_align_ecx"
gdb_test "info frame" \
".*Saved registers:.*ecx at.*ebp at.*edi at.*eip at.*" \
- "saved registers in stack_align"
+ "saved registers in stack_align_ecx"
+
+
+# Testcase from breakpoints/2080 (when %edx is used)
+
+gdb_test "break *(stack_align_edx + 7)" \
+ "Breakpoint \[0-9\]* at $hex"
+
+gdb_test "continue" \
+ "Breakpoint \[0-9\]*.*stack_align_edx.*" \
+ "continue to stack_align_edx + 7"
+
+gdb_test "backtrace 10" \
+ "#0\[ \t\]*$hex in stack_align_edx.*\r\n#1\[ \t\]*$hex in main.*" \
+ "first backtrace in stack_align_edx"
+
+gdb_test "continue" \
+ "Program received signal SIGTRAP.*" \
+ "continue in stack_align_edx"
+
+skip_breakpoint stack_align_edx
+
+gdb_test "backtrace 10" \
+ "#0\[ \t\]*$hex in stack_align_edx.*\r\n#1\[ \t\]*$hex in main.*" \
+ "second backtrace in stack_align_edx"
+
+gdb_test "info frame" \
+ ".*Saved registers:.*ecx at.*ebp at.*edi at.*eip at.*" \
+ "saved registers in stack_align_edx"
+
+
+# Testcase from breakpoints/2080 (when %eax is used)
+
+gdb_test "break *(stack_align_eax + 7)" \
+ "Breakpoint \[0-9\]* at $hex"
+
+gdb_test "continue" \
+ "Breakpoint \[0-9\]*.*stack_align_eax.*" \
+ "continue to stack_align_eax + 7"
+
+gdb_test "backtrace 10" \
+ "#0\[ \t\]*$hex in stack_align_eax.*\r\n#1\[ \t\]*$hex in main.*" \
+ "first backtrace in stack_align_eax"
+
+gdb_test "continue" \
+ "Program received signal SIGTRAP.*" \
+ "continue in stack_align_eax"
+
+skip_breakpoint stack_align_eax
+
+gdb_test "backtrace 10" \
+ "#0\[ \t\]*$hex in stack_align_eax.*\r\n#1\[ \t\]*$hex in main.*" \
+ "second backtrace in stack_align_eax"
+
+gdb_test "info frame" \
+ ".*Saved registers:.*ecx at.*ebp at.*edi at.*eip at.*" \
+ "saved registers in stack_align_eax"
# Testcase from symtab/1253.