From: Yao Qi <yao@codesourcery.com>
To: "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Recognize branch instruction on MIPS in gdb.trace/entry-values.exp
Date: Sun, 04 Jan 2015 08:42:00 -0000 [thread overview]
Message-ID: <87r3vbuecf.fsf@codesourcery.com> (raw)
In-Reply-To: <alpine.DEB.1.10.1412301401280.19155@tp.orcam.me.uk> (Maciej W. Rozycki's message of "Tue, 30 Dec 2014 14:17:17 +0000")
"Maciej W. Rozycki" <macro@codesourcery.com> writes:
>> I'll update the pattern to {jalrc|(?:jal|bal)[^\r\n]+\r\n}
>
> I think {jalrc|[jb]al[^\r\n]+\r\n} will be a little bit more efficient,
> but please make sure too that the right-hand side branch does not swallow
> `jalrc' with its following instruction by greedy matching:
>
> "An RE consisting of two or more branches connected by the | operator
> prefers longest match."
>
> (from the TCL Reference Manual) -- so I think you'll have to modify your
> regexp further yet.
OK, I'll update the pattern to avoid this...
>
>> >> All tests in entry-values.exp are PASS.
>> >
>> > Which target and ABI(s) did you ran your testing on? Please try at least
>> > these: o32/MIPS, o32/MIPS16, o32/microMIPS, n64 on a Linux and a
>> > bare-metal target each; testing o32/MIPS16 with the `-mflip-mips16' GCC
>> > option too will be appreciated. These combinations should trigger some
>> > (although not all) of the other possible instructions.
>>
>> To avoid of misunderstanding, let me map them to the following concrete gcc
>> options (I don't find -mabi=o32 nor -mabi=n64 in
>> https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html),
>>
>> -mabi=32
>> -mabi=32 -mips16
>> -mabi=32 -mips16 -mflip-mips16
>> -mabi=32 -mmicromips
>> -mabi=64 on both linux and bare-metal target
>>
>> are they what you want?
>
> Yes, except I meant both Linux and bare-metal across all the variations,
> not n64 only (missing comma after `n64' in my original sentence). Here
> n64 matters as it covers PIC calling sequences.
I did the tests with the following options on both bare metal and linux targets,
-mabi=64
-mabi=32
-mabi=32 -mips16
-mabi=32 -mmicromips
and test this on bare metal target only,
-mabi=32 -mips16 -mflip-mips16
instructions bal jal jals and jalx are generated in these combinations.
--
Yao (齐尧)
gdb/testsuite:
2015-01-04 Yao Qi <yao@codesourcery.com>
* gdb.trace/entry-values.exp: Set call_insn for MIPS target.
---
gdb/testsuite/gdb.trace/entry-values.exp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index 6bb0514..50e9636 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -43,6 +43,19 @@ if { [istarget "arm*-*-*"] || [istarget "aarch64*-*-*"] } {
set call_insn "brasl"
} elseif { [istarget "powerpc*-*-*"] } {
set call_insn "bl"
+} elseif { [istarget "mips*-*-*"] } {
+ # Skip the delay slot after jump or branch instruction if it has.
+ #
+ # JUMP (or BRANCH) foo
+ # insn1
+ # insn2
+ #
+ # All the jump or branch instructions except jalrc (jal, jals, jalx,
+ # jalr, jalrs, bal, bals) have the delay slot, so program goes to
+ # insn2 when it returns from foo. If it is jalrc, set
+ # RETURNED_FROM_FOO to insn1, otherwise set RETURNED_FROM_FOO to
+ # insn2.
+ set call_insn {jalrc|[jb]al[sxr]*[ \t][^\r\n]+\r\n}
} else {
set call_insn "call"
}
--
1.9.3
next prev parent reply other threads:[~2015-01-04 8:42 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 [this message]
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
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=87r3vbuecf.fsf@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=macro@codesourcery.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).