CN115525464A - A system, method and storage medium for dealing with application program crash - Google Patents
A system, method and storage medium for dealing with application program crash Download PDFInfo
- Publication number
- CN115525464A CN115525464A CN202211213740.4A CN202211213740A CN115525464A CN 115525464 A CN115525464 A CN 115525464A CN 202211213740 A CN202211213740 A CN 202211213740A CN 115525464 A CN115525464 A CN 115525464A
- Authority
- CN
- China
- Prior art keywords
- crash
- signal
- main program
- restart
- application program
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0793—Remedial or corrective actions
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/079—Root cause analysis, i.e. error or fault diagnosis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Quality & Reliability (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Retry When Errors Occur (AREA)
- Stored Programmes (AREA)
Abstract
Description
技术领域technical field
本发明涉及电子设备技术领域,尤其涉及一种应对应用程序崩溃的系统、方法和存储介质。The invention relates to the technical field of electronic equipment, in particular to a system, method and storage medium for dealing with application program crashes.
背景技术Background technique
随着互联网的发展,各类应用程序也随之而生,为了满足用户的使用需求,不同功能的应用程序不断被研发出来,极大的方便了用户的生活和工作,同时,也造成了用户需要使用大量的应用程序的情况。With the development of the Internet, various applications have emerged. In order to meet the needs of users, applications with different functions have been continuously developed, which greatly facilitates the life and work of users. At the same time, it also causes users Situations that require the use of a large number of applications.
目前,为了提高用户的体验度,要求应用程序能够不间断的运行,然而,基于各种硬件、软件或操作不当等方面的原因,应用程序经常会发生概率性崩溃,并且应用程序在崩溃后会弹出一个错误报告框,阻止崩溃后的应用程序进程退出,只有当用户手动关闭错误报告框时,崩溃的应用程序进程才会关闭。也就是说,应用程序在崩溃后,需要人工手动处理错误报告框,才能关闭应用程序进程。At present, in order to improve user experience, applications are required to run uninterrupted. However, based on various reasons such as hardware, software, or improper operation, applications often crash probabilistically, and applications will crash after crashes. An error report box pops up to prevent the crashed application process from exiting. Only when the user closes the error report box manually, the crashed application process will be closed. That is to say, after the application program crashes, it is necessary to manually process the error report box to close the application process.
因此,现有技术中,在应用程序崩溃后,存在需要人工手动处理错误报告框才能关闭应用程序,从而导致主程序崩溃后的重启速度慢的问题。Therefore, in the prior art, after the application program crashes, it is necessary to manually process the error report box to close the application program, which leads to the problem that the restart speed of the main program after the crash is slow.
发明内容Contents of the invention
有鉴于此,有必要提供一种应对应用程序崩溃的系统、方法和存储介质,用于解决现有技术中在应用程序崩溃后,存在的需要人工手动处理错误报告框才能关闭应用程序的问题。In view of this, it is necessary to provide a system, method and storage medium for dealing with application program crashes, which are used to solve the problem in the prior art that the application program needs to be manually processed to close the application program after the application program crashes.
为了解决上述问题,本发明提供一种应对应用程序崩溃的系统,包括:In order to solve the above problems, the present invention provides a system for dealing with application program crashes, including:
崩溃信号采集模块,用于获取应用程序的崩溃信号;The crash signal acquisition module is used to acquire the crash signal of the application program;
崩溃异常处理模块,与崩溃信号采集模块耦接,用于根据崩溃信号关闭主程序并输出重启信号;The crash exception processing module is coupled with the crash signal acquisition module, and is used to close the main program according to the crash signal and output a restart signal;
重启模块,与崩溃异常处理模块耦接,用于根据重启信号重新启动主程序。The restart module, coupled with the crash exception handling module, is used to restart the main program according to the restart signal.
进一步地,崩溃信号采集模块包括等待单元,用于根据主程序的运行状态获取应用程序的崩溃信号。Further, the crash signal acquisition module includes a waiting unit, which is used to acquire the crash signal of the application program according to the running status of the main program.
进一步地,崩溃异常处理模块包括崩溃异常处理单元和状态判别单元,其中,崩溃异常处理单元用于根据崩溃信号关闭主程序,状态判别单元用于根据主程序的开闭状态输出重启信号。Further, the crash exception processing module includes a crash exception processing unit and a state judgment unit, wherein the crash exception processing unit is used to close the main program according to the crash signal, and the state judgment unit is used to output a restart signal according to the opening and closing state of the main program.
进一步地,重启模块包括创建进程单元,用于根据重启信号启动主程序。Further, the restart module includes creating a process unit for starting the main program according to the restart signal.
为了解决上述问题,本发明还提供一种应对应用程序崩溃的方法,,包括:In order to solve the above problems, the present invention also provides a method for dealing with application program crashes, including:
获取应用程序的崩溃信号;Get the crash signal of the application;
根据崩溃信号关闭主程序并输出重启信号;Close the main program according to the crash signal and output a restart signal;
根据重启信号重新启动主程序。Restart the main program according to the restart signal.
进一步地,获取应用程序的崩溃信号,包括:Further, obtain the crash signal of the application, including:
设置等待函数,根据等待函数获取主程序的运行状态;Set the waiting function, and obtain the running status of the main program according to the waiting function;
根据主程序的运行状态,判断是否输出应用程序的崩溃信号;According to the running state of the main program, it is judged whether to output the crash signal of the application program;
当主程序的运行状态为崩溃退出时,输出应用程序的崩溃信号;当主程序的运行状态正常运行时,保持当前运行状态。When the running state of the main program is crash and exit, output the crash signal of the application program; when the running state of the main program is running normally, keep the current running state.
进一步地,根据崩溃信号关闭主程序并输出重启信号,包括:Further, close the main program according to the crash signal and output a restart signal, including:
设置崩溃异常处理函数和状态判别函数;Set crash exception handling function and state discrimination function;
崩溃异常处理函数根据崩溃信号,输出关闭主程序的指令;The crash exception handling function outputs an instruction to close the main program according to the crash signal;
状态判别函数根据主程序的开闭状态判断是否输出重启信号;The state discrimination function judges whether to output the restart signal according to the opening and closing state of the main program;
当主程序的开闭状态为关闭时,输出重启信号;当主程序的开闭状态为打开时,保持当前运行状态。When the opening and closing state of the main program is closed, the restart signal is output; when the opening and closing state of the main program is open, the current running state is maintained.
进一步地,崩溃异常处理函数是基于SetUnhandledExceptionFilter函数进行设置。Further, the crash exception handling function is set based on the SetUnhandledExceptionFilter function.
进一步地,根据重启信号重新启动主程序,包括:Further, restart the main program according to the restart signal, including:
设置重启函数,根据重启信号输出重新启动主程序的指令。A restart function is set, and an instruction to restart the main program is output according to the restart signal.
为了解决上述问题,本发明还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,其中,当计算机程序运行时控制计算机可读存储介质所在设备执行如上文所述的应对应用程序崩溃的方法。In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which a computer program is stored, wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to perform the above-mentioned processing App crash method.
采用上述技术方案的有益效果是:本发明提供一种应对应用程序崩溃的系统、方法和存储介质,该系统包括:崩溃信号采集模块,用于获取应用程序的崩溃信号;崩溃异常处理模块,与崩溃信号采集模块耦接,用于根据崩溃信号关闭主程序并输出重启信号;重启模块,与崩溃异常处理模块耦接,用于根据重启信号重新启动主程序。通过崩溃异常处理模块根据崩溃信号指导关闭主程序,从而避免系统生成错误报告框,减少人工手动操作的步骤;通过重启模块在确认主程序完全关闭后重新启动主程序,从而实现重启应用程序,不仅避免了操作不当的问题,并且实现了对主程序关闭及重启过程的时间统筹,能够减少过程中的空余时间,从而有效提高主程序崩溃后的重启速度。The beneficial effects of adopting the above technical solution are: the present invention provides a system, method and storage medium for dealing with application program crashes, the system includes: a crash signal acquisition module for acquiring application program crash signals; a crash exception processing module, and The crash signal acquisition module is coupled to close the main program according to the crash signal and output a restart signal; the restart module is coupled to the crash exception processing module and is used to restart the main program according to the restart signal. The crash exception processing module guides the shutdown of the main program according to the crash signal, thereby avoiding the system from generating an error report box and reducing the steps of manual operations; the restart module restarts the main program after confirming that the main program is completely closed, so as to restart the application program, not only The problem of improper operation is avoided, and the time coordinating the closing and restarting process of the main program is realized, which can reduce the idle time in the process, thereby effectively improving the restart speed after the main program crashes.
附图说明Description of drawings
图1为本发明提供的应对应用程序崩溃的系统一实施例的结构示意图;FIG. 1 is a schematic structural diagram of an embodiment of a system for dealing with application program crashes provided by the present invention;
图2为本发明提供的应对应用程序崩溃的方法一实施例的流程示意图;FIG. 2 is a schematic flowchart of an embodiment of a method for dealing with application program crashes provided by the present invention;
图3为本发明提供的获取应用程序的崩溃信号一实施例的流程示意图;FIG. 3 is a schematic flow diagram of an embodiment of obtaining a crash signal of an application provided by the present invention;
图4为本发明提供的根据崩溃信号关闭主程序并输出重启信号一实施例的流程示意图。Fig. 4 is a schematic flowchart of an embodiment of closing the main program according to the crash signal and outputting the restart signal provided by the present invention.
具体实施方式detailed description
下面结合附图来具体描述本发明的优选实施例,其中,附图构成本申请一部分,并与本发明的实施例一起用于阐释本发明的原理,并非用于限定本发明的范围。Preferred embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of the application and together with the embodiments of the present invention are used to explain the principle of the present invention and are not intended to limit the scope of the present invention.
在本发明的描述中,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。此外,“多个”的含义是至少两个,例如两个,三个等,除非另有明确具体的限定。In the description of the present invention, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include at least one of these features. In addition, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
在本发明的描述中,提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本发明的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,所描述的实施例可以与其它实施例相结合。In the description of the present invention, reference to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present invention. The occurrences of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is understood explicitly and implicitly by those skilled in the art that the described embodiments can be combined with other embodiments.
在本发明的描述中,流程之间步骤的执行顺序并不限于文中出现的顺序,其相应的顺序可以调整先后,或者并列出现。In the description of the present invention, the execution order of the steps between the processes is not limited to the order presented in the text, and the corresponding order can be adjusted or appear in parallel.
在描述实施例之前,对主程序、守护程序、SetUnhandledExceptionFilter进行释义:Before describing the embodiment, explain the main program, daemon program and SetUnhandledExceptionFilter:
主程序是指会概率性崩溃的程序。The main program refers to the program that will crash probabilistically.
守护程序是指能够获取主程序部分运行参数的程序。A daemon is a program that can obtain some operating parameters of the main program.
SetUnhandledExceptionFilter是指Windows系统中的设置异常捕获函数,当主程序进程发生导致崩溃的异常后,系统会调用SetUnhandledExceptionFilter所设置的异常处理函数。SetUnhandledExceptionFilter refers to the setting exception capture function in the Windows system. When an exception occurs in the main program process that causes a crash, the system will call the exception handling function set by SetUnhandledExceptionFilter.
目前,在应用程序发生概率性崩溃后,系统会弹出一个错误报告框,阻止崩溃后的应用程序进程退出,从而实现输出应用程序崩溃的提示,并且针对该提示,只有当人工手动处理错误报告框后,才能关闭应用程序进程。然而,针对应用程序崩溃的情况,用户更在意的是该应用程序的恢复,或者是不影响使用其他应用程序。At present, after a probabilistic crash of the application, the system will pop up an error report box to prevent the application process from exiting after the crash, so as to output the prompt of the application crash, and for this prompt, only when the error report box is manually processed Only then can the application process be closed. However, in the case of an application program crashing, the user is more concerned about the recovery of the application program, or whether it does not affect the use of other applications.
因此,现有技术在应对应用程序崩溃时,存在需要人工手动处理错误报告框才能关闭应用程序的问题。Therefore, in the prior art, there is a problem that the application program needs to be manually processed to close the application program when dealing with the crash of the application program.
为了解决上述问题,本发明提供了一种应对应用程序崩溃的系统、方法和存储介质,以下分别进行详细说明。In order to solve the above problems, the present invention provides a system, method and storage medium for coping with application program crashes, which will be described in detail below.
如图1所示,图1为本发明提供的应对应用程序崩溃的系统一实施例的结构示意图,应对应用程序崩溃的系统100包括:As shown in FIG. 1, FIG. 1 is a schematic structural diagram of an embodiment of a system for dealing with application program crashes provided by the present invention. The
崩溃信号采集模块101,用于获取应用程序的崩溃信号;A crash
崩溃异常处理模块102,与崩溃信号采集模块101耦接,用于根据崩溃信号关闭主程序并输出重启信号;The crash
重启模块103,与崩溃异常处理模块102耦接,用于根据重启信号重新启动主程序。The
本实施例中,首先,由崩溃信号采集模块101根据应用程序的运行参数获取到应用程序的崩溃信号;然后,崩溃异常处理模块102在崩溃信号的作用下被激活,根据崩溃信号输出关闭主程序的指令,并在主程序完全关闭后,输出重启主程序的信号;最后,重启模块103在重启信号的驱动下,重新启动主程序。In this embodiment, firstly, the crash signal of the application program is obtained by the crash
本实施例中,通过设置崩溃异常处理模块102,在接收到应用程序的崩溃信号后立即发出关闭主程序的指令,使得在系统发出错误报告框之前使得系统接收到“关闭主程序”的指令,避免系统发出错误报告框,从而完全避免了需要人工手动关闭错误报告框的问题;进一步地,本实施例中的崩溃异常处理模块102还在确认主程序完全关闭后输出重启信号,重启模块103根据重启信号重新启动主程序,从而实现重启应用程序。In this embodiment, by setting the crash
本实施例中,应用程序中包括主程序和守护程序,主程序是应用程序的主要部分,与应用程序的运行相关;守护程序是应用程序的边缘部分,不涉及主程序的运行。In this embodiment, the application program includes a main program and a daemon program. The main program is the main part of the application program and is related to the running of the application program. The daemon program is a marginal part of the application program and does not involve the running of the main program.
作为优选的实施例,崩溃信号采集模块101包括等待单元,用于根据主程序的运行状态获取应用程序的崩溃信号。As a preferred embodiment, the crash
作为优选的实施例,崩溃异常处理模块102包括崩溃异常处理单元和状态判别单元,其中,崩溃异常处理单元用于根据崩溃信号关闭主程序,状态判别单元用于根据主程序的开闭状态输出重启信号。As a preferred embodiment, the crash
作为优选的实施例,重启模块103包括创建进程单元,用于根据重启信号启动主程序。As a preferred embodiment, the
为了解决上述问题,本发明提供了一种应对应用程序崩溃的方法,如图2所示,图2为本发明提供的应对应用程序崩溃的方法一实施例的流程示意图,包括:In order to solve the above problems, the present invention provides a method for dealing with application program crashes, as shown in FIG. 2 , which is a schematic flowchart of an embodiment of the method for dealing with application program crashes provided by the present invention, including:
步骤S101:获取应用程序的崩溃信号。Step S101: Obtain a crash signal of the application program.
步骤S102:根据崩溃信号关闭主程序并输出重启信号。Step S102: Close the main program according to the crash signal and output a restart signal.
步骤S103:根据重启信号重新启动主程序。Step S103: Restart the main program according to the restart signal.
本实施例中,首先,获取应用程序的崩溃信号;然后,根据崩溃信号关闭主程序,并在完全关闭主程序后输出重启信号;最后,根据重启信号重新启动主程序。In this embodiment, firstly, the crash signal of the application program is obtained; then, the main program is closed according to the crash signal, and a restart signal is output after the main program is completely closed; finally, the main program is restarted according to the restart signal.
本实施例中,通过在接收到应用程序的崩溃信号后,立即关闭应用程序中的主程序,从而避免了系统生成错误报告框;然后在完全关闭主程序后输出重启信号,并根据重启信号重新启动主程序,提高了主程序崩溃后重启的速度。In this embodiment, by closing the main program in the application program immediately after receiving the crash signal of the application program, thereby avoiding the system from generating an error report box; Start the main program, which improves the speed of restarting after the main program crashes.
作为优选的实施例,在步骤S101中,为了获取应用程序的崩溃信号,如图3所示,图3为本发明提供的获取应用程序的崩溃信号一实施例的流程示意图,包括:As a preferred embodiment, in step S101, in order to obtain the crash signal of the application program, as shown in FIG. 3 , FIG. 3 is a schematic flowchart of an embodiment of obtaining the crash signal of the application program provided by the present invention, including:
步骤S111:设置等待函数,根据等待函数获取主程序的运行状态。Step S111: Set a waiting function, and obtain the running state of the main program according to the waiting function.
步骤S112:根据主程序的运行状态,判断是否输出应用程序的崩溃信号。Step S112: According to the running state of the main program, determine whether to output a crash signal of the application program.
步骤S113:当主程序的运行状态为崩溃退出时,输出应用程序的崩溃信号;当主程序的运行状态正常运行时,保持当前运行状态。Step S113: When the running state of the main program is crash and exit, output the crash signal of the application program; when the running state of the main program is running normally, keep the current running state.
本实施例中,通过设置等待函数,获取主程序的运行参数,从而对应地获取主程序的运行状态;然后,根据主程序的运行状态,当主程序的运行状态为崩溃退出时,输出应用程序的崩溃信号;当主程序的运行状态正常运行时,保持当前运行状态。In this embodiment, the operating parameters of the main program are obtained by setting the waiting function, thereby correspondingly obtaining the operating state of the main program; then, according to the operating state of the main program, when the operating state of the main program is crash exit, the output application program The crash signal of the main program; when the running state of the main program is running normally, keep the current running state.
在一具体的实施例中,等待函数采用WaitForSingleObject函数,以主程序的句柄作为第一个参数,第一个参数为handle,INFINITE作为第二个参数,表示等待的时间为无限长。In a specific embodiment, the waiting function adopts the WaitForSingleObject function, the handle of the main program is used as the first parameter, the first parameter is handle, and INFINITE is used as the second parameter, indicating that the waiting time is infinite.
如果主程序崩溃退出,WaitForSingleObject函数会立刻返回,说明handle所指向的对象状态改变,输出应用程序的崩溃信号;如果主程序正常运行,则WaitForSingleObject一直等待。If the main program crashes and exits, the WaitForSingleObject function will return immediately, indicating that the state of the object pointed to by handle has changed, and output the crash signal of the application; if the main program is running normally, WaitForSingleObject will wait forever.
具体的,等待函数中运行的相关伪代码如下:Specifically, the relevant pseudocodes running in the waiting function are as follows:
作为优选的实施例,在步骤S102中,为了根据崩溃信号关闭主程序并输出重启信号,如图4所示,图4为本发明提供的根据崩溃信号关闭主程序并输出重启信号一实施例的流程示意图,包括:As a preferred embodiment, in step S102, in order to close the main program according to the crash signal and output a restart signal, as shown in Figure 4, Figure 4 is an embodiment of closing the main program according to the crash signal and outputting a restart signal provided by the present invention Schematic diagram of the process, including:
步骤S121:设置崩溃异常处理函数和状态判别函数。Step S121: Set a crash exception handling function and a state discrimination function.
步骤S122:崩溃异常处理函数根据崩溃信号,输出关闭主程序的指令。Step S122: The crash exception handling function outputs an instruction to close the main program according to the crash signal.
步骤S123:状态判别函数根据主程序的开闭状态判断是否输出重启信号。Step S123: The state judging function judges whether to output a restart signal according to the on/off state of the main program.
步骤S124:当主程序的开闭状态为关闭时,输出重启信号;当主程序的开闭状态为打开时,保持当前运行状态。Step S124: When the opening and closing state of the main program is closed, output a restart signal; when the opening and closing state of the main program is open, maintain the current running state.
本实施例中,通过设置崩溃异常处理函数,能够在获取到崩溃信号时,及时输出关闭主程序的指令;通过设置状态判别函数,能够及时获取到主程序的开闭状态,并在主程序完全关闭后输出重启信号,实现以最快的速度输出重启信号,从而提高主程序崩溃后的重启速度。In this embodiment, by setting the crash exception handling function, the command to close the main program can be output in time when the crash signal is obtained; Output the restart signal after closing, realize the output restart signal at the fastest speed, so as to improve the restart speed after the main program crashes.
作为优选的实施例,在步骤S121中,崩溃异常处理函数是基于SetUnhandledExceptionFilter函数进行设置的,作为系统指定的在应用程序崩溃后启动的SetUnhandledExceptionFilter函数,以其为基础设置崩溃异常处理函数,能够较好地满足适配性,避免由于适配性不高导致的使用过程不稳定现象。As a preferred embodiment, in step S121, the crash exception handling function is set based on the SetUnhandledExceptionFilter function, as the SetUnhandledExceptionFilter function specified by the system to start after the application program crashes, the crash exception handling function is set based on it, which can be better Satisfy the adaptability as much as possible, and avoid the instability of the use process caused by the poor adaptability.
在一具体的实施例中,崩溃异常处理函数采用UnhandledExceptionFilter函数,在捕获到崩溃信号后,系统调用UnhandledExceptionFilter函数,若函数直接返回EXCEPTION_EXECUTE_HANDLER,则表示异常已处理,这样系统就不会创建错误报告框进程,从而避免了人工手动操作处理错误报告框。In a specific embodiment, the crash exception handling function adopts the UnhandledExceptionFilter function. After the crash signal is captured, the system calls the UnhandledExceptionFilter function. If the function directly returns EXCEPTION_EXECUTE_HANDLER, it means that the exception has been processed, so that the system will not create an error report box process. , thereby avoiding the manual handling of error reporting boxes by humans.
具体的,崩溃异常处理函数运行的相关伪代码如下:Specifically, the relevant pseudocode of the crash exception handling function is as follows:
(1)定义崩溃异常处理函数(1) Define the crash exception handling function
(2)注册崩溃异常处理函数(2) Register crash exception handling function
begin:begin:
SetUnhandledExceptionFilter(UnhandledExcepFilter);SetUnhandledExceptionFilter(UnhandledExcepFilter);
End;end;
作为优选的实施例,在步骤S103中,为了根据重启信号重新启动主程序,设置重启函数,根据重启信号输出重新启动主程序的指令。As a preferred embodiment, in step S103, in order to restart the main program according to the restart signal, a restart function is set, and an instruction to restart the main program is output according to the restart signal.
本实施例中,通过重启函数及时地获取重启信号,并根据重启信号输出重新启动主程序的指令,能够减少捕获重启信号的时间,有效提高主程序崩溃后的重启速度。In this embodiment, the restart signal is obtained in time through the restart function, and an instruction to restart the main program is output according to the restart signal, which can reduce the time for capturing the restart signal and effectively improve the restart speed of the main program after it crashes.
在一具体的实施例中,重启函数采用CreateProcess函数,在捕获到重启信号后,调用CreateProcess函数启动主程序,保存CreateProcess函数返回的主程序的句柄,其中,句柄用变量名为Handle的变量存储。In a specific embodiment, the restart function adopts the CreateProcess function. After the restart signal is captured, the CreateProcess function is called to start the main program, and the handle of the main program returned by the CreateProcess function is preserved, wherein the handle is stored in a variable named Handle.
通过上述方式,在检测到应用程序崩溃的信号后,首先,通过崩溃异常处理模块中的崩溃异常处理函数指导主程序进行关闭的动作,从而避免系统生成错误报告框,减少人工手动操作的步骤;然后,在确认主程序完全关闭后重新启动主程序,从而实现重启应用程序,不仅避免了操作不当的问题,并且基于重启模块中的重启函数指导主程序进行重启,实现了对主程序关闭及重启过程的时间统筹,能够减少过程中的空余时间,从而有效提高主程序崩溃后的重启速度。Through the above method, after detecting the signal of the application program crash, firstly, the crash exception handling function in the crash exception handling module guides the main program to close the action, thereby avoiding the system from generating an error report box and reducing the steps of manual operation; Then, restart the main program after confirming that the main program is completely closed, so as to restart the application program, not only avoiding the problem of improper operation, but also guiding the main program to restart based on the restart function in the restart module, realizing the shutdown and restart of the main program The time planning of the process can reduce the idle time in the process, thereby effectively improving the restart speed after the main program crashes.
为了解决上述问题,本发明还提供了一种计算机可读存储介质,其上存储有计算机程序,其中,当计算机程序运行时控制计算机可读存储介质所在设备执行如上述任一技术方案所述的应对应用程序崩溃的方法。In order to solve the above problems, the present invention also provides a computer-readable storage medium, on which a computer program is stored, wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any of the above technical solutions. A way to deal with application crashes.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented through computer programs to instruct related hardware, and the computer programs can be stored in a non-volatile computer-readable memory In the medium, when the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Any reference to memory, storage, database or other media used in the various embodiments provided herein may include non-volatile and/or volatile memory. Nonvolatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Chain Synchlink DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
以上所述,仅为本发明较佳的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。The above is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed in the present invention can easily think of changes or Replacement should be covered within the protection scope of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211213740.4A CN115525464B (en) | 2022-09-30 | 2022-09-30 | A system, method and storage medium for coping with application crash |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202211213740.4A CN115525464B (en) | 2022-09-30 | 2022-09-30 | A system, method and storage medium for coping with application crash |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN115525464A true CN115525464A (en) | 2022-12-27 |
| CN115525464B CN115525464B (en) | 2024-12-10 |
Family
ID=84702156
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202211213740.4A Active CN115525464B (en) | 2022-09-30 | 2022-09-30 | A system, method and storage medium for coping with application crash |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115525464B (en) |
Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030167421A1 (en) * | 2002-03-01 | 2003-09-04 | Klemm Reinhard P. | Automatic failure detection and recovery of applications |
| US8813079B1 (en) * | 2006-06-07 | 2014-08-19 | Ca, Inc. | Thread management to prevent race conditions in computer programs |
| CN107861854A (en) * | 2017-09-27 | 2018-03-30 | 努比亚技术有限公司 | A kind of terminal local collapse processing method, terminal and computer-readable recording medium |
| CN109542689A (en) * | 2018-11-30 | 2019-03-29 | 努比亚技术有限公司 | Applied program processing method, terminal and computer readable storage medium |
| CN111949368A (en) * | 2020-07-07 | 2020-11-17 | 西安万像电子科技有限公司 | Application control method and device |
| CN112416555A (en) * | 2020-11-20 | 2021-02-26 | 山东亚华电子股份有限公司 | Client restarting method, device and apparatus, and storage medium |
| CN114253752A (en) * | 2021-11-17 | 2022-03-29 | 华人运通(上海)云计算科技有限公司 | Application crash processing method, device, equipment and medium |
-
2022
- 2022-09-30 CN CN202211213740.4A patent/CN115525464B/en active Active
Patent Citations (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030167421A1 (en) * | 2002-03-01 | 2003-09-04 | Klemm Reinhard P. | Automatic failure detection and recovery of applications |
| US8813079B1 (en) * | 2006-06-07 | 2014-08-19 | Ca, Inc. | Thread management to prevent race conditions in computer programs |
| CN107861854A (en) * | 2017-09-27 | 2018-03-30 | 努比亚技术有限公司 | A kind of terminal local collapse processing method, terminal and computer-readable recording medium |
| CN109542689A (en) * | 2018-11-30 | 2019-03-29 | 努比亚技术有限公司 | Applied program processing method, terminal and computer readable storage medium |
| CN111949368A (en) * | 2020-07-07 | 2020-11-17 | 西安万像电子科技有限公司 | Application control method and device |
| CN112416555A (en) * | 2020-11-20 | 2021-02-26 | 山东亚华电子股份有限公司 | Client restarting method, device and apparatus, and storage medium |
| CN114253752A (en) * | 2021-11-17 | 2022-03-29 | 华人运通(上海)云计算科技有限公司 | Application crash processing method, device, equipment and medium |
Non-Patent Citations (1)
| Title |
|---|
| 黄涛: "WinNT驱动程序的快速开发", 雷达科学与技术, no. 04, 31 December 2000 (2000-12-31), pages 25 - 32 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN115525464B (en) | 2024-12-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN109284269B (en) | Abnormal log analysis method and device, storage medium and server | |
| CN113254294B (en) | Equipment restarting detection method and device | |
| CN113329222B (en) | Camera function detection method and device | |
| CN102981955A (en) | Automatic continuous restarting method based on Linux system | |
| WO2017148271A1 (en) | Linux system reset processing method and device, and computer storage medium | |
| CN111124761B (en) | Equipment restarting method, device, equipment and medium | |
| CN109976920A (en) | A kind of implementation method and device of the concurrent type frog control for educating operating system | |
| CN109918276B (en) | Exposure buried point processing method based on APP and related equipment | |
| CN115525464A (en) | A system, method and storage medium for dealing with application program crash | |
| CN105242981A (en) | Configuration method of Kdump and computer device | |
| CN111372129B (en) | Method for storing playing information based on android system, intelligent terminal and storage medium | |
| TWI697776B (en) | Computer system, updating method thereof and computer program product | |
| US10783027B2 (en) | Preemptive crash data capture | |
| WO2019019672A1 (en) | Application program data recovery method and apparatus, computer device and storage medium | |
| CN114691497A (en) | An automatic test recording screen control method, device, system and medium | |
| CN108391120B (en) | Camera starting test method, device, equipment and storage medium | |
| CN118606535A (en) | Data acquisition method, device, medium and equipment | |
| CN118012534A (en) | Application loading method, device, electronic device and storage medium | |
| CN111880849B (en) | Platform intelligent log control processing method and device | |
| CN115309638A (en) | Method and device for assisting model optimization | |
| CN112559248A (en) | Preprocessing service recovery method, device, equipment and storage medium | |
| CN114356659A (en) | Restarting method and apparatus, terminal device and storage medium | |
| CN114785676A (en) | Method, device and equipment for extracting log and storage medium | |
| CN110764818B (en) | Method, device, computer equipment and storage medium for automatically switching Swagger | |
| CN115878652A (en) | Database access method, device, computer equipment and storage medium |
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 | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |

