Page 1 of 1

XQuery Debugger

Posted: Wed Aug 24, 2016 12:47 pm
by Dill
Hi,

I'm just evaluating oxygen and I like it a lot, but I'm struggling with the debugger.

First of all when I step through the code, it jumps around wildly. I understand, that XQuery is not a imperative language, but why arent't for example even successive let-clauses processed in order...? Also it's not clear when a variable value is available.

For example this code

Code: Select all



let $foo := ...
let $bar := ...
return
XXX (:when I'm here $foo or $bar may be unavailable, why? - in XWatch they are!)
About breakpoints:
Is it possible, that conditional breakpoints do not work in version 18?
eg I set a breakpoint at XXX and set condition to false() or 0 its always hit nevertheless.
When I select conditional only, it seems like the breakpoint is removed from the line and hits always when the condition is met - not what I want.

And a last question: how can I use trace() and error()?
Where are the trace() messages output?
How can I access the node that error() gets as an argument?

Thank you!

Re: XQuery Debugger

Posted: Wed Aug 24, 2016 6:27 pm
by adrian
Hello,

Oxygen uses the Saxon XQuery engine for XQuery debugging, so most behavior depends on how Saxon handles certain things.
First of all, if you want maximum granularity during debugging, you should set in the "Advanced options" (cogwheel button in the debugger toolbar next to engine name, "Saxon-EE XQuery 9.x") the "Optimization level" to 0. This should also improve variable availability.
Dill wrote:First of all when I step through the code, it jumps around wildly. I understand, that XQuery is not a imperative language, but why arent't for example even successive let-clauses processed in order...? Also it's not clear when a variable value is available.
It all depends on the variable use. Saxon also performs a lot of code optimizations to the point that it may not declare variables that are not used and will process the let clauses in any order it pleases, if they do not depend on one another in sequence.
Dill wrote:let $foo := ...
let $bar := ...
return
XXX (:when I'm here $foo or $bar may be unavailable, why? - in XWatch they are!)
It's a matter of context, check the debugger status (in the toolbar).
Dill wrote:Is it possible, that conditional breakpoints do not work in version 18?
eg I set a breakpoint at XXX and set condition to false() or 0 its always hit nevertheless.
If I use false() as the condition on a breakpoint set on a line, it always skips that breakpoint. However, I could identify an issue with breakpoints set in an older Oxygen session, where they no longer connect with the breakpoint seen in the editor. Disabling such breakpoints in the Breakpoints view doesn't have any effect, so neither does setting a condition on them. Clearing the breakpoint in both Breakpoints view and in the editor (breakpoints stripe) and setting it again, should correct the problem.
Dill wrote:When I select conditional only, it seems like the breakpoint is removed from the line and hits always when the condition is met - not what I want.
Yes, "Conditional only" is a breakpoint triggered after evaluating a condition expression, it does not depend on the location (document and line).
Dill wrote:And a last question: how can I use trace() and error()?
Where are the trace() messages output?
How can I access the node that error() gets as an argument?
These aren't handled by Oxygen, but if you run Oxygen with the command line launcher (oxygen.bat, or oxygen.sh or oxygenMac.sh depending on the platform), you should find the trace messages in the terminal window.

Regards,
Adrian