Re: Question for you?
David Huynh <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.jsdebugger |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Yup, I got what you got :-) I thought maybe it's an off-by-one error in highlighting the current line, but even stepping further didn't set a to 1. I've given up on Venkman. You might want to try jslib which has debug printing functions (jslib.mozdev.org). These functions output to the Javascript console. Best, David 7stud wrote: > "David Huynh" <[email protected]> wrote in message > news:[email protected]... > >>getStore() is actually defined in piggy-bank.js, which is linked in >>through the first <script> element. >> >>It turned out that there was an exception thrown in getStore(). >>Regardless, Venkman didn't help me locate that. Half of the times I >>wasn't sure if the debugger was quirky or my code was erroneous. >>Consequently, I have abandoned Venkman altogether and resorted to >>alert() and incremental code writing. It's a shame, really, and I can >>sympathize with your experience with Venkman. >> >>Best regards, >> >>David >> > > > Hi, > > I have tried that same tutorial you linked, and nothing seems to work > according to the way the tutorial says it should. For instance, on page 3 > of the tutorial > > http://www.svendtofte.com/code/learning_venkman/basics.php > > you step through this example: > > 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> > > When I stepped from line 4 to line 5, and then typed 'a' into the > Interactive Session input line, and hit return, I got this: > > < 001: a > >>$[0] = [void] void > > > The tutorial says I should get a value of 1 for a. I've used other > debuggers before, and I would expect the value of a to be 1, not undefined. > Does that happen to you too? > > > > >>7stud wrote: >> >>>><html> >>>><head> >>>><script type="application/x-javascript" >>>>src="piggy-bank.js"/> >>>><script language="javascript"> >>>>function getStore2() { >>>>debugger >>>>getStore(); >>>>} >>>></script> >>>></head> >>>><body> >>>><span onclick="alert('a'); getStore2();">click me</span> >>>></body> >>>></html> >>> >>> >>>Here, I'll be Venkman for you: >>> >>>Error: line 8: GetStore() does not exist. >>> >>>The rest of your post is unintelligible, although I too have used > > debuggers > >>>before, and Venkman does not work for me with Firefox1.0 on Win98. If I >>>have two lines like this: >>> >>>1)var a=10; >>>2)var b = 10; >>> >>>After I step from line 1 to line 2, the debugger says a is undefined. >>> >>> >>> >>> >>> >>>"David Huynh" <[email protected]> wrote in message >>>news:[email protected]... >>> >>> >>>>Hi, >>>> >>>>I'm having problem using the JS debugger. I'm reading this guide >>>>http://www.svendtofte.com/code/learning_venkman/basics.php >>>>to find out how to use the debugger, and although I've used plenty of >>>>debuggers in the past, I can't figure out how this Venkman thing works. >>>> >>>>I have a pretty simple HTML file here: >>>> >>>> >>>>And I followed these steps: >>>>1. start Mozilla >>>>2. open the JS debugger and click on the Stop button (gosh, I didn't >>>>expect to click "stop" to _start_ my debugging task) >>>>3. load the HTML file in Mozilla browser >>>>4. go to the JS debugger and set the right evaluation context >>>>5. refresh the browser. The JS debugger does break into the script file >>>>piggy-bank.js (containing a bunch of functions) and I let it runs > > through. > >>>>6. click on the span "click me". The alert "a" comes up but then nothing >>>>else happens. It doesn't matter if I set any breakpoint in getStore2() >>>>or getStore(). The debugger keyword doesn't help either. >>>> >>>>Then I got clever and put in a function call to getStore() at the end of >>>>piggy-bank.js so that step #5 above would let me debug the function >>>>getStore(). The debugger does go into getStore(), which is something >>>>like this: >>>> >>>>function getStore() { >>>>debugger >>>>var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1'] >>>>.getService(Components.interfaces.nsIRDFService); >>>>... >>>>} >>>> >>>>I hit F11 to step into at every point, but then when it reaches the >>>>assignment statement (RDF = ...), F11 seems to behave like F5--Venkman >>>>does not stop at the next statement. Frankly I don't know where it goes >>>>after I hit F11 at the assignment statement. >>>> >>>>Then I got even more clever and tried to paste the body of getStore() in >>>>the middle of step #5 above. But alas, the little textbox in Venkman >>>>only takes one line of text! >>>> >>>>I'm running Mozilla 1.7.2, Venkman 0.9.81. Venkman seems to be choking >>>>the daylight out of Mozilla. >>>> >>>> >>>> >>>>So I have 2 questions: >>>> >>>>1. What should I do if I want to debug the function getStore()? >>>> >>>>2. How did those folks that develop various Mozilla-based applications >>>>refrain from killing themselves with this kind of debugging support? >>>>Seriously, I have great respect for the Mozilla product from an >>>>engineering standpoint, but the documentation and developer support >>>>are... Are they using some other tricks to debug their JS code? >>>> >>>>Forgot to mention, the HTML file was originally a XUL. But Venkman >>>>doesn't even seem to handle XUL... >>>> >>>>Thanks in advance! >>>> >>>>David >>> >>> >