Re: Current version of Venkman?

"7stud" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Message-ID <[email protected]>
Hi,

Thanks for the response.

> Could it be a locals vs. globals issue.
> I don't know how JS does it's variable scoping, but
> may be something to look up.
>

Outside the function, the 'local' scope is the window, which contains all
the
global variables.  See here:

http://www.svendtofte.com/code/learning_venkman/venkmanwindows.php
-------
"All the variables you can find under "scope", represent variables you can
fetch
under the current scope (duh). Variables under "this", are all properties
that
are attached to the current this reference.

At first the list might look mad, but remember, that the list is merely
showing
all the properties of the Window object, which is both the current this
object,
and the current scope. Scroll through the list, and you might recognize
familiar
entries such as document, location and so on.
------


> Also, at line 5 you're not running the function, you're stepping through
> it's definition.
> Maybe globals (or any vars for that matter) don't make sense in
> reading in the definition.
>

Yes, I am aware of that. First, things first though. The value of 'a' should
not
in any way depend on the function being defined or executed.  Why doesn't it
have a value of 1.  I would expect that as soon as I step past line 4 where
'a'
is declared and assigned the value 1, that 'a' would be defined and have a
value
of 1.

> What happens at line 9?
>

Starting at line 4, when I successively click on Step Into, the debugger
moves
to these lines:

4(start)
5
9
4
5

and it is not until the last line in that list that 'a' finally shows a
value of 1.

> What's on the stack?
>

The first time I step to line 5, the 'stack' in the watch I set for 'a'
says:

"@x-jsd:interactive-session:1\n@file:///C:My%20Documents/html/test%20Venkman
.htm:4\n"

There is also a line in the watch for 'a' that says:

message:  'a' is not defined'


> What happens if you insert the line:
>  var b = 7;
> between line 4 & 5.
>

Are you aware that would create two declarations for 'b' in the script? With
this script:

1)  <html>
2)  <head>
3)  <script>
4)  var a = 1;
5)  var b = 7;
6)  function test(a) {
7)    var t = "passed : ";
8)    return t + a;
9)  }
10) var b = test(a);
11) 1document.write("<p>" + b + "</p>");
12) </script>
13) </head>
14) </html>


starting at line 4, when I successively click on Step Into, the debugger
moves
to these lines:

4
5
6
10
4
5

It is not until the last line that 'a' finally shows a value of 1.
Essentially,
nothing changed by adding 'var b = 7'.

> Will have to muck around with your script when I have time.
>

Ok, thanks.  I really can't believe any useful debugger can operate in the
manner I am experiencing.



>
> 7stud wrote:
> > Sheesh! Finally, it works.  I read this newsgroup with IE6, and when I
> > clicked on your link it launched an IE window, so that is why it
wouldn't
> > download.  When I switched to FF1.0, it downloaded fine.
>
> Hmm.
> They should really give users a better error.
> Use it as advertising.... tell them they need to download and run
> Firefox
>
> >
> > However, this whole quest was to see if a newer version of Venkman would
> > work for me, but I am still having trouble understanding the logic of
how
> > Venkman steps through a simple script.  Here is the idiotically
simplistic
> > script I am trying to step through:
> >
> >
> >>3) <script>
> >>4) var a = 1;
> >>5) function test(a) {
> >>6)    var t = "passed : ";
> >>7)    return t + a;
> >>8) }
> >>9) var b = test(a);
> >>10) document.write("<p>" + b + "</p>");
> >>11) </script
> >
> >
> > Here are my steps:
> >
> > 1)Open page with that javascript on it in FF.
> >
> > 2)Set the script as the Evaluation object:
> > Open Windows tab>right click mouse on the file name> Set as Evaluation
> > Object
> >
> > 3) Click Venkman's Stop button.
> >
> > 4)Reload the page with the script, and line 4 is highlighted in yellow
> >
> > 5)Click on Step Into to advance to line 5.
> >  In the local variables list 'a' is void, and if I type 'a' into the
> > Interactive Session window, 'a' is void.
> >
> > How in the heck is that possible???!!
> >
>
> Could it be a locals vs. globals issue.
> I don't know how JS does it's variable scoping, but
> may be something to look up.
>
> Also, at line 5 you're not running the function, you're stepping through
> it's definition.
> Maybe globals (or any vars for that matter) don't make sense in
> reading in the definition.
>
> What happens at line 9?
>
> What's on the stack?
>
> What happens if you insert the line:
>  var b = 7;
> between line 4 & 5.
>
> Will have to muck around with your script when I have time.
>
> Bye
>  -Rob.
>



"Robert North" <[email protected]> wrote in message
news:[email protected]...
> 7stud wrote:
> > Sheesh! Finally, it works.  I read this newsgroup with IE6, and when I
> > clicked on your link it launched an IE window, so that is why it
wouldn't
> > download.  When I switched to FF1.0, it downloaded fine.
>
> Hmm.
> They should really give users a better error.
> Use it as advertising.... tell them they need to download and run
> Firefox ;-)
>
> >
> > However, this whole quest was to see if a newer version of Venkman would
> > work for me, but I am still having trouble understanding the logic of
how
> > Venkman steps through a simple script.  Here is the idiotically
simplistic
> > script I am trying to step through:
> >
> >
> >>3) <script>
> >>4) var a = 1;
> >>5) function test(a) {
> >>6)    var t = "passed : ";
> >>7)    return t + a;
> >>8) }
> >>9) var b = test(a);
> >>10) document.write("<p>" + b + "</p>");
> >>11) </script
> >
> >
> > Here are my steps:
> >
> > 1)Open page with that javascript on it in FF.
> >
> > 2)Set the script as the Evaluation object:
> > Open Windows tab>right click mouse on the file name> Set as Evaluation
> > Object
> >
> > 3) Click Venkman's Stop button.
> >
> > 4)Reload the page with the script, and line 4 is highlighted in yellow
> >
> > 5)Click on Step Into to advance to line 5.
> >  In the local variables list 'a' is void, and if I type 'a' into the
> > Interactive Session window, 'a' is void.
> >
> > How in the heck is that possible???!!
> >
>
> Could it be a locals vs. globals issue.
> I don't know how JS does it's variable scoping, but
> may be something to look up.
>
> Also, at line 5 you're not running the function, you're stepping through
> it's definition.
> Maybe globals (or any vars for that matter) don't make sense in
> reading in the definition.
>
> What happens at line 9?
>
> What's on the stack?
>
> What happens if you insert the line:
> var b = 7;
> between line 4 & 5.
>
> Will have to muck around with your script when I have time.
>
> Bye
> -Rob.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.