Bug 5503

Summary: looping program hits infinite breakpoints
Product: frysk Reporter: Andrew Cagney <cagney>
Component: generalAssignee: Tim Moore <timoore>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 2246, 5495    

Description Andrew Cagney 2007-12-17 16:26:41 UTC
Consider:

main()
{
   while(1);
}

and:
  (fhpd) break main
  (fhpd) step
gets infinite reports of the breakpoint main being hit.

this is caused by the breakpoint code not injecting a "breakpoint-hit" event
into the stepping engine.
Comment 1 Tim Moore 2008-01-04 12:00:26 UTC
This function, even without optimization, degenerates to one instruction after
the function prologue: a jump to itself. The address of the breakpoint is this
instruction. For reference, gdb shows the same behavior with optimized and
optimized version of the function.