This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Step-by-step debugging with foreach loops

6 replies
Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.

hi,

i have a problem with the debugger (in the eclipse plug-in). in the
following code snippets, it is impossible to go from the line
"rootsC.foreach" to the "val root =" line using step by step
execution. if i perform step-intos i end up in a deep forest of the
foreach implementation, but never really jumps the debugger to the
next line in the sourcecode. the only remedy is now to place a
breakpoint in the "val root=" line and pressing continue until that
breakpoint is hit...

is that normal behaviour?

thanks, -sciss-

val rootsC = roots.elements.counted
rootsC.foreach( rootEntry => {
val root = readNode( rootEntry.id )
if( root.getLevel != stats.treeHeight( rootsC.count )) {
println( "Invalid tree height." )
return false
}
// ...
})

milessabin
Joined: 2008-08-11,
User offline. Last seen 33 weeks 3 days ago.
Re: Step-by-step debugging with foreach loops

On Mon, Jan 12, 2009 at 9:54 PM, Sciss wrote:
> is that normal behaviour?

Sadly at the moment it is ...

Cheers,

Miles

Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: Step-by-step debugging with foreach loops

ok, well... at least there is a workaround. i found two other issues
with the debugger:

- private fields are not shown in the variables tables (no problem
when debugging java programs and an essential tool)
- the context is "hidden" when jumping into functions
e.g. with

