首先,我对这类东西不是很熟练,所以我可能会写一些愚蠢的问题,请友善;-(
我有一个调用c++代码的R代码。不幸的是,我的代码有问题,可能是内存没有映射,我想用valgrind来了解错误在哪里。
我几年前就已经用过了,但现在似乎不起作用了。当我吃午饭时,以下命令
R -d valgrind
我得到这个输出
==69495== Memcheck, a memory error detector
==69495== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==69495== Using Valgrind-3.14.0.GIT and LibVEX; rerun with -h for copyright info
==69495== Command: /Library/Frameworks/R.framework/Resources/bin/exec/R
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476D88: bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476E2C: df_bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476A15: df (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476631: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476D88: bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476EBC: df_bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476A15: df (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476631: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476D88: bcc_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476A6E: df (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476631: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476B30: df (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476631: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495== by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101476CBC: drbg_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x1014766AA: nistctr_init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x10147607B: init (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101623C9E: arc4_init (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623B59: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495== by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495== by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x10147621E: generate (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101623B92: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495== by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495== by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101472F31: ccaes_vng_ctr_crypt (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476C3F: drbg_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476269: generate (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101623B92: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495== by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495== by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101476C5C: drbg_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476269: generate (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101623B92: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495== by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495== by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101476CBC: drbg_update (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101476269: generate (in /usr/lib/system/libcorecrypto.dylib)
==69495== by 0x101623B92: arc4random (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x101623F7D: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495== by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495== by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x101623F86: arc4random_uniform (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163E765: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495== by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495== by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Use of uninitialised value of size 8
==69495== at 0x10163E768: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495== by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495== by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
==69495== Conditional jump or move depends on uninitialised value(s)
==69495== at 0x10163E8BD: find_temp_path (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x10163EABF: mkdtemp (in /usr/lib/system/libsystem_c.dylib)
==69495== by 0x1002418CE: R_reInitTempDir (sysutils.c:1662)
==69495== by 0x1001B29AE: setup_Rmainloop (main.c:841)
==69495== by 0x1001B3558: Rf_mainloop (main.c:1088)
==69495== by 0x100000F5A: main (in /Library/Frameworks/R.framework/Resources/bin/exec/R)
==69495==
--69495-- WARNING: unhandled amd64-darwin syscall: unix:475
--69495-- You may be able to write your own handler.
--69495-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--69495-- Nevertheless we consider this a bug. Please report
--69495-- it at http://valgrind.org/support/bug_reports.html.
Fatal error: cannot create 'R_TempDir'
==69495==
==69495== HEAP SUMMARY:
==69495== in use at exit: 189,122 bytes in 408 blocks
==69495== total heap usage: 530 allocs, 122 frees, 504,429 bytes allocated
==69495==
==69495== LEAK SUMMARY:
==69495== definitely lost: 1,664 bytes in 26 blocks
==69495== indirectly lost: 0 bytes in 0 blocks
==69495== possibly lost: 456 bytes in 10 blocks
==69495== still reachable: 130,172 bytes in 237 blocks
==69495== suppressed: 56,830 bytes in 135 blocks
==69495== Rerun with --leak-check=full to see details of leaked memory
==69495==
==69495== For counts of detected and suppressed errors, rerun with: -v
==69495== Use --track-origins=yes to see where uninitialised values come from
==69495== ERROR SUMMARY: 30 errors from 12 contexts (suppressed: 1 from 1)
然后不加载R。我不知道该怎么解决。我知道错误"致命错误:无法创建'R_TempDir'"可能意味着硬盘上没有更多空间,但事实并非如此。
我在macbook pro上,有High Sierra和R 3.5.0
Valgrind生成一条错误消息,告诉您unix:475系统调用未被处理。
在这种情况下,它会向来宾应用程序报告系统调用失败,错误号为ENOSYS。
darwin上的系统调用475是mkdirat系统调用。我想当这个系统调用失败时,然后R报告无法创建R_Tempdir的致命错误。
如错误消息中所示,您应该提交一份关于valgrind-bugzilla的错误报告。
您也可以尝试解决这个问题:这可能是valgrind文件中的一个微不足道的更改m_syswrap/priv_syswrap-darwin.h,以制作类似于阅读上面几行的链接。