You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Helpers provided by Ark for the C/C++ debugger #7174
When debugging native code with codelldb, you can see R variables of type SEXP but they are currently completely opaque. First because the variable pane doesn't reveal anything about the variable such as the type or contents (see #7171). But also because the Debug Console isn't currently of much help by default as there is no way of seeing the output of called functions.
Currently that output is captured by Ark and sent over IOPub but when Ark is paused in the debugger, the code in charge of sending IOPub message is not running. The output accumulates in the IOPub thread's incoming channel until Ark is unpaused.
To work around this Ark could implement a diversion system in the WriteConsole() hook that redirects output to another location than IOPub. When Ark is in that state, output would no longer be sent to IOPub. This could be managed automatically with a function taking a closure, e.g. capture_console_output(|| Rf_PrintValue(x)), that would be in charge of setting up the redirection and resetting it. This helper would be used to implement easy to call wrappers provided by Ark, e.g. ark_print(). Users would then be able to
Call these helpers in the Watch Pane.
Call them in the Debug Console.
Ideally the output would be redirected to stdout but for reasons I'll explain in the PR that's very hard and I couldn't find a nice way to do it. Alternatively the helpers can return the redirected output as a C string. It is nicely printed with this LLDB setting:
settings set escape-non-printables false
Ark could expose different helpers such as:
Print a variable
Inspect the structure of a variable
Print the R level call stack (can be very useful to figure out how the C code was called)
Activity