Trouble Getting Started

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble Getting Started

Steve-296
Hi;

I am having trouble getting started with venkham.   I think I am
missing something conceptually which is causing me to skip a needed
step that other people see by reading between the lines of the
tutorials.

Firefox:      2.0.0.11
Venkahm:  0.9.87.1
OS:           Microsoft Windows XP Professional Service Pack 2

I would like to debug a javascript on a JSP site my company has.
Since any given functioning page is put together dynamically, I went
to the spot where the JS malfunction is and I saved the JSP as a
*.html page.  Lets call it "mypage.html".

1.  I booted up firefox fresh

2.  I booted up venkham

3.  In Venkham I went to File | Open to bring up mypage.html

4.  I scrolled to the definition for  myfieldlostfocusproc()

5.  I tried to set this as a breakpoint, but could only set it as a
future breakpoint.   I understand it is a "top level" funciton and it
hasn't been loaded.

6. I go back to firefox and open the mypage.html in the browser, from
my desktop.   "mypage.html" appears in the loaded scripts window.  The
only node under it is "onblur".

7. In firefox, in mypage.html,  I go to "myfield" type in a value and
leave "myfield" which *SHOULD* fire myfieldlostfocusproc(), and bring
the debugger to that function.

This doesn't happen and this is where I am stuck.

I don't really have a top level function in mypage.html.   It is a
page of html fields, with each field having its own function that gets
activated onblur.

A few times, noodling around, I was able to set a breakpoint on
"onblur", the only node visible under mypage.html in the loaded script
window.   That would take me to the very top of the file and would
finally activate the debugging controls like the continue button so I
could get going.   Playing around I could get to the point.........by
accident.......of having myfieldlostfocusproc()  BEING LOADED, active,
and having a real break point.

The problem is, when I stopped everything and started from scratch to
test my understanding I could never intentionally get
myfieldlostfocusproc() to load.

myfieldlostfocusproc() is called from the onblur event of the myfield
html text field in mypage.html.

LOL.  I need a clue.

As I understand debuggers:
1.  You first bring up the source code and mark some breakpoints
2.  You activate the live code
3.  Somehow the debugger links what it knows about the source to the
live code, it comes alive and stops at the breakpoint to let you begin
debugging.

I can't intentionally get #3 to happen in my steps 1 - 7 above.

Any ideas what I am missing?

Thanks in advance for any info.

Please reply to the group as the above address is just a spam catcher
I rarely check.  Im sure other people will find your coments useful
too.  Thanks

Steve





_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Trouble Getting Started

Gijs Kruitbosch ("Hannibal")
Steve wrote:

> Hi;
>
> I am having trouble getting started with venkham.   I think I am
> missing something conceptually which is causing me to skip a needed
> step that other people see by reading between the lines of the
> tutorials.
>
> Firefox:      2.0.0.11
> Venkahm:  0.9.87.1
> OS:           Microsoft Windows XP Professional Service Pack 2
>
> I would like to debug a javascript on a JSP site my company has.
> Since any given functioning page is put together dynamically, I went
> to the spot where the JS malfunction is and I saved the JSP as a
> *.html page.  Lets call it "mypage.html".
>
> 1.  I booted up firefox fresh
>
> 2.  I booted up venkham
>
> 3.  In Venkham I went to File | Open to bring up mypage.html
>
> 4.  I scrolled to the definition for  myfieldlostfocusproc()
>
> 5.  I tried to set this as a breakpoint, but could only set it as a
> future breakpoint.   I understand it is a "top level" funciton and it
> hasn't been loaded.
>
> 6. I go back to firefox and open the mypage.html in the browser, from
> my desktop.   "mypage.html" appears in the loaded scripts window.  The
> only node under it is "onblur".
>
> 7. In firefox, in mypage.html,  I go to "myfield" type in a value and
> leave "myfield" which *SHOULD* fire myfieldlostfocusproc(), and bring
> the debugger to that function.
>
> This doesn't happen and this is where I am stuck.
>
> I don't really have a top level function in mypage.html.   It is a
> page of html fields, with each field having its own function that gets
> activated onblur.
>
> A few times, noodling around, I was able to set a breakpoint on
> "onblur", the only node visible under mypage.html in the loaded script
> window.   That would take me to the very top of the file and would
> finally activate the debugging controls like the continue button so I
> could get going.   Playing around I could get to the point.........by
> accident.......of having myfieldlostfocusproc()  BEING LOADED, active,
> and having a real break point.
>
> The problem is, when I stopped everything and started from scratch to
> test my understanding I could never intentionally get
> myfieldlostfocusproc() to load.
>
> myfieldlostfocusproc() is called from the onblur event of the myfield
> html text field in mypage.html.
>
> LOL.  I need a clue.
>
> As I understand debuggers:
> 1.  You first bring up the source code and mark some breakpoints
> 2.  You activate the live code
> 3.  Somehow the debugger links what it knows about the source to the
> live code, it comes alive and stops at the breakpoint to let you begin
> debugging.
>
> I can't intentionally get #3 to happen in my steps 1 - 7 above.
>
> Any ideas what I am missing?
>
> Thanks in advance for any info.
>
> Please reply to the group as the above address is just a spam catcher
> I rarely check.  Im sure other people will find your coments useful
> too.  Thanks
>
> Steve
>

Hi Steve, thanks for the detailed feedback.

Unfortunately I don't have the time to try to recreate the exact setup
you're describing (writing my own html file etc.) - if you can point us
to an example on the web, that would probably help. I will instead reply
to your understanding of debuggers, hoping that may clarify things.

The most important thing to understand is that JavaScript is an
interpreted language. Before the source code is interpreted, there is no
"live code" to be activated, unlike compiled C or Java programs, where
the source representation will have a "ready-made" compiled equivalent.
This is why venkman, when you present it with a new file, will set a
"future" breakpoint - it will attempt to break on that line if the file
in question eventually gets loaded, but it can't be sure that line is
actually executable: it doesn't interpret the files you give it. It
expects Mozilla's javascript engine to do that for it, which it will as
soon as you load the file.

Looking at it from the other end, do the following:

1. Open your browser and Venkman
2. Open a random webpage with script in your webbrowser.
3. Look for the associated file which has script in it, and open this in
venkman from the "loaded scripts" view by double-clicking it.

You will now see the file get loaded, and to the left of the source you
will see dashes on all lines that venkman can set a breakpoint on. There
will be no dashes for empty lines, comments, etc. The reason this works
the way it does is because the result of the interpretation step (which
was made when you loaded the webpage) is bytecode, which venkman's
backend APIs need to translate back into actual source lines. Then, when
you set a breakpoint on a line, Venkman looks at its translation,
figures out which bit of bytecode it should set a breakpoint at, and
tells the JS runtime that. You might say "but shouldn't the runtime
allow you to set a breakpoint by line?" - maybe. But it doesn't. The
point of the "future" breakpoint, then, is to set a breakpoint in a file
that's not yet loaded. The "future" means "I'm not sure if I'm going to
be able to manage stopping here, so don't expect too much".

[warning: less-well-researched stuff coming up:] Other debuggers, like
Firebug, opt instead to let you break wherever, and this may or may not
lead to expected results (ie an actual breakpoint). Venkman decided to
do things the way it does a looong time ago, and I'm not sure whether
we're up for changing it - the current system works if you get the hang
of it.



Then, as general advice: have you read Svendt Tofte's guide? (
http://www.svendtofte.com/code/learning_venkman/ ) It's quite old by
now, but still a pretty good guide on how to get started with the debugger.

Oh, and finally: enabling both Venkman and Firebug at the same time
sometimes gets you into trouble (again, because of the way the backend
API works - neither add-on can do much about it without breaking some or
all of its functionality). It's best to avoid doing this.

~ Gijs
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Trouble Getting Started

John J Barton
Gijs Kruitbosch wrote:
> Steve wrote:

>
> [warning: less-well-researched stuff coming up:] Other debuggers, like
> Firebug, opt instead to let you break wherever, and this may or may not
> lead to expected results (ie an actual breakpoint). Venkman decided to
> do things the way it does a looong time ago, and I'm not sure whether
> we're up for changing it - the current system works if you get the hang
> of it.

Firebug 1.1 (http://fireclipse.xucia.com) marks executable lines (in
green) analogous to the way Venkman does (with dashes).  Firebug still
lets you set breakpoints on non-executable lines, since sometimes the
line numbers are just wrong.
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Trouble Getting Started

Steve-296
In reply to this post by Gijs Kruitbosch ("Hannibal")
On Dec 6, 6:28 pm, Gijs Kruitbosch <[hidden email]>

> Hi Steve, thanks for the detailed feedback.
>
> Unfortunately I don't have the time to try to recreate the exact setup
> you're describing (writing my own html file etc.) - if you can point us
> to an example on the web, that would probably help.

Hi Gijs;

Are you a venkham developer?  If so, I can email you a copy of the
html I saved from the JSP.

(snip informative piece about the workings of venkham )


> Looking at it from the other end, do the following:
>
> 1. Open your browser and Venkman
> 2. Open a random webpage with script in your webbrowser.
> 3. Look for the associated file which has script in it, and open this in
> venkman from the "loaded scripts" view by double-clicking it.

These steps were an improvement over what I tried but did not get me
any further.


> Then, as general advice: have you read Svendt Tofte's guide? (http://www.svendtofte.com/code/learning_venkman/) It's quite old by
> now, but still a pretty good guide on how to get started with the debugger.

I wouldn't mind investing the time in doing that depending on the
answers to these questions:

1. Can Venkham debug javascript that is not housed in a *.js file ?