MyClass {
var gaga = 33;

def test {
x.foreach( lala => {
println( "schoko" );
}
}
}

if i put a breakpoint on the "println" line, from within there i
cannot see the content of the 'gaga' variable...

ciao, -sciss-

Am 12.01.2009 um 22:59 schrieb Miles Sabin:

> On Mon, Jan 12, 2009 at 9:54 PM, Sciss wrote:
>> is that normal behaviour?
>
> Sadly at the moment it is ...
>
> Cheers,
>
>
> Miles
>

Chris Twiner
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Step-by-step debugging with foreach loops

i don't think they are hidden, but they may be nested under one or
more layers of closure. Try looking for 1,2 etc and outers.

On 1/12/09, Sciss wrote:
> ok, well... at least there is a workaround. i found two other issues with
> the debugger:
>
> - private fields are not shown in the variables tables (no problem when
> debugging java programs and an essential tool)
> - the context is "hidden" when jumping into functions
> e.g. with
>
> MyClass {
> var gaga = 33;
>
> def test {
> x.foreach( lala => {
> println( "schoko" );
> }
> }
> }
>
> if i put a breakpoint on the "println" line, from within there i
> cannot see the content of the 'gaga' variable...
>
>
> ciao, -sciss-
>
>
>
> Am 12.01.2009 um 22:59 schrieb Miles Sabin:
>
>
>
> > On Mon, Jan 12, 2009 at 9:54 PM, Sciss wrote:
> >
> > > is that normal behaviour?
> > >
> >
> > Sadly at the moment it is ...
> >
> > Cheers,
> >
> >
> > Miles
> >
> > --
> > Miles Sabin
> > tel: +44 (0)1273 720 779
> > mobile: +44 (0)7813 944 528
> > skype: milessabin
> >
>
>

Sean McDirmid
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Step-by-step debugging with foreach loops
Exactly. It would be nice if we could configure the debugger to show lexical variables from outer scopes. But even when debugging Java anonymous, I don't think you can see a value from an outer scope (if you could, we could piggy back on that functionality somehow).
Sean

On Tue, Jan 13, 2009 at 6:10 AM, Chris Twiner <chris [dot] twiner [at] gmail [dot] com> wrote:
i don't think they are hidden, but they may be nested under one or
more layers of closure.  Try looking for 1,2 etc and outers.

On 1/12/09, Sciss <contact [at] sciss [dot] de> wrote:
> ok, well... at least there is a workaround. i found two other issues with
> the debugger:
>
>  - private fields are not shown in the variables tables (no problem when
> debugging java programs and an essential tool)
>  - the context is "hidden" when jumping into functions
>         e.g. with
>
>  MyClass {
>         var gaga = 33;
>
>         def test {
>                 x.foreach( lala => {
>                         println( "schoko" );
>                 }
>         }
>  }
>
>         if i put a breakpoint on the "println" line, from within there i
> cannot see the content of the 'gaga' variable...
>
>
>  ciao, -sciss-
>
>
>
>  Am 12.01.2009 um 22:59 schrieb Miles Sabin:
>
>
>
> > On Mon, Jan 12, 2009 at 9:54 PM, Sciss <contact [at] sciss [dot] de> wrote:
> >
> > > is that normal behaviour?
> > >
> >
> > Sadly at the moment it is ...
> >
> > Cheers,
> >
> >
> > Miles
> >
> > --
> > Miles Sabin
> > tel:    +44 (0)1273 720 779
> > mobile: +44 (0)7813 944 528
> > skype:  milessabin
> >
>
>

Sean McDirmid
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Step-by-step debugging with foreach loops
Exactly. It would be nice if we could configure the debugger to show lexical variables from outer scopes. But even when debugging Java anonymous, I don't think you can see a value from an outer scope (if you could, we could piggy back on that functionality somehow).
Sean

On Tue, Jan 13, 2009 at 6:10 AM, Chris Twiner <chris [dot] twiner [at] gmail [dot] com> wrote:
i don't think they are hidden, but they may be nested under one or
more layers of closure.  Try looking for 1,2 etc and outers.

On 1/12/09, Sciss <contact [at] sciss [dot] de> wrote:
> ok, well... at least there is a workaround. i found two other issues with
> the debugger:
>
>  - private fields are not shown in the variables tables (no problem when
> debugging java programs and an essential tool)
>  - the context is "hidden" when jumping into functions
>         e.g. with
>
>  MyClass {
>         var gaga = 33;
>
>         def test {
>                 x.foreach( lala => {
>                         println( "schoko" );
>                 }
>         }
>  }
>
>         if i put a breakpoint on the "println" line, from within there i
> cannot see the content of the 'gaga' variable...
>
>
>  ciao, -sciss-
>
>
>
>  Am 12.01.2009 um 22:59 schrieb Miles Sabin:
>
>
>
> > On Mon, Jan 12, 2009 at 9:54 PM, Sciss <contact [at] sciss [dot] de> wrote:
> >
> > > is that normal behaviour?
> > >
> >
> > Sadly at the moment it is ...
> >
> > Cheers,
> >
> >
> > Miles
> >
> > --
> > Miles Sabin
> > tel:    +44 (0)1273 720 779
> > mobile: +44 (0)7813 944 528
> > skype:  milessabin
> >
>
>

Sciss
Joined: 2008-12-17,
User offline. Last seen 28 weeks 5 days ago.
Re: Step-by-step debugging with foreach loops

ah ok, i see.... if i select in the debug window the line two below
the new "anonfunc" context, i'm just before entering the foreach.
well... that's not very ergonomic, but at least it's possible.

thanks, -sciss-

Am 12.01.2009 um 23:10 schrieb Chris Twiner:

> i don't think they are hidden, but they may be nested under one or
> more layers of closure. Try looking for 1,2 etc and outers.
>
> On 1/12/09, Sciss wrote:
>> ok, well... at least there is a workaround. i found two other
>> issues with
>> the debugger:
>>
>> - private fields are not shown in the variables tables (no
>> problem when
>> debugging java programs and an essential tool)
>> - the context is "hidden" when jumping into functions
>> e.g. with
>>
>> MyClass {
>> var gaga = 33;
>>
>> def test {
>> x.foreach( lala => {
>> println( "schoko" );
>> }
>> }
>> }
>>
>> if i put a breakpoint on the "println" line, from within
>> there i
>> cannot see the content of the 'gaga' variable...
>>
>>
>> ciao, -sciss-
>>
>>
>>
>> Am 12.01.2009 um 22:59 schrieb Miles Sabin:
>>
>>
>>
>>> On Mon, Jan 12, 2009 at 9:54 PM, Sciss wrote:
>>>
>>>> is that normal behaviour?
>>>>
>>>
>>> Sadly at the moment it is ...
>>>
>>> Cheers,
>>>
>>>
>>> Miles
>>>
>>> --
>>> Miles Sabin
>>> tel: +44 (0)1273 720 779
>>> mobile: +44 (0)7813 944 528
>>> skype: milessabin
>>>
>>
>>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland