Subj : JSErrorReport->linebuf .. Help!! To : netscape.public.mozilla.jseng From : j Date : Mon Feb 21 2005 10:28 am Hello, I have two questions that have plagued me for the past 2 years of working on Spidermonkey.. Please, help! In my error handler, I have always had this section of code: ... if(report->linebuf) { addDebugLog( "%s\n", (char *)report->linebuf ); ... } However, it never fires off! linebuf is NEVER valid.. I was reading the docs for JSErrorReport ( http://www.mozilla.org/js/spidermonkey/apidoc/gen/api-JSErrorReport.html ), and they report: "linebuf is a pointer to a user-defined buffer into which JS copies the offending line of the script." User defined... "To use JSErrorReport, your application must define a variable of type JSErrorReport and allocate a buffer to hold the text that generated the error condition. Set linebuf to point at the buffer before your application executes a script." Now, pardon me a moment, but, the only usage I've ever seen related to JSErrorReport is this: (in js.c in the spidermonkey source package!) JS_SetErrorReporter(cx, my_ErrorReporter); And inside my_ErrorReporter?.. if (!report->linebuf) { fputc('\n', gErrFile); goto out; } Very smiliar line of code to what I am using. No where in js.c is JSErrorReport->linebuf set to anything user defined. I don't recall the above line ever not firing in js.c either (always jmps), but perhaps it does under some conditions? No where in js.c is there a variable of type JSErrorReport defined, and even if there were, the docs don't mention how they should be applied to the executed script instance so the interpretter can make use of the 'user defined' object.. ???? So, my question, how do I get linebuf to _always_ contain the source line of code? Using the 'open source file, jump to line X' method is not an option in my application, and I could really use this extra debugging information for my scripters. Ie, what is the 'preferred' way of actually using this information CORRECTLY? My other question.. When using the js callback to step through a script, is it possible to get each line of source code that is executed, so I can create some sort of debug dump? (not compiled opcode, but the actual source line being executed) Thanks in advance! --Paul .