Skip to content

Problem installing gdb into Rtools42

3 messages · Dominick Samperi, Dirk Eddelbuettel, Tomas Kalibera

#
On second thought, there is a lot of metapramming code in Rcpp that runs
before main, so
I was wrong to say nothing can happen before main() is called.
Strategically placed print
statements may be the best strategy.

On Wed, Jan 18, 2023 at 8:17 PM Dominick Samperi <djsamperi at gmail.com>
wrote:

  
  
#
On 18 January 2023 at 22:44, Dominick Samperi wrote:
| On second thought, there is a lot of metapramming code in Rcpp that runs
| before main, so
| I was wrong to say nothing can happen before main() is called.
| Strategically placed print
| statements may be the best strategy.

Yes, and if you want to rule our Rcpp / RInside you can try to embed R
directly without these two and see if you get your repl + plotting device
going without. There is some basic documentation about embedding in section 8
in https://rstudio.github.io/r-manuals/r-exts/ (more nicely rendered version
of the standard manual).

The manual also has a special section on Window -- and while do not do that
much in RInside and Rcpp that is platform specific it is always possible that
we have a bug here or there. That said, there have always been embedded uses
of RInside on Windows too. Good luck, and let us know if you find bugs.

Dirk
#
On 1/19/23 04:44, Dominick Samperi wrote:
You can insert breakpoints into the code which runs before main() as 
well. With C++, these may be constructors for static and global objects. 
gdb calls this "elaboration phase", see their documentation. Right, 
adding print statements (to output, or to files with GUI) may sometimes 
be useful as well. Also you can add some checks to the code and crash it 
intentionally when something happens, that way you get to the debugger 
as well if you ran your program in it. On Windows, you can also enter 
the debugger programmatically without crashing, with an interrupt (see 
breaking to debugger in Rgui). On Windows, you can also set windbg to be 
the post-mortem debugger, invoked automatically when the program 
crashes. But most of this is probably already off topic for this list. 
Some of these things are mentioned in 
https://cran.r-project.org/bin/windows/base/howto-R-devel.html.

Tomas