Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <kettenis@chello.nl>
To: guitton@act-europe.fr
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA]  New test for i386 prologue scan
Date: Thu, 29 Apr 2004 18:05:00 -0000	[thread overview]
Message-ID: <200404291805.i3TI5YBZ000368@elgar.kettenis.dyndns.org> (raw)
In-Reply-To: <20040427180734.GA7639@act-europe.fr> (message from Jerome Guitton on Tue, 27 Apr 2004 20:07:34 +0200)

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


  reply	other threads:[~2004-04-29 18:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-27 18:07 Jerome Guitton
2004-04-29 18:05 ` Mark Kettenis [this message]
2004-04-29 18:11   ` Jerome Guitton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200404291805.i3TI5YBZ000368@elgar.kettenis.dyndns.org \
    --to=kettenis@chello.nl \
    --cc=gdb-patches@sources.redhat.com \
    --cc=guitton@act-europe.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox