This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] New test for i386 prologue scan
- From: Mark Kettenis <kettenis at chello dot nl>
- To: guitton at act-europe dot fr
- Cc: gdb-patches at sources dot redhat dot com
- Date: Thu, 29 Apr 2004 20:05:34 +0200 (CEST)
- Subject: Re: [RFA] New test for i386 prologue scan
- References: <20040427180734.GA7639@act-europe.fr>
Date: Tue, 27 Apr 2004 20:07:34 +0200
From: Jerome Guitton <guitton@act-europe.fr>
Thanks, I checked it in after tweaking the indentation a bit.
Related to this patch (not approved yet):
http://sources.redhat.com/ml/gdb-patches/2004-04/msg00432.html
Tested on i686-linux. OK to apply?
Index: testsuite/ChangeLog
from Jerome Guitton <guitton@gnat.com>
* i386-prologue.exp: Add testcase for jump instruction as first
instruction of the real code.
* i386-prologue.c (jump_at_beginning): New function.
Index: testsuite/gdb.arch/i386-prologue.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-prologue.c,v
retrieving revision 1.2
diff -u -p -r1.2 i386-prologue.c
--- testsuite/gdb.arch/i386-prologue.c 17 Aug 2003 23:18:31 -0000 1.2
+++ testsuite/gdb.arch/i386-prologue.c 29 Apr 2004 18:02:58 -0000
@@ -1,11 +1,13 @@
void gdb1253 (void);
void gdb1338 (void);
+void jump_at_beginning (void);
int
main (void)
{
gdb1253 ();
gdb1338 ();
+ jump_at_beginning ();
return 0;
}
@@ -34,4 +36,20 @@ asm(".text\n"
" popl %ebx\n"
" popl %esi\n"
" popl %edi\n"
+ " ret\n");
+
+/* The purpose of this function is to verify that, during prologue
+ skip, GDB does not follow a jump at the beginnning of the "real"
+ code. */
+
+asm(".text\n"
+ " .align 8\n"
+ "jump_at_beginning:\n"
+ " pushl %ebp\n"
+ " movl %esp,%ebp\n"
+ " jmp .gdbjump\n"
+ " nop\n"
+ ".gdbjump:\n"
+ " movl %ebp,%esp\n"
+ " popl %ebp\n"
" ret\n");
Index: testsuite/gdb.arch/i386-prologue.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/i386-prologue.exp,v
retrieving revision 1.3
diff -u -p -r1.3 i386-prologue.exp
--- testsuite/gdb.arch/i386-prologue.exp 7 Sep 2003 16:38:00 -0000 1.3
+++ testsuite/gdb.arch/i386-prologue.exp 29 Apr 2004 18:02:58 -0000
@@ -76,3 +76,16 @@ gdb_test "backtrace 10" \
gdb_test "info frame" \
".*Saved registers:.*ebx at.*esi at.*edi at.*eip at.*" \
"saved registers in gdb1338"
+
+# Testcase jump_at_beginning.
+gdb_test_multiple "break jump_at_beginning" \
+ "set breakpoint in jump_at_beginning" {
+ -re "Breakpoint \[0-9\]* at ($hex).*$gdb_prompt $" {
+ gdb_test "x/i $expect_out(1,string)" \
+ ".*<jump_at_beginning.*>:.*jmp.*" \
+ "check jump_at_beginning prologue end"
+ }
+ default {
+ fail "set breakpoint in jump_at_beginning"
+ }
+}