Fault repair method, device and equipment, computer readable storage medium and product
By obtaining the repair files of the cloud server and using the built-in capabilities of the operating system to dynamically locate and modify the objective functions, the problem that the operating system application failure cannot be quickly fixed is solved, and dynamic repair is achieved when the application is run, reducing the impact on other functions, and improving user experience and business continuity.
Patent Information
- Application Number
- CN202510443158.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-07-25
AI Technical Summary
In the prior art, operating system application failures cannot be quickly fixed, resulting in application exit or multiple hierarchical functional abnormalities, affecting user experience and business continuity.
By obtaining the repair files sent by the cloud server, using the built-in Apect atomic capability and dynamic loading classes of the operating system, dynamically locate and modify the objective function, generate and replace the original function, and realize dynamic repair of the objective function.
Dynamically repair the objective function when the application runs, reduce the impact on other functions, and minimize user experience and business losses.
Smart Images

Figure CN120371607A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technologies, and in particular, to a fault repair method, apparatus, device, computer-readable storage medium, and product. Background Art
[0002] With the continuous development of mobile platform operating systems, the user base has also been continuously increasing. For new operating systems, there have been great changes from development languages to system designs, with many platform-specific features and limitations.
[0003] In related technologies, the implementation of a service usually requires multiple modules and multiple levels of calls to be realized. Therefore, when an abnormal operation occurs at a certain level, it often leads to the application exiting, or functional abnormalities occurring in multiple associated levels.
[0004] Therefore, how to achieve rapid dynamic repair of application problems to avoid affecting other functions has become an urgent problem to be solved. Summary of the Invention
[0005] Embodiments of the present disclosure provide a fault repair method, apparatus, device, computer-readable storage medium, and product, which are used to solve the technical problem that application faults in an operating system cannot be quickly repaired.
[0006] In a first aspect, embodiments of the present disclosure provide a fault repair method, including:
[0007] Obtaining a repair file for a target function sent by a cloud server, where the repair file includes positioning information and repair information associated with the target function, the positioning information is used to locate the target function in a source code file associated with a target application, the repair information includes exception protection information and / or parameter repair information, and the repair file is generated by the cloud server after obtaining error information uploaded by the operating system;
[0008] Dynamically locating the target function in the source code file based on the positioning information during the operation of the target application;
[0009] Modifying the target function based on the repair information to obtain an updated function;
[0010] Replacing the target function in the source code file with the updated function.
[0011] The fault repair method provided by this embodiment can obtain a repair file sent by a cloud server when any target function fails. The repair file includes location information for locating the target function and repair information for repairing the target function. Therefore, the location and modification of the target function can be dynamically performed based on the Apect atomic capabilities built into the operating system and the dynamic loading class to obtain atomic capabilities. And the target function is replaced based on the modified update function. Thus, the repair operation of the target function can be dynamically realized during the application running without affecting other subsequent functions, thereby minimizing the loss in user experience and business.
[0012] In a second aspect, an embodiment of the present disclosure provides a fault repair device, including:
[0013] An acquisition module, configured to acquire a repair file for a target function sent by a cloud server, where the repair file includes location information associated with the target function and repair information, the location information is used to locate the target function in a source code file associated with the target application, the repair information includes exception protection information and / or parameter repair information, and the repair file is generated by the cloud server after obtaining error information uploaded by the operating system;
[0014] A location module, configured to dynamically locate the target function in the source code file based on the location information during the running of the target application;
[0015] A modification module, configured to perform a modification operation on the target function based on the repair information to obtain an update function;
[0016] A replacement module, configured to replace the target function in the source code file with the update function.
[0017] The fault repair device provided by this embodiment can obtain a repair file sent by a cloud server when any target function fails. The repair file includes location information for locating the target function and repair information for repairing the target function. Therefore, the location and modification of the target function can be dynamically performed based on the Apect atomic capabilities built into the operating system and the dynamic loading class to obtain atomic capabilities. And the target function is replaced based on the modified update function. Thus, the repair operation of the target function can be dynamically realized during the application running without affecting other subsequent functions, thereby minimizing the loss in user experience and business.
[0018] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;
[0019] The memory stores computer-executable instructions;
[0020] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the fault repair method described in the first aspect above and various possible designs of the first aspect.
[0021] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the fault repair method described in the first aspect above and various possible designs of the first aspect is implemented.
[0022] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program. When the computer program is executed by a processor, the fault repair method described in the first aspect above and various possible designs of the first aspect is implemented.
[0023] For the fault repair method, device, equipment, computer-readable storage medium and product provided in this embodiment, when any target function fails, a repair file sent by the cloud server can be obtained. Among them, the repair file includes positioning information for positioning the target function and repair information for repairing the target function. Therefore, the target function can be dynamically positioned and modified based on the Apect atomic capability built into the operating system and the dynamic loading class to obtain the atomic capability. And the target function is replaced based on the updated function after modification. Thus, the repair operation of the target function can be dynamically realized during the application operation without affecting other subsequent functions, so as to minimize the loss of user experience and business. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0025] Figure 1 It is a schematic diagram of the levels associated with the business within the operating system;
[0026] Figure 2 It is a system architecture diagram based on the present disclosure;
[0027] Figure 3 It is a schematic flowchart of the fault repair method provided by an embodiment of the present disclosure;
[0028] Figure 4 It is a schematic flowchart of the fault repair method provided by another embodiment of the present disclosure;
[0029] Figure 5 Schematic diagram of the update function provided by the embodiments of the present disclosure;
[0030] Figure 6 Schematic diagram of the structure of the fault repair device provided by the embodiments of the present disclosure;
[0031] Figure 7 Schematic diagram of the structure of the electronic device provided by the embodiments of the present disclosure. Specific embodiments
[0032] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present disclosure without creative efforts shall fall within the scope of protection of the present disclosure.
[0033] It can be understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, usage scopes, usage scenarios, etc. of the personal information involved in the present disclosure shall be informed to the user and the user's authorization shall be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0034] For example, when receiving the user's active request, a prompt message is sent to the user to clearly prompt the user that the operation requested by the user will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application program, server, or storage medium that performs the operations of the technical solutions of the present disclosure according to the prompt message.
[0035] As an optional but non-limiting implementation manner, the manner of sending a prompt message to the user in response to receiving the user's active request may be, for example, in the form of a pop-up window, and the prompt message may be presented in text in the pop-up window. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0036] It can be understood that the above process of notifying and obtaining the user's authorization is only illustrative and does not limit the implementation manner of the present disclosure. Other manners that meet relevant laws and regulations can also be applied to the implementation manner of the present disclosure.
[0037] In the actual application development process, the implementation of a service in the operating system often requires multiple modules and multi-level calls to achieve. When any problem occurs at any level, it often causes the application to exit, or the entire call chain associated with that level to be abnormal.
[0038] Figure 1It is a hierarchical schematic diagram of business association within an operating system. As Figure 1 shown, this business is used to print an array, which includes five numbers from 1 to 5. Among them, the printitem11 function provides the atomic ability to print a single number, printall12 provides the ability to print all numbers by traversing the printitem11 atomic ability, and starttest13 is the business entry point, which calls printall12 to execute the printing requirement.
[0039] In this business, when an exception occurs in any printitem, according to the current fault handling mechanism, it will directly jump from the faulty printitem to the outermost layer for exception handling. That is, printitem → printall → starttest → exception handling. When using the above method for exception handling, other printitems behind the faulty printitem will not have the opportunity to be executed. And if there is other logic after the call to printall and starttest, it will also not have the opportunity to be executed. Therefore, the current fault handling method may cause subsequent business losses.
[0040] In the process of solving the above technical problems, the inventor found through research that in order to avoid business losses during fault repair, the fault repair can be limited within the faulty printitem, and the subsequent levels can be kept running, so as to minimize the loss in user experience and business.
[0041] Optionally, when a fault occurs in any target function, a repair file sent by the cloud server can be obtained. Among them, the repair file includes location information for locating the target function and repair information for repairing the target function.
[0042] Therefore, the location and modification of the target function can be dynamically performed based on the Apect atomic ability built into the operating system and the atomic ability obtained by dynamically loading classes. And the target function is replaced based on the modified update function. Thus, the repair operation of the target function can be dynamically realized during the application runtime without affecting other subsequent functions, so as to minimize the loss in user experience and business.
[0043] In order to solve the technical problem that application faults in the operating system cannot be quickly repaired, the present disclosure provides a fault repair method, apparatus, device, computer-readable storage medium, and product.
[0044] It should be noted that the fault repair method, apparatus, device, computer-readable storage medium, and product provided by the present disclosure can be applied to any fault repair scenario within an operating system.
[0045] Figure 2 is the system architecture diagram on which the present disclosure is based. As Figure 2 shown, the system architecture on which the present disclosure is based at least includes a cloud server 21 and a terminal device 22. Among them, the terminal device 22 uses a preset operating system.
[0046] Based on the above system architecture, when a target function in any application in the terminal device 22 fails, an error message can be sent to the cloud server 21. Therefore, the cloud server 21 can send a repair file to the terminal device 22. Therefore, the terminal device 22 can dynamically locate and modify the target function based on the Apect atomic capabilities built into the operating system and the dynamically loaded classes to obtain atomic capabilities. And perform a replacement operation on the target function based on the updated function after modification.
[0047] Figure 3 is a schematic flowchart of a fault repair method provided by an embodiment of the present disclosure, which is applied to an operating system. As Figure 3 shown, the method includes:
[0048] Step 301, obtain a repair file for a target function sent by a cloud server, where the repair file includes location information and repair information associated with the target function. The location information is used to locate the target function in the source code file associated with the target application, and the repair information includes exception protection information and / or parameter repair information. The repair file is generated by the cloud server after obtaining the error message uploaded by the operating system.
[0049] The execution subject of this embodiment is a fault repair device, and the fault repair device can be coupled to a preset operating system. The operating system is installed in a terminal device communicatively connected to the cloud server. Among them, the operating system can be any operating system set in the terminal device. For example, the operating system can be the HarmonyOS.
[0050] In this embodiment, when any target function in the operating system fails, an error message can be sent to the cloud server. Therefore, the cloud server can generate a repair file based on the error message. Wherein, the repair file includes location information and repair information associated with the target function. The location information is used to locate the target function in the source code file associated with the target application, and the repair information includes exception protection information and / or parameter repair information.
[0051] Optionally, the location information may include the module class where the class to which the target function belongs is located, and the specific value may be the final absolute path of the target class; the location information may also include data such as the class to which the target function belongs, the export method of the target class in the module, the target function name, and whether it is of the static type.
[0052] This exception protection information is used to return a preset result value when an exception occurs in the target function. The exception protection information may include a message condition (messageCondition), a fault message, and a comparison method (messageOperation) between the fault message and a preset error message condition. The comparison method includes any one of inclusion, equality, greater than, and less than. It also includes a call stack condition (stackCondition) and a comparison method (stackOperation) between the actual call stack and the call stack condition. The comparison method includes any one of inclusion, equality, greater than, and less than. The exception protection information may further include a preset result value and the type of the result value. For example, the type may be a number, a string, or a complex object.
[0053] This parameter repair information is used to adjust the parameters of the target function when a fault occurs in the target function. The parameter repair information may include the total number of parameters (paramSize) of the function, the index (paramModifiyIndex) of the parameter to be modified, starting from 0, a parameter condition value (paramCondition), an operator (operation) for judging the parameter value. The judgment method includes any one of inclusion, equality, greater than, and less than, a new parameter value (paramNew), and a new parameter value type (paramNewType). For example, the type may be a number, a string, or a complex object.
[0054] Step 302: Dynamically locate the target function in the source code file based on the positioning information when the target application is running.
[0055] In this embodiment, after obtaining the repair file, based on the built-in capabilities of the operating system, the target function can be dynamically located in the source code file based on the positioning information when the target application is running.
[0056] Step 303: Perform a modification operation on the target function based on the repair information to obtain an updated function.
[0057] In this embodiment, since the repair file includes exception protection information and / or parameter repair information, the target function can be modified based on the repair information to obtain an updated function.
[0058] Optionally, the repair information capable of fixing the fault type can be determined based on the current fault type, and the target function can be modified based on the repair information to obtain an updated function.
[0059] Alternatively, the modification operation of the target function can also be achieved based on the exception protection information and the parameter repair information together to obtain an updated function.
[0060] Step 304: Replace the target function in the source code file through the update function.
[0061] In this embodiment, after the target function is transformed based on the repair information, the target function can be replaced with the update function. Therefore, when the application runs subsequently, the update function can be called for data processing.
[0062] Since the update function includes exception protection information and / or parameter repair information, when a failure occurs, the failure can be processed within the function based on the exception protection information and / or parameter repair information, avoiding affecting other functions.
[0063] Taking an actual application as an example, the operating system can be the HarmonyOS. When a failure occurs in any target function in the HarmonyOS, the error message can be uploaded to the cloud server. Therefore, the cloud server can generate a repair file based on the error message. The repair file includes location information for locating the target function and repair information for repairing the target function. Therefore, after the HarmonyOS obtains the repair file, it can dynamically locate the target function based on the location information and modify the target function based on the repair information to obtain an update function. Subsequently, the target function can be replaced by the update function without affecting other subsequent functions.
[0064] The fault repair method provided in this embodiment can obtain the repair file sent by the cloud server when any target function fails. The repair file includes location information for locating the target function and repair information for repairing the target function. Therefore, the target function can be dynamically located and modified based on the Apect atomic capability built into the operating system and the dynamic loading class to obtain the atomic capability. And the target function is replaced based on the modified update function. Thus, the repair operation of the target function can be dynamically realized during the application running without affecting other subsequent functions, thereby minimizing the loss of user experience and business.
[0065] Figure 4 It is a schematic flowchart of the fault repair method provided in another embodiment of the present disclosure. Based on any of the above embodiments, as Figure 4 shown,
[0066] Step 401: Determine multiple classes to be compiled in the source code file.
[0067] Step 402: Determine the relative path corresponding to the class to be compiled, and determine the absolute path corresponding to the class to be compiled based on the relative path.
[0068] Step 403: Adjust the reference relationship of the class to be compiled to the absolute path through a preset compilation tool.
[0069] In this embodiment, the original operating system does not support dynamically implementing the search for the target class in the way of a complete variable expression. Configuration needs to be carried out in the source code in advance, so it is impossible to implement the dynamic distribution of different parameters.
[0070] In order to be able to implement the dynamic distribution of parameters, non-source-code-level parameters can be adopted to avoid compilation period restrictions and runtime search failures, and the configuration parameters are confirmed by collecting the complete path code (absolute path) after the final obfuscation of the compilation product.
[0071] Optionally, multiple classes to be compiled in the source code file can be determined. For each class to be compiled, its corresponding relative path is determined, and the absolute path corresponding to the class to be compiled is determined based on the relative path. During the compilation process, the reference relationship of the class to be compiled is adjusted to the absolute path through a preset compilation tool.
[0072] The fault repair method provided in this embodiment can avoid the problems of compiler restrictions and runtime search failures by adjusting the reference relationship of the class to be compiled to the absolute path, and can accurately locate the target function based on the location information during the application running process.
[0073] Further, on the basis of any of the above embodiments, step 302 includes: the location information includes the absolute path of the module to which the target function belongs, the absolute path of the class to which the target function belongs, the export method, and the function name.
[0074] The location information is searched through the preset dynamic class loading ability in the operating system to obtain the class object associated with the target function, and the target function is determined in the class object.
[0075] In this embodiment, the location information includes the absolute path of the module to which the target function belongs, the absolute path of the class to which the target function belongs, the export method, and the function name.
[0076] Optionally, the operating system provides an atomic ability to dynamically load classes, which supports dynamically locating functions during the application running. Therefore, the location information can be searched through the preset dynamic class loading ability in the operating system to obtain the class object associated with the target function, and the target function is determined in the class object.
[0077] Since using the absolute path can improve the maintainability of the code and avoid complex relative paths. Therefore, by using the absolute path for the location of the target function, the location operation of the target code can be more accurately implemented.
[0078] The fault repair method provided in this embodiment locates the positioning information by dynamically loading the class capabilities, obtains the class object associated with the target function, and thus can accurately locate the target function based on the capabilities built into the operating system. In addition, by using the absolute path for the positioning of the target function, the accuracy of the target function positioning can be improved.
[0079] Further, based on any of the above embodiments, step 304 includes:
[0080] Perform a re-assignment operation on the function attributes of the class object based on the update function.
[0081] In this embodiment, after the target function is located based on the positioning information, a re-assignment operation can be performed on the function attributes of the class object based on the update function. Thus, during the subsequent application operation, the update function can be directly called for data processing.
[0082] The fault repair method provided in this embodiment can accurately implement the replacement operation of the target function during the operation by performing a re-assignment operation on the function attributes of the class object based on the update function.
[0083] Further, based on any of the above embodiments, the exception protection information includes a preset first condition and a preset result value, and the parameter repair information includes a preset second condition and a preset parameter.
[0084] Further, based on any of the above embodiments, step 303 includes:
[0085] Add the exception protection information and / or parameter repair information at the position associated with the target function through the preset Aspect atomic capability in the operating system to obtain the update function.
[0086] Wherein, after the target function is modified based on the exception protection information, the update function is used to return the preset result value when it is determined that the fault information of the target function meets the preset first condition during the call process.
[0087] After the target function is modified based on the parameter repair information, the update function is used to update the parameter associated with the target function to the preset parameter when it is determined that the fault information of the target function meets the preset second condition during the call process.
[0088] In this embodiment, the operating system provides certain Aspect atomic capabilities. Based on these capabilities, some modification capabilities can be added during the application operation. It supports adding custom logic before and after other class methods or replacing the original method.
[0089] After the target function is located based on the positioning information, abnormal protection information and / or parameter repair information can be added at the position associated with the target function through the preset Aspect atomic capability in the operating system to obtain an updated function.
[0090] Figure 5 The schematic diagram of the updated function provided by the embodiments of the present disclosure is as Figure 5 shown. After the target function is transformed, an updated function can be obtained. The updated function 51 includes the target function 52, abnormal protection information 53, and parameter repair information 54.
[0091] Optionally, the abnormal protection information includes a preset first condition and a preset result value. Therefore, after the fault information is obtained, the fault information can be compared with the first condition. If the comparison is successful, the preset result value in the abnormal protection information can be fed back. Otherwise, an exception message can be thrown.
[0092] Optionally, the parameter repair information includes a preset second condition and a preset parameter. Therefore, when a fault occurs, if the fault information matches the second condition, the parameter associated with the target function can be updated to the preset parameter.
[0093] Taking an actual application as an example, if the target function is print item, after adding parameter repair information to the target function, an updated function print itemNew can be obtained. Through this parameter repair information, the parameters can be automatically modified, so the call of the target function + new parameters can be executed to achieve the effect of repairing the parameters.
[0094] The fault repair method provided by this embodiment adds at the position associated with the target function through the preset Aspect atomic capability in the operating system to obtain an updated function, so that the modification operation of the target function can be accurately realized. Therefore, during the operation of the updated function, when an error occurs, a preset result value can be returned, or the parameters can be automatically modified. The fault can be repaired within the target function without affecting other functions and levels associated with the target function.
[0095] Further, based on any of the above embodiments, after step 304, it further includes:
[0096] During the operation of the preset application, the updated function is called to process data.
[0097] In this embodiment, after the original target function is replaced based on the updated function, during the operation of the preset application, the updated function can be directly called to process data.
[0098] Optionally, the user can pre-configure the fault types of exception protection information and parameter repair information according to actual requirements. When a fault occurs, the fault type can be determined, and the exception protection information or parameter repair information can be selected based on the fault type for data processing.
[0099] For example, exception protection information can be used for data processing. After obtaining the fault information, the fault information can be compared with the first condition. If the comparison is successful, the preset result value in the exception protection information can be fed back. Otherwise, an exception message can be thrown.
[0100] The fault repair method provided in this embodiment calls an update function for data processing during the operation of a preset application, so that when an error occurs, a preset result value can be returned, or the parameters can be automatically modified to avoid the problem of the application crashing and the system malfunctioning due to a fault in the target function.
[0101] Further, based on any of the above embodiments, the method further includes:
[0102] In response to a fault occurring in the current target code, determine the location information of the target code in the source code file and the fault type.
[0103] Send an error message to the cloud server, where the error message includes the location information and the fault type.
[0104] In this embodiment, in order to quickly implement the repair operation of the target function, when it is determined that a fault occurs in any target code in the operating system, the location information of the target code in the source code file and the fault type can be determined. Based on the location information and the fault type, an error message is determined. The error message is uploaded to the cloud server.
[0105] Optionally, after obtaining the error message, the cloud server can determine the target function that currently has a fault based on the error message, and determine the repair information that matches the fault type in the preset repair data set. Based on the location information and the repair information, a repair file is constructed, and the repair file is fed back to the terminal device so that the terminal device can implement the repair operation of the target function during the application operation based on the repair file.
[0106] Alternatively, after obtaining the error message, the technical personnel can perform fault analysis based on the error message. Determine the repair information that matches the fault type based on the analysis result. Based on the location information and the repair information, a repair file is constructed, and the repair file is fed back to the terminal device.
[0107] The fault repair method provided in this embodiment actively uploads error messages to the cloud server when a fault occurs, so that the cloud server can accurately generate a repair file based on the error messages. Subsequently, the repair operation of the target function can be implemented during the application running process based on the repair file.
[0108] Figure 6 FIG. is a schematic structural diagram of a fault repair device provided in an embodiment of the present disclosure, which is applied to an operating system, such as Figure 6 As shown, the device includes: an acquisition module 61, a positioning module 62, a modification module 63, and a replacement module 64. Among them, the acquisition module 61 is configured to acquire a repair file for a target function sent by a cloud server, where the repair file includes positioning information associated with the target function and repair information, the positioning information is used to locate the target function in a source code file associated with a target application, the repair information includes exception protection information and / or parameter repair information, and the repair file is generated by the cloud server after obtaining error messages uploaded by the operating system. The positioning module 62 is configured to dynamically locate the target function in the source code file based on the positioning information when the target application is running. The modification module 63 is configured to perform a modification operation on the target function based on the repair information to obtain an updated function. The replacement module 64 is configured to replace the target function in the source code file with the updated function.
[0109] The fault repair device provided in this embodiment can obtain a repair file sent by a cloud server when any target function fails. Among them, the repair file includes positioning information for locating the target function and repair information for repairing the target function. Therefore, the positioning and modification of the target function can be dynamically performed based on the Apect atomic capability built in the operating system and the atomic capability obtained by dynamically loading classes. And the target function is replaced based on the modified updated function. Thus, the repair operation of the target function can be dynamically implemented during the application running process, without affecting other subsequent functions, so as to minimize the loss of user experience and business.
[0110] Further, based on any of the above embodiments, the device further includes: a determination module, configured to determine multiple classes to be compiled in the source code file. A processing module, configured to determine the relative path corresponding to the class to be compiled, and determine the absolute path corresponding to the class to be compiled based on the relative path. An adjustment module, configured to adjust the reference relationship of the class to be compiled to the absolute path through a preset compilation tool.
[0111] The fault repair device provided in this embodiment can avoid the problems of compiler restrictions and runtime lookup failures by adjusting the guidance relationship of the class to be compiled to an absolute path, and can accurately locate the target function based on the positioning information during the operation of the application.
[0112] Further, on the basis of any of the above embodiments, the positioning information includes the absolute path of the module to which the target function belongs, the absolute path of the class to which it belongs, the export method, and the function name. The positioning module is configured to: find the positioning information through the dynamic class loading capability preset in the operating system, obtain the class object associated with the target function, and determine the target function in the class object.
[0113] The fault repair device provided in this embodiment can accurately locate the target function based on the built-in capabilities of the operating system by finding the positioning information through the dynamic class loading capability and obtaining the class object associated with the target function. In addition, by using the absolute path for the positioning of the target function, the accuracy of the target function positioning can be improved.
[0114] Further, on the basis of any of the above embodiments, the replacement module is configured to: reassign the function attribute of the class object based on the update function.
[0115] The fault repair device provided in this embodiment can accurately implement the replacement operation of the target function during the operation by reassigning the function attribute of the class object based on the update function.
[0116] Further, on the basis of any of the above embodiments, the exception protection information includes a preset first condition and a preset result value, and the parameter repair information includes a preset second condition and preset parameters.
[0117] Further, on the basis of any of the above embodiments, the modification module is configured to: add the exception protection information and / or the parameter repair information at the position associated with the target function through the preset Aspect atomic capability in the operating system to obtain the update function. Among them, after modifying the target function based on the exception protection information, the update function is used to return the preset result value when it is determined that the fault information of the target function meets the preset first condition during the call. After modifying the target function based on the parameter repair information, the update function is used to update the parameter associated with the target function to the preset parameter when it is determined that the fault information of the target function meets the preset second condition during the call.
[0118] The fault repair device provided in this embodiment adds exception protection information and / or parameter repair information at the position associated with the target function through the preset Aspect atomic capabilities, and obtains an updated function, so as to accurately implement the modification operation of the target function. Therefore, during the operation of the updated function, when an error occurs, a preset result value can be returned, or the parameters can be automatically modified. It can repair faults within the target function without affecting other functions and levels associated with the target function.
[0119] Further, based on any of the above embodiments, the device further includes: a calling module, configured to call the updated function to process data during the operation of the preset application.
[0120] The fault repair device provided in this embodiment processes data by calling the updated function during the operation of the preset application, so that when an error occurs, a preset result value can be returned, or the parameters can be automatically modified, avoiding problems such as application crashes and system failures caused by faults in the target function.
[0121] Further, based on any of the above embodiments, the device further includes: a determining module, configured to determine the location information and fault type of the target code in the source code file in response to a fault occurring in the current target code. A sending module, configured to send an error message to the cloud server, where the error message includes the location information and the fault type.
[0122] The fault repair device provided in this embodiment actively uploads an error message to the cloud server when a fault occurs, so that the cloud server can accurately generate a repair file based on the error message. Therefore, the repair operation of the target function can be implemented during the operation of the application based on the repair file subsequently.
[0123] The device provided in this embodiment can be used to execute the technical solutions of the above method embodiments, and its implementation principle and technical effects are similar, which will not be elaborated here in this embodiment.
[0124] To implement the above embodiments, the embodiments of the present disclosure further provide a computer-readable storage medium, in which computer-executable instructions are stored, and when a processor executes the computer-executable instructions, the fault repair method described in any of the above embodiments is implemented.
[0125] The computer-readable storage medium provided in this embodiment can obtain a repair file sent by a cloud server when any target function fails. The repair file includes location information for locating the target function and repair information for repairing the target function. Therefore, based on the Apect atomic capabilities built into the operating system and dynamic loading classes, atomic capabilities can be obtained to dynamically locate and modify the target function. And a replacement operation is performed on the target function based on the modified update function. Thus, the repair operation of the target function can be dynamically implemented during application runtime without affecting other subsequent functions, thereby minimizing losses in user experience and business.
[0126] To implement the above embodiment, the present disclosure also provides a computer program product, including a computer program, which when executed by a processor, implements the fault repair method as described in any of the above embodiments.
[0127] The computer program product provided in this embodiment can obtain a repair file sent by a cloud server when any target function fails. The repair file includes location information for locating the target function and repair information for repairing the target function. Therefore, based on the Apect atomic capabilities built into the operating system and dynamic loading classes, atomic capabilities can be obtained to dynamically locate and modify the target function. And a replacement operation is performed on the target function based on the modified update function. Thus, the repair operation of the target function can be dynamically implemented during application runtime without affecting other subsequent functions, thereby minimizing losses in user experience and business.
[0128] To implement the above embodiment, the present disclosure also provides an electronic device, including: a processor and a memory;
[0129] The memory stores computer execution instructions;
[0130] The processor executes the computer execution instructions stored in the memory, causing the processor to execute the fault repair method as described in any of the above embodiments.
[0131] Figure 7Schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. The electronic device 700 may be a terminal device or a server. Among them, the terminal device may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers, portable media players (PMPs), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present disclosure.
[0132] As Figure 7 shown, the electronic device 700 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 701, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0133] Generally, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 7 the electronic device 700 with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices may be implemented or had.
[0134] In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes program code for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 709, or installed from a storage device 708, or installed from a ROM 702. When the computer program is executed by a processing device 701, the above functions defined in the method of the embodiment of the present disclosure are performed.
[0135] For the electronic device provided in this embodiment, when any target function fails, a repair file sent by a cloud server can be obtained. The repair file includes location information for locating the target function and repair information for repairing the target function. Therefore, based on the Apect atomic capabilities built into the operating system and dynamic loading classes, the atomic capabilities can be used to dynamically locate and modify the target function. And a replacement operation is performed on the target function based on the updated function after modification. Thus, the repair operation of the target function can be dynamically implemented during the operation of the application, without affecting other subsequent functions, thereby minimizing the loss in user experience and business.
[0136] It should be noted that the computer-readable medium described above in the present disclosure may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0137] The above computer-readable medium may be included in the above electronic device; or it may exist separately without being assembled into the electronic device.
[0138] The above computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device is caused to execute the method shown in the above embodiments.
[0139] Computer program code for performing the operations of this disclosure may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also conventional procedural programming languages such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0140] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system that performs the specified functions or operations, or may be implemented by a combination of dedicated hardware and computer instructions.
[0141] The units involved in the embodiments described in this disclosure may be implemented in software or in hardware. Among them, the name of the unit does not constitute a limitation to the unit itself in some cases. For example, the first acquisition unit may also be described as "the unit for acquiring at least two Internet protocol addresses".
[0142] The functions described above in this document may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), system on a chip (SOC), complex programmable logic devices (CPLD), and so on.
[0143] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0144] In a first aspect, according to one or more embodiments of the present disclosure, there is provided a fault repair method applied to an operating system, including:
[0145] Obtain a repair file for a target function sent by a cloud server, where the repair file includes positioning information associated with the target function and repair information, the positioning information is used to locate the target function in a source code file associated with a target application, the repair information includes exception protection information and / or parameter repair information, and the repair file is generated by the cloud server after obtaining error information uploaded by the operating system;
[0146] Dynamically locate the target function in the source code file based on the positioning information when the target application is running;
[0147] Modify the target function based on the repair information to obtain an updated function;
[0148] Replace the target function in the source code file with the updated function.
[0149] According to one or more embodiments of the present disclosure, the method further includes:
[0150] Determine multiple classes to be compiled in the source code file;
[0151] Determine the relative path corresponding to the class to be compiled, and determine the absolute path corresponding to the class to be compiled based on the relative path;
[0152] Adjust the reference relationship of the class to be compiled to the absolute path through a preset compilation tool.
[0153] According to one or more embodiments of the present disclosure, the positioning information includes the absolute path of the module to which the objective function belongs, the absolute path of the class to which it belongs, the export method, and the function name.
[0154] Dynamically locating the objective function in the source code file based on the positioning information during the runtime of the target application includes:
[0155] Finding the positioning information through the preset dynamic class loading capability in the operating system, obtaining the class object associated with the objective function, and determining the objective function in the class object.
[0156] According to one or more embodiments of the present disclosure, replacing the objective function in the source code file through the update function includes:
[0157] Performing a re-assignment operation on the function attribute of the class object based on the update function.
[0158] According to one or more embodiments of the present disclosure, the exception protection information includes a preset first condition and a preset result value, and the parameter repair information includes a preset second condition and preset parameters.
[0159] According to one or more embodiments of the present disclosure, the exception protection information includes a preset first condition and a preset result value, and the parameter repair information includes a preset second condition and preset parameters.
[0160] According to one or more embodiments of the present disclosure, after replacing the objective function in the source code file through the update function, it further includes:
[0161] During the runtime of the preset application, calling the update function for data processing.
[0162] According to one or more embodiments of the present disclosure, the method further includes:
[0163] In response to a failure of the current target code, determining the positioning information of the target code in the source code file and the type of the failure;
[0164] Sending an error message to the cloud server, where the error message includes the positioning information and the type of the failure.
[0165] In a second aspect, according to one or more embodiments of the present disclosure, a fault repair device applied to an operating system is provided, including:
[0166] An acquisition module, configured to acquire a repair file for a target function sent by a cloud server, where the repair file includes location information and repair information associated with the target function, the location information is used to locate the target function in a source code file associated with a target application, the repair information includes exception protection information and / or parameter repair information, and the repair file is generated by the cloud server after acquiring error information uploaded by the operating system;
[0167] A location module, configured to dynamically locate the target function in the source code file based on the location information when the target application is running;
[0168] A modification module, configured to perform a modification operation on the target function based on the repair information to obtain an updated function;
[0169] A replacement module, configured to replace the target function in the source code file with the updated function.
[0170] According to one or more embodiments of the present disclosure, the apparatus further includes:
[0171] A determination module, configured to determine a plurality of classes to be compiled in the source code file;
[0172] A processing module, configured to determine a relative path corresponding to the class to be compiled, and determine an absolute path corresponding to the class to be compiled based on the relative path;
[0173] An adjustment module, configured to adjust the reference relationship of the class to be compiled to the absolute path through a preset compilation tool.
[0174] According to one or more embodiments of the present disclosure, the location information includes an absolute path of a module to which the target function belongs, an absolute path of a class to which the target function belongs, an export method, and a function name;
[0175] The location module is configured to:
[0176] Find the location information through a preset dynamic class loading capability in the operating system, obtain a class object associated with the target function, and determine the target function in the class object.
[0177] According to one or more embodiments of the present disclosure, the replacement module is configured to:
[0178] Reassign the function attribute of the class object based on the updated function.
[0179] According to one or more embodiments of the present disclosure, the exception protection information includes a preset first condition and a preset result value, and the parameter repair information includes a preset second condition and a preset parameter.
[0180] According to one or more embodiments of the present disclosure, the modification module is configured to:
[0181] Add the exception protection information and / or parameter repair information at a position associated with the target function through a preset Aspect atomic capability within the operating system to obtain the updated function;
[0182] Wherein, after modifying the target function based on the exception protection information, the updated function is used to return the preset result value when it is determined that the fault information of the target function meets a preset first condition during the calling process;
[0183] After modifying the target function based on the parameter repair information, the updated function is used to update the parameter associated with the target function to the preset parameter when it is determined that the fault information of the target function meets a preset second condition during the calling process.
[0184] According to one or more embodiments of the present disclosure, the apparatus further includes:
[0185] A calling module, configured to call the updated function to process data during the operation of the preset application.
[0186] According to one or more embodiments of the present disclosure, the apparatus further includes:
[0187] A determination module, configured to determine the location information of the target code in the source code file and the type of fault in response to a fault occurring in the current target code;
[0188] A sending module, configured to send an error message to the cloud server, where the error message includes the location information and the type of fault.
[0189] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, including: at least one processor and a memory;
[0190] The memory stores computer execution instructions;
[0191] The at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the fault repair method as described in the first aspect and various possible designs of the first aspect above.
[0192] In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium, in which computer execution instructions are stored, and when a processor executes the computer execution instructions, the fault repair method as described in the first aspect and various possible designs of the first aspect above is implemented.
[0193] Fifthly, according to one or more embodiments of the present disclosure, there is provided a computer program product including a computer program which, when executed by a processor, implements the fault repair method described in the first aspect above and various possible designs of the first aspect.
[0194] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present disclosure.
[0195] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features described in the context of separate embodiments may also be implemented combinatorially in a single embodiment. Conversely, the various features described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.
[0196] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. On the contrary, the specific features and acts described above are merely example forms for implementing the claims.
Claims
1. A fault repair method, characterized in that, Applied to an operating system, including: Obtain a repair file for a target function sent by a cloud server, where the repair file includes location information and repair information associated with the target function. The location information is used to locate the target function in a source code file associated with a target application, and the repair information includes exception protection information and / or parameter repair information. The repair file is generated by the cloud server after obtaining error information uploaded by the operating system; Dynamically locate the target function in the source code file based on the location information during the operation of the target application; Modify the target function based on the repair information to obtain an updated function; Replace the target function in the source code file with the updated function.
2. The method according to claim 1, wherein The method further includes: Determine multiple classes to be compiled in the source code file; Determine the relative path corresponding to the class to be compiled, and determine the absolute path corresponding to the class to be compiled based on the relative path; Adjust the reference relationship of the class to be compiled to the absolute path through a preset compilation tool.
3. The method according to claim 2, wherein The location information includes the absolute path of the module to which the target function belongs, the absolute path of the class to which the target function belongs, the export method, and the function name; The step of dynamically locating the target function in the source code file based on the location information during the operation of the target application includes: Find the location information through the preset dynamic class loading capability in the operating system, obtain the class object associated with the target function, and determine the target function in the class object.
4. The method according to claim 3, wherein The step of replacing the target function in the source code file with the updated function includes: Reassign the function attribute of the class object based on the updated function.
5. The method according to claim 1, wherein The exception protection information includes a preset first condition and a preset result value, and the parameter repair information includes a preset second condition and preset parameters.
6. The method according to claim 5, wherein The step of modifying the target function based on the repair information to obtain an updated function includes: Add the exception protection information and / or parameter repair information at the position associated with the target function through the preset Aspect atomic capability in the operating system to obtain the updated function; Wherein, after modifying the target function based on the exception protection information, the updated function is used to return the preset result value when it is determined that the fault information of the target function meets the preset first condition during the call; After modifying the target function based on the parameter repair information, the updated function is used to update the parameter associated with the target function to the preset parameter when it is determined that the fault information of the target function meets the preset second condition during the call.
7. The method according to any one of claims 1-5, characterized in that, After replacing the target function in the source code file with the updated function, it further includes: During the operation of a preset application, call the updated function for data processing.
8. The method according to any one of claims 1-5, characterized in that The method further includes: In response to a failure of the current target code, determine the location information of the target code in the source code file and the type of failure; Send an error message to the cloud server, where the error message includes the positioning information and the fault type.
9. A fault repair device, characterized in that, Applied to an operating system, including: An acquisition module, configured to acquire a repair file for a target function sent by a cloud server, where the repair file includes the positioning information associated with the target function and repair information, the positioning information is used to locate the target function in a source code file associated with a target application, and the repair information includes exception protection information and / or parameter repair information, and the repair file is generated by the cloud server after acquiring the error message uploaded by the operating system; A positioning module, configured to dynamically locate the target function in the source code file based on the positioning information during the operation of the target application; A modification module, configured to perform a modification operation on the target function based on the repair information to obtain an updated function; A replacement module, configured to replace the target function in the source code file with the updated function.
10. An electronic device, characterized in that, Including: A processor and a memory; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory, so that the processor executes the fault repair method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, Computer execution instructions are stored in the computer-readable storage medium, and when the processor executes the computer execution instructions, the fault repair method according to any one of claims 1 to 8 is implemented.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the fault repair method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Fault tracing method and device for service system assertion failure event
CN120743607A
A fault tracing method and device for business system assertion failure events
CN120743607B