Ovidiu Predescu wrote: > On Monday, October 14, 2002, at 01:20 AM, Sylvain Wallez wrote: > >> Ovidiu Predescu wrote: >> >>> On Friday, October 11, 2002, at 02:09 AM, Sylvain Wallez wrote: >>> >>>> Stefano Mazzocchi wrote: >>>> >>>>> People, >>>>> >>>>> Neal Gafter is about to start the process for a new JSR on Java >>>>> Compiler API which would hopefully make it fir Tiger (aka Java >>>>> 1.5). He asked me if there are people interested in helping out >>>>> with the details of bootstrapping this from Apache and since we >>>>> (and Tomcat) are the one who need this the most (for XSP and >>>>> sitemap compilation), I thought about asking here. >>>>> >>>>> The idea is to allow us to compile stuff without having to use the >>>>> filesystem to retrieve both the source file and the classes on >>>>> which the code to be compiled depend upon. >>>>> >>>>> So, if you are a committer and want to join, just raise your hand >>>>> and we'll see what happens. >>>> >>>> >>>> What would be very cool is to be able to specify line numbers of >>>> the source file that generated the Java code (like #line in C). >>>> This would allow for source-level XSP debuggers ! >>> >>> >>> I've implemented this feature long time ago for the compiled >>> sitemap, in the sitemap.xsl stylesheet. The generated sitemap would >>> have lines like: >>> >>> // file: src/webapp/sitemap.xmap >>> // line: 123 >> >> >> I know this, and what I'm proposing extends it to the source file and >> line number information in the bytecode. >> >> The above allows to find the line in the sitemap/XSP that generated a >> given statement in the Java code. But exceptions stacktraces still >> refer to source lines of the generated java code, and not source >> lines of the original sitemap/XSP. >> >> My proposal would allow to have exceptions carry the file name and >> line number of the _sitemap/XSP file_ that originated the Java code. >> You would then have stacktraces like this : >> >> my.app.MyException (app failed) >> at my.app.MyClass (MyClass.java:315) >> at my.webapp.myXsp_xsp.generate (myXsp.xsp:79) <=== >> at ServerPagesGenerator.generate (ServerPagesGenerator.java:89) >> at my.webapp.sitemap_xmap.match123 (sitemap.xmap:152) <=== >> ... >> >> This kind of information would greatly help debugging Cocoon >> applications, and would also allow source-level debugging of XSPs >> using existing debuggers. > > > Gotcha! > > I was thinking along the same lines when I've wrote the code to > generate filename/line number in the sitemap. You can have an > exception translator which maps line numbers from compiled XSP and > sitemaps to the original source code. This is a common technique used > in debuggers, including JSP debuggers. This mapping however happens by > analyzing the translated source code, in our case the XSP or sitemap > generated Java code, which embeds comments containing filename and > line number information. You technically don't need to go to the low > level Java bytecodes to generate this information.
I didn't knew this technique. It surely works, but requires a custom debugger : you cannot use e.g. JSwat or Eclipse built-in debugger which provide excellent features. Do you know an open-source debugger that implements this ? Sylvain -- Sylvain Wallez Anyware Technologies Apache Cocoon http://www.anyware-tech.com mailto:[EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]