From a8958849c4e86363003ed25c2bf1e7685fd7bf36 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 29 Apr 2004 18:05:31 +0000 Subject: [PATCH] * i386-prologue.exp: Add testcase for jump instruction as first instruction of the real code. * i386-prologue.c (jump_at_beginning): New function. --- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.arch/i386-prologue.c | 18 ++++++++++++++++++ gdb/testsuite/gdb.arch/i386-prologue.exp | 13 +++++++++++++ 3 files changed, 37 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 16308ff8aa8..40a0cf268ed 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2004-04-27 Jerome Guitton + + * i386-prologue.exp: Add testcase for jump instruction as first + instruction of the real code. + * i386-prologue.c (jump_at_beginning): New function. + 2004-04-28 Mark Kettenis * gdb.base/call-sc.exp: Remove patterns to KFAIL PR gdb/1624 on diff --git a/gdb/testsuite/gdb.arch/i386-prologue.c b/gdb/testsuite/gdb.arch/i386-prologue.c index 4c92a9c83e5..33fc1dbefb2 100644 --- a/gdb/testsuite/gdb.arch/i386-prologue.c +++ b/gdb/testsuite/gdb.arch/i386-prologue.c @@ -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; } @@ -35,3 +37,19 @@ asm(".text\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"); diff --git a/gdb/testsuite/gdb.arch/i386-prologue.exp b/gdb/testsuite/gdb.arch/i386-prologue.exp index f1c1e72425a..ea04b535e5d 100644 --- a/gdb/testsuite/gdb.arch/i386-prologue.exp +++ b/gdb/testsuite/gdb.arch/i386-prologue.exp @@ -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)" \ + ".*:.*jmp.*" \ + "check jump_at_beginning prologue end" + } + default { + fail "set breakpoint in jump_at_beginning" + } +} -- 2.30.2