Re: Setting breakpoints
"Dassburger" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.jsdebugger |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
James Ross wrote: > Dassburger wrote: > > I tried to solve this by storing breakpoint lines and setting a hook at > > the start of toplevel script execution. In the hook handler > > JSD_SetExecutionHook is called for each breakpoint. But again, there > > are problems, as toplevel code, and code inside functions belong to > > different JSDScripts and I have no idea how to figure out which line > > belongs to which script. > > You're close - the right way is to set it when the script that contains > the line is loaded using script.baseLineNumber and script.lineExtent. > > The debugger notifies you of each script as it is loaded (top-level > always comes first), and you just need to set the breakpoint in each > that overlaps the line (you can check if the line is executable within > that script, but I don't think you have to). Thank you very much! This is exactly what I need. For someone who stuck with the same problem: the handler for script loaded/unloaded event is set by JSD_SetScriptHook(), execution hooks are set in this handler. Base line number and line extent can be retrieved with JSD_GetScriptBaseLineNumber() and JSD_GetScriptLineExtent() respectively. > -- > James Ross <[email protected]> > ChatZilla Developer