public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug breakpoints/12703] New: Different function breakpoints are set at same pc address.
@ 2011-04-26  3:22 terry.guo at arm dot com
  2011-04-26  3:33 ` [Bug breakpoints/12703] " terry.guo at arm dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: terry.guo at arm dot com @ 2011-04-26  3:22 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12703

           Summary: Different function breakpoints are set at same pc
                    address.
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: terry.guo@arm.com
            Target: ARM EABI


Created attachment 5686
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5686
Test case for this bug.

I built a tool chain for ARM EABI from the recent code in trunk. When I try to
set breakpoints for two different functions, I saw GDB set the two breakpoints
at the same PC.

terguo01@terry-pc01:~/work/gdb-bp-issue$ arm-none-eabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc
COLLECT_LTO_WRAPPER=/home/terguo01/tmp/install/bin/../libexec/gcc/arm-none-eabi/4.7.0/lto-wrapper
Target: arm-none-eabi
Configured with: /home/hudson/workspace/UpstreamDailyBuild/combined/configure
--prefix=/home/hudson/workspace/UpstreamDailyBuild/install
--enable-checking=release --disable-gdbtk --disable-werror --disable-tui
--disable-rda --disable-sid --disable-utils --disable-lto
--target=arm-none-eabi
--with-headers=/home/hudson/workspace/UpstreamDailyBuild/combined/newlib/libc/include
--with-newlib --disable-libmudflap --enable-languages=c,c++
Thread model: single
gcc version 4.7.0 20110424 (experimental) (GCC) 

terguo01@terry-pc01:~/work/gdb-bp-issue$ arm-none-eabi-gcc -mthumb -march=armv7
-mfix-cortex-m3-ldrd -Os -ffunction-sections -fdata-sections -MD -std=c99 -Wall
-pedantic bp.c

terguo01@terry-pc01:~/work/gdb-bp-issue$ arm-none-eabi-gdb a.out 
GNU gdb (GDB) 7.3.50.20110424-cvs
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/terguo01/work/gdb-bp-issue/a.out...done.
(gdb) b fault_isr 
Breakpoint 1 at 0x8174
(gdb) b reset_isr 
Note: breakpoint 1 also set at pc 0x8174.
Breakpoint 2 at 0x8174

The output of objdump are:

00008160 <fault_isr>:
    8160:    e7fe          b.n    8160 <fault_isr>
    ...

00008164 <reset_isr>:
    8164:    4a05          ldr    r2, [pc, #20]    ; (817c <reset_isr+0x18>)
    8166:    4b06          ldr    r3, [pc, #24]    ; (8180 <reset_isr+0x1c>)
    8168:    4906          ldr    r1, [pc, #24]    ; (8184 <reset_isr+0x20>)
    816a:    e003          b.n    8174 <reset_isr+0x10>
    816c:    f852 0b04     ldr.w    r0, [r2], #4
    8170:    f843 0b04     str.w    r0, [r3], #4
    8174:    428b          cmp    r3, r1
    8176:    d3f9          bcc.n    816c <reset_isr+0x8>
    8178:    e7fe          b.n    8178 <reset_isr+0x14>
    817a:    bf00          nop
    817c:    00012420     .word    0x00012420
    8180:    00012424     .word    0x00012424
    8184:    00012320     .word    0x00012320

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/12703] Different function breakpoints are set at same pc address.
  2011-04-26  3:22 [Bug breakpoints/12703] New: Different function breakpoints are set at same pc address terry.guo at arm dot com
@ 2011-04-26  3:33 ` terry.guo at arm dot com
  2011-04-26  3:34 ` terry.guo at arm dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: terry.guo at arm dot com @ 2011-04-26  3:33 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12703

--- Comment #1 from Terry Guo <terry.guo at arm dot com> 2011-04-26 03:33:02 UTC ---
Created attachment 5687
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5687
Patch to fix this issue.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/12703] Different function breakpoints are set at same pc address.
  2011-04-26  3:22 [Bug breakpoints/12703] New: Different function breakpoints are set at same pc address terry.guo at arm dot com
  2011-04-26  3:33 ` [Bug breakpoints/12703] " terry.guo at arm dot com
@ 2011-04-26  3:34 ` terry.guo at arm dot com
  2011-05-06  4:17 ` qiyao at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: terry.guo at arm dot com @ 2011-04-26  3:34 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12703

