public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Recognize branch instruction on MIPS in gdb.trace/entry-values.exp
Date: Thu, 08 Jan 2015 03:47:00 -0000	[thread overview]
Message-ID: <87fvbmszkv.fsf@codesourcery.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1501080118280.27020@eddie.linux-mips.org>	(Maciej W. Rozycki's message of "Thu, 8 Jan 2015 01:24:15 +0000")

"Maciej W. Rozycki" <macro@linux-mips.org> writes:

>  Fair enough, the pattern matches more than necessary, but there are no 
> MIPS instructions it would match that it shouldn't, so let's keep your 
> proposal as it is for simplicity.  I have no further concerns, thanks for 
> your work and for getting through this review.

Patch below is what I pushed in.  Thanks for your review, Maciej.

-- 
Yao (齐尧)

Subject: [PATCH] Recognize branch instruction on MIPS in gdb.trace/entry-values.exp

The test entry-values.exp doesn't recognize the call instructions
on MIPS, such as JAL, JALS and etc, so this patch sets call_insn
to match various jump and branch instructions first.

Currently, we assume the next instruction address of call instruction
is the address returned from foo, however it is not correct on MIPS
which has delay slot.  We extend variable call_insn to match one
instruction after jump or branch instruction, so that
$returned_from_foo is correct on MIPS.

All tests in entry-values.exp are PASS.

gdb/testsuite:

2015-01-08  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/entry-values.exp: Set call_insn for MIPS target.

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 862f27c..2154036 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-01-08  Yao Qi  <yao@codesourcery.com>
+
+	* gdb.trace/entry-values.exp: Set call_insn for MIPS target.
+
 2015-01-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	Fix testcase compilation.
diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index e812241..2548e89 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -43,6 +43,20 @@ if { [istarget "arm*-*-*"] || [istarget "aarch64*-*-*"] } {
     set call_insn "brasl"
 } elseif { [istarget "powerpc*-*-*"] } {
     set call_insn "bl"
+} elseif { [istarget "mips*-*-*"] } {
+    # Skip the delay slot after the instruction used to make a call
+    # (which can be a jump or a branch) if it has one.
+    #
+    #  JUMP (or BRANCH) foo
+    #  insn1
+    #  insn2
+    #
+    # Most MIPS instructions used to make calls have a delay slot.
+    # These include JAL, JALS, JALX, JALR, JALRS, BAL and BALS.
+    # In this case the program continues from `insn2' when `foo'
+    # returns.  The only exception is JALRC, in which case execution
+    # resumes from `insn1' instead.
+    set call_insn {jalrc|[jb]al[sxr]*[ \t][^\r\n]+\r\n}
 } else {
     set call_insn "call"
 }

      reply	other threads:[~2015-01-08  3:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29  8:15 Yao Qi
2014-12-29 23:20 ` Maciej W. Rozycki
2014-12-30 12:34   ` Yao Qi
2014-12-30 14:17     ` Maciej W. Rozycki
2015-01-04  8:42       ` Yao Qi
2015-01-07 23:22         ` Maciej W. Rozycki
2015-01-08  1:10           ` Yao Qi
2015-01-08  1:24             ` Maciej W. Rozycki
2015-01-08  3:47               ` Yao Qi [this message]

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=87fvbmszkv.fsf@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@linux-mips.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).