Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/386.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
需要帮助分析Java崩溃吗_Java_C++_Assembly_Crash - Fatal编程技术网

需要帮助分析Java崩溃吗

需要帮助分析Java崩溃吗,java,c++,assembly,crash,Java,C++,Assembly,Crash,JRE版本:6.0_45-b06 Java虚拟机:Java热点(TM)客户端虚拟机(20.45-b01混合模式,共享windows-x86) 嗨 我们有一个java应用程序周期性地崩溃(显然多年来一直如此)。它在Windows上使用本机代码(.cpp)。以下是热点错误日志之一的堆栈顶部: ------------T H R E A D------------------ 当前线程(0x002a6c00):JavaThread“main”[\u vm中的线程,id=4168,堆栈(0x006400

JRE版本:6.0_45-b06 Java虚拟机:Java热点(TM)客户端虚拟机(20.45-b01混合模式,共享windows-x86)

我们有一个java应用程序周期性地崩溃(显然多年来一直如此)。它在Windows上使用本机代码(.cpp)。以下是热点错误日志之一的堆栈顶部:

------------T H R E A D------------------

当前线程(0x002a6c00):JavaThread“main”[\u vm中的线程,id=4168,堆栈(0x00640000,0x00690000)]

siginfo:ExceptionCode=0xc0000005,读取地址0xCCCC

Registers:
EAX=0xcccccccc, EBX=0x0068fa2c, ECX=0x0068f940, EDX=0xcccccccc
ESP=0x0068f900, EBP=0x0068f900, ESI=0x002a6c00, EDI=0x002a6d28
EIP=0x6da12c06, EFLAGS=0x00010286

Top of Stack: (sp=0x0068f900)
0x0068f900:   0068f91c 6d8fe0d1 cccccccc 002a6d28
0x0068f910:   002a6c00 0068fa2c 0068f940 0068f934
0x0068f920:   6d8fe1a5 0068f940 cccccccc 002a6c00
0x0068f930:   002a6c00 0068f960 6d973a71 cccccccc
0x0068f940:   002a6c00 0068f9c0 0068f970 0068fa2c
0x0068f950:   002a6c00 002a75e0 0000026d 6db0848c
0x0068f960:   0068f9c0 042307a2 002a6d28 cccccccc
0x0068f970:   0068fa2c 04290e18 0068fa2c cccccccc 

Instructions: (pc=0x6da12c06)
0x6da12be6:   24 c0 3c 80 75 01 4f 41 3b ca 7c f1 5e 8b c7 5f
0x6da12bf6:   5d c3 cc cc cc cc cc cc cc cc 55 8b ec 8b 55 08
0x6da12c06:   8a 0a 33 c0 84 c9 74 13 8b ff 80 e1 c0 80 f9 80
0x6da12c16:   74 01 40 8a 4a 01 42 84 c9 75 ef 5d c3 cc cc cc 


Register to memory mapping:

EAX=0xcccccccc is an unknown value
EBX=0x0068fa2c is pointing into the stack for thread: 0x002a6c00
ECX=0x0068f940 is pointing into the stack for thread: 0x002a6c00
EDX=0xcccccccc is an unknown value
ESP=0x0068f900 is pointing into the stack for thread: 0x002a6c00
EBP=0x0068f900 is pointing into the stack for thread: 0x002a6c00
ESI=0x002a6c00 is a thread
EDI=0x002a6d28 is an unknown value

Stack: [0x00640000,0x00690000],  sp=0x0068f900,  free space=318k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x132c06]
V  [jvm.dll+0x1e0d1]
V  [jvm.dll+0x1e1a5]
V  [jvm.dll+0x93a71]
C  [MSWordCOMBatch.dll+0x107a2]  Java_com_ams_cnl_common_MSWordCOMBatch_connectToWord+0xf239
C  [MSWordCOMBatch.dll+0xfceb]  Java_com_ams_cnl_common_MSWordCOMBatch_connectToWord+0xe782
j  com.ams.cnl.common.MSWordCOMBatch.addDocument(Ljava/lang/String;)Ljava/lang/String;+0
j  com.ams.cnl.common.CNLBatchPrintProcess.printSingleTemplateLetters(Ljava/util/ArrayList;Ljava/lang/String;IIZ)V+338
我使用此处提供的说明反汇编了mswordcobatch.dll:

图像库为10000000。这是100107A2偏移量的组件

偏移量100107A2

100107A2: 3B F4              cmp         esi,esp
100107A4: E8 47 43 00 00     call        10014AF0
100107A9: 5F                 pop         edi
100107AA: 5E                 pop         esi
100107AB: 5B                 pop         ebx
100107AC: 83 C4 44           add         esp,44h
100107AF: 3B EC              cmp         ebp,esp
100107B1: E8 3A 43 00 00     call        10014AF0
100107B6: 8B E5              mov         esp,ebp
100107B8: 5D                 pop         ebp
100107B9: C2 04 00           ret         4
偏移量10014AF0

10014AF0: 75 01              jne         10014AF3
10014AF2: C3                 ret
10014AF0: 75 01              jne         10014AF3
10014AF2: C3                 ret
偏移量10014AF3

10014AF3: 55                 push        ebp
10014AF4: 8B EC              mov         ebp,esp
10014AF6: 83 EC 00           sub         esp,0
10014AF9: 50                 push        eax
10014AFA: 52                 push        edx
10014AFB: 53                 push        ebx
10014AFC: 56                 push        esi
10014AFD: 57                 push        edi
10014AFE: CC                 int         3
10014AFF: 5F                 pop         edi
10014B00: 5E                 pop         esi
10014B01: 5B                 pop         ebx
10014B02: 5A                 pop         edx
10014B03: 58                 pop         eax
10014B04: 8B E5              mov         esp,ebp
10014B06: 5D                 pop         ebp
10014B07: C3                 ret
10014AF3: 55                 push        ebp
10014AF4: 8B EC              mov         ebp,esp
10014AF6: 83 EC 00           sub         esp,0
10014AF9: 50                 push        eax
10014AFA: 52                 push        edx
10014AFB: 53                 push        ebx
10014AFC: 56                 push        esi
10014AFD: 57                 push        edi
10014AFE: CC                 int         3
10014AFF: 5F                 pop         edi
10014B00: 5E                 pop         esi
10014B01: 5B                 pop         ebx
10014B02: 5A                 pop         edx
10014B03: 58                 pop         eax
10014B04: 8B E5              mov         esp,ebp
10014B06: 5D                 pop         ebp
10014B07: C3                 ret
第二连接字框架 偏移量1000FCEB

1000FCE6: E8 E5 15 FF FF     call        100012D0
1000FCEB: 8B 4D F4           mov         ecx,dword ptr [ebp-0Ch]
1000FCEE: 64 89 0D 00 00 00  mov         dword ptr fs:[00000000h],ecx
        00
1000FCF5: 5F                 pop         edi
1000FCF6: 5E                 pop         esi
1000FCF7: 5B                 pop         ebx
1000FCF8: 83 C4 60           add         esp,60h
1000FCFB: 3B EC              cmp         ebp,esp
1000FCFD: E8 EE 4D 00 00     call        10014AF0
1000FD02: 8B E5              mov         esp,ebp
1000FD04: 5D                 pop         ebp
1000FD05: C2 0C 00           ret         0Ch
偏移量10014AF0

10014AF0: 75 01              jne         10014AF3
10014AF2: C3                 ret
10014AF0: 75 01              jne         10014AF3
10014AF2: C3                 ret
偏移量10014AF3

10014AF3: 55                 push        ebp
10014AF4: 8B EC              mov         ebp,esp
10014AF6: 83 EC 00           sub         esp,0
10014AF9: 50                 push        eax
10014AFA: 52                 push        edx
10014AFB: 53                 push        ebx
10014AFC: 56                 push        esi
10014AFD: 57                 push        edi
10014AFE: CC                 int         3
10014AFF: 5F                 pop         edi
10014B00: 5E                 pop         esi
10014B01: 5B                 pop         ebx
10014B02: 5A                 pop         edx
10014B03: 58                 pop         eax
10014B04: 8B E5              mov         esp,ebp
10014B06: 5D                 pop         ebp
10014B07: C3                 ret
10014AF3: 55                 push        ebp
10014AF4: 8B EC              mov         ebp,esp
10014AF6: 83 EC 00           sub         esp,0
10014AF9: 50                 push        eax
10014AFA: 52                 push        edx
10014AFB: 53                 push        ebx
10014AFC: 56                 push        esi
10014AFD: 57                 push        edi
10014AFE: CC                 int         3
10014AFF: 5F                 pop         edi
10014B00: 5E                 pop         esi
10014B01: 5B                 pop         ebx
10014B02: 5A                 pop         edx
10014B03: 58                 pop         eax
10014B04: 8B E5              mov         esp,ebp
10014B06: 5D                 pop         ebp
10014B07: C3                 ret
以下是MSWordCOMBatch.cpp中的代码:

#include <afx.h>
#include <Afxdisp.h>
#include <Afxwin.h>
#include <comdef.h>
#include "com_ams_cnl_common_MSWordCOMBatch.h"
#include "MSWordCOMBatch.h"
#include <winspool.h>
#include <Winuser.h>
#include <Windows.h>

int miConnectOption;
char* msTemplateDir = NULL;
bool mbWordWasRunning;
bool mbOpen;
bool mbLoadPrintDuplex = false;
ApplicationPtr moWord;
_DocumentPtr moDoc;

/* other methods not included, can provide as needed */

/**
 * connectToWord()
*/
void connectToWord(int fiOption, char* fsTemplateDir)
{   
    miConnectOption = fiOption;
    msTemplateDir = fsTemplateDir;

    mbWordWasRunning = false;
    mbOpen = false;

    if (moDoc != NULL) moDoc.Release();
    if (moWord != NULL) moWord.Release();

    // Create word object
    if (mbOpen == false)
    {
    moWord.CreateInstance("Word.Application");
    mbOpen = true;
    miConnectOption = 1;
}

    return;
}
#包括
#包括
#包括
#包括
#包括“com_ams_cnl_common_mswordcobatch.h”
#包括“MSWordCOMBatch.h”
#包括
#包括
#包括
int微连接选择;
char*msTemplateDir=NULL;
布尔正在跑步;
布尔姆博潘;
bool mbLoadPrintDuplex=false;
应用程序PTR moWord;
_moDoc文件;
/*未包括的其他方法,可根据需要提供*/
/**
*connectToWord()
*/
void connectToWord(int-fiOption,char*fsTemplateDir)
{   
miConnectOption=fiOption;
msTemplateDir=fsTemplateDir;
mbWordWasRunning=false;
mbOpen=假;
如果(moDoc!=NULL)moDoc.Release();
如果(moWord!=NULL)moWord.Release();
//创建word对象
如果(mbOpen==false)
{
CreateInstance(“Word.Application”);
mbOpen=真;
miConnectOption=1;
}
返回;
}
问题是我不知道汇编或cpp.)我很难将汇编翻译成cpp


非常感谢您提供的任何帮助。谢谢

您得到的是一个未处理的异常0xc0000005-访问冲突。 你的反汇编代码真的毫无意义。很抱歉它仅显示标准Windows SEH结构化异常处理的条目。它的目的是向您展示一个带有错误代码的奇特对话框

我很确定你的问题是

moWord.CreateInstance("Word.Application");
在某些情况下生成空指针异常

if (moWord != NULL) moWord.Release();

// Create word object
if (mbOpen == false)
{
    moWord.CreateInstance("Word.Application");

在这里,您首先检查对象是否存在,然后释放它。但是如果你不知道这个对象,你就永远不会得到它。

如果你不知道C++,我不知道把汇编程序翻译成C++的人的努力会对你有什么帮助?这个C++片段并不令人印象深刻。全局变量。没有异常处理。不支持Unicode目录名。可能访问
moWord
moDoc
中处于未定义状态(未初始化或内存泄漏)的变量。程序集列表和日志并没有指明到底出了什么问题(寄存器丢失)。如果您要维护应用程序,那么将一些代码重写为更易于维护的形状似乎是一个很好的机会,请参阅获取一些灵感从日志中添加了寄存器信息。还从.cpp文件中添加了更多内容,让您了解代码有多旧。谢谢