Home > Software engineering >  O answer!!!!! 0 xc0000094, serial port communication problem!!!
O answer!!!!! 0 xc0000094, serial port communication problem!!!

Time:09-21

Recently took over others write a software, running environment is XP, peripherals is a temperature measuring instrument, the program contains the function of serial communication, with a serial port, normal communication, software running every time after 13 hours or so, I snapped, prompt application exception occurs, the unknown software error 0 xc0000094!!!!!!
When I unplug a serial port, the software running all day no problem, so I judge is a serial port communication of this code, not much said, first stick source:
//a serial port communication
LONG CMainFrame: : OnCommunication (WPARAM ch, LPARAM port)
{
Int j;

//serial port 1, connect the temperature meter
for (j=0; J<4. J++) {
If (port==m_nPorts [j] & amp; & M_tyPorts [j]=={PORT_TYPE_TEMP)
If (ch==10)//get the return code, says up
{
Cstrings STR, TSTR;

STR=m_strPortReceived [j];
M_strPortReceived [j]="";
STR. SetAt (STR) GetLength () - 1, '\ 0');
STR. TrimLeft ();
STR. TrimRight ();




If (STR. Mid (0, 2)=="!//T ")? The temperature of the monochromatic W get? T get double color temperature
{
STR=STR. Mid (2);

int i;//I is used to store to get temperature, usually for a few red, temperature or letters, such as EUUU
I=StrToInt (STR);

//only after sending the query command in processing the received data
If (m_nTempQuery [j] & gt; 0 {
M_nTempDetail [j] [m_nTempDetailCount [j] - 1]=I;

//remove the temperature of less than 10
If (I & lt; M_temp_expt_low) return 0;

//get the maximum
If (i> [j]) (int) m_fTempVal m_fTempVal [j]=(float) I;
}
}
}
The else
{
M_strPortReceived [j] +=(char) ch;

}

break;
}
}

Doubted memory leaks, but observe a resource manager in memory usage, memory has been a steady and rarely,
2. The program to send a serial port every second request to measure temperature of command? T (the temperature gauge defined request instructions, followed by a carriage return said sent), is back! TEUUU or! T1234 (1234 of them said temperature, behind also has a carriage return, table after receiving),

Sincerely for the great god, can you see suspicious, please help!!!!!!

CodePudding user response:

0 xc0000094l STATUS_INTEGER_DIVIDE_BY_ZERO integer division by 0
The DEBUG mode, open the Win32 in anomaly, DEBUG mode, it is easy to capture the exception, melt when combined with debugging stack modification solution



CodePudding user response:

reference 1st floor zgl7903 response:
0 xc0000094l STATUS_INTEGER_DIVIDE_BY_ZERO integer division by 0 the
DEBUG mode, open the Win32 in anomaly, DEBUG mode, it is easy to capture the exception, melt when combined with debugging stack modification solution
because it is in release mode, the VC6.0 as if can't find the DEBUG mode, set breakpoints can hit, but in its error after I click the debugging, the pop-up prompts, it really was an integer division by 0, but I didn't save the screenshot, last one remember like mov eda, edx, could you tell me from my post code can see may be what went wrong?

CodePudding user response:

reference 1st floor zgl7903 response:
0 xc0000094l STATUS_INTEGER_DIVIDE_BY_ZERO integer division by 0 the
The DEBUG mode, open the Win32 in anomaly, DEBUG mode, it is easy to capture the exception, melt when combined with debugging stack modification solution
eda value is 3600, edx is 0

CodePudding user response:

VC6 Release versions of debugging the individual feels too weak
Can first compiled into the Debug version, but VC6 exception to start debugging after to open, then you can set a breakpoint in the entrance of the program such as InitInstance, test and operation, such as the program to stop after the abnormal in the Debug menu to open again continue to run





CodePudding user response:

According to the information you provide, the problem might be out after receiving data processing, can consider to search devide/in this section, before and after the analysis of the code

CodePudding user response:

reference 5 floor zgl7903 reply:
according to the information you provide, the problem may be out after receiving data processing, can consider to search devide/in this section, before and after the analysis of the code
do array overflow words will report the error?

CodePudding user response:

Tip is zero, everything is possible

CodePudding user response:

Use the debug version, find where there is division instructions,

CodePudding user response:

Is back! What temperature TEUUU said? Will process the results=0?

CodePudding user response:

The log output to a file to see first ~

CodePudding user response:

Error writing the dump file and debug again

CodePudding user response:

Direct the compiler breakpoint tracking debugging, see the specific error position statement,
  • Related