Re: Breakpoints in "unrolled loop"



Hans-Bernhard Bröker wrote:

if you select a source statement to set a breakpoint, the debugger has
to select which binary location(s) get a breakpoint.

Not quite true. Somebody has to make that decision, but it doesn't have
to be done by the tool alone. I've seen at least one debugger offer a
complete selection of eligible code addresses in such cases.

This would be fine. Do you remember which debugger did so?

Similar problems can happen even without optimization, too. E.g.
imagine setting a breakpoint on a statement that's actually a call to a
multi-statement inlined function, or function-like macro.

Indeed. Currently, I have to accept to get a breakpoint on the first
statement.

When setting a breakpoint during program execution (e.g. by
background debug mode), I would set a breakpoint at _each_
corresponding location, since I can't know the PC at the time of
breakpoint setting.

Personally I think I'd prefer a tool that sets a breakpoint on the first
copy in this case (assuming that it's really just an unrolled loop) or
generally on the entry point into the unrolled portion.

If there are function calls with long (potential) duration in the
loop, this could delay the breakpoint hit. On the other hand, such
loops shouldn't be unrolled.

Ultimately, source code <-> binary code is an n:m relation. Yes, that
makes it tricky to resolve queries in both directions. But I don't
believe anybody ever promised that writing good debuggers for optimizing
compilers was simple.

No, but I try to forward some information to the supplier to make it
better.

Thanks for your comments!

Oliver
--
Oliver Betz, Muenchen (oliverbetz.de)
.



Relevant Pages

  • Re: loop debugging Compag Visual Fortran Compiler
    ... | facility in Compaq Visual Fortran 6.6.0. ... Suppose I have a simple loop ... | there a way in Compaq Visual Fortran (in the debugger) to watch the ... Select the newly created breakpoint, and in the "expression" edit box ...
    (comp.lang.fortran)
  • Re: [Patch 00/11] Hardware Breakpoint interfaces
    ... legacy ptrace interface. ... to set up a breakpoint a debugger needs to call ptrace ... be best to keep the existing registers in the thread structure. ... It's just a tiny loop. ...
    (Linux-Kernel)
  • Bug in Single Stepping over WHILE(TRUE) in VS2003
    ... VS skips the first statement in a block while ... single-stepping if the loop is WHILE. ... Set a breakpoint on the whileline. ... The debugger highlights t++; ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: debugging multithreaded app
    ... >> i was debugging a multithreaded app, when i stumbled across some weird ... > on encountering the breakpoint? ... If so, why use the hokey busy loop? ... between the functionality in the threads, and the cleanup code. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: (BUG) Inline assembly/breakpoints in lcc
    ... fixing it with high priority. ... If an inline assembly statement immediately follows a for loop ... and you try to set a breakpoint on it, then the breakpoint is hit at each ... The compiler does NOT emit any debug info when using ...
    (comp.lang.c)