|
|
01917d |
commit 2d6f0de676f46ebd8bb7d98a0093aa081e17e94b
|
|
|
01917d |
Author: Yao Qi <yao@codesourcery.com>
|
|
|
01917d |
Date: Mon Jun 30 11:47:51 2014 +0800
|
|
|
01917d |
|
|
|
01917d |
Tweak gdb.trace/tfile.c for thumb mode
|
|
|
01917d |
|
|
|
01917d |
We see the fail below happens on thumb related multi-libs
|
|
|
01917d |
(-mthumb -march={armv4t,armv7-a}),
|
|
|
01917d |
|
|
|
01917d |
target tfile tfile-basic.tf ^M
|
|
|
01917d |
warning: Uploaded tracepoint 1 has no source location, using raw address^M
|
|
|
01917d |
warning: Breakpoint address adjusted from 0x00008959 to 0x00008958.^M
|
|
|
01917d |
Tracepoint 3 at 0x8958: file /scratch/yqi/arm-none-linux-gnueabi/src/gdb-trunk/gdb/testsuite/gdb.trace/tfile.c, line 91.^M
|
|
|
01917d |
Created tracepoint 3 for target's tracepoint 1 at 0x8959.^M
|
|
|
01917d |
warning: Breakpoint address adjusted from 0x00008959 to 0x00008958.^M
|
|
|
01917d |
warning: Breakpoint address adjusted from 0x00008959 to 0x00008958.^M
|
|
|
01917d |
warning: Breakpoint address adjusted from 0x00008959 to 0x00008958.^M
|
|
|
01917d |
(gdb) FAIL: gdb.trace/tfile.exp: complete-command 'target tfile'
|
|
|
01917d |
|
|
|
01917d |
The address of write_basic_trace_file is two-bytes aligned,
|
|
|
01917d |
|
|
|
01917d |
(gdb) p write_basic_trace_file
|
|
|
01917d |
$1 = {void (void)} 0x8958 <write_basic_trace_file>
|
|
|
01917d |
|
|
|
01917d |
but the ld sets the LSB of every reference to the function address
|
|
|
01917d |
(indicating the address is in thumb mode), so "&write_basic_trace_file"
|
|
|
01917d |
in the program becomes 0x8959, which is saved in the trace file. That
|
|
|
01917d |
is why the warnnings are emitted.
|
|
|
01917d |
|
|
|
01917d |
This patch is to clear the LSB of the function address written to trace
|
|
|
01917d |
file in thumb and thumb2 mode. This patch fixes the fail above.
|
|
|
01917d |
|
|
|
01917d |
gdb/testsuite:
|
|
|
01917d |
|
|
|
01917d |
2014-07-10 Yao Qi <yao@codesourcery.com>
|
|
|
01917d |
|
|
|
01917d |
* gdb.trace/tfile.c (write_basic_trace_file)
|
|
|
01917d |
[__thumb__||__thumb2__]: Clear the Thumb bit of the function
|
|
|
01917d |
address written to trace file.
|
|
|
01917d |
|
|
|
01917d |
Index: gdb-7.6.1/gdb/testsuite/gdb.trace/tfile.c
|
|
|
01917d |
===================================================================
|
|
|
01917d |
--- gdb-7.6.1.orig/gdb/testsuite/gdb.trace/tfile.c
|
|
|
01917d |
+++ gdb-7.6.1/gdb/testsuite/gdb.trace/tfile.c
|
|
|
01917d |
@@ -68,6 +68,7 @@ write_basic_trace_file (void)
|
|
|
01917d |
{
|
|
|
01917d |
int fd, int_x;
|
|
|
01917d |
short short_x;
|
|
|
01917d |
+ long func_addr;
|
|
|
01917d |
|
|
|
01917d |
fd = start_trace_file ("basic.tf");
|
|
|
01917d |
|
|
|
01917d |
@@ -86,8 +87,14 @@ write_basic_trace_file (void)
|
|
|
01917d |
/* Dump tracepoint definitions, in syntax similar to that used
|
|
|
01917d |
for reconnection uploads. */
|
|
|
01917d |
/* FIXME need a portable way to print function address in hex */
|
|
|
01917d |
- snprintf (spbuf, sizeof spbuf, "tp T1:%lx:E:0:0\n",
|
|
|
01917d |
- (long) &write_basic_trace_file);
|
|
|
01917d |
+ func_addr = (long) &write_basic_trace_file;
|
|
|
01917d |
+#if defined(__thumb__) || defined(__thumb2__)
|
|
|
01917d |
+ /* Although Thumb functions are two-byte aligned, function
|
|
|
01917d |
+ pointers have the Thumb bit set. Clear it. */
|
|
|
01917d |
+ func_addr &= ~1;
|
|
|
01917d |
+#endif
|
|
|
01917d |
+
|
|
|
01917d |
+ snprintf (spbuf, sizeof spbuf, "tp T1:%lx:E:0:0\n", func_addr);
|
|
|
01917d |
write (fd, spbuf, strlen (spbuf));
|
|
|
01917d |
/* (Note that we would only need actions defined if we wanted to
|
|
|
01917d |
test tdump.) */
|