Bug 832240

Summary: breakpoint at numerical address corrupts other breakpoints
Product: [Fedora] Fedora Reporter: John Reiser <jreiser>
Component: gdbAssignee: Jan Kratochvil <jan.kratochvil>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: gbenson, jan.kratochvil, patrickm, pmuldoon, sergiodj
Target Milestone: ---   
Target Release: ---   
Hardware: powerpc   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 14:17:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Reiser 2012-06-15 00:18:15 UTC
Description of problem: Setting a breakpoint at a numerical address changes the breakpoint address for each existing breakpoint, thus corrupting the breakpoint table.


Version-Release number of selected component (if applicable):
gdb-7.4.50.20120603-2.fc18.ppc


How reproducible: every time


Steps to Reproduce:
1. Compile the test program
----- bugtest.c
main() { bug(); }
----- bug.S
bug: .globl bug
	nop
L100:
	nop
L200:
	nop
	blr
-----
2. Invoke gdb on the program of step 1.  Plant a breakpoint at the numerical address of L100 and L200:
(gdb) x/i L100
   0x10000438 <L100>:	nop
(gdb) b *$_
Breakpoint 1 at 0x10000438: file bug.S, line 4.
(gdb) x/i L200
   0x1000043c <L200>:	nop
(gdb) b *$_
Breakpoint 2 at 0x1000043c: file bug.S, line 6.
(gdb) info breakpoint
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   0x10000438 bug.S:4
2       breakpoint     keep y   0x1000043c bug.S:6

3. Run the gdb target program.  See which breakpoint is hit, and display all breakpoints:
(gdb) run
Breakpoint 1, L200 () at bug.S:6
6		nop
(gdb) info breakpoint
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   0x1000043c bug.S:6
	breakpoint already hit 1 time
2       breakpoint     keep y   0x1000043c bug.S:6
	breakpoint already hit 1 time
(gdb) x/i $pc
=> 0x1000043c <L200>:	nop

  
Actual results:  Notice that execution stopped first at L200 instead of L100, and that all the breakpoints are at 0x1000043c which is L200.  The address of every breakpoint has been set to the address of the last-entered breakpoint.

Expected results:  Stop first at L100, and with no clobbered breakpoints.


Additional info:

Comment 1 Jan Kratochvil 2012-06-15 02:52:08 UTC
The problem is you used $_ in the breakpoint expression.  GDB remembers it as during some situations it re-evaluates all these stored expressions (breakpoint_re_set).

An improvement to avoid this confusion could be to print a warning if '$_' (or '$') are used in a breakpoint expression.

Comment 2 John Reiser 2012-06-15 14:13:19 UTC
It's a bug that "info breakpoint" does not reveal what breakpoint_re_set will do to the addresses (and conditional guards, or any other part of the specification for the breakpoints.)

It's a bug that there is any confusion between 'eval' and 'quote'.  What's the syntax for distinguishing between the two evaluation modes?

"break *" should use 'eval' mode (the resulting numerical hardware breakpoint address never changes); contrast "break *&L100" with "break &L100" and "break L100".

"break L100" actually puts the breakpoint at 8+L100.  I was using "x/i L100; b *$_" in an effort to get the correct address.

Comment 3 Fedora End Of Life 2013-04-03 15:08:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 4 Fedora End Of Life 2015-01-09 17:11:47 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Fedora End Of Life 2015-02-17 14:17:38 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.