CN110032502B - Abnormality processing method and device and electronic equipment - Google Patents

Abnormality processing method and device and electronic equipment Download PDF

Info

Publication number
CN110032502B
CN110032502B CN201810028031.6A CN201810028031A CN110032502B CN 110032502 B CN110032502 B CN 110032502B CN 201810028031 A CN201810028031 A CN 201810028031A CN 110032502 B CN110032502 B CN 110032502B
Authority
CN
China
Prior art keywords
target application
function
dump file
application program
exception
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810028031.6A
Other languages
Chinese (zh)
Other versions
CN110032502A (en
Inventor
周志刚
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Kangjin Information Technology Co ltd
Original Assignee
Guangzhou Kangjin Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Kangjin Information Technology Co ltd filed Critical Guangzhou Kangjin Information Technology Co ltd
Priority to CN201810028031.6A priority Critical patent/CN110032502B/en
Publication of CN110032502A publication Critical patent/CN110032502A/en
Application granted granted Critical
Publication of CN110032502B publication Critical patent/CN110032502B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3624Software debugging by performing operations on the source code, e.g. via a compiler
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program

Abstract

The embodiment of the invention discloses an exception handling method, an exception handling device and electronic equipment. The method of the embodiment of the invention comprises the following steps: defining global variables in the target application program to store the running environment information of the target application program; writing a function for generating dump files in a target application program; writing an exception handling function capturing exceptions in an EXE module of a target application program; registering an exception handling function in an EXE module of the target application; when the exception handling function captures an exception, a dump file is generated by generating a function of the dump file and sent to the server. In the embodiment of the invention, the global variable is defined in the target application program, so that the dump file generated when the abnormality occurs comprises the data of the global variable, and a developer can acquire additional global variable information from the dump file to assist in analyzing the cause of the breakdown, thereby greatly helping the developer to locate the problem and improving the efficiency of analyzing the abnormality.

Description

Abnormality processing method and device and electronic equipment
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a method and an apparatus for exception handling, and an electronic device.
Background
At present, for development of Windows client software, no one can ensure that own software runs under various unknown environments, so for Windows system, the system provides corresponding application programming interfaces (Application Programming Interface, APIs) to capture the abnormality occurring in the program, after capturing the abnormality, the API function of the system can be called to generate dump file, wherein the dump file comprises a function call stack when the program is abnormal, and the client software reports the dump file to the server. The developer views the exception reason of the dump file mainly through the Windbg tool provided by Windows, wherein the most important is to view the function call stack, so that the position of the source code of the program error is known, and the problem of crashing can be solved.
However, for some abnormal situations, it is difficult to locate the cause of program error by just looking at the function call stack, which is usually caused by the abnormal situation of the parameters transferred by the function, and the environment information of the current function running needs to be known. Therefore, there is a need for a method that better assists developers in locating the cause of an application crash.
Disclosure of Invention
The embodiment of the invention provides an exception handling method, an exception handling device and electronic equipment, which are used for solving the problem that the cause of the breakdown of an application program cannot be accurately positioned when the application program is abnormal at present.
In a first aspect, the present application provides a method for exception handling, the method comprising:
defining global variables in a target application program to store the running environment information of the target application program;
writing a function for generating dump files in the target application program;
writing an exception handling function capturing exceptions in an EXE module of the target application program;
registering the exception handling function in an EXE module of the target application;
and when the exception handling function captures an exception, generating a dump file through the function generating the dump file, and sending the dump file to a server, wherein the dump file comprises the data of the global variable.
Further, writing an exception handling function capturing exceptions in an EXE module of the target application program, including:
defining an exception handling function in the target application, wherein the exception handling function defines exception type information of the process, and calling the function for generating the dump file when the exception is captured.
Further, when the exception handling function captures an exception, generating a dump file by the function that generates a dump file includes:
when the exception handling function captures an exception, writing a module for calling a function createFile provided by a system in the target application program to create a dump file;
writing a module for calling a system function MiniDumpWriteDump in the target application program so as to write the generated dump information into a dump file;
and writing the data of the global variable at the tail part of the dump file.
Further, the dump file also includes error log information generated in the running process of the target application program;
when the exception handling function captures an exception, generating a dump file through the function for generating the dump file, and further comprising:
and merging and writing the error log file generated in the running process of the target application program into the dump file.
Further, the writing the data of the global variable at the tail of the dump file includes:
and calling a system file writing function WriteFile to write the data of the global variable into the dump file.
In a second aspect, the present application provides an apparatus for exception handling, the apparatus comprising:
a definition module, configured to define global variables in a target application program, so as to store operating environment information of the target application program;
the first writing module is used for writing a function for generating a dump file in the target application program;
the second writing module is used for writing an exception handling function capturing exceptions in the EXE module of the target application program;
the registration module is used for registering the exception processing function in the EXE module of the target application program;
and the exception handling module is used for generating a dump file through the function for generating the dump file when the exception handling function captures an exception, and sending the dump file to a server, wherein the dump file comprises the data of the global variable.
Further, the second writing module is specifically configured to:
defining an exception handling function in the target application, wherein the exception handling function defines exception type information of the process, and calling the function for generating the dump file when the exception is captured.
Further, the exception handling module is specifically configured to:
when the exception handling function captures an exception, writing a module for calling a function createFile provided by a system in the target application program to create a dump file;
writing a module for calling a system function MiniDumpWriteDump in the target application program so as to write the generated dump information into a dump file;
and writing the data of the global variable at the tail part of the dump file.
Further, the dump file also includes error log information generated in the running process of the target application program;
the exception handling module is specifically further configured to:
and merging and writing the error log file generated in the running process of the target application program into the dump file.
Further, the exception handling module is specifically configured to:
and calling a system file writing function WriteFile to write the data of the global variable into the dump file.
In a third aspect, the present invention also provides an electronic device, including: the system comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor can realize the method of any one of the first aspects when executing the computer program.
In a fourth aspect, the present invention also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the method of any of the first aspects.
The embodiment of the invention defines global variables in the target application program to store the running environment information of the target application program; writing a function for generating dump files in a target application program; writing an exception handling function capturing exceptions in an EXE module of a target application program; registering an exception handling function in an EXE module of the target application; when the exception handling function captures an exception, a dump file is generated by generating a function of the dump file and sent to the server. In the embodiment of the invention, the global variable is defined in the target application program, so that the dump file generated when the abnormality occurs comprises the data of the global variable, and a developer can acquire additional global variable information from the dump file to assist in analyzing the cause of the breakdown, thereby greatly helping the developer to locate the problem and improving the efficiency of analyzing the abnormality.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a schematic diagram of one embodiment of a method of exception handling in an embodiment of the present invention;
FIG. 2 is a schematic diagram of one embodiment of step S105 in the embodiment shown in FIG. 1;
FIG. 3 is a schematic diagram of another embodiment of step S105 in the embodiment shown in FIG. 1;
FIG. 4 is a schematic diagram of an embodiment of an apparatus for exception handling in an embodiment of the present invention;
FIG. 5 is a schematic diagram of an embodiment of an electronic device in an embodiment of the invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
The terms first, second and the like in the description and in the claims and in the above-described figures, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The method for processing the abnormality in the embodiment of the invention is applied to the device for processing the abnormality, the device is positioned in the electronic equipment, the electronic equipment system in the embodiment is a Windows system, and the electronic equipment can be Windows system electronic equipment such as a mobile phone, a tablet computer or a personal computer, and also can be future newly-appearing Windows system electronic equipment, and the like.
An Exception (Exception) is an error that may occur at the time of execution of an application program that may cause the program to terminate execution. Since one of the requirements of programming is the robustness of the program, it is desirable that the program be run without or with fewer problems. However, in the actual running of the program, there are always some factors that cause the program to fail to run normally. When designing an algorithm, the normal logic processing flow of the algorithm is often designed more accurately, the processing of abnormal conditions is not easy to design comprehensively, the program is crashed when the abnormal conditions occur, and if the software occurs, extremely unfriendly experience is brought to a user. At present, the problem that the information for generating dump files after the exception is captured is limited, and the cause of the breakdown of the application program cannot be accurately positioned. Therefore, the embodiment of the invention provides an exception handling method, an exception handling device and electronic equipment, so as to solve the problem.
Referring to fig. 1, an embodiment of a method for exception handling according to an embodiment of the present invention includes:
s101, defining global variables in a target application program to store the running environment information of the target application program;
in the embodiment of the invention, the target application program is a Windows application program. It should be noted that, in the embodiment of the present invention, the application program may be an application program (APP) on a mobile terminal (such as a mobile Phone or a tablet lamp) or a computer program on a terminal (such as a personal computer), that is, may be a Windows Phone application on a mobile terminal or a Windows application program on a computer.
In this embodiment, the data stored in the global variable is the running environment information of the target application program, for example, for the live client software, the running environment information may include whether the camera is used in the current period, whether the movie is played in the current period, or whether the movie is played in the current period, the name of the game being live, the duration of the current period, and the time when the client software is started. Furthermore, in the embodiment of the invention, the sea can set a timer in the target application program, and actively update the running environment information of the target application program at intervals, so that the latest information stored by the global variable in the current period is ensured.
S102, writing a function for generating dump files in a target application program;
in this embodiment, a function of generating a dump file is written in the target application program, so that a dump file can be generated when an abnormality occurs.
S103, writing an exception handling function for capturing exceptions in an EXE module of the target application program;
for Windows application development, the development of the Windows application program is completed by splitting the Windows application program into a plurality of modules, such as an EXE module and a DLL module, wherein one module is a file, for example, one EXE module is an EXE file, and one DLL module is a DLL file, so that the Windows application program is beneficial to code sharing and division, functions can be split as much as possible, and the code coupling degree is reduced. Thus, a Windows application program is composed of an EXE file and DLL files.
In this embodiment, in order to enable the target application program to be used normally subsequently, the exception needs to be captured first, so in this embodiment, an exception handling function for capturing the exception needs to be written, so that the application program can continue to execute by handling the exception when the exception is generated.
S104, registering an exception handling function in an EXE module of the target application program;
specifically, since the application programs in the Windows system can be normally used only after registration, in this embodiment, the exception handling function written as described above needs to be registered, and when an exception occurs, the corresponding logic of the exception handling function written is executed.
S105, when the exception handling function captures an exception, generating a dump file through a function generating the dump file, and sending the dump file to a server.
The dump file includes the data of the global variable described in step S101. In this embodiment, the dump file is sent to the server, so that the development engineer downloads the dump file from the server for analysis.
The embodiment of the invention defines global variables in the target application program to store the running environment information of the target application program; writing a function for generating dump files in a target application program; writing an exception handling function capturing exceptions in an EXE module of a target application program; registering an exception handling function in an EXE module of the target application; when the exception handling function captures an exception, a dump file is generated by generating a function of the dump file and sent to the server. In the embodiment of the invention, the global variable is defined in the target application program, so that the dump file generated when the abnormality occurs comprises the data of the global variable, and a developer can acquire additional global variable information from the dump file to assist in analyzing the cause of the breakdown, thereby greatly helping the developer to locate the problem and improving the efficiency of analyzing the abnormality.
In some embodiments of the present invention, the step S103 may further include:
an exception handling function is defined in the target application, in which exception type information for handling is defined, and a function that generates dump files is called when an exception is captured.
The specific implementation is as follows:
LONG__stdcall MyUnhandledExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo){
{
CreateMiniDump(pExceptionInfo,"core.dmp");
return EXCEPTION_CONTINUE_EXECUTION;
}
an exception handling function is defined, the function name is MyUndledExceptionFilter, and the parameter pExceptionInfo transmits some exception-related information, including what exception is at the moment, such as exception 0 exception, invalid handle exception, memory access exception, and the like. In addition, createMiniDump is the function written in the above steps to generate dump files; the parameter pExceptionInfo is environment information when the system generates abnormality; the parameter "core.dmp" is the name of the dump file that needs to be generated, where dmp is the format of the dump file.
By this step, it is realized that an exception handling function capturing exceptions is written in the EXE module of the target application.
Since the corresponding API function is provided in the Windows system to register the exception handling function, the exception handling function may be registered according to the provided API function, and the specific implementation of registering the exception handling function in the EXE module of the target application in step S104 may be as follows:
SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
wherein, the system API function SetUnHandledExceptionFilter is used for registering an exception handling function; the parameter MyUnHandledExceptionFilter is the exception handling function written in the above steps. Thus, only the exception handling function is registered in the system, and when an exception occurs when the application is executed, the system will go to execute the registered exception handling function myunhandleexceptionfilter. In this function, exceptions are handled. By this step, registration of the exception handling function in the EXE module of the target application is achieved.
As shown in fig. 2, in some embodiments of the present invention, when the exception handling function captures an exception in the step S105, generating a dump file by generating a function of the dump file may further include:
s1051, when an exception handling function captures an exception, writing a module for calling a function CreateFile provided by a system in a target application program to create a dump file;
the specific implementation mode is as follows:
firstly, an interface is written in a target application program for generating a dump file, which is specifically as follows:
void CreateMiniDump(PEXCEPTION_POINTERS pep,LPCTSTR strFileName)
since dump is a file, it is also necessary to create a dump file for writing the generated dump information in this embodiment. Specifically, the function CreateFile provided by the system is called to create a file, and the method is specifically implemented as follows:
HANDLE hFile=CreateFile(strFileName,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
the parameter strFileName indicates the name of the created file.
S1052, writing a module for calling a system function MiniDumpWriteDump in a target application program to write the generated dump information into a dump file;
in this embodiment, the generated dump information is written into the dump file by calling the system function MiniDumpWriteDump in the target application program, and the specific implementation manner is as follows:
MiniDumpWriteDump(GetCurrentProcess(),GetCurrentProcessId(),hFile,MiniDumpNormal,NULL,NULL,NULL);
wherein, the system function MiniDumpWriteDump can generate the current dump information; parameter 1 is the handle of the current process and is obtained by calling the system function GetCurrentProcess; parameter 2 is the ID of the current process, and is obtained by calling the system function GetCurrentProcessId; the parameter 3hFile is a handle to be written into the file, and is a previously created file handle; parameter 4 is the input need to generate MiniDumpnormal, rather than the full amount dump.
Finally, the file handle CloseHandle (hFile) is closed, and the system function CloseHandle is called, so that the dump file is generated.
S1053, writing the data of the global variable at the tail of the dump file.
After the dump file is generated, in this embodiment, data of defined global variables are written at the tail of the dump file, so that when the dump file is sent to the server, the global variable information is carried to help the developer locate the problem.
Specifically, the system file writing function WriteFile is called to write the data of the global variable into the dump file, and the implementation mode is as follows:
WriteFile (hFile, global variable size, actual written data size, NULL);
thereby realizing the writing of the data of the global variable into the dump file.
In the embodiment of the invention, in order to further write more information into the dump file for analysis by a developer, the log content of the error level of the log file can be written into the tail part of the dump file when the program crashes, so that the developer can be greatly helped to locate the problem when the error log exists. Therefore, in the embodiment of the invention, when the exception handling function in the target application program captures an exception, the dump file generated by the function generating the dump file also comprises error log information generated in the running process of the target application program; at this time, as shown in fig. 3, when the exception handling function captures an exception, generating a dump file by the function for generating a dump file in step S105 may further include:
s1054, merging the error log files generated in the running process of the target application program and writing the merged error log files into the dump file.
Specifically, the global variable is written into the dump file by calling a file write function. Firstly, reading file contents of an error log through a file, and then writing the file contents into the tail part of a dump file, wherein the specific implementation mode is as follows:
WriteFile (hFile, log File content, log File size, actual written data size, NULL);
thereby enabling the writing of the error log into the dump file.
Finally closing the file handle CloseHandle (hFile); the system function CloseHandle is called. Whereby dump files are generated.
An embodiment of the device for exception handling in the embodiment of the present invention is described below.
Referring to fig. 4, an embodiment of an apparatus for exception handling according to an embodiment of the present invention includes:
a definition module 401, configured to define global variables in a target application program, so as to store operating environment information of the target application program;
a first writing module 402, configured to write a function for generating a dump file in the target application program;
a second writing module 403, configured to write an exception handling function for capturing exceptions in the EXE module of the target application program;
a registration module 404, configured to register the exception handling function in an EXE module of the target application program;
and the exception handling module 405 is configured to generate a dump file according to the function that generates a dump file when the exception handling function captures an exception, and send the dump file to a server, where the dump file includes data of the global variable.
Further, the second writing module 403 is specifically configured to:
defining an exception handling function in the target application, wherein the exception handling function defines exception type information of the process, and calling the function for generating the dump file when the exception is captured.
Further, the exception handling module 405 is specifically configured to:
when the exception handling function captures an exception, writing a module for calling a function createFile provided by a system in the target application program to create a dump file;
writing a module for calling a system function MiniDumpWriteDump in the target application program so as to write the generated dump information into a dump file;
and writing the data of the global variable at the tail part of the dump file.
Further, the dump file also includes error log information generated in the running process of the target application program;
the exception handling module 405 is specifically further configured to:
and merging and writing the error log file generated in the running process of the target application program into the dump file.
Further, the exception handling module 405 is specifically configured to:
and calling a system file writing function WriteFile to write the data of the global variable into the dump file.
An embodiment of the present invention further provides an electronic device, referring to fig. 5, including:
the system comprises a memory 501, a processor 502 and a computer program 503 stored in the memory and capable of running on the processor, wherein the processor 502 can implement the method for processing the exception when executing the computer program 503. Included in this computer program 503 is the target application described in the above embodiments.
For convenience of explanation, only those portions of the embodiments of the present invention that are relevant to the embodiments of the present invention are shown, and specific technical details are not disclosed, please refer to the method portions of the embodiments of the present invention. The memory 501 may be used to store a computer program 503 comprising software programs, modules and data, and the processor 502 may perform various functional applications of the electronic device and data processing by executing the computer program 503 stored in the memory 501.
In a specific implementation, the memory 501 may be used to store software programs and modules, and the processor 502 executes the software programs and modules stored in the memory 501 to perform various functional applications and data processing of the electronic device. The memory 501 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (e.g., a game-type application program, a chat-type application program), and the like; the storage data area may store data (game configuration data, audio data) created according to the use of the electronic device, and the like. In addition, memory 501 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. The processor 502 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and/or modules stored in the memory 501, and calling data stored in the memory 501, thereby performing overall monitoring of the electronic device. Optionally, the processor 502 may include one or more processing units; preferably, the processor 502 may integrate an application processor, wherein the application processor primarily handles operating systems, user interfaces, application programs and the like.
The embodiment of the invention also provides a computer readable storage medium, wherein the computer readable storage medium can store a program, and the program when executed comprises part or all of the steps of the method for exception handling described in the method embodiment.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method of exception handling, the method comprising:
defining global variables in a target application program to store the running environment information of the target application program; setting a timer in a target application program, updating the running environment information of the target application program every preset time, and updating the global variable;
writing a function for generating dump files in the target application program;
writing an exception handling function capturing exceptions in an EXE module of the target application program;
registering the exception handling function in an EXE module of the target application;
and when the exception handling function captures an exception, generating a dump file through the function generating the dump file, and sending the dump file to a server, wherein the dump file comprises the data of the global variable.
2. The method of claim 1, wherein writing the exception handling function that captures the exception in the EXE module of the target application comprises:
defining an exception handling function in the target application, wherein the exception handling function defines exception type information of the process, and calling the function for generating the dump file when the exception is captured.
3. The method of claim 1, wherein generating a dump file by the function that generates a dump file when the exception handling function captures an exception comprises:
when the exception handling function captures an exception, writing a module for calling a function createFile provided by a system in the target application program to create a dump file;
writing a module for calling a system function MiniDumpWriteDump in the target application program so as to write the generated dump information into a dump file;
and writing the data of the global variable at the tail part of the dump file.
4. The method of claim 3, wherein the dump file further includes error log information generated during the running of the target application;
when the exception handling function captures an exception, generating a dump file through the function for generating the dump file, and further comprising:
and merging and writing the error log file generated in the running process of the target application program into the dump file.
5. The method of claim 3 or 4, wherein writing the data of the global variable at the tail of the dump file comprises:
and calling a system file writing function WriteFile to write the data of the global variable into the dump file.
6. An apparatus for exception handling, the apparatus comprising:
a definition module, configured to define global variables in a target application program, so as to store operating environment information of the target application program; setting a timer in a target application program, updating the running environment information of the target application program every preset time, and updating the global variable;
the first writing module is used for writing a function for generating a dump file in the target application program;
the second writing module is used for writing an exception handling function capturing exceptions in the EXE module of the target application program;
the registration module is used for registering the exception processing function in the EXE module of the target application program;
and the exception handling module is used for generating a dump file through the function for generating the dump file when the exception handling function captures an exception, and sending the dump file to a server, wherein the dump file comprises the data of the global variable.
7. The apparatus of claim 6, wherein the second writing module is specifically configured to:
defining an exception handling function in the target application, wherein the exception handling function defines exception type information of the process, and calling the function for generating the dump file when the exception is captured.
8. The apparatus of claim 6, wherein the exception handling module is specifically configured to:
when the exception handling function captures an exception, writing a module for calling a function createFile provided by a system in the target application program to create a dump file;
writing a module for calling a system function MiniDumpWriteDump in the target application program so as to write the generated dump information into a dump file;
and writing the data of the global variable at the tail part of the dump file.
9. The apparatus of claim 6, wherein the dump file further includes error log information generated during the running of the target application;
the exception handling module is specifically further configured to:
and merging and writing the error log file generated in the running process of the target application program into the dump file.
10. An electronic device, comprising: a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor is capable of implementing the method of any one of claims 1 to 5 when executing the computer program.
CN201810028031.6A 2018-01-11 2018-01-11 Abnormality processing method and device and electronic equipment Active CN110032502B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810028031.6A CN110032502B (en) 2018-01-11 2018-01-11 Abnormality processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810028031.6A CN110032502B (en) 2018-01-11 2018-01-11 Abnormality processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN110032502A CN110032502A (en) 2019-07-19
CN110032502B true CN110032502B (en) 2023-05-26

Family

ID=67234335

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810028031.6A Active CN110032502B (en) 2018-01-11 2018-01-11 Abnormality processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110032502B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111414270B (en) * 2020-03-24 2023-05-09 北京字节跳动网络技术有限公司 Exception handling method and device
CN113010440A (en) * 2021-04-29 2021-06-22 福建天晴在线互动科技有限公司 Method and system for realizing windows program exception feedback
CN113220495B (en) * 2021-05-24 2024-04-16 浙江大华技术股份有限公司 Method and device for processing process abnormal event, electronic equipment and storage medium
CN113742122A (en) * 2021-08-19 2021-12-03 深圳Tcl新技术有限公司 Exception handling method and device, storage medium and electronic equipment
CN117149667B (en) * 2023-10-31 2024-04-05 宁德时代新能源科技股份有限公司 Abnormal data acquisition method, device, equipment and computer readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7028056B1 (en) * 2000-04-14 2006-04-11 Microsoft Corporation Method and arrangements for generating debugging information following software failures
US7069271B1 (en) * 2000-11-03 2006-06-27 Oracle International Corp. Methods and apparatus for implementing internet storefronts to provide integrated functions
EP1927943A2 (en) * 2006-11-30 2008-06-04 Hitachi, Ltd. Environmental information aggregating apparatus and method
JP2009223754A (en) * 2008-03-18 2009-10-01 Nippon Telegr & Teleph Corp <Ntt> User environment restoration system and user environment restoration method
CN101593147A (en) * 2009-04-15 2009-12-02 卡斯柯信号有限公司 Abnormal information dump method based on symbol file
CN105930224A (en) * 2016-06-28 2016-09-07 广东欧珀移动通信有限公司 Dump operation control method, device and terminal

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1329836C (en) * 2004-05-26 2007-08-01 华为技术有限公司 Method for locating program abnormity
US7890814B2 (en) * 2007-06-27 2011-02-15 Microsoft Corporation Software error report analysis
US8726240B2 (en) * 2010-05-12 2014-05-13 Salesforce.Com, Inc. Capturing replayable information at software defect locations in a multi-tenant environment
CN102768639B (en) * 2012-06-11 2015-02-18 北京奇虎科技有限公司 Operating system kernel-level error positioning method and device
CN102819466B (en) * 2012-06-29 2015-08-19 华为技术有限公司 The disposal route of operating system exception and device thereof
CN103530199B (en) * 2012-07-02 2015-12-02 腾讯科技(深圳)有限公司 A kind of method, Apparatus and system repairing running software mistake
CN103116715B (en) * 2013-03-01 2016-08-03 中标软件有限公司 Windows platform executable file API postpones to import guard method
CN104361076B (en) * 2014-11-12 2018-02-09 腾讯科技(成都)有限公司 The abnormality eliminating method and device of browser
CN104572327A (en) * 2014-12-24 2015-04-29 北京奇虎科技有限公司 Method, device and system for processing browser crash
JP6447348B2 (en) * 2015-05-01 2019-01-09 富士通株式会社 Dump data management program, dump data management method, and dump data management device
CN106649089B (en) * 2016-10-09 2019-07-09 武汉斗鱼网络科技有限公司 A kind of program crashing analysis method and system
CN106484617A (en) * 2016-10-09 2017-03-08 武汉斗鱼网络科技有限公司 Statistical method and system are automatically analyzed for the dump file of Windows software product
CN107301056A (en) * 2017-07-27 2017-10-27 上海斐讯数据通信技术有限公司 A kind of AP online upgradings processing method and processing device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7028056B1 (en) * 2000-04-14 2006-04-11 Microsoft Corporation Method and arrangements for generating debugging information following software failures
US7069271B1 (en) * 2000-11-03 2006-06-27 Oracle International Corp. Methods and apparatus for implementing internet storefronts to provide integrated functions
EP1927943A2 (en) * 2006-11-30 2008-06-04 Hitachi, Ltd. Environmental information aggregating apparatus and method
JP2009223754A (en) * 2008-03-18 2009-10-01 Nippon Telegr & Teleph Corp <Ntt> User environment restoration system and user environment restoration method
CN101593147A (en) * 2009-04-15 2009-12-02 卡斯柯信号有限公司 Abnormal information dump method based on symbol file
CN105930224A (en) * 2016-06-28 2016-09-07 广东欧珀移动通信有限公司 Dump operation control method, device and terminal

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
aws pg_dump不包括全局变量;voidcc;《http://cn.voidcc.com/question/p-dvkuniyv-ba.html》;20161114;全文 *
php vardump;php中文网;《https://www.php.cn/php-notebook-185085.html》;20160613;全文 *

Also Published As

Publication number Publication date
CN110032502A (en) 2019-07-19

Similar Documents

Publication Publication Date Title
CN110032502B (en) Abnormality processing method and device and electronic equipment
CN108255719B (en) Application program dump file acquisition method and device and electronic equipment
US9979785B2 (en) Systems and methods for restoring data from opaque data backup streams
TW200813838A (en) Method and apparatus for handling exceptions during binding to native code
CN108763060A (en) Native layers of collapse source tracing method, device, storage medium and terminal in android system
CN110737895A (en) Extending dynamic detection of malware using static and dynamic malware analysis
US10318479B2 (en) Method and device for automatically identifying junk file
JP2017146966A (en) Method and system for extending function to package file
CN109271789B (en) Malicious process detection method and device, electronic equipment and storage medium
CN106484779B (en) File operation method and device
CN110764486B (en) Method and device for operating vehicle-mounted controller, vehicle-mounted controller and storage medium
CN108132832B (en) Application program starting method and device
CN105683985A (en) Virtual machine introspection
CN112230947A (en) Upgrading method and upgrading system of operating system
US11630714B2 (en) Automated crash recovery
CN106372505A (en) Embedded system code attack-oriented quick recovery method
US20160246627A1 (en) Detecting an interrupted operation associated with a virtual machine
CN108133149B (en) Data protection method and device and electronic equipment
US8352438B1 (en) Systems and methods for contextual evaluation of files for use in file restoration
CN114253587A (en) Application program updating method and device, electronic equipment and readable storage medium
CN114356290A (en) Data processing method and device and computer readable storage medium
CN110825417A (en) Application program updating method and system
WO2020065778A1 (en) Information processing device, control method, and program
US20140075092A1 (en) Simulating eeprom in virtual distributed switches
CN116483517B (en) Virtual machine control method, device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20230511

Address after: Unit 02, Room 2202, Building 11, No. 51 Xingang East Road, Haizhu District, Guangzhou City, Guangdong Province, 510000 (for office only)

Applicant after: Guangzhou Kangjin Information Technology Co.,Ltd.

Address before: 430000 East Lake Development Zone, Wuhan City, Hubei Province, No. 1 Software Park East Road 4.1 Phase B1 Building 11 Building

Applicant before: WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant