* [RFA] Fix display of entry point address
@ 2010-04-30 16:01 Matthew Gretton-Dann
2010-04-30 16:58 ` Doug Evans
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Gretton-Dann @ 2010-04-30 16:01 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1528 bytes --]
Hi,
Please can someone review the attached patch?
When displaying the entry point to a file (for instance as part of the
output of `info files') gdb prints the raw address it has calculated.
This is misleading on some platforms (notably on ARM when the entry
point is to a Thumb-state function) as the address will contain
additional information.
For example (from the break-entry.exp test):
(gdb) file /home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry
Reading symbols from /home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry...(no debugging symbols found)...done.
(gdb) info files
Symbols from "/home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry".
Local exec file:
`/home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry', file type elf32-littlearm.
Entry point: 0x8171
This is confusing as trying to set a breakpoint at 0x8171 causes a
warning like the following to be displayed:
(gdb) break *0x8171
warning: Breakpoint address adjusted from 0x00008171 to 0x00008170.
Breakpoint 1 at 0x8170
The attached patch changes gdb's behaviour to strip the arch specific
bits off the entry point before displaying it.
A testsuite run shows no regressions, and the gdb.base/break-entry.exp
test now passes in its entirety.
Suggested ChangeLog entry:
2010-04-30 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* exec.c (print_section_info): Display entry point without arch
specific parts.
Thanks,
Matt
--
Matthew Gretton-Dann
Principal Engineer - Tools, PD Software
ARM Limited
[-- Attachment #2: 1004-gdb-entry-point.patch --]
[-- Type: text/x-patch, Size: 1068 bytes --]
Index: gdb/exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.97
diff -u -p -u -p -r1.97 exec.c
--- gdb/exec.c 14 Apr 2010 17:26:11 -0000 1.97
+++ gdb/exec.c 30 Apr 2010 13:05:27 -0000
@@ -669,6 +669,7 @@ print_section_info (struct target_sectio
{
/* gcc-3.4 does not like the initialization in <p == t->sections_end>. */
bfd_vma displacement = 0;
+ bfd_vma entry_point;
for (p = t->sections; p < t->sections_end; p++)
{
@@ -690,9 +691,11 @@ print_section_info (struct target_sectio
warning (_("Cannot find section for the entry point of %s.\n"),
bfd_get_filename (abfd));
+ entry_point = gdbarch_addr_bits_remove (gdbarch,
+ bfd_get_start_address (abfd)
+ + displacement);
printf_filtered (_("\tEntry point: %s\n"),
- paddress (gdbarch, (bfd_get_start_address (abfd)
- + displacement)));
+ paddress (gdbarch, entry_point));
}
for (p = t->sections; p < t->sections_end; p++)
{
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Fix display of entry point address
2010-04-30 16:01 [RFA] Fix display of entry point address Matthew Gretton-Dann
@ 2010-04-30 16:58 ` Doug Evans
2010-04-30 21:14 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Doug Evans @ 2010-04-30 16:58 UTC (permalink / raw)
To: Matthew Gretton-Dann; +Cc: gdb-patches
On Fri, Apr 30, 2010 at 9:01 AM, Matthew Gretton-Dann
<matthew.gretton-dann@arm.com> wrote:
> Hi,
>
> Please can someone review the attached patch?
>
> When displaying the entry point to a file (for instance as part of the
> output of `info files') gdb prints the raw address it has calculated.
> This is misleading on some platforms (notably on ARM when the entry
> point is to a Thumb-state function) as the address will contain
> additional information.
>
> For example (from the break-entry.exp test):
>
> (gdb) file /home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry
> Reading symbols from /home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry...(no debugging symbols found)...done.
> (gdb) info files
> Symbols from "/home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry".
> Local exec file:
> `/home/mgretton/gdb/build/gdb/testsuite/gdb.base/break-entry', file type elf32-littlearm.
> Entry point: 0x8171
>
> This is confusing as trying to set a breakpoint at 0x8171 causes a
> warning like the following to be displayed:
>
> (gdb) break *0x8171
> warning: Breakpoint address adjusted from 0x00008171 to 0x00008170.
> Breakpoint 1 at 0x8170
>
> The attached patch changes gdb's behaviour to strip the arch specific
> bits off the entry point before displaying it.
>
> A testsuite run shows no regressions, and the gdb.base/break-entry.exp
> test now passes in its entirety.
>
> Suggested ChangeLog entry:
>
> 2010-04-30 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
>
> * exec.c (print_section_info): Display entry point without arch
> specific parts.
>
> Thanks,
>
> Matt
>
> --
> Matthew Gretton-Dann
> Principal Engineer - Tools, PD Software
> ARM Limited
>
Hi. I'd give it a day to see if someone else comments, but the patch
is ok to me.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Fix display of entry point address
2010-04-30 16:58 ` Doug Evans
@ 2010-04-30 21:14 ` Joel Brobecker
0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2010-04-30 21:14 UTC (permalink / raw)
To: Doug Evans; +Cc: Matthew Gretton-Dann, gdb-patches
> Hi. I'd give it a day to see if someone else comments, but the patch
> is ok to me.
FWIW: This change makes sense to me too.
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-30 21:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-30 16:01 [RFA] Fix display of entry point address Matthew Gretton-Dann
2010-04-30 16:58 ` Doug Evans
2010-04-30 21:14 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox