Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Multiple breakpoints
@ 2008-04-03  8:54 Nick Roberts
  2008-04-03  9:01 ` Andreas Schwab
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Roberts @ 2008-04-03  8:54 UTC (permalink / raw)
  To: gdb


If I set a breakpoint on TRY_CATCH in gdb_evaluate_expression, I get
multiple breakpoints:

  gdb_evaluate_expression (struct expression *exp, struct value **value)
  {
    volatile struct gdb_exception except;

->  TRY_CATCH (except, RETURN_MASK_ERROR)
      {
        *value = evaluate_expression(exp);
      }

    if (except.reason < 0)
      return 0;
    return 1;
  }

where -> shows the breakpoint location.


Is this to be expected?  The assembler looks like this:


    0x081c04a1 <gdb_evaluate_expression+0>:	push   %ebp
    0x081c04a2 <gdb_evaluate_expression+1>:	mov    %esp,%ebp
    0x081c04a4 <gdb_evaluate_expression+3>:	sub    $0x28,%esp
->  0x081c04a7 <gdb_evaluate_expression+6>:	mov    0x83a55a0,%edx
    0x081c04ad <gdb_evaluate_expression+12>:	movl   $0x2,0x8(%esp)
    0x081c04b5 <gdb_evaluate_expression+20>:	lea    -0x10(%ebp),%eax
    0x081c04b8 <gdb_evaluate_expression+23>:	mov    %eax,0x4(%esp)
    0x081c04bc <gdb_evaluate_expression+27>:	mov    %edx,(%esp)
    0x081c04bf <gdb_evaluate_expression+30>:	call   0x814e660 <exce...
    0x081c04c4 <gdb_evaluate_expression+35>:	mov    %eax,-0x4(%ebp)
    0x081c04c7 <gdb_evaluate_expression+38>:	mov    -0x4(%ebp),%eax
    0x081c04ca <gdb_evaluate_expression+41>:	movl   $0x1,0x4(%esp)
    0x081c04d2 <gdb_evaluate_expression+49>:	mov    %eax,(%esp)
    0x081c04d5 <gdb_evaluate_expression+52>:	call   0x8089058 <__si...
    0x081c04da <gdb_evaluate_expression+57>:	jmp    0x81c04f7 <gdb_...
    0x081c04dc <gdb_evaluate_expression+59>:	mov    0x8(%ebp),%eax
    0x081c04df <gdb_evaluate_expression+62>:	mov    %eax,(%esp)
    0x081c04e2 <gdb_evaluate_expression+65>:	call   0x810fc5e <eval...
    0x081c04e7 <gdb_evaluate_expression+70>:	mov    %eax,%edx
    0x081c04e9 <gdb_evaluate_expression+72>:	mov    0xc(%ebp),%eax
    0x081c04ec <gdb_evaluate_expression+75>:	mov    %edx,(%eax)
->  0x081c04ee <gdb_evaluate_expression+77>:	call   0x814e983 <exce...
    0x081c04f3 <gdb_evaluate_expression+82>:	test   %eax,%eax
    0x081c04f5 <gdb_evaluate_expression+84>:	jne    0x81c04dc <gdb_...
    0x081c04f7 <gdb_evaluate_expression+86>:	call   0x814e96f <exce...
    0x081c04fc <gdb_evaluate_expression+91>:	test   %eax,%eax
    0x081c04fe <gdb_evaluate_expression+93>:	jne    0x81c04ee <gdb_...
    0x081c0500 <gdb_evaluate_expression+95>:	mov    -0x10(%ebp),%ea
    0x081c0503 <gdb_evaluate_expression+98>:	test   %eax,%eax
    0x081c0505 <gdb_evaluate_expression+100>:	jns    0x81c0510 <gdb_...
    0x081c0507 <gdb_evaluate_expression+102>:	movl   $0x0,-0x14(%ebp
    0x081c050e <gdb_evaluate_expression+109>:	jmp    0x81c0517 <gdb_...
    0x081c0510 <gdb_evaluate_expression+111>:	movl   $0x1,-0x14(%ebp)
    0x081c0517 <gdb_evaluate_expression+118>:	mov    -0x14(%ebp),%eax
    0x081c051a <gdb_evaluate_expression+121>:	leave  
    0x081c051b <gdb_evaluate_expression+122>:	ret    
    End of assembler dump.


-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

* Re: Multiple breakpoints
  2008-04-03  8:54 Multiple breakpoints Nick Roberts
@ 2008-04-03  9:01 ` Andreas Schwab
  2008-04-03 13:18   ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2008-04-03  9:01 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb

Nick Roberts <nickrob@snap.net.nz> writes:

> If I set a breakpoint on TRY_CATCH in gdb_evaluate_expression, I get
> multiple breakpoints:
>
>   gdb_evaluate_expression (struct expression *exp, struct value **value)
>   {
>     volatile struct gdb_exception except;
>
> ->  TRY_CATCH (except, RETURN_MASK_ERROR)
>       {
>         *value = evaluate_expression(exp);
>       }
>
>     if (except.reason < 0)
>       return 0;
>     return 1;
>   }
>
> where -> shows the breakpoint location.
>
>
> Is this to be expected?  The assembler looks like this:

TRY_CATCH expands to a loop, probably the loop condition has been
duplicated by the compiler.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: Multiple breakpoints
  2008-04-03  9:01 ` Andreas Schwab
@ 2008-04-03 13:18   ` Daniel Jacobowitz
  2008-04-03 13:55     ` Vladimir Prus
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-04-03 13:18 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Nick Roberts, gdb

On Thu, Apr 03, 2008 at 11:01:10AM +0200, Andreas Schwab wrote:
> TRY_CATCH expands to a loop, probably the loop condition has been
> duplicated by the compiler.

I think we try to set only one breakpoint per containing function,
though.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Multiple breakpoints
  2008-04-03 13:18   ` Daniel Jacobowitz
@ 2008-04-03 13:55     ` Vladimir Prus
  2008-04-03 14:07       ` Daniel Jacobowitz
  0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Prus @ 2008-04-03 13:55 UTC (permalink / raw)
  To: gdb

Daniel Jacobowitz wrote:

> On Thu, Apr 03, 2008 at 11:01:10AM +0200, Andreas Schwab wrote:
>> TRY_CATCH expands to a loop, probably the loop condition has been
>> duplicated by the compiler.
> 
> I think we try to set only one breakpoint per containing function,
> though.

Uh-uh, you keep on telling this :-)
Per *block*, not per function.

- Volodya



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

* Re: Multiple breakpoints
  2008-04-03 14:07       ` Daniel Jacobowitz
@ 2008-04-03 14:02         ` Daniel Jacobowitz
  2008-04-03 17:37         ` Michael Snyder
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-04-03 14:02 UTC (permalink / raw)
  To: gdb, gdb

On Thu, Apr 03, 2008 at 05:51:00PM +0400, Vladimir Prus wrote:
> Daniel Jacobowitz wrote:
> 
> > On Thu, Apr 03, 2008 at 11:01:10AM +0200, Andreas Schwab wrote:
> >> TRY_CATCH expands to a loop, probably the loop condition has been
> >> duplicated by the compiler.
> > 
> > I think we try to set only one breakpoint per containing function,
> > though.
> 
> Uh-uh, you keep on telling this :-)
> Per *block*, not per function.

Durn.  Well, I would have thought the parts of a for loop were in the
same block, but I can see GCC deciding otherwise.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Multiple breakpoints
  2008-04-03 13:55     ` Vladimir Prus
@ 2008-04-03 14:07       ` Daniel Jacobowitz
  2008-04-03 14:02         ` Daniel Jacobowitz
  2008-04-03 17:37         ` Michael Snyder
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-04-03 14:07 UTC (permalink / raw)
  To: gdb, gdb

On Thu, Apr 03, 2008 at 05:51:00PM +0400, Vladimir Prus wrote:
> Daniel Jacobowitz wrote:
> 
> > On Thu, Apr 03, 2008 at 11:01:10AM +0200, Andreas Schwab wrote:
> >> TRY_CATCH expands to a loop, probably the loop condition has been
> >> duplicated by the compiler.
> > 
> > I think we try to set only one breakpoint per containing function,
> > though.
> 
> Uh-uh, you keep on telling this :-)
> Per *block*, not per function.

Durn.  Well, I would have thought the parts of a for loop were in the
same block, but I can see GCC deciding otherwise.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Multiple breakpoints
  2008-04-03 14:07       ` Daniel Jacobowitz
  2008-04-03 14:02         ` Daniel Jacobowitz
@ 2008-04-03 17:37         ` Michael Snyder
  2008-04-03 21:36           ` Michael Snyder
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Snyder @ 2008-04-03 17:37 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb, gdb

On Thu, 2008-04-03 at 10:01 -0400, Daniel Jacobowitz wrote:
> On Thu, Apr 03, 2008 at 05:51:00PM +0400, Vladimir Prus wrote:
> > Daniel Jacobowitz wrote:
> > 
> > > On Thu, Apr 03, 2008 at 11:01:10AM +0200, Andreas Schwab wrote:
> > >> TRY_CATCH expands to a loop, probably the loop condition has been
> > >> duplicated by the compiler.
> > > 
> > > I think we try to set only one breakpoint per containing function,
> > > though.
> > 
> > Uh-uh, you keep on telling this :-)
> > Per *block*, not per function.
> 
> Durn.  Well, I would have thought the parts of a for loop were in the
> same block, but I can see GCC deciding otherwise.

The inside parts probably are, but there has to be loop
block, and there has to be something outside the loop
block to decide whether or not to repeat the loop block.

If that made sense...   ;-)



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

* Re: Multiple breakpoints
  2008-04-03 17:37         ` Michael Snyder
@ 2008-04-03 21:36           ` Michael Snyder
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Snyder @ 2008-04-03 21:36 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb, gdb

On Thu, 2008-04-03 at 10:01 -0400, Daniel Jacobowitz wrote:
> On Thu, Apr 03, 2008 at 05:51:00PM +0400, Vladimir Prus wrote:
> > Daniel Jacobowitz wrote:
> > 
> > > On Thu, Apr 03, 2008 at 11:01:10AM +0200, Andreas Schwab wrote:
> > >> TRY_CATCH expands to a loop, probably the loop condition has been
> > >> duplicated by the compiler.
> > > 
> > > I think we try to set only one breakpoint per containing function,
> > > though.
> > 
> > Uh-uh, you keep on telling this :-)
> > Per *block*, not per function.
> 
> Durn.  Well, I would have thought the parts of a for loop were in the
> same block, but I can see GCC deciding otherwise.

The inside parts probably are, but there has to be loop
block, and there has to be something outside the loop
block to decide whether or not to repeat the loop block.

If that made sense...   ;-)



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

end of thread, other threads:[~2008-04-03 17:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-03  8:54 Multiple breakpoints Nick Roberts
2008-04-03  9:01 ` Andreas Schwab
2008-04-03 13:18   ` Daniel Jacobowitz
2008-04-03 13:55     ` Vladimir Prus
2008-04-03 14:07       ` Daniel Jacobowitz
2008-04-03 14:02         ` Daniel Jacobowitz
2008-04-03 17:37         ` Michael Snyder
2008-04-03 21:36           ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox