public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Hoerner <towardvictory@gmail.com>
To: palves@redhat.com
Cc: brobecker@adacore.com, gdb@sourceware.org
Subject: Re: GDB for R?
Date: Fri, 30 Nov 2018 01:22:00 -0000	[thread overview]
Message-ID: <CAL_jiYedu6E7zdLW9GOMH8E_jikcEebdtO-Z_PJA2HDswLPxVg@mail.gmail.com> (raw)
In-Reply-To: <3f916641-1a37-b34a-4c99-5688c23dd20b@redhat.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 <palves@redhat.com> 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

  reply	other threads:[~2018-11-30  1:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29  2:45 Andrew Hoerner
2018-11-29 14:32 ` Joel Brobecker
2018-11-29 14:41   ` Pedro Alves
2018-11-30  1:22     ` Andrew Hoerner [this message]
2018-12-01  4:09     ` GDB for R? Some info on current use of GDB with R Andrew Hoerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAL_jiYedu6E7zdLW9GOMH8E_jikcEebdtO-Z_PJA2HDswLPxVg@mail.gmail.com \
    --to=towardvictory@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=gdb@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).