--- Comment #2 from Terry Guo <terry.guo at arm dot com> 2011-04-26 03:34:24 UTC ---
(In reply to comment #1)
> Created attachment 5687 [details]
> Patch to fix this issue.

I looked into the function arm_skip_prologue which uses limit_pc to indicate
the range of prologue. If it fails to get an acute pc boundary, it will use
pc+64 as limit_pc. For my case, the pc+64 exceeds the body of function
fault_isr and reaches the prologue of following function reset_isr. This
mechanism cause GDB to  set two different function points at the same pc
address.

I come up with attached patch to ensure the limit_pc shouldn't exceed the body
of current functions. It fixes this issue.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/12703] Different function breakpoints are set at same pc address.
  2011-04-26  3:22 [Bug breakpoints/12703] New: Different function breakpoints are set at same pc address terry.guo at arm dot com
  2011-04-26  3:33 ` [Bug breakpoints/12703] " terry.guo at arm dot com
  2011-04-26  3:34 ` terry.guo at arm dot com
@ 2011-05-06  4:17 ` qiyao at gcc dot gnu.org
  2011-10-13  8:17 ` cvs-commit at gcc dot gnu.org
  2011-10-13  8:24 ` qiyao at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: qiyao at gcc dot gnu.org @ 2011-05-06  4:17 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12703

Yao Qi <qiyao at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qiyao at gcc dot gnu.org

--- Comment #3 from Yao Qi <qiyao at gcc dot gnu.org> 2011-05-06 04:17:03 UTC ---

> 
> I looked into the function arm_skip_prologue which uses limit_pc to indicate
> the range of prologue. If it fails to get an acute pc boundary, it will use
> pc+64 as limit_pc. For my case, the pc+64 exceeds the body of function
> fault_isr and reaches the prologue of following function reset_isr. This
> mechanism cause GDB to  set two different function points at the same pc
> address.

This fix works, however, IMO, the root cause is that thumb_analyze_prologue is
unable to compute/analyze such prologue in your case.

> 
> I come up with attached patch to ensure the limit_pc shouldn't exceed the body
> of current functions. It fixes this issue.

Please send your patch to gcc-patches@, then maintainers can review/approve it.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/12703] Different function breakpoints are set at same pc address.
  2011-04-26  3:22 [Bug breakpoints/12703] New: Different function breakpoints are set at same pc address terry.guo at arm dot com
                   ` (2 preceding siblings ...)
  2011-05-06  4:17 ` qiyao at gcc dot gnu.org
@ 2011-10-13  8:17 ` cvs-commit at gcc dot gnu.org
  2011-10-13  8:24 ` qiyao at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2011-10-13  8:17 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12703

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2011-10-13 08:16:58 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    qiyao@sourceware.org    2011-10-13 08:16:49

Modified files:
    gdb            : ChangeLog arm-tdep.c 

Log message:
    PR gdb/12703
    * arm-tdep.c (thumb_analyze_prologue): Call thumb_insn_size to check
    whether insn is a 32-bit Thumb-2 instruction.
    (thumb_in_function_epilogue_p): Likewise.
    (thumb_get_next_pc_raw): Likewise.
    (arm_breakpoint_from_pc): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.13428&r2=1.13429
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/arm-tdep.c.diff?cvsroot=src&r1=1.351&r2=1.352

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug breakpoints/12703] Different function breakpoints are set at same pc address.
  2011-04-26  3:22 [Bug breakpoints/12703] New: Different function breakpoints are set at same pc address terry.guo at arm dot com
                   ` (3 preceding siblings ...)
  2011-10-13  8:17 ` cvs-commit at gcc dot gnu.org
@ 2011-10-13  8:24 ` qiyao at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: qiyao at gcc dot gnu.org @ 2011-10-13  8:24 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=12703

Yao Qi <qiyao at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
         AssignedTo|unassigned at sourceware    |qiyao at gcc dot gnu.org
                   |dot org                     |

--- Comment #5 from Yao Qi <qiyao at gcc dot gnu.org> 2011-10-13 08:24:20 UTC ---
Fixed.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-13  8:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-26  3:22 [Bug breakpoints/12703] New: Different function breakpoints are set at same pc address terry.guo at arm dot com
2011-04-26  3:33 ` [Bug breakpoints/12703] " terry.guo at arm dot com
2011-04-26  3:34 ` terry.guo at arm dot com
2011-05-06  4:17 ` qiyao at gcc dot gnu.org
2011-10-13  8:17 ` cvs-commit at gcc dot gnu.org
2011-10-13  8:24 ` qiyao at gcc dot gnu.org

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).