2. Can Venkham debug javascript functions, where there is no top level
function, just functions in response to javascript events, like
onblur...as is the case with my example?

Since I was at work I managed to get microsoft interdev to do the job,
but for various reasons I would like to use an OS deugger if it can
handle my needs.

Let me if Venkham can do #1 & #2 above and/or get to the functions in
the example page I can send by email.   If so, I will invest the time
to read over that big tutorial carefully.

Thanks again for the good information.



_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Trouble Getting Started

Robert Kaiser
Steve wrote:
> Hi Gijs;
>
> Are you a venkham developer?

venk_man_ it is:
http://en.wikipedia.org/wiki/Venkman

That scientist in Ghostbusters was no ham, he was a real man.

Robert Kaiser

_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Trouble Getting Started

Gijs Kruitbosch ("Hannibal")
In reply to this post by Steve-296
Steve wrote:

> On Dec 6, 6:28 pm, Gijs Kruitbosch <[hidden email]>
>
>> Hi Steve, thanks for the detailed feedback.
>>
>> Unfortunately I don't have the time to try to recreate the exact setup
>> you're describing (writing my own html file etc.) - if you can point us
>> to an example on the web, that would probably help.
>
> Hi Gijs;
>
> Are you a venkham developer?  If so, I can email you a copy of the
> html I saved from the JSP.
>
> (snip informative piece about the workings of venkham )

Venkman developer, yes. Though part-time and very busy. ;-)

Please feel free to send me the html you saved. I will try to look at it
  ASAP, which should be within a week's time.


>> Looking at it from the other end, do the following:
>>
>> 1. Open your browser and Venkman
>> 2. Open a random webpage with script in your webbrowser.
>> 3. Look for the associated file which has script in it, and open this in
>> venkman from the "loaded scripts" view by double-clicking it.
>
> These steps were an improvement over what I tried but did not get me
> any further.
>
>
>> Then, as general advice: have you read Svendt Tofte's guide? (http://www.svendtofte.com/code/learning_venkman/) It's quite old by
>> now, but still a pretty good guide on how to get started with the debugger.
>
> I wouldn't mind investing the time in doing that depending on the
> answers to these questions:
>
> 1. Can Venkham debug javascript that is not housed in a *.js file ?

Yes.

> 2. Can Venkham debug javascript functions, where there is no top level
> function, just functions in response to javascript events, like
> onblur...as is the case with my example?

Yes. But if the code is on one line, you probably want to turn on pretty
print (big flowery button on the right end of the toolbar).

The easiest way to make Venkman break somewhere in such code is probably
to add a debugger; statement to your onblur function. Alternatively,
doubleclick the right thing ("onblur" or whatever) on the loaded scripts
pane with pretty print enabled should give you just that JS function
(though decompiled, so comments, if any, will not be there).


> Since I was at work I managed to get microsoft interdev to do the job,
> but for various reasons I would like to use an OS deugger if it can
> handle my needs.
>
> Let me if Venkham can do #1 & #2 above and/or get to the functions in
> the example page I can send by email.   If so, I will invest the time
> to read over that big tutorial carefully.
>
> Thanks again for the good information.

You're welcome. Please let me know how things work out! :-)

Gijs
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Trouble Getting Started

Steve-296
In reply to this post by Robert Kaiser
On Dec 10, 3:18 pm, Robert Kaiser <[hidden email]> wrote:

> Steve wrote:
> > Hi Gijs;
>
> > Are you a venkham developer?
>
> venk_man_ it is:http://en.wikipedia.org/wiki/Venkman
>
> That scientist in Ghostbusters was no ham, he was a real man.
>
> Robert Kaiser

Ah, that explains Bill Murray's picture on the tutorial :).   I
thought the name was an Indian thing as I friend from Tamil in
graduate school named Venkat.

Steve
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Trouble Getting Started

Steve-296
In reply to this post by Gijs Kruitbosch ("Hannibal")
On Dec 10, 4:49 pm, Gijs Kruitbosch <[hidden email]> wrote:
> > Are you a venkham developer?  If so, I can email you a copy of the
> > html I saved from the JSP.

> Venkman developer, yes. Though part-time and very busy. ;-)
>
> Please feel free to send me the html you saved. I will try to look at it
>   ASAP, which should be within a week's time.

Can you email me ( [hidden email] ) your email address?  I know
it is lame, but they have usenet blocked at my job, I don't have a
usenet client at home,  I'm reading this through google groups, and
they obscure people's email addresses.

Thanks much in advance for all of the trouble.

If you can show me how to get venkman working with my file I will read
the tutorial thoroughly AND I will help people in my company learn how
to use it instead of interdev.    We debug a lot of similar and a lot
of crappy autogenerated javascripts.

I'm sure we are not the only ones and the information in this thread
will be available via the google groups archives for others.

Thanks again.

Steve


_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger