0

The following code, when run from a terminal, brings me in debug mode:

foo:{
    out:x+2; 
    '`HELLO + 6;
    :out}

foo 50  

When I run this in qStudio, however, this just fails and it seems to exit the function. Does qStudio support debug mode? if so, how can I get into a mode that allows me to inspect/manipulate the variables within that function?

Donald_W
  • 1,773
  • 21
  • 35

2 Answers2

2

The ability to dive into functions isn't part of qStudio. You have some functionality that will help a little:

Watch expressions: http://www.timestored.com/qstudio/help/advanced-use#watchExp

Keyboard shortcut: ctrl+shift+enter allows executing a line of code, displaying its value and moving to the next line

You could load a debugger in: http://code.kx.com/q/ref/debug/

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
Ryan
  • 21
  • 1
  • In that case, qStudio may not be the right tool for me to develop and test q code. Is there a better editor? What do most people use for this? I currently use Vim+terminal, but that requires a lot of copy-pasting via the mouse which I'd like to avoid. I'd be interested to hear any other suggestions you may have. – user3625002 Apr 17 '15 at 17:38
  • no other editors are better, there simply isn't any comprehensive debugging tools for kdb. I generally write/debug functions line-by-line in qStudio and in my head keep track of what is local and what is global. Once I'm happy with it I start a fresh session (or delete any unintentional globals that I've created) and try the function as a whole. Unless I've been careless, all locals/globals should resolve properly and the function is working as intended. – terrylynch Apr 17 '15 at 18:47
2

Check out qInsightPad.com - it includes debugger by Andrey Kozyrev in injectable form (mentioned in the answer before) wrapped in decent GUI, which makes it possible to get to errors at depth and look through whole call stack & local variables contexts along the execution path that lead to it.

So, I find phrase "no other editors are better" a bit arguable :)