温馨提示:本文翻译自stackoverflow.com,查看原文请点击:c - Debugging .dll with R application attachment produces "Illegal Instruction" error
c r tcl

c - 使用R应用程序附件调试.dll会产生“非法指令”错误

发布于 2020-05-07 04:17:09

我正在调试的程序是一个R GUI应用程序,它利用几个C .dll文件执行任务。我使用Visual Studio 2019作为调试器。

错误: Unhandled exception at 0x00000000279BB8CC (tcl86.dll) in rsession.exe: 0xC000001D: Illegal Instruction.

我不确定如何更深入地研究为什么tcl86.dll如此。

这是我第一次调试程序,它恰好是一个令人费解的程序,因此我不确定如何解释给出的输出。我将分享尽可能多的信息,并让我知道是否需要发布更多信息。

这是调用堆栈:

    tcl86.dll!00000000279bb8cc()    Unknown Non-user code. Binary was not built with debug information.
    tcl86.dll!000000002797f8b5()    Unknown Non-user code. Binary was not built with debug information.
    tcl86.dll!000000002797f9d2()    Unknown Non-user code. Binary was not built with debug information.
    tcl86.dll!0000000027999606()    Unknown Non-user code. Binary was not built with debug information.
    tcl86.dll!0000000027999c2b()    Unknown Non-user code. Binary was not built with debug information.
>   tkogl2.dll!del(void * clientData, Tcl_Interp * interp, int objc, Tcl_Obj * const * objv) Line 1148  C   Symbols loaded.
    tcl86.dll!00000000278a7a07()    Unknown Non-user code. Binary was not built with debug information.
    tcltk.dll!000000006c302378()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7a6542()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f3249()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c80268c()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c802f2a()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f6733()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f8bdf()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f8bdf()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f8bdf()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f8bdf()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f8bdf()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fa2()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c80268c()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c802f2a()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f6733()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c80268c()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c802f2a()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f6733()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c80268c()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c802f2a()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f6733()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c80268c()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c802f2a()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f6733()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c80268c()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c802f2a()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f6733()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f8bdf()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f8bdf()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f8bdf()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c7f8bdf()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fe1()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c803a98()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c804b1f()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c801fa2()    Unknown Non-user code. Binary was not built with debug information.
    tcltk.dll!000000006c301aae()    Unknown Non-user code. Binary was not built with debug information.
    tcl86.dll!00000000278a2492()    Unknown Non-user code. Binary was not built with debug information.
    tcl86.dll!00000000278a7a07()    Unknown Non-user code. Binary was not built with debug information.
    tcl86.dll!00000000278aa454()    Unknown Non-user code. Binary was not built with debug information.
    tk86.dll!0000000062982874() Unknown Non-user code. Binary was not built with debug information.
    tk86.dll!00000000629170bf() Unknown Non-user code. Binary was not built with debug information.
    tk86.dll!000000006292111f() Unknown Non-user code. Binary was not built with debug information.
    user32.dll!00007ffea7315b6d()   Unknown Non-user code. Cannot find or open the PDB file.
    user32.dll!00007ffea7315562()   Unknown Non-user code. Cannot find or open the PDB file.
    Rgraphapp.dll!000000006355751b()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c721365()    Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!000000000085b0e9() Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c796727()    Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!000000000085d670() Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!000000000044de43() Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!00000000004194b7() Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!0000000000894845() Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c829772()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c829a01()    Unknown Non-user code. Binary was not built with debug information.
    R.dll!000000006c829a92()    Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!00000000008a9801() Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!00000000008915cf() Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!0000000000bedf98() Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!00000000004013e8() Unknown Non-user code. Binary was not built with debug information.
    rsession.exe!000000000040151b() Unknown Non-user code. Binary was not built with debug information.
    kernel32.dll!00007ffea5b47bd4() Unknown Non-user code. Cannot find or open the PDB file.
    ntdll.dll!00007ffea754ced1()    Unknown Non-user code. Cannot find or open the PDB file.

这是调试器中的输出: alloc: invalid block: 000000002BF31390: 0 2bException thrown at 0x00000000279BB8CC (tcl86.dll) in rsession.exe: 0xC000001D: Illegal Instruction. Unhandled exception at 0x00000000279BB8CC (tcl86.dll) in rsession.exe: 0xC000001D: Illegal Instruction.

这是调试器在C代码中停止的一些代码:

else if (strcmp(shape, "specimens") == 0)
    {
        specimen_del(0);

        if (models != NULL)
        {
            Tcl_Free((char*)models);
            models = NULL; //error symbol here
        }
        if (context != NULL)
        {
            Tcl_Free((char*)context);
            context = NULL;
        }
    }

这篇文章的目的是了解如何解释调试器给出的错误和信息以及我可能能够探索的潜在解决方案。谢谢!

查看更多

提问者
hkj447
被浏览
27
Donal Fellows 2020-02-19 03:56

该消息的第一部分alloc: invalid block: 000000002BF31390: 0 2b是Tcl库之外的消息。该消息的含义是内存已超出边界内存写入限制。该消息的生成位置在Tcl的线程感知内存分配器中,而不是该错误所在的位置:它只是检测到问题的地方 一旦内存被破坏,所有关于该程序未来行为的赌注都将消失。死于非法指令错误是完全有可能的(可能是由于堆栈损坏)。

如果内存没有损坏,Tcl和Tk DLL(特别是在堆栈跟踪中)tcl86.dllTk DLL tk86.dll都不会创建超出范围的访问:我们确实非常仔细地检查了这种情况(并且开发人员构建模式使任何此类问题都可以显示出来)至少在其实施中)。但是,如果其他代码写在不该写的地方(那里有很多代码我根本无法保证),那么所有的赌注都被取消了,因为代码正确性的先决条件不再成立。

tl; dr您遇到了内存损坏问题。糟透了。

尝试使用诸如电子围栏或净化之类的内存访问跟踪工具对应用程序进行静态构建(可能还有其他人,这并不是详尽的清单);这样做对性能的影响是深远的,但是发现错误本身的机会却相当高。

最新帖子

最新文章