From: Chen Gang <gang.chen.5i5j@gmail.com>
To: gdb-patches@sourceware.org
Cc: Andreas Schwab <schwab@suse.de>, Joel Brobecker <brobecker@adacore.com>
Subject: [PATCH v2] gdb/hppa-tdep.c: Fix logical working flow typo issue
Date: Wed, 22 Oct 2014 15:39:00 -0000 [thread overview]
Message-ID: <5447CF8A.6020603@gmail.com> (raw)
inst_saves_gr() wants to recognize 'st??' instruction, according to the
code we know it include 'stb' (for store byte), 'stw(m)' (for store
word), and 'std' (for store double word).
They should be in the same format, and have neighbour numbers:
especially, 'stw(m)' need be in the middle of 'stb' and 'std'.
- for ((inst >> 26) != 0x3):
stb: 0x18, or 0x19,
stw: 0x1a, stwm: 0x1b,
std: 0x1c.
- else ((inst >> 26) == 0x3), need check:
stb: 0x08, or 0x09,
stw: 0x0a,
std: 0x0b.
For clearer reason, not combine the logical comparation code together.
2014-10-22 Chen Gang <gang.chen.5i5j@gmail.com>
* hppa-tdep.c (inst_saves_gr): Fix logical working flow typo
issue.
Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
gdb/hppa-tdep.c | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 627f31a..4363ab4 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -1376,16 +1376,35 @@ is_branch (unsigned long inst)
}
/* Return the register number for a GR which is saved by INST or
- zero it INST does not save a GR. */
+ zero it INST does not save a GR.
+
+ inst_saves_gr() wants to recognize 'st??' instruction, it include 'stb' (for
+ store byte), 'stw(m)' (for store word), and 'std' (for store double word).
+
+ They should be in the same format, and have neighbour numbers: especially,
+ 'stw(m)' need be in the middle of 'stb' and 'std'.
+
+ - for ((inst >> 26) != 0x3):
+
+ stb: 0x18, or 0x19,
+ stw: 0x1a, stwm: 0x1b,
+ std: 0x1c.
+
+ - else ((inst >> 26) == 0x3), need check :
+
+ stb: 0x08, or 0x09,
+ stw: 0x0a,
+ std: 0x0b.
+*/
static int
inst_saves_gr (unsigned long inst)
{
- /* Does it look like a stw? */
+ /* Does it look like a stw(m)? */
if ((inst >> 26) == 0x1a || (inst >> 26) == 0x1b
|| (inst >> 26) == 0x1f
- || ((inst >> 26) == 0x1f
- && ((inst >> 6) == 0xa)))
+ || ((inst >> 26) == 0x3
+ && ((inst >> 6) & 0xf) == 0xa))
return hppa_extract_5R_store (inst);
/* Does it look like a std? */
@@ -1394,16 +1413,12 @@ inst_saves_gr (unsigned long inst)
&& ((inst >> 6) & 0xf) == 0xb))
return hppa_extract_5R_store (inst);
- /* Does it look like a stwm? GCC & HPC may use this in prologues. */
- if ((inst >> 26) == 0x1b)
- return hppa_extract_5R_store (inst);
-
/* Does it look like sth or stb? HPC versions 9.0 and later use these
too. */
if ((inst >> 26) == 0x19 || (inst >> 26) == 0x18
|| ((inst >> 26) == 0x3
&& (((inst >> 6) & 0xf) == 0x8
- || (inst >> 6) & 0xf) == 0x9))
+ || ((inst >> 6) & 0xf) == 0x9)))
return hppa_extract_5R_store (inst);
return 0;
--
1.9.3
next reply other threads:[~2014-10-22 15:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-22 15:39 Chen Gang [this message]
2014-10-22 15:41 ` Chen Gang
2014-10-24 22:41 ` Chen Gang
2014-11-23 6:38 ` Joel Brobecker
2014-11-23 13:40 ` Chen Gang
2014-12-07 22:31 ` Chen Gang
2014-12-08 3:15 ` Joel Brobecker
2014-12-08 4:20 ` Chen Gang
2014-12-08 5:08 ` Joel Brobecker
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=5447CF8A.6020603@gmail.com \
--to=gang.chen.5i5j@gmail.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=schwab@suse.de \
/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