Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jerome Guitton <guitton@act-europe.fr>
To: gdb-patches@sources.redhat.com
Subject: [RFA]  New test for i386 prologue scan
Date: Tue, 27 Apr 2004 18:07:00 -0000	[thread overview]
Message-ID: <20040427180734.GA7639@act-europe.fr> (raw)

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

             reply	other threads:[~2004-04-27 18:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-27 18:07 Jerome Guitton [this message]
2004-04-29 18:05 ` Mark Kettenis
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=20040427180734.GA7639@act-europe.fr \
    --to=guitton@act-europe.fr \
    --cc=gdb-patches@sources.redhat.com \
    /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