Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA]  New test for i386 prologue scan
@ 2004-04-27 18:07 Jerome Guitton
  2004-04-29 18:05 ` Mark Kettenis
  0 siblings, 1 reply; 3+ messages in thread
From: Jerome Guitton @ 2004-04-27 18:07 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]


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?

-- 
Jerome

[-- Attachment #2: diff.6 --]
[-- Type: text/plain, Size: 2206 bytes --]

2004-04-27  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: 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
--- gdb.arch/i386-prologue.c	17 Aug 2003 23:18:31 -0000	1.2
+++ gdb.arch/i386-prologue.c	27 Apr 2004 17:57:23 -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"
+    "    push   %ebp\n"
+    "    mov    %esp,%ebp\n"
+    "    jmp    .gdbjump\n"
+    "    nop\n"
+    ".gdbjump:\n"
+    "    movl %ebp,%esp\n"
+    "    popl %ebp\n"
     "    ret\n");
Index: 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
--- gdb.arch/i386-prologue.exp	7 Sep 2003 16:38:00 -0000	1.3
+++ gdb.arch/i386-prologue.exp	27 Apr 2004 17:57:23 -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"
+    }
+}

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

* Re: [RFA]  New test for i386 prologue scan
  2004-04-27 18:07 [RFA] New test for i386 prologue scan Jerome Guitton
@ 2004-04-29 18:05 ` Mark Kettenis
  2004-04-29 18:11   ` Jerome Guitton
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Kettenis @ 2004-04-29 18:05 UTC (permalink / raw)
  To: guitton; +Cc: gdb-patches

   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"
+    }
+}


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

* Re: [RFA]  New test for i386 prologue scan
  2004-04-29 18:05 ` Mark Kettenis
@ 2004-04-29 18:11   ` Jerome Guitton
  0 siblings, 0 replies; 3+ messages in thread
From: Jerome Guitton @ 2004-04-29 18:11 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches

Mark Kettenis (kettenis@chello.nl):

> Thanks, I checked it in after tweaking the indentation a bit.

Right, I noticed that emacs has serious problems to indent the
testsuite files correctly... Probably something wrong in my setup.
Thanks for all.

-- 
Jerome


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

end of thread, other threads:[~2004-04-29 18:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 18:07 [RFA] New test for i386 prologue scan Jerome Guitton
2004-04-29 18:05 ` Mark Kettenis
2004-04-29 18:11   ` Jerome Guitton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox