Data dump management and control method and device
By collecting target parameter values that affect the core dump function, determining whether the core dump operation is accepted, the problem of failure of the core dump operation in the existing technology is solved, and the field data for abnormal location is successfully dumped.
Patent Information
- Application Number
- CN202411845521.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, when the program runs abnormally, the default execution of the core dump operation fails to effectively consider the influencing factors, resulting in the core dump operation failing and the exception field data cannot be successfully dumped.
A data dump control method is proposed, by collecting target parameter values that affect the core dump function, and determining whether the core dump operation is accepted. If not accepted, the core dump function is blocked and some target field data suitable for abnormal positioning is dumped; if accepted, the core dump operation is performed through the core dump function.
Effectively control the dumping operation of abnormal on-site data to ensure successful dumping of field data for abnormal location, and improve the reliability of abnormal debugging.
Smart Images

Figure CN119718749A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data dump, and in particular to a data dump management method and device. Background Art
[0002] In operating systems such as Linux, when an exception occurs during program execution, the operating system's built-in core dump function will perform a core dump operation on the exception site data, such as memory data and register status data, at the time of the exception, so as to record the exception site data dump for use by exception debuggers to locate the exception.
[0003] At present, the core dump operation is usually set as the default operation. As long as the program is abnormal, the core dump function will perform a core dump operation on the abnormal scene data. However, the success of the core dump operation is affected by many factors. The default execution of the core dump operation does not effectively consider these factors, which may result in the default execution of the core dump operation. The core dump operation may fail due to the influence of these factors, resulting in the inability to successfully dump the abnormal scene data for the abnormal debugger to use for abnormal location.
[0004] It can be seen that how to effectively control the dumping operation of abnormal on-site data to successfully dump the on-site data for abnormal location has become a technical problem that urgently needs to be solved. Summary of the invention
[0005] The present application proposes a data dump control method and device, the main purpose of which is to effectively control the dump operation of abnormal on-site data to achieve successful dumping of on-site data for abnormal location.
[0006] In order to achieve the above objectives, this application mainly provides the following technical solutions:
[0007] In a first aspect, the present application provides a data dump control method. The data dump control method provided in this embodiment may include: in response to a target exception in a target program that triggers a core dump function, collecting at least one target parameter value corresponding to the target exception, the at least one target parameter value affecting the core dump function to perform a core dump operation on the abnormal field data of the target exception; based on the at least one target parameter value, judging whether to accept the core dump operation; if not accepted, preventing the core dump function from performing a core dump operation on the abnormal field data of the target exception, and performing a dump operation on part of the target field data that is suitable for locating the target exception; if accepted, performing a core dump operation on the abnormal field data of the target exception through the core dump function.
[0008] In some embodiments of the present application, each target parameter value has a related influencing factor, and the influencing factor affects the core dump function to perform a core dump operation on the abnormal field data of the target abnormality. Then, based on the at least one target parameter value, it is determined whether to accept the core dump operation, including: for each of the influencing factors, respectively executing: based on the target parameter value related to the influencing factor, evaluating whether the influencing factor will cause an unacceptable abnormality in the core dump operation; if it is evaluated that each influencing factor will not cause an unacceptable abnormality in the core dump operation, determining to accept the core dump operation; if it is evaluated that at least some of the influencing factors will cause an unacceptable abnormality in the core dump operation, determining not to accept the core dump operation.
[0009] In some embodiments of the present application, the influencing factors include storage space factors, and the target parameter values related to the storage space factors include: the memory size occupied by the process of the target program on the host where the target program is located when the target exception occurs, the free storage space size of the target memory used to store the abnormal field data from the core dump operation, and the minimum free storage space threshold required for the target memory to perform normal storage work. Then, based on the target parameter values related to the influencing factors, it is evaluated whether the influencing factors will cause unacceptable exceptions in the core dump operation, including: determining whether the memory size is not greater than the difference between the free storage space size and the minimum free storage space threshold; if not, it is evaluated that the storage space factor will not cause unacceptable exceptions in the core dump operation; if greater, it is evaluated that the storage space factor will cause unacceptable exceptions in the core dump operation.
[0010] In some embodiments of the present application, the influencing factors include memory space factors, and the target parameter values related to the memory space factors include: the free memory size of the host where the target program is located, the memory size occupied by the process of the target program on the host when the target exception occurs, and the minimum free memory space threshold required for the core dump function to perform a normal core dump operation. Then, based on the target parameter values related to the influencing factors, it is evaluated whether the influencing factors will cause unacceptable exceptions in the core dump operation, including: determining a target coefficient related to the memory size required for the core dump function to perform a normal core dump operation, the size of the target coefficient is positively correlated with the memory size; determining the difference between the free memory size and the minimum free memory space threshold; judging whether the memory size is not greater than the product of the target coefficient and the difference; if not, it is evaluated that the memory space factor will not cause unacceptable exceptions in the core dump operation; if greater, it is evaluated that the memory space factor will cause unacceptable exceptions in the core dump operation.
[0011] In some embodiments of the present application, the influencing factors include a dump time factor, and the target parameter values related to the dump time factor include: the memory size occupied by the process of the target program on the host where the target program is located when the target exception occurs, and the dump speed of the core dump function when performing a normal core dump operation. Then, based on the target parameter values related to the influencing factors, it is evaluated whether the influencing factors will cause unacceptable exceptions in the core dump operation, including: determining whether the ratio between the memory size and the dump speed is less than the target duration; if it is less than, it is evaluated that the dump time factor will not cause unacceptable exceptions in the core dump operation; if it is not less than, it is evaluated that the dump time factor will cause unacceptable exceptions in the core dump operation.
[0012] In some embodiments of the present application, the influencing factors include host environment factors, and the target parameter values related to the host environment factors include: the idle CPU resources of the host where the target program is located when the target exception occurs, and the CPU resources required for the core dump function to perform a normal core dump operation. Then, based on the target parameter values related to the influencing factors, it is evaluated whether the influencing factors will cause unacceptable exceptions in the core dump operation, including: determining whether the idle CPU resources are not less than the CPU resources; if not less than, evaluating that the dump time-consuming factor will not cause unacceptable exceptions in the core dump operation; if less than, evaluating that the dump time-consuming factor will cause unacceptable exceptions in the core dump operation.
[0013] In some embodiments of the present application, at least one custom field parameter item corresponding to at least one type of exception is preset. Then, the data dump control method provided in this embodiment also includes: determining at least one custom field parameter item corresponding to the type of exception of the target exception; extracting the field parameter value corresponding to each custom field parameter item from the abnormal field data; integrating the extracted field parameter values to obtain target field data suitable for locating the target exception.
[0014] In some embodiments of the present application, a processing function corresponding to at least one exception type is preset, and the processing function is used to extract field data suitable for locating the exception of the exception type from the exception field data. Then, the data dump management and control method provided in this embodiment also includes: determining a processing function corresponding to the exception type of the target exception; calling the determined processing function to extract target field data suitable for locating the target exception from the exception field data.
[0015] In some embodiments of the present application, when an exception occurs in the program that triggers the core dump function, a corresponding exception signal for characterizing the type of exception is generated. Then, the data dump control method provided in this embodiment also includes: collecting the exception signal corresponding to the target exception; and determining the type of exception characterized by the exception signal as the type of exception of the target exception.
[0016] In some embodiments of the present application, the at least one custom field parameter item includes at least one of the following: a register state information item, a function call stack information item, a memory mapping information item, and a stack pointer information item.
[0017] In some embodiments of the present application, the data dump management method provided in this embodiment also includes: determining whether a request requiring host environment data to assist in locating the target exception is received; if received, then when it is determined that the core dump operation is accepted, the host environment data in the host where the target program is located when the target exception occurs is incrementally added to the exception site data; and when it is determined that the core dump operation is not accepted, the host environment data in the host where the target program is located when the target exception occurs is incrementally added to the target site data.
[0018] In some embodiments of the present application, the data dump management method provided in this embodiment also includes: after performing a core dump operation on the abnormal field data of the target abnormality through the core dump function, detecting whether a dump operation is performed on part of the target field data in the abnormal field data that is suitable for abnormality location by default; if so, executing the step of performing a dump operation on part of the target field data in the abnormal field data that is suitable for the target abnormality location.
[0019] In some embodiments of the present application, the data dump management method provided in this embodiment also includes: after performing a core dump operation on the abnormal field data of the target exception through the core dump function, monitoring whether the core dump operation has an abnormality; if so, terminating the core dump operation, and executing the step of performing a dump operation on part of the abnormal field data that is suitable for locating the target exception.
[0020] In some embodiments of the present application, the data dump management method provided in this embodiment also includes: after performing a dump operation on a portion of the target field data in the abnormal field data that is suitable for the target abnormality positioning, monitoring whether an abnormality occurs in the dump operation; if so, terminating the dump operation and dumping the target field data to a preset memory in which no data has been stored.
[0021] In a second aspect, the present application provides a data dump control device. The data dump control device provided in this embodiment may include:
[0022] A collection module, configured to collect at least one target parameter value corresponding to the target exception in response to a target exception of the target program triggering the core dump function, wherein the at least one target parameter value affects the core dump function to perform a core dump operation on the abnormal field data of the target exception;
[0023] A judgment module, used for judging whether to accept the core dump operation based on the at least one target parameter value;
[0024] A first dump module is used for preventing the core dump function from performing a core dump operation on the abnormal field data of the target abnormality if the judgment module determines that the core dump operation is not acceptable, and performing a dump operation on a portion of the target field data in the abnormal field data that is applicable to the target abnormality location;
[0025] The second dump module is used to perform a core dump operation on the abnormal field data of the target abnormality through the core dump function if the judgment module determines that the core dump operation is accepted.
[0026] In a third aspect, the present application provides a computer-readable storage medium, wherein the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the data dump management and control method described in any one of the first aspects.
[0027] In a fourth aspect, the present application provides an electronic device, comprising: a memory for storing a program; and a processor, coupled to the memory, for running the program to execute the data dump management method described in any one of the first aspects.
[0028] The data dump control method and device provided by the present application, in response to the target exception of the target program triggering the core dump function, collects at least one target parameter value that affects the core dump function to perform a core dump operation on the abnormal field data of the target exception, and based on at least one target parameter value, determines whether to accept the core dump operation. If it is determined not to accept, the core dump function is prevented from performing a core dump operation on the abnormal field data of the target exception, and a dump operation is performed on the target field data that is partially applicable to the target abnormal location in the abnormal field data. If it is determined to accept, a core dump operation is performed on the abnormal field data of the target exception through the core dump function. It can be seen that the solution provided by the present application does not perform a core dump operation by default when an exception occurs in the program, but before performing the core dump operation, a judgment decision is made on whether to perform a core dump operation, and then based on the judgment result, it is determined whether to perform a core dump operation on the abnormal field data of the exception through the core dump function, or to prevent the core dump function from performing a core dump operation on the abnormal field data of the exception and only perform a dump operation on the target field data that is partially applicable to the target abnormal location in the abnormal field data. In this way, the dumping operation of abnormal on-site data can be effectively controlled, so that the on-site data for abnormal location can be successfully dumped for use by abnormal debugging personnel for abnormal location and debugging.
[0029] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0031] Figure 1 A flow chart of a data dump management method provided by an embodiment of the present application is shown;
[0032] Figure 2 A schematic diagram of the structure of a data dump control device provided by an embodiment of the present application is shown;
[0033] Figure 3 A structural schematic diagram of a data dump control device provided in another embodiment of the present application is shown. DETAILED DESCRIPTION
[0034] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0035] The success or failure of the core dump operation is affected by many factors, such as the memory size occupied by the program process on the host where the program is located when the exception occurs, the free storage space size of the memory used to store the abnormal field data from the core dump operation, etc. However, the core dump operation is usually set as the default operation at present. As long as the program is abnormal, the core dump function will perform a core dump operation on the abnormal field data, without effectively considering the factors affecting the core dump operation. In this way, the core dump operation is often affected by these factors and fails, resulting in the failure to successfully dump the abnormal field data, thereby causing the abnormal debugger to have no basis for locating the abnormality.
[0036] After research, it was found that if before performing the core dump operation, the target parameter values that affect the core dump function to perform the core dump operation on the abnormal field data of the target abnormality are collected, and then based on the collected parameter values, it is determined whether to accept the core dump operation, and based on the judgment result, it is determined whether to perform the core dump operation on the abnormal field data of the abnormality through the core dump function, or to prevent the core dump function from performing the core dump operation on the abnormal field data of the abnormality, and only perform the dump operation on the target field data that is suitable for the target abnormality location in the abnormal field data. Then, the dump operation on the abnormal field data can be effectively controlled, so as to achieve the successful dumping of the field data for abnormal location.
[0037] Based on the above findings, an embodiment of the present application specifically provides a technical solution for data dump management and control, specifically: in response to a target exception in a target program that triggers a core dump function, collecting at least one target parameter value corresponding to the target exception, and the collected at least one target parameter value affects the core dump function to perform a core dump operation on the abnormal field data of the target exception; based on at least one target parameter value, judging whether to accept the core dump operation; if not accepted, preventing the core dump function from performing a core dump operation on the abnormal field data of the target exception, and performing a dump operation on part of the target field data in the abnormal field data that is suitable for locating the target exception; if accepted, performing a core dump operation on the abnormal field data of the target exception through the core dump function.
[0038] The technical solution for data dump control provided in this embodiment can be applied to any operating system to effectively control the dump operation of abnormal on-site data of the abnormality when an abnormality occurs in a program in the operating system, thereby successfully dumping the on-site data for abnormal location. This embodiment does not limit the specific types of operating system and program, and both can be flexibly selected based on business needs. Exemplarily, the operating system may include but is not limited to the Linux operating system, and the program may include but is not limited to a program applicable to the Linux operating system.
[0039] Based on the above-mentioned technical solution of data dump control, this embodiment specifically provides a data dump control method and device. The data dump control method and device provided in this embodiment are specifically described below.
[0040] like Figure 1 As shown, the embodiment of the present application provides a data dump control method, and the data dump control method provided by this embodiment may at least include the following steps 101 to 104:
[0041] 101. In response to a target exception of a target program that triggers a core dump function, at least one target parameter value corresponding to the target exception is collected, and the collected at least one target parameter value affects the core dump function to perform a core dump operation on the abnormal field data of the target exception.
[0042] The data dump control method provided in this embodiment is executed in response to an exception in the program that triggers the core dump function. Therefore, in order to ensure the timeliness of data dump control, it is necessary to monitor whether the program in the operating system has an exception that triggers the core dump function. Normally, when an exception occurs in the program in the operating system that triggers the core dump function, the program will trigger the generation of an exception signal related to the exception in the operating system. Based on this, the specific process of monitoring whether the program in the operating system has an exception that triggers the core dump function may include the following steps: monitoring whether an exception signal is generated in the operating system; if generated, determining the program that triggers the operating system to generate an exception signal as the target program and the exception related to the exception signal as the target exception, and determining that the target program in the operating system has a target exception that triggers the core dump function; if not generated, continue to monitor.
[0043] When a target exception that triggers a core dump function occurs in a target program, in response to the target exception that triggers a core dump function, at least one target parameter value that affects the core dump function to perform a core dump operation on the abnormal field data of the target exception is collected. The target parameter value affects the core dump function to perform a core dump operation on the abnormal field data of the target exception, and is used to reflect whether the core dump function can successfully perform a core dump operation on the abnormal field data of the target exception.
[0044] The target parameter value is strongly correlated with the influencing factors. The influencing factors affect the core dump function to perform core dump operations on the abnormal field data of the target anomaly. Based on this, each target parameter value collected has a related influencing factor. The following explains the collected target parameter values based on the influencing factors:
[0045] First, the influencing factors include storage space factors. The core dump operation usually dumps the abnormal field data to the target memory used to store the abnormal field data from the core dump operation, so as to record the abnormal field data through the target memory. If the target memory does not have storage space to store the dumped abnormal field data, the core dump operation will inevitably fail. Based on this, the storage space factor is used to evaluate whether the free storage space size of the target memory meets the storage of abnormal field data. Therefore, at least one target parameter value collected may include a target parameter value related to the storage space factor, and these target parameter values may include but are not limited to: the memory size occupied by the process of the target program on the host where the target program is located when the target exception occurs (the memory size is used to reflect the size of the abnormal field data), the free storage space size of the target memory used to store the abnormal field data from the core dump operation, and the minimum free storage space threshold required for the target memory to perform normal storage work.
[0046] Second, the influencing factors include memory space factors. The core dump operation requires memory consumption. If the memory cannot support the core dump operation, the core dump operation will inevitably fail. Based on this, the memory space factor is used to evaluate whether the free memory size of the target program on the host can support the core dump operation to dump the abnormal scene data. Therefore, at least one target parameter value collected includes a target parameter value related to the memory space factor, and these target parameter values may include but are not limited to: the free memory size of the host where the target program is located, the memory size occupied by the target program process on the host when the target exception occurs (the memory size is used to reflect the size of the abnormal scene data), and the minimum free memory space threshold required for the core dump function to perform a normal core dump operation.
[0047] Third, the influencing factors include the dump time factor. When the core dump operation is in progress, the target program cannot provide services. If the target program cannot provide services for a long time, it will affect the normal use of the target program, and then the core dump operation must be unacceptable. Based on this, the dump time factor is used to evaluate whether the dump time of the core dump operation is acceptable. Therefore, at least one target parameter value collected includes a target parameter value related to the dump time factor, and these target parameter values may include but are not limited to: the memory size occupied by the target program process on the host where the target program is located when the target exception occurs (the memory size is used to reflect the size of the abnormal field data), and the dump speed of the core dump function when performing a normal core dump operation.
[0048] Fourth, the influencing factors include host environment factors. The core dump operation requires the consumption of CPU resources, which is a host environment factor. If the CPU resources cannot support the core dump operation, the core dump operation will inevitably fail. Based on this, the host environment factor is used to evaluate whether the idle CPU resources of the host where the target program is located when the target exception occurs support the core dump operation. Therefore, at least one target parameter value collected includes a target parameter value related to the host environment factor, and these target parameter values may include but are not limited to: the idle CPU resources of the host where the target program is located when the target exception occurs, and the CPU resources required for the core dump function to perform a normal core dump operation.
[0049] 102. Based on at least one target parameter value, determine whether to accept the core dump operation; if not, execute step 103; if accepted, execute step 104.
[0050] The collected target parameter value is used to determine whether the core dump operation can be successfully performed on the abnormal field data. Therefore, based on at least one target parameter value, it is determined whether to accept the core dump operation.
[0051] Each target parameter value has a related influencing factor, and the influencing factor affects the influencing factor of the core dump function performing a core dump operation on the abnormal field data of the target abnormality. Based on this, based on at least one target parameter value, the specific process of judging whether to accept the core dump operation may include the following steps 102A to 102C:
[0052] 102A. For each influencing factor, perform the following steps: Based on the target parameter value associated with the influencing factor, evaluate whether the influencing factor will cause an unacceptable abnormality in the core dump operation.
[0053] Each influencing factor is strongly related to the success or failure of the core dump operation. Therefore, it is necessary to evaluate whether each influencing factor will cause unacceptable abnormalities in the core dump operation based on the target parameter value related to each influencing factor.
[0054] The steps for evaluating whether each influencing factor will cause unacceptable exceptions in the core dump operation are related to the specific influencing factor and the target parameter value related to the influencing factor. The following describes the specific methods for evaluating whether the influencing factor will cause unacceptable exceptions in the core dump operation under different influencing factors:
[0055] The first type is that the influencing factors include storage space factors, and the target parameter values related to the storage space factors include: the memory size occupied by the target program process on the host where the target program is located when the target exception occurs, the free storage space size of the target memory used to store the abnormal field data from the core dump operation, and the minimum free storage space threshold required for the target memory to perform normal storage work. Based on this, based on the target parameter values related to the influencing factors, the specific process of evaluating whether the influencing factors will cause unacceptable exceptions in the core dump operation can include the following steps: determining whether the memory size is not greater than the difference between the free storage space size and the minimum free storage space threshold; if not, evaluating that the storage space factor will not cause unacceptable exceptions in the core dump operation; if greater, evaluating that the storage space factor will cause unacceptable exceptions in the core dump operation.
[0056] When the target exception occurs, the memory size occupied by the target program process on the host where the target program is located reflects the size of the abnormal field data of the target exception. Therefore, by judging whether the memory size is not greater than the difference between the free storage space size and the minimum free storage space threshold, it can be determined whether the target memory has enough free storage space to store the dumped abnormal field data. Judging whether the memory size is not greater than the difference between the free storage space size and the minimum free storage space threshold can be expressed by the following formula: size ≤D free -D min , where P size Indicates the memory size occupied by the target program process on the host where the target program is located when the target exception occurs. free Indicates the free storage space size of the target memory, D min Indicates the minimum free storage space threshold required for the target storage to perform normal storage work.
[0057] If it is determined that the memory size occupied by the target program process on the host where the target program is located when the target exception occurs is not greater than the difference between the free storage space size and the minimum free storage space threshold, it means that the target memory has sufficient space to store the abnormal scene data of the target exception, and the core dump operation will not fail due to insufficient storage space of the target memory. Therefore, it is assessed that the storage space factor will not cause unacceptable exceptions in the core dump operation.
[0058] If it is determined that the memory size occupied by the target program process on the host where the target program is located when the target exception occurs is greater than the difference between the free storage space size and the minimum free storage space threshold, it means that the target memory does not have enough space to store the abnormal scene data of the target exception. There is a high probability that the core dump operation will fail due to insufficient storage space in the target memory. Therefore, it is assessed that the storage space factor will cause unacceptable exceptions in the core dump operation.
[0059] The second type is that the influencing factors include memory space factors, and the target parameter values related to the memory space factors include: the free memory size of the host where the target program is located, the memory size occupied by the process of the target program in the host where the target program is located when the target exception occurs, and the minimum free memory space threshold required for the core dump function to perform normal core dump operations. Based on this, based on the target parameter values related to the influencing factors, the specific process of evaluating whether the influencing factors will cause unacceptable exceptions in the core dump operation can include the following steps: determining a target coefficient related to the memory size required for the core dump function to perform normal core dump operations; determining the difference between the free memory size and the minimum free memory space threshold; judging whether the memory size is not greater than the product of the target coefficient and the difference; if not, it is evaluated that the memory space factor will not cause unacceptable exceptions in the core dump operation; if greater, it is evaluated that the memory space factor will cause unacceptable exceptions in the core dump operation.
[0060] When the target exception occurs, the memory size occupied by the target program process on the host where the target program is located reflects the size of the abnormal field data of the target exception, and the memory size determines the memory size required for the core dump operation. In principle, the memory size is positively correlated with the memory size required for the core dump operation. Therefore, the target coefficient related to the memory size required for the core dump function to perform a normal core dump operation can be determined based on the memory size. The size of the target coefficient is positively correlated with the memory size. Then determine the difference between the free memory size and the minimum free memory space threshold. Finally, by judging whether the memory size is not greater than the product of the target coefficient and the difference, it is determined whether the host's memory can support the core dump operation of the abnormal field data of the target exception. Judging whether the memory size is not greater than the product of the target coefficient and the difference can be expressed by the following formula: P size ≤k×(M free -M min ), where P size Indicates the memory size occupied by the target program process on the host where the target program is located when the target exception occurs. free Indicates the free memory size of the host where the target program is located, M min represents the minimum free memory space threshold required for the core dump function to perform a normal core dump operation, and k represents the target coefficient. It should be noted that in order to quickly determine the target coefficient, multiple memory sizes and target systems corresponding to each memory size can be calibrated in advance, so that the target coefficient can be determined based on the pre-calibrated data.
[0061] If it is determined that the memory size occupied by the target program process on the host where the target program is located when the target exception occurs is not greater than the product of the target coefficient and the difference, it means that the host where the target program is located has sufficient memory space for the core dump operation, and the core dump operation will not fail due to insufficient memory. Therefore, it is assessed that the storage space factor will not cause unacceptable exceptions in the core dump operation.
[0062] If it is determined that the memory size occupied by the target program process on the host where the target program is located when the target exception occurs is greater than the product of the target coefficient and the difference, it means that the host where the target program is located does not have enough memory space for the core dump operation. There is a high probability that the core dump operation will fail due to insufficient host memory space. Therefore, it is assessed that the storage space factor will cause unacceptable exceptions in the core dump operation.
[0063] The third type is that the influencing factors include the dump time factor, and the target parameter values related to the dump time factor include: the memory size occupied by the target program process on the host where the target program is located when the target exception occurs, and the dump speed of the core dump function when performing a normal core dump operation. Based on this, based on the target parameter values related to the influencing factors, the specific process of evaluating whether the influencing factors will cause unacceptable exceptions in the core dump operation can include the following steps: determining whether the ratio between the memory size and the dump speed is less than the target duration; if it is less than, evaluating that the dump time factor will not cause unacceptable exceptions in the core dump operation; if it is not less than, evaluating that the dump time factor will cause unacceptable exceptions in the core dump operation.
[0064] When the target exception occurs, the memory size occupied by the target program process on the host where the target program is located reflects the size of the abnormal field data of the target exception. Therefore, by judging whether the ratio between the memory size and the dump speed is less than the target duration, it can be determined whether the core dump operation speed is acceptable. Judging whether the ratio between the memory size and the dump speed is less than the target duration can be expressed by the following formula: size / S≤T, where P size It indicates the memory size occupied by the target program process on the host where the target program is located when the target exception occurs, and the memory size can be represented by the number of bytes. S indicates the dump speed of the core dump function when performing a normal core dump operation, and the dump speed can be the number of bytes transmitted per unit time, and the unit time can be per second, per minute, etc. T indicates the target time.
[0065] If the ratio between the memory size and the dump speed is determined to be less than the target duration, it means that the core dump operation will be completed within an acceptable time and will not delay the normal use of the target program. Therefore, it is assessed that the storage space factor will not cause unacceptable abnormalities in the core dump operation.
[0066] If the ratio between the memory size and the dump speed is not less than the target duration, it means that the core dump operation cannot be completed within an acceptable time. Since the target program is unavailable during the core dump operation, this will delay the normal use of the target program. Therefore, it is assessed that the storage space factor will cause unacceptable exceptions in the core dump operation.
[0067] In the fourth type, the influencing factors include host environment factors, and the target parameter values related to the host environment factors include: the idle CPU resources of the host where the target program is located when the target exception occurs, and the CPU resources required for the core dump function to perform a normal core dump operation. Based on this, based on the target parameter values related to the influencing factors, the specific process of evaluating whether the influencing factors will cause unacceptable exceptions in the core dump operation may include: judging whether the idle CPU resources are not less than the CPU resources required for the core dump function to perform a normal core dump operation; if not, evaluating that the dump time-consuming factor will not cause unacceptable exceptions in the core dump operation; if less, evaluating that the dump time-consuming factor will cause unacceptable exceptions in the core dump operation.
[0068] The core dump operation consumes CPU resources, which is a host environment factor. If the CPU resources cannot support the core dump operation, the core dump operation will inevitably fail. Therefore, you can determine whether there are sufficient CPU resources to perform the core dump operation by judging whether the idle CPU resources are not less than the CPU resources required for the core dump function to perform a normal core dump operation.
[0069] If it is determined that the idle CPU resources are not less than the CPU resources required by the core dump function for normal core dump operations, it means that the host where the target program is located has sufficient CPU resources for the core dump operation, and the core dump operation will not fail due to insufficient CPU resources. Therefore, it is evaluated that the storage space factor will not cause unacceptable exceptions in the core dump operation.
[0070] If the free CPU resources are less than the CPU resources required by the core dump function for normal core dump operations, it means that the host where the target program is located does not have sufficient CPU resources for the core dump operation. There is a high probability that the core dump operation will fail due to insufficient CPU resources. Therefore, it is assessed that the storage space factor will cause unacceptable exceptions in the core dump operation.
[0071] The above four influencing factors can be flexibly selected based on business needs, and this embodiment does not limit this. Exemplarily, at least one of the above influencing factors can be selected to perform data dump control.
[0072] 102B. If it is evaluated that each influencing factor will not cause an unacceptable abnormality in the core dump operation, it is determined that the core dump operation is accepted.
[0073] If it is evaluated that each influencing factor will not cause an unacceptable exception in the core dump operation, it means that all influencing factors will not cause the core dump operation to fail, and it is feasible to perform a core dump operation on the abnormal field data of the target exception, so it is determined to accept the core dump operation.
[0074] 102C. If it is assessed that at least some of the influencing factors will cause an unacceptable abnormality in the core dump operation, it is determined that the core dump operation is not accepted.
[0075] If it is assessed that at least some of the influencing factors will cause unacceptable exceptions in the core dump operation, it means that some influencing factors will cause the core dump operation to fail, and it is not feasible to perform a core dump operation on the abnormal field data of the target exception, so it is determined that the core dump operation is not accepted.
[0076] 103. The core dump prevention function performs a core dump operation on the abnormal scene data of the target abnormality, and performs a dump operation on a portion of the target scene data in the abnormal scene data that is suitable for locating the target abnormality.
[0077] When it is determined that the core dump operation is not acceptable, it means that the core dump operation is likely to fail, and the abnormal on-site data of the target abnormality cannot be successfully dumped. At this time, in order to avoid the failure of the core dump operation, it is necessary to skip the core dump operation so as not to perform the core dump operation. Based on this, the core dump function is prevented from performing the core dump operation on the abnormal on-site data of the target abnormality.
[0078] Preventing the core dump function from performing a core dump operation on the abnormal scene data of the target abnormality means that the abnormal scene data cannot be successfully dumped out, and the abnormal debugging personnel cannot obtain the abnormal scene data to locate the target abnormality and analyze the abnormality. Therefore, in order to enable the abnormal debugging personnel to still have the target scene data suitable for locating the target abnormality when the core dump function is prevented from performing a core dump operation on the abnormal scene data of the target abnormality, to locate the target abnormality and analyze the abnormality, it is necessary to perform a dump operation on part of the target scene data suitable for locating the target abnormality. Part of the target scene data suitable for locating the target abnormality is the key data suitable for locating the target abnormality extracted from the abnormal scene data, which can not only be used for locating the abnormality of the target abnormality, but also its data volume is much smaller than the abnormal scene data.
[0079] Methods for extracting target field data suitable for target anomaly positioning from abnormal field data may include the following two methods:
[0080] One is that at least one custom field parameter item corresponding to at least one abnormality type is preset. Based on this, the specific process of extracting target field data suitable for target abnormality positioning from abnormal field data may include the following steps: determining at least one custom field parameter item corresponding to the abnormality type of the target abnormality; extracting the field parameter value corresponding to each custom field parameter item from the abnormal field data; integrating the extracted field parameter values to obtain the target field data suitable for target abnormality positioning.
[0081] Considering that different types of exceptions may occur during program operation, and different types of exceptions have different field data suitable for exception location, we can first count all the exceptions that may occur in the program in the operating system, and then set corresponding custom field parameter items for each type of exception. Custom field parameter items are used to specify the target parameter values that need to be extracted.
[0082] When extracting target field data suitable for locating target exceptions from the exception field data, first determine the exception type of the target exception. For a program in an operating system, when an exception occurs in the program that triggers the core dump function, a corresponding exception signal for characterizing the exception type will be generated. Based on this, the specific process of determining the exception type of the target exception may include the following steps: collecting the exception signal corresponding to the target exception; determining the exception type characterized by the exception signal as the exception type of the target exception. Exemplarily, if the exception signal corresponding to the target exception is collected as an illegal memory reference signal (the illegal memory reference signal can be represented as SIGSEGV), then the exception type of the target exception is determined to be an illegal memory reference. Exemplarily, if the exception signal corresponding to the target exception is collected as a process abnormal termination signal (the process abnormal termination signal can be represented as SIGABRT), then the exception type of the target exception is determined to be a process abnormal termination.
[0083] After determining the abnormality type of the target abnormality, determine at least one custom field parameter item corresponding to the abnormality type of the target abnormality, and then extract the field parameter value corresponding to each custom field parameter item from the abnormal field data (which can be extracted by an extraction tool developed based on the custom field parameter item). After extracting the thread parameter value corresponding to each custom field parameter, integrate the extracted field parameter values to obtain target field data suitable for locating the target abnormality.
[0084] It should be noted that a dump configuration module can be deployed in advance in the operating system so that the user can customize and configure at least one custom field parameter item corresponding to at least one exception type through the dump configuration module for use in data dump. At least one custom field parameter item corresponding to each exception type can be configured based on business needs, and this embodiment does not limit this. However, it should be noted that at least one custom field parameter item corresponding to the exception type needs to be able to extract key field data for locating and analyzing the exceptions of the exception type. Exemplarily, at least one custom field parameter item corresponding to the exception type may include, but is not limited to, at least one of the following: register state information item, function call stack information item, memory mapping information item, stack pointer information item. Accordingly, the extracted target field data may include, but is not limited to, at least one of the following: register state information, function call stack information, memory mapping information, stack pointer information.
[0085] Another is that a processing function corresponding to at least one type of exception is preset, and the processing function is used to extract field data suitable for locating the exception of the exception type from the exception field data. Based on this, the specific process of extracting target field data suitable for locating the target exception from the exception field data may include the following steps: determining the processing function corresponding to the exception type of the target exception; calling the determined processing function to extract the target field data suitable for locating the target exception from the exception field data.
[0086] In order to quickly extract the target field data suitable for locating the target anomaly, at least one processing function corresponding to the anomaly type can be preset, and the processing function is used to extract the field data suitable for locating the anomaly of the corresponding anomaly type from the anomaly field data. In this way, after determining the anomaly type of the target anomaly, the processing function corresponding to the anomaly type of the target anomaly can be called to extract the target field data suitable for locating the target anomaly from the anomaly field data. The specific steps for determining the anomaly type of the target anomaly here can be found in the detailed explanation of the previous method, which will not be repeated here.
[0087] The extracted target field data may include but is not limited to at least one of the following: register status information, function call stack information, memory mapping information, and stack pointer information. The register status information is the register status information at the time of the CPU instruction that triggered the exception. This information can be directly passed to the corresponding signal processing function by the operating system, and can be extracted from the signal processing function by the corresponding processing function. The function call stack information can be obtained by calling the processing function (for example, the standard library function backtrace(), backtrace_symbols(), etc.) through the corresponding processing function. The memory mapping information is the memory mapping information of the process address space of the program, which can be read through the corresponding processing function in the Linux and other operating systems / proc / <pid> / maps file, where pid is the process id of the abnormal process. In addition, the target field data can also include other status information of the process, such as / proc / <pid> / and other files that can assist in locating faults, etc. It can also include other status information, such as the CPU usage of each process and the system memory usage when the exception occurs.
[0088] The above two methods of extracting target field data suitable for target anomaly location from abnormal field data can be used alone or in combination based on business use. When used in combination, the results of the two methods can be verified and supplemented with each other.
[0089] After extracting the target field data suitable for target abnormality location, the target field data is dumped to a designated storage location for subsequent target abnormality location and analysis. The designated storage location here can be a target memory or other designated memory, which is not limited in this embodiment.
[0090] 104. Perform a core dump operation on the abnormal on-site data of the target abnormality through the core dump function.
[0091] When it is determined that the core dump operation is accepted, it means that the core dump operation will not fail with a high probability, and the abnormal scene data of the target abnormality can be successfully dumped. At this time, the core dump operation is performed on the abnormal scene data of the target abnormality through the core dump function to complete the core dump of the abnormal scene data.
[0092] The data dump control method provided in the embodiment of the present application, in response to the target exception of the target program triggering the core dump function, collects at least one target parameter value that affects the core dump function to perform a core dump operation on the abnormal field data of the target exception, and based on at least one target parameter value, determines whether to accept the core dump operation. If it is determined not to accept, the core dump function is prevented from performing a core dump operation on the abnormal field data of the target exception, and the dump operation is performed on the target field data that is partially applicable to the target abnormal location in the abnormal field data. If it is determined to accept, the core dump operation is performed on the abnormal field data of the target exception through the core dump function. It can be seen that the solution provided in the embodiment of the present application does not perform a core dump operation by default when the program is abnormal, but before performing the core dump operation, first judges and decides whether to perform a core dump operation, and then decides based on the judgment result whether to perform a core dump operation on the abnormal abnormal field data of the exception through the core dump function, or to prevent the core dump function from performing a core dump operation on the abnormal abnormal field data of the exception and only perform a dump operation on the target field data that is partially applicable to the target abnormal location in the abnormal field data. In this way, the dumping operation of abnormal on-site data can be effectively controlled, so that the on-site data for abnormal location can be successfully dumped for use by abnormal debugging personnel for abnormal location and debugging.
[0093] In some embodiments of the present application, it is considered that the data obtained solely based on the dump operation is not rich enough as the basis for abnormal location and debugging. Based on this, the data dump control method provided in this embodiment may also include the following steps: determining whether a request for host environment data to assist in target abnormal location is received; if received, then in the case where the core dump operation is accepted in the above step 102, the host environment data in the host where the target program is located when the target abnormality occurs is incrementally added to the abnormal site data; and in the case where the core dump operation is not accepted in the above step 102, the host environment data in the host where the target program is located when the target abnormality occurs is incrementally added to the target site data.
[0094] Considering that the exception may also be caused by the indirect influence of other programs in the operating system, but the exception site data only records the information of the program process, the exception debugger may also need the host environment data (such as CPU occupancy, memory usage, etc.) at the time of the exception, so as to locate and debug the exception by combining the exception site data and the host environment data. Based on this, it is necessary to determine whether a request for the host environment data to assist in the target exception location is received.
[0095] If it is determined that a request is received that requires host environment data to assist in locating the target exception, it means that it is necessary to combine the exception site data and the host environment data for exception location and debugging. Therefore, if it is determined that the core dump operation is accepted, the host environment data in the host where the target program is located when the target exception occurs is incrementally added to the exception site data; and if it is determined that the core dump operation is not accepted, the host environment data in the host where the target program is located when the target exception occurs is incrementally added to the target site data, so that the host environment data can be dumped together with the site data for use by exception debuggers.
[0096] In some embodiments of the present application, considering that after the dump operation is performed on part of the target field data in the abnormal field data that is suitable for target abnormality positioning in the above-mentioned step 103, the dump operation may be interrupted or other abnormalities, resulting in the target field data being unable to be dumped successfully, based on this, after the dump operation is performed on part of the target field data in the abnormal field data that is suitable for target abnormality positioning in the above-mentioned step 103, the data dump management and control method provided in this embodiment may also include the following steps: monitoring whether the dump operation is abnormal; if so, terminating the dump operation, and dumping the target field data to a preset memory in which no data has been stored.
[0097] When an abnormality is detected in the dump operation, it means that the target field data is unlikely to be dumped successfully, which will result in a lack of basis for abnormality location and analysis. Therefore, in order to avoid the lack of basis for abnormality location and analysis, the dump operation is terminated and the target field data is dumped to a preset storage device that has not yet stored data, so as to eliminate the situation where the dump operation cannot be performed due to storage space problems.
[0098] After the target field data is dumped to the preset memory that has not stored any data, if it is determined that the target field data is successfully dumped to the preset memory, the target field data is provided for target abnormality location and debugging.
[0099] After dumping the target field data to a preset memory that has not yet stored data, if it is determined that the target field data has not yet been successfully dumped to the preset memory, it means that the dump operation was unsuccessful not due to insufficient storage space, but other reasons. At this time, an alarm can be issued to enable the abnormal debugging personnel to take corresponding measures.
[0100] In some embodiments of the present application, considering that after the core dump operation is performed on the abnormal field data of the target abnormality through the core dump function in the above step 104, the core dump operation may be interrupted or other abnormalities, resulting in the failure to successfully dump the abnormal field data, based on this, after the core dump operation is performed on the abnormal field data of the target abnormality through the core dump function in the above step 104, the data dump management and control method provided in this embodiment may also include the following steps: monitoring whether the core dump operation is abnormal; if so, terminating the core dump operation, and executing the step of dumping the target field data in the abnormal field data that is suitable for locating the target abnormality.
[0101] When an abnormality is detected in the core dump operation, it means that the abnormal site data is unlikely to be dumped successfully, and there will be a lack of basis for abnormal location and analysis. Therefore, in order to avoid the lack of basis for abnormal location and analysis, the core dump operation is terminated, and the steps of dumping part of the target site data suitable for target abnormal location are performed, so that the abnormal debugging personnel can still use the target site data as the basis for target abnormal location and analysis to perform target abnormal location and analysis.
[0102] In some embodiments of the present application, it is considered that the abnormal field data dumped out by the core dump operation may at least bring the following two problems: First, the abnormal field data after the core dump operation is usually present in the core file (i.e., core file), and the core file requires special tools and environment to perform abnormal location and abnormal debugging, which brings certain complexity to abnormal location and debugging. Second, the core dump operation may be interrupted unexpectedly, resulting in the failure of the abnormal field data to be dumped successfully. In view of this, after the above-mentioned step 104 performs a core dump operation on the abnormal field data of the target abnormality through the core dump function, the data dump method provided in this embodiment may also include the steps of: detecting whether to perform a dump operation on the target field data that is partially applicable to abnormal location in the abnormal field data by default; if so, executing the step of performing a dump operation on the target field data that is partially applicable to the target abnormal location in the abnormal field data.
[0103] In the case where a dump operation is performed on part of the target field data in the exception field data that is suitable for exception location by default, whether a core dump operation is performed on the exception field data of the target exception by blocking or using the core dump function, a dump operation will be performed on part of the target field data in the exception field data that is suitable for exception location.
[0104] If it is detected that a dump operation is performed on a portion of the target field data in the abnormal field data that is applicable to abnormal location by default, then the step of performing a dump operation on a portion of the target field data in the abnormal field data that is applicable to target abnormal location is performed. The advantages of doing so are as follows: First, a core dump operation is performed on the abnormal field data of the target abnormality through the core dump function, and if the abnormal field data dump is successful, the abnormality location and analysis can be performed based on the target field data first. Only when the abnormality location and analysis cannot be performed based on the target field data, the abnormality analysis and location can be performed based on the abnormal field data. Another is that even if the core dump operation on the abnormal field data is unexpectedly interrupted, the abnormality location and analysis can still be performed based on the target field data.
[0105] If it is detected that the dump operation is not performed by default on part of the target field data in the abnormal field data that is suitable for abnormality location, it means that the core dump operation on the abnormal field data of the target abnormality through the core dump function has met the business requirements, and the current process can be ended.
[0106] In some embodiments of the present application, in actual applications, a data dump control module can be developed based on the data dump control method provided in this embodiment, and the data dump control module can be applied to various programs as a common module to realize data dump control when an exception occurs in the program. In addition, at least one custom field parameter item of each exception type can be customized based on the business conditions of each program, so as to perform a dump operation on the target field data applicable to the exception location belonging to the corresponding exception type through the custom field parameter item.
[0107] Furthermore, an embodiment of the present application also provides a data dump control device, such as Figure 2 As shown, the data dump control device provided in this embodiment may include:
[0108] A collection module 21 is used for collecting at least one target parameter value corresponding to the target exception in response to a target exception that triggers a core dump function in a target program, wherein the at least one target parameter value affects the core dump function to perform a core dump operation on the abnormal field data of the target exception;
[0109] A determination module 22, configured to determine whether to accept a core dump operation based on the at least one target parameter value;
[0110] A first dump module 23 is used for preventing the core dump function from performing a core dump operation on the abnormal field data of the target abnormality if the judgment module 22 determines that the core dump operation is not acceptable, and performing a dump operation on a portion of the target field data in the abnormal field data that is suitable for locating the target abnormality;
[0111] The second dump module 24 is used to perform a core dump operation on the abnormal field data of the target abnormality through the core dump function if the judgment module 22 determines to accept the core dump operation.
[0112] The data dump control device provided in the embodiment of the present application, in response to the target exception of the target program triggering the core dump function, collects at least one target parameter value that affects the core dump function to perform a core dump operation on the abnormal field data of the target exception, and judges whether to accept the core dump operation based on at least one target parameter value. If it is determined not to accept, the core dump function is prevented from performing a core dump operation on the abnormal field data of the target exception, and the dump operation is performed on the target field data that is partially applicable to the target abnormal location in the abnormal field data. If it is determined to accept, the core dump operation is performed on the abnormal field data of the target exception through the core dump function. It can be seen that the solution provided in the embodiment of the present application does not perform a core dump operation by default when the program is abnormal, but before performing the core dump operation, it first makes a judgment and decision on whether to perform a core dump operation, and then decides based on the judgment result whether to perform a core dump operation on the abnormal abnormal field data of the exception through the core dump function, or to prevent the core dump function from performing a core dump operation on the abnormal abnormal field data of the exception and only perform a dump operation on the target field data that is partially applicable to the target abnormal location in the abnormal field data. In this way, the dumping operation of abnormal on-site data can be effectively controlled, so that the on-site data for abnormal location can be successfully dumped for use by abnormal debugging personnel for abnormal location and debugging.
[0113] In some embodiments of the present application, each target parameter value has a related influencing factor, and the influencing factor affects the core dump function to perform a core dump operation on the abnormal field data of the target abnormality. Then, if Figure 3 As shown, the judgment module 22 may include:
[0114] The judging unit 221 is configured to respectively perform, for each of the influencing factors: based on a target parameter value related to the influencing factor, assess whether the influencing factor will cause an unacceptable abnormality in the core dump operation;
[0115] The first determination unit 222 is configured to determine that the core dump operation is acceptable if the determination unit 221 determines that each influencing factor will not cause an unacceptable abnormality in the core dump operation.
[0116] The second determination unit 223 is configured to determine that the core dump operation is not acceptable if the determination unit 221 determines that at least some of the influencing factors will cause an unacceptable abnormality in the core dump operation.
[0117] In some embodiments of the present application, the influencing factors include storage space factors, and the target parameter values related to the storage space factors include: the memory size occupied by the process of the target program on the host where the target program is located when the target exception occurs, the free storage space size of the target memory used to store the abnormal field data from the core dump operation, and the minimum free storage space threshold required for the target memory to perform normal storage work. Then, if Figure 3 As shown, the judging unit 221 may include:
[0118] The first judgment subunit 2211 is used to judge whether the memory size is not greater than the difference between the free storage space size and the minimum free storage space threshold; if not, it is evaluated that the storage space factor will not cause unacceptable abnormalities in the core dump operation; if greater, it is evaluated that the storage space factor will cause unacceptable abnormalities in the core dump operation.
[0119] In some embodiments of the present application, the influencing factors include memory space factors, and the target parameter values related to the memory space factors include: the free memory size of the host where the target program is located, the memory size occupied by the process of the target program on the host when the target exception occurs, and the minimum free memory space threshold required for the core dump function to perform a normal core dump operation. If Figure 3 As shown, the judging unit 221 may include:
[0120] The second judgment subunit 2212 is used to determine a target coefficient related to the memory size required for the core dump function to perform a normal core dump operation, and the size of the target coefficient is positively correlated with the memory size; determine the difference between the free memory size and the minimum free memory space threshold; determine whether the memory size is not greater than the product of the target coefficient and the difference; if not, it is evaluated that the memory space factor will not cause unacceptable abnormalities in the core dump operation; if greater, it is evaluated that the memory space factor will cause unacceptable abnormalities in the core dump operation.
[0121] In some embodiments of the present application, the influencing factors include a dump time factor, and the target parameter values related to the dump time factor include: the memory size occupied by the process of the target program on the host where the target program is located when the target exception occurs, and the dump speed of the core dump function when performing a normal core dump operation. If Figure 3 As shown, the judging unit 221 may include:
[0122] The third judgment subunit 2213 is used to judge whether the ratio between the memory size and the dump speed is less than the target duration; if it is less than, it is assessed that the dump time-consuming factor will not cause unacceptable abnormalities in the core dump operation; if it is not less than, it is assessed that the dump time-consuming factor will cause unacceptable abnormalities in the core dump operation.
[0123] In some embodiments of the present application, the influencing factors include host environment factors, and the target parameter values related to the host environment factors include: the idle CPU resources of the host where the target program is located when the target exception occurs, and the CPU resources required for the core dump function to perform a normal core dump operation. If Figure 3 As shown, the judging unit 221 may include:
[0124] The fourth judgment subunit 2214 is used to judge whether the idle CPU resources are not less than the CPU resources; if not, it is assessed that the dump time-consuming factor will not cause unacceptable abnormalities in the core dump operation; if less, it is assessed that the dump time-consuming factor will cause unacceptable abnormalities in the core dump operation.
[0125] In some embodiments of the present application, at least one custom field parameter item corresponding to at least one abnormal type is preset. Figure 3 As shown, the data dump control device provided in this embodiment may also include:
[0126] The first determination module 25 is used to determine at least one custom field parameter item corresponding to the abnormality type of the target abnormality; extract the field parameter value corresponding to each custom field parameter item from the abnormal field data; integrate the extracted field parameter values to obtain target field data suitable for locating the target abnormality.
[0127] In some embodiments of the present application, the at least one custom field parameter item used by the first determination module 25 includes at least one of the following: a register state information item, a function call stack information item, a memory mapping information item, and a stack pointer information item.
[0128] In some embodiments of the present application, at least one processing function corresponding to an abnormality type is preset, and the processing function is used to extract field data suitable for locating an abnormality of the abnormal type from the abnormal field data. Then, if Figure 3 As shown, the data dump control device provided in this embodiment may also include:
[0129] The second determination module 26 is used to determine a processing function corresponding to the abnormality type of the target abnormality; call the determined processing function to extract target field data suitable for locating the target abnormality from the abnormal field data.
[0130] In some embodiments of the present application, when an exception occurs in the program that triggers the core dump function, a corresponding exception signal for characterizing the type of exception is generated. Figure 3 As shown, the data dump control device provided in this embodiment may also include:
[0131] The third determination module 27 is used to collect an abnormal signal corresponding to the target abnormality; and determine the abnormality type represented by the abnormal signal as the abnormality type of the target abnormality.
[0132] In some embodiments of the present application, Figure 3 As shown, the data dump control device provided in this embodiment may also include:
[0133] A first detection module 28, used to determine whether a request for host environment data to assist in locating the target anomaly is received;
[0134] An adding module 29 is used for, when the first detection module 28 determines that a request for host environment data to assist in locating the target exception is received, and when the judgment module 22 determines that a core dump operation is accepted, the host environment data in the host where the target program is located when the target exception occurs is incrementally added to the exception site data; and when the judgment module 22 determines that the core dump operation is not accepted, the host environment data in the host where the target program is located when the target exception occurs is incrementally added to the target site data for the dump operation performed by the first dump module 23.
[0135] In some embodiments of the present application, Figure 3 As shown, the data dump control device provided in this embodiment may also include:
[0136] A second detection module 30 is used to detect whether to perform a dump operation on a portion of the target field data suitable for abnormality location in the abnormal field data by default after the second dump module 24 performs a core dump operation on the abnormal field data of the target abnormality through the core dump function;
[0137] The first dump module 23 is also used to execute the step of dumping part of the target field data in the abnormal field data that is suitable for the target abnormality location if the second detection module 30 detects that a dump operation is performed on part of the target field data in the abnormal field data that is suitable for the abnormality location by default.
[0138] In some embodiments of the present application, Figure 3 As shown, in some embodiments of the present application, as Figure 3 As shown, the data dump control device provided in this embodiment may also include:
[0139] A first monitoring module 31 is used to monitor whether an abnormality occurs in the core dump operation after the second dump module 24 performs a core dump operation on the abnormal field data of the target abnormality through the core dump function;
[0140] A first termination module 32 is configured to terminate the core dump operation if the first monitoring module 31 detects that the core dump operation is abnormal;
[0141] The first dump module 23 is further configured to execute the step of dumping a portion of the target field data suitable for the target abnormality location in the abnormal field data if the first monitoring module 31 monitors that the core dump operation is abnormal.
[0142] In some embodiments of the present application, Figure 3 As shown, in some embodiments of the present application, as Figure 3 As shown, the data dump control device provided in this embodiment may also include:
[0143] A second monitoring module 33 is used to monitor whether an abnormality occurs in the dumping operation after the first dumping module 23 performs a dumping operation on a portion of the target field data in the abnormal field data that is suitable for the target abnormality location;
[0144] A second termination module 34 is used to terminate the dump operation if the second monitoring module 33 monitors that the dump operation is abnormal;
[0145] The first dump module 23 is further configured to dump the target on-site data to a preset memory that has not stored any data if the second monitoring module 33 detects that the dump operation is abnormal.
[0146] In the data dump control device provided in the embodiment of the present application, the detailed explanations used in the operation of each functional module can be found in the corresponding detailed explanations of the above-mentioned data dump control method embodiment, which will not be repeated here.
[0147] Furthermore, an embodiment of the present application also provides a computer-readable storage medium, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the above-mentioned data dump management and control method.
[0148] Furthermore, an embodiment of the present application also provides an electronic device, comprising: a memory for storing a program; and a processor, coupled to the memory, for running the program to execute the above-mentioned data dump management and control method.
[0149] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0150] It is understandable that the related features in the above methods and devices can be referenced to each other. In addition, the "first", "second", etc. in the above embodiments are used to distinguish the various embodiments, and do not represent the advantages and disadvantages of the various embodiments.
[0151] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0152] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the application is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the application described herein, and the description of the above specific language is to disclose the preferred embodiment of the application.
[0153] In addition, the memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0154] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0155] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data cutover device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data cutover device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0156] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data switching device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0157] These computer program instructions can also be loaded onto a computer or other programmable data transfer device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0158] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0159] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0160] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0161] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, commodity or device including the element.
[0162] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0163] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.< / pid> < / pid>
Claims
1. A data dump management and control method, characterized in that: The method comprises: In response to a target exception of a target program that triggers a core dump function, collecting at least one target parameter value corresponding to the target exception, wherein the at least one target parameter value affects the core dump function to perform a core dump operation on the abnormal field data of the target exception; Based on the at least one target parameter value, determining whether to accept the core dump operation; If not accepted, the core dump function is prevented from performing a core dump operation on the abnormal field data of the target abnormality, and a dump operation is performed on a portion of the abnormal field data that is applicable to the target abnormality location; If accepted, a core dump operation is performed on the abnormal field data of the target abnormality through the core dump function.
2. The method according to claim 1, characterized in that Each target parameter value has a related influencing factor, and the influencing factor affects the core dump function to perform a core dump operation on the abnormal field data of the target abnormality. Then, based on the at least one target parameter value, determining whether to accept the core dump operation includes: For each of the influencing factors, respectively: based on the target parameter value related to the influencing factor, evaluating whether the influencing factor will cause an unacceptable abnormality in the core dump operation; If it is evaluated that each influencing factor will not cause an unacceptable abnormality in the core dump operation, it is determined that the core dump operation is acceptable; If it is assessed that at least some of the influencing factors will cause an unacceptable abnormality in the core dump operation, it is determined that the core dump operation is not accepted.
3. The method according to claim 2, characterized in that The influencing factors include storage space factors, and the target parameter values related to the storage space factors include: the memory size occupied by the process of the target program on the host where the target program is located when the target exception occurs, the free storage space size of the target memory used to store the abnormal field data from the core dump operation, and the minimum free storage space threshold required for the target memory to perform normal storage work. Then, based on the target parameter values related to the influencing factors, evaluating whether the influencing factors will cause an unacceptable exception to the core dump operation includes: judging whether the memory size is not greater than the difference between the free storage space size and the minimum free storage space threshold; if not, evaluating that the storage space factor will not cause an unacceptable exception to the core dump operation; if greater, evaluating that the storage space factor will cause an unacceptable exception to the core dump operation; and / or, The influencing factors include memory space factors, and the target parameter values related to the memory space factors include: the free memory size of the host where the target program is located, the memory size occupied by the process of the target program on the host when the target exception occurs, and the minimum free memory space threshold required for the core dump function to perform a normal core dump operation. Then, based on the target parameter values related to the influencing factors, it is evaluated whether the influencing factors will cause an unacceptable exception to the core dump operation, including: determining a target coefficient related to the memory size required for the core dump function to perform a normal core dump operation, the size of the target coefficient is positively correlated with the memory size; determining the difference between the free memory size and the minimum free memory space threshold; judging whether the memory size is not greater than the product of the target coefficient and the difference; if not, it is evaluated that the memory space factor will not cause an unacceptable exception to the core dump operation; if greater, it is evaluated that the memory space factor will cause an unacceptable exception to the core dump operation; and / or, The influencing factors include a dump time factor, and the target parameter value related to the dump time factor includes: the memory size occupied by the process of the target program on the host where the target program is located when the target exception occurs, and the dump speed of the core dump function when performing a normal core dump operation. Then, based on the target parameter value related to the influencing factors, evaluating whether the influencing factors will cause an unacceptable exception to the core dump operation includes: determining whether a ratio between the memory size and the dump speed is less than a target duration; if so, evaluating that the dump time factor will not cause an unacceptable exception to the core dump operation; if not, evaluating that the dump time factor will cause an unacceptable exception to the core dump operation; and / or, The influencing factors include host environment factors, and the target parameter values related to the host environment factors include: the idle CPU resources of the host where the target program is located when the target exception occurs, and the CPU resources required for the core dump function to perform a normal core dump operation. Then, based on the target parameter values related to the influencing factors, it is evaluated whether the influencing factors will cause unacceptable exceptions in the core dump operation, including: determining whether the idle CPU resources are not less than the CPU resources; if not less than, evaluating that the dump time-consuming factor will not cause unacceptable exceptions in the core dump operation; if less than, evaluating that the dump time-consuming factor will cause unacceptable exceptions in the core dump operation.
4. The method according to claim 1, characterized in that: At least one custom field parameter item corresponding to at least one abnormality type is preset, then the method further includes: determining at least one custom field parameter item corresponding to the abnormality type of the target abnormality; extracting the field parameter value corresponding to each custom field parameter item from the abnormal field data; integrating the extracted field parameter values to obtain target field data suitable for locating the target abnormality; and / or, There is preset a processing function corresponding to at least one type of exception, and the processing function is used to extract field data suitable for locating the exception of the exception type from the exception field data. Then, the method also includes: determining a processing function corresponding to the exception type of the target exception; calling the determined processing function to extract target field data suitable for locating the target exception from the exception field data.
5. The method according to claim 4, characterized in that When an exception occurs in the program that triggers the core dump function, a corresponding exception signal for characterizing the exception type is generated. The method further includes: collecting the exception signal corresponding to the target exception; and determining the exception type characterized by the exception signal as the exception type of the target exception.
6. The method according to claim 4, characterized in that The at least one custom field parameter item includes at least one of the following: a register state information item, a function call stack information item, a memory mapping information item, and a stack pointer information item.
7. The method according to any one of claims 1 to 6, characterized in that The method further includes: determining whether a request for host environment data to assist in locating the target exception is received; if received, if it is determined that a core dump operation is accepted, incrementally adding the host environment data in the host where the target program is located when the target exception occurs to the exception site data; and if it is determined that a core dump operation is not accepted, incrementally adding the host environment data in the host where the target program is located when the target exception occurs to the target site data; and / or, The method further comprises: after performing a core dump operation on the abnormal field data of the target abnormality through the core dump function, detecting whether a dump operation is performed on a portion of the target field data in the abnormal field data that is applicable to abnormality location by default; if so, executing the step of performing a dump operation on a portion of the target field data in the abnormal field data that is applicable to the target abnormality location; and / or, The method further comprises: after performing a core dump operation on the abnormal field data of the target abnormality through the core dump function, monitoring whether an abnormality occurs in the core dump operation; if an abnormality occurs, terminating the core dump operation, and performing a step of performing a dump operation on a portion of the abnormal field data that is applicable to the target abnormality location in the abnormal field data; and / or, The method also includes: after performing a dump operation on a portion of the target field data in the abnormal field data that is suitable for the target abnormality positioning, monitoring whether the dump operation is abnormal; if so, terminating the dump operation and dumping the target field data to a preset memory that has not stored data.
8. A data dump control device, characterized in that: The device comprises: A collection module, configured to collect at least one target parameter value corresponding to the target exception in response to a target exception of the target program triggering the core dump function, wherein the at least one target parameter value affects the core dump function to perform a core dump operation on the abnormal field data of the target exception; A judgment module, used for judging whether to accept the core dump operation based on the at least one target parameter value; A first dump module, configured to prevent the core dump function from performing a core dump operation on the abnormal field data of the target abnormality if the judgment module determines that the core dump operation is not acceptable, and to perform a dump operation on a portion of the target field data in the abnormal field data that is applicable to the target abnormality location; The second dump module is used to perform a core dump operation on the abnormal field data of the target abnormality through the core dump function if the judgment module determines that the core dump operation is accepted.
9. A computer-readable storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the data dump control method described in any one of claims 1 to claim 7.
10. An electronic device, characterized in that: The electronic device comprises: Memory, used to store programs; A processor, coupled to the memory, is used to run the program to execute the data dump management method described in any one of claims 1 to claim 7.
Citation Information
Cited By
Operating system control method and device and storage medium
CN116501464A