[R-pkg-devel] New package with C++ code causes R abort in RStudio, not in R console.

Luc De Wilde Luc@DeW||de @end|ng |rom UGent@be
Wed Nov 13 09:28:01 CET 2024


Thanks to your instructions I have found the probable reason of the crash: char* items allocated with "new char[...]" were deleted with 'delete' and not with 'delete[]' in one of the destructors. I will recheck my code and retry all tests.

For your information: Visual Studio debugger works with the debug info stored in the dll, it asks for the location of the source file (.cpp) and then shows the correct location of the problematic instruction.

Thanks a lot!

Luc
________________________________
Van: Ivan Krylov <ikrylov using disroot.org>
Verzonden: dinsdag 12 november 2024 22:33
Aan: Luc De Wilde <Luc.DeWilde using UGent.be>
CC: r-package-devel using r-project.org <r-package-devel using r-project.org>
Onderwerp: Re: [R-pkg-devel] New package with C++ code causes R abort in RStudio, not in R console.

� Tue, 12 Nov 2024 21:09:54 +0000
Luc De Wilde <Luc.DeWilde using UGent.be> �����:

> I have attached a debugger (from Visual Studio) to the R process,
> which gives me the message "A breakpoint instruction (__debugbreak()
> statement or similar call) was executed in rsession-utf8.exe.
>
> When I go to the dll module in the Call Stack I get the message
> "Binary was not built with debug information".

So the crash does happen inside lavaanC.dll, did I get this right?

If you set the environment variable DEBUG to a non-empty string before
compiling the package, the resulting *.dll will have debug information
in the DWARF format (this is set in file.path(R.home('etc'), 'x64',
'Makeconf')). Visual Studio might not work with it, so you could
install gdb into Rtools using pacman, or you could try to give the
executable to Dr. Mingw <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjrfonseca%2Fdrmingw&data=05%7C02%7CLuc.DeWilde%40UGent.be%7C74c6b594e5414ac8486c08dd03619cae%7Cd7811cdeecef496c8f91a1786241b99c%7C1%7C0%7C638670439969607386%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=hiUfEIBkezT%2FoWd%2FC5ZJncKFkTNUZPmqiavOCLOzOUM%3D&reserved=0<https://github.com/jrfonseca/drmingw>>.

--
Best regards,
Ivan

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list