From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Tweak gdb.trace/tfile.c for thumb mode
Date: Thu, 10 Jul 2014 01:30:00 -0000 [thread overview]
Message-ID: <53BDEBD8.5030201@codesourcery.com> (raw)
In-Reply-To: <53BD5710.5040105@redhat.com>
On 07/09/2014 10:52 PM, Pedro Alves wrote:
> #if defined(__thumb__) || defined(__thumb2__)
> /* Although Thumb functions are two-byte aligned, function
> pointers have the Thumb bit set. Clear it. */
> func_addr &= ~1;
> #endif
>
> (This bit is widely known as the "Thumb bit", so call it that,
> and remove a few "the"'s that sound odd to me, and say
> "two-byte aligned".)
I often associate "Thumb bit" with the bit in CPSR. Look into
arm-tdep.c and arm-linux-tdep.c, "Thumb bit" is used for both cases
(LSB of function address and the bit in CPSR). It shouldn't cause any
confusion.
Patch is updated as you suggested and pushed in.
--
Yao (é½å°§)
gdb/testsuite:
2014-07-10 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.c (write_basic_trace_file)
[__thumb__||__thumb2__]: Clear the Thumb bit of the function
address written to trace file.
---
gdb/testsuite/ChangeLog | 6 ++++++
gdb/testsuite/gdb.trace/tfile.c | 11 +++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 19e6232..2278496 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2014-07-10 Yao Qi <yao@codesourcery.com>
+
+ * gdb.trace/tfile.c (write_basic_trace_file)
+ [__thumb__||__thumb2__]: Clear the Thumb bit of the function
+ address written to trace file.
+
2014-07-09 Pedro Alves <palves@redhat.com>
* gdb.base/attach-wait-input.exp: New file.
diff --git a/gdb/testsuite/gdb.trace/tfile.c b/gdb/testsuite/gdb.trace/tfile.c
index ac65901..bc25b80 100644
--- a/gdb/testsuite/gdb.trace/tfile.c
+++ b/gdb/testsuite/gdb.trace/tfile.c
@@ -91,6 +91,7 @@ write_basic_trace_file (void)
{
int fd, int_x;
short short_x;
+ long func_addr;
fd = start_trace_file (TFILE_DIR "tfile-basic.tf");
@@ -109,8 +110,14 @@ write_basic_trace_file (void)
/* Dump tracepoint definitions, in syntax similar to that used
for reconnection uploads. */
/* FIXME need a portable way to print function address in hex */
- snprintf (spbuf, sizeof spbuf, "tp T1:%lx:E:0:0\n",
- (long) &write_basic_trace_file);
+ func_addr = (long) &write_basic_trace_file;
+#if defined(__thumb__) || defined(__thumb2__)
+ /* Although Thumb functions are two-byte aligned, function
+ pointers have the Thumb bit set. Clear it. */
+ func_addr &= ~1;
+#endif
+
+ snprintf (spbuf, sizeof spbuf, "tp T1:%lx:E:0:0\n", func_addr);
write (fd, spbuf, strlen (spbuf));
/* (Note that we would only need actions defined if we wanted to
test tdump.) */
--
1.9.0
next prev parent reply other threads:[~2014-07-10 1:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-30 3:52 Yao Qi
2014-07-09 11:55 ` Yao Qi
2014-07-09 14:52 ` Pedro Alves
2014-07-10 1:30 ` Yao Qi [this message]
2014-07-15 13:20 ` Pedro Alves
2014-07-15 14:16 ` Yao Qi
2014-07-15 14:38 ` Pedro Alves
2014-07-16 2:19 ` Yao Qi
2014-07-16 5:19 ` Yao Qi
2014-07-16 19:02 ` Pedro Alves
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=53BDEBD8.5030201@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@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