Re: GDB for R?
Andrew Hoerner <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAL_jiYedu6E7zdLW9GOMH8E_jikcEebdtO-Z_PJA2HDswLPxVg@mail.gmail.com> |
With respect to the inner workings of R I am far from being an expert, but here is my understanding and a few links. The vast majority of core R functions are themselves written either in C or in R, so all the code is in some sense C at the base. But the vast majority of R users never deal with the C-level code, even when debugging. Core R code has been byte-compiled since 2011. In early 2017, (R 3.4.0) R got a JIT compiler (applied primarily to functions and loops) in R code run interactively or through scripts, usually with no intervention on the part of the user. Under older versions of R, and also still for code the JIT algorithm doesn't like, R code is parsed and the parse tree run by an AST interpreter. This is still true, but more and more code is run under the byte compiler. The byte compiler itself is written almost entirely in R . Formerly, package authors had the option of byte-compiling their package when installed. As of R 3.5.0, released in April of this year, all R packages are byte-compiled . The dominant languages for package code are R and C++, in that order, but among the 13,000 or so contributed packages you will find a bit of everything. Although most R code is now run as byte code, R's debugging facilities are all entirely based on the AST, bypassing the byte-code. A description of the byte compiler is here: homepage.cs.uiowa.edu/~luke/R/compiler/compiler.pdf A nice overview of the language: strengths, weaknesses, peculiarities. http://r.cs.purdue.edu/pub/ecoop12.pdf R manuals are here: https://cran.r-project.org/ Click the "Manuals" link at the left-hand edge under Documentation. I suspect that the most useful for your purposes will be either "The R Language Definition" or "R Internals." Warmest regards, Andrew On Thu, Nov 29, 2018 at 9:41 AM Pedro Alves <[email protected]> wrote: > > On 11/29/2018 02:32 PM, Joel Brobecker wrote: > > Hi Andrew, > > > >> I would very much like to know if there is any appreciable probability that > >> there will be a GDB debugger for the R language in a time frame of months > >> to single-digit years. I’d also like to know if there is pretty clearly no > >> such probability. > > > > To the best of my knowledge, I haven't heard any rumours about adding > > R support to GDB. But maybe others have heard something? > > I haven't either. > > I don't know much about how R works. E.g., does it compile down to native > code? Or to some byte code that is JIT compiled at run time? Or is > it fully interpreted? > > Thanks, > Pedro Alves