Code block calling method and device, equipment, medium and program product

By generating address jump information to instruct the second code block to replace the first code block, the problem of not being able to repair code without pre-embedded stubs in the pre-embedded stub code scheme is solved, thus improving the stability and security of program operation.

CN121742935APending Publication Date: 2026-03-27TENCENT TECH (CHENGDU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

In existing technologies, the hot-fix scheme for pre-embedded stub code is not flexible enough and cannot effectively replace abnormal code without pre-embedded stub code, affecting the stability of code operation.

Method used

By generating address jump information, the second code block is instructed to write to the second address, replacing the first code block, thus achieving targeted repair of abnormal code.

Benefits of technology

It enables flexible repair of code that lacks pre-embedded stubs, avoids code redundancy issues, and improves the stability and security of program operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121742935A_ABST
    Figure CN121742935A_ABST
Patent Text Reader

Abstract

The invention discloses a code block calling method and device, equipment, a medium and a program product, and relates to the technical field of computers. The method comprises the steps of obtaining a program file of a first program; in the process of running the program file, in response to the fact that a first code block used for achieving the first subprogram logic is abnormal, configuration information related to the first code block is rewritten based on the second address, and address jump information is generated; invoking a second code block from a second address based on the address jump information; executing the second code block implements the first subprogram logic in the first program. The second address written by the second code block can be indicated in a targeted mode through the generated address jump information, the purpose of replacing the first code block in a targeted mode through the second code block is achieved, and the running stability of the first program is guaranteed. The method and the device can be applied to various scenes such as program running repair scenes and program analysis scenes.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to a code block calling method and device, equipment, medium and program product. BACKGROUND

[0002] During code running, there may be abnormal codes causing running bugs or running crashes. In order to avoid the occurrence of the above problems, abnormal codes are usually dynamically repaired during software running. This method is called hot repair, that is, the repair of problems can be realized without stopping services and restarting applications, so as to guarantee the stability of code running.

[0003] In related technologies, the scheme of pre-embedding stake codes is usually used to realize hot repair. In the case of abnormal codes, the pre-embedded stake codes replace the problematic abnormal codes to avoid program running errors.

[0004] However, the scheme of pre-embedding stake codes is not flexible enough. If the abnormal code is other code without pre-embedded stake codes, hot repair cannot be realized, which affects the stability of code running. SUMMARY

[0005] Embodiments of the present application provide a code block calling method, device, equipment, medium and program product, which can use generated address jump information to indicate the second address written by the second code block, realize the purpose of replacing the first code block by the second code block, and guarantee the running stability of the first program. The technical solution is as follows.

[0006] On the one hand, a code block calling method is provided, and the method comprises:

[0007] Obtaining a program file of a first program, the program file comprising a plurality of code blocks, the plurality of code blocks being used to jointly implement program logic of the first program;

[0008] In the process of running the program file, in response to the existence of an abnormal first code block used to implement a first sub-program logic, rewriting configuration information related to the first code block based on a second address, generating address jump information, the address jump information being obtained after rewriting the configuration information related to the first code block, the first code block being stored in a first address, and the address jump information being used to indicate jumping to a second address;

[0009] Calling a second code block from the second address based on the address jump information, the second code block being a code block written in the second address in the case of the existence of the abnormal first code block;

[0010] Executing the second code block to implement the first sub-program logic in the first program.

[0011] In another aspect, a code block calling method is provided, the method comprising:

[0012] receiving a repair request sent by a first terminal, the repair request being used to acquire a second code block to replace a first code block, the first code block being used to implement a first subprogram logic in a first program, the first code block being stored in a first address in the first terminal;

[0013] acquiring the second code block based on the repair request, the second code block being used to replace the first code block to implement the first subprogram logic in the first program;

[0014] sending the second code block to the first terminal, the second code block being used to be written in a second address in a case where the first code block has an exception, the second address being used to generate address jump information in the first terminal, the address jump information being information used to jump to the second address to call the second code block after the configuration information related to the first code block is rewritten.

[0015] In another aspect, a code block calling apparatus is provided, the apparatus comprising:

[0016] an acquiring module, configured to acquire a program file of a first program, the program file comprising a plurality of code blocks, the plurality of code blocks being used to jointly implement program logic of the first program;

[0017] a generating module, configured to, in a process of running the program file, in response to a first code block used to implement a first subprogram logic having an exception, rewrite configuration information related to the first code block based on a second address, and generate address jump information, the address jump information being obtained after the configuration information related to the first code block is rewritten, the first code block being stored in a first address, the address jump information being used to indicate jumping to the second address;

[0018] a calling module, configured to call a second code block from the second address based on the address jump information, the second code block being a code block written in the second address in a case where the first code block has an exception;

[0019] an executing module, configured to execute the second code block to implement the first subprogram logic in the first program.

[0020] In an optional embodiment, the calling module is further configured to call the second code block from the second address based on the address jump information in a case where the second code block is written in the second address.

[0021] In an optional embodiment, the calling module is further configured to obtain an address mapping table, the address mapping table being configured to represent address replacement relationships between a plurality of addresses; in response to an exception existing in the first code block for implementing the first subprogram logic, search the address mapping table for the second address having the address replacement relationship with the first address; and overwrite the configuration information related to the first code block based on the second address.

[0022] In an optional embodiment, the generating module is further configured to, in response to an exception existing in the first code block for implementing the first subprogram logic, dynamically determine the second address from at least one free address; and overwrite the configuration information related to the first code block based on the second address to generate the address jump information.

[0023] In an optional embodiment, the generating module is further configured to determine the second address meeting a preset length requirement from the at least one free address, the preset length requirement being a preset requirement for effectively storing the second code block.

[0024] In an optional embodiment, the generating module is further configured to, in response to an exception existing in the first code block for implementing the first subprogram logic, generate a repair request for the first code block, the repair request being configured to request to obtain the second code block for replacing the first code block; receive the second code block, and write the second code block into the second address; and overwrite the configuration information related to the first code block based on the second address to generate the address jump information.

[0025] In an optional embodiment, the generating module is further configured to obtain the second address meeting an address length requirement based on a code block length of the second code block, the address length requirement being a length requirement for effectively storing the second code block; and write the second code block into the second address.

[0026] In an optional embodiment, the generating module is further configured to, in response to an exception existing in the first code block for implementing the first subprogram logic, determine a third code block calling the first code block from the plurality of code blocks, the third code block including a first pointing value pointing to the first address in a first register; adjust the first pointing value to a second pointing value based on the second address to obtain the address jump information, the second pointing value being configured to point to the second address in the first register.

[0027] In an optional embodiment, the generating module is further configured to, in response to an exception existing in the first code block for implementing the first subprogram logic, adjust preset configuration content in the first code block to a jump instruction based on the second address, to obtain the address jump information; the jump instruction is used to indicate jumping to the second address for calling the second code block.

[0028] In an optional embodiment, the generating module is further configured to determine a first instruction operation code corresponding to a first platform type of a hardware platform on which the program file is run, based on the first platform type; the instruction operation code is used to represent an operation code for implementing a direct jump function on the hardware platform; and the preset configuration content in the first code block is adjusted by using the first instruction operation code and the second address, to obtain the jump instruction as the address jump information.

[0029] In an optional embodiment, the executing module is further configured to, in a case where a fourth code block called by the first code block in the program file is a normal code block, execute second subprogram logic in which the second code block calls the fourth code block.

[0030] In another aspect, a code block calling apparatus is provided, and the apparatus includes:

[0031] A receiving module is configured to receive a repair request sent by a first terminal, the repair request being used to obtain a second code block for replacing a first code block, the first code block being used to implement first subprogram logic in a first program, and the first code block being stored in a first address in the first terminal.

[0032] An obtaining module is configured to obtain the second code block based on the repair request, the second code block being used to replace the first code block to implement the first subprogram logic in the first program.

[0033] A sending module is configured to send the second code block to the first terminal, the second code block being used to be written into a second address in a case where an exception exists in the first code block, the second address being used to generate address jump information in the first terminal, the address jump information being information for jumping to the second address for calling the second code block and being obtained by rewriting configuration information related to the first code block.

[0034] In an optional embodiment, the obtaining module is further configured to distribute the second code block to a plurality of terminals, and the plurality of terminals are configured to write the second code block into the second address.

[0035] In an optional embodiment, the sending module is further configured to send an address mapping table to the first terminal, the address mapping table being configured to represent the address replacement relationship among a plurality of addresses, the address replacement relationship being configured to represent a mutual replacement relationship between at least two addresses; and wherein the first terminal is configured to find the second address having the address replacement relationship with the first address from the address mapping table based on the first code block, and write the second code block into the second address.

[0036] In another aspect, a computer device is provided, the computer device comprising a processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the code block calling method according to any one of the above embodiments of the present application.

[0037] In another aspect, a computer readable storage medium is provided, the storage medium storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by a processor to implement the code block calling method according to any one of the above embodiments of the present application.

[0038] In another aspect, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the code block calling method according to any one of the above embodiments.

[0039] The technical scheme provided by the embodiments of the present application has at least the following beneficial effects:

[0040] In the process of running the program file, if the first code block has an exception, the configuration information related to the first code block is rewritten to obtain address jump information, indicating that the second address outside the first address where the first code block is stored is jumped to, so that the second code block at the second address is called instead of the first code block to execute the first program logic responsible for the first code block. Among them, the second code block is the code block written in the second address in the case of the exception of the first code block. The second code block written in the second address is indicated by the generated address jump information, and the purpose of replacing the first code block by the second code block is realized, avoiding the code redundancy problem existing in the pre-embedded stub code mode, and overcoming the problem that other codes without pre-embedded stub codes cannot be hot repaired. The code complexity can be reduced during the code block writing process, and the more targeted hot repair process can be performed on the abnormal code existing in any position during the program file running process, thereby helping to ensure the running safety of the first program and the running stability of the first program. BRIEF DESCRIPTION OF DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0042] Figure 1 is a structural block diagram of a repair system provided by an example embodiment of the present application;

[0043] Figure 2 is a flowchart of a code block calling method provided by an example embodiment of the present application;

[0044] Figure 3 is a flowchart of a code block calling method provided by another example embodiment of the present application;

[0045] Figure 4 is a flowchart of a normally executed code block provided by an example embodiment of the present application;

[0046] Figure 5 is a flowchart of an abnormally executed code block provided by an example embodiment of the present application;

[0047] Figure 6 is a flowchart of a code block calling method provided by another example embodiment of the present application;

[0048] Figure 7 is a flowchart of obtaining address jump information provided by an example embodiment of the present application;

[0049] Figure 8 is a flowchart of repairing abnormal code based on a pointing value adjustment method provided by an example embodiment of the present application;

[0050] Figure 9 is a schematic diagram of a third code block provided by an example embodiment of the present application;

[0051] Figure 10 is a schematic diagram of a first code block provided by an example embodiment of the present application;

[0052] Figure 11 is a schematic diagram of address jump information provided by an example embodiment of the present application;

[0053] Figure 12 is a schematic diagram of a second code block provided by an example embodiment of the present application;

[0054] Figure 13 is a flowchart of obtaining address jump information provided by another example embodiment of the present application;

[0055] Figure 14 is a flowchart of repairing abnormal code based on a code header rewriting method provided by an example embodiment of the present application;

[0056] Figure 15 is a schematic diagram of a first code block provided by another example embodiment of the present application;

[0057] Figure 16 is a schematic diagram of rewriting a code header to obtain address jump information provided by an example embodiment of the present application;

[0058] Figure 17 is a schematic diagram of a second code block provided by another example embodiment of the present application;

[0059] Figure 18 is a flowchart of a code block calling method executed by a server provided by an example embodiment of the present application;

[0060] Figure 19 is a flowchart of performing hot repair by a related technology provided by an example embodiment of the present application;

[0061] Figure 20 is a flowchart of performing hot repair by a related technology provided by another example embodiment of the present application;

[0062] Figure 21 is a structural block diagram of a code block calling device provided by an example embodiment of the present application;

[0063] Figure 22 is a structural block diagram of a code block calling device provided by another example embodiment of the present application;

[0064] Figure 23 is a structural block diagram of a terminal provided by an example embodiment of the present application. DETAILED DESCRIPTION

[0065] For the purpose, technical solutions and advantages of the present application to be clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.

[0066] In the related art, a scheme of pre-embedding pile code is usually adopted to implement hot repair, and in the case of abnormal code, the pre-embedded pile code is used to replace the problematic abnormal code to avoid program running errors. However, the scheme of pre-embedding pile code is not flexible enough, and if the abnormal code is other code that is not pre-embedded with pile code, hot repair cannot be implemented, affecting the stability of code running.

[0067] In the embodiments of the present application, a code block calling method is introduced, which can use the generated address jump information to indicate the second address written by the second code block, so as to achieve the purpose of replacing the first code block by the second code block, and guarantee the running stability of the first program. The code block calling method provided by the embodiments of the present application can be applied to multiple computer computing scenarios such as program running repair scenarios, program analysis scenarios, data processing scenarios, network communication scenarios, etc., and the embodiments of the present application do not limit this.

[0068] In an optional embodiment, the code block calling method is applied to the program running repair scenario as an example for description.

[0069] Illustratively, the first program is a game application, and the program file of the first program is a file supporting at least one function of running the game, such as a program file supporting the function of a virtual object controlled by a host to cast a big move. The program file includes a plurality of code blocks, and the plurality of code blocks are used to implement the program logic of the first program, such as code block 1 used to implement the starting special effect of the big move function, and code block 2 used to implement the casting special effect of the big move function. During the running of the program file, in response to an exception of a first code block used to implement the first program logic, address jump information is generated. The first code block is stored at a first address. The exception of the first code block is, for example, a syntax error of the first code block, or the first code block does not exist at the first address. Based on the exception of the first code block, configuration information related to the first code block is rewritten to obtain the address jump information, and the address jump information is used to indicate a jump to a second address outside the first address. Then, the second code block at the second address can be called based on the address jump information. The second code block is a code block written into the second address in the case of the exception of the first code block. For example, when the first code block has an exception, the address jump information for jumping to the second address is generated, and the second code block for replacing the first code block is requested to be written into the second address, so that the first program logic supported by the first code block is implemented by executing the second code block. By means of the above-mentioned method, the problem that the program cannot continue to be executed due to the exception of the first code block during the running of the program file can be avoided, and the problem that the game application running environment has a security risk due to the pre-insertion of the stub can also be avoided. By means of the flexible generation of the address jump information indicating the second address and the flexible acquisition of the second code block for replacing the first code block, the purpose of normal running of the game application is achieved, the analysis range of the exception code is improved, and the overall repair of the code block during the running is improved.

[0070] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data for analysis, stored data, displayed data, etc.) and signals involved in the present application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards in the relevant region. For example, the program file, code block, address and other contents involved in the present application are obtained under full authorization.

[0071] Secondly, the calling system involved in the embodiments of the present application is described. The code block calling method provided by the embodiments of the present application can be implemented by a terminal alone, or can be implemented by a server, or can be implemented by the terminal and the server through data interaction. The embodiments of the present application do not limit this. Optionally, the terminal and the server are taken as an example to describe the implementation of the code block calling method.

[0072] Illustratively, please refer toFigure 1 The system involves a terminal 110 and a server 120, which are connected via a communication network 130.

[0073] In some embodiments, terminal 110 obtains a program file of a first program, the program file including multiple code blocks, the multiple code blocks being used to jointly implement the program logic of the first program.

[0074] In illustrative terms, the first program may be a system program; or, the first program may be a system-built-in application; or, the first program may be an externally installed application, etc. The program file of the first program is a file that supports running the first program; or, a program file is a file that supports running some functions of the first program, etc. For example, a program file may be a source code file, an executable file, a script text file, etc.

[0075] In some embodiments, during the execution of a program file, in response to an exception in the first code block used to implement the logic of the first subroutine, the terminal 110 rewrites the configuration information related to the first code block based on the second address and generates address jump information.

[0076] Schematic illustration: the first code block is any one of multiple code blocks in the program file (e.g., ...). Figure 1 (Code block 2 in the code block is the exception code); the first code block is used to implement the logic of the first subroutine in the first program. If the first code block has an exception, the logic of the first subroutine cannot be effectively implemented. In this case, in order to avoid the program running terminal, the logic of the first subroutine needs to be executed by other code blocks used to replace the first code block.

[0077] The address jump information is obtained by rewriting the configuration information related to the first code block. The first code block is stored at the first address, and the address jump information is used to indicate the jump to the second address.

[0078] To illustrate, when an exception occurs in the first code block, the configuration information related to the first code block is rewritten to obtain address jump information to a second address other than the first address, so as to obtain the code block that replaces the first code block from the second address.

[0079] In some embodiments, terminal 110 invokes a second code block from a second address based on address jump information.

[0080] The second code block is written to the second address in case of an exception in the first code block. For example, when an exception occurs in the first code block, it generates address jump information to the second address and requests that the second code block, replacing the first code block, be written to the second address. This allows the second code block to be invoked from the second address when the jump is based on the address jump information.

[0081] Optionally, when the first code block has an exception, the terminal 110 sends a repair request to the server 120 through the communication network 130 to request to obtain the second code block and write the second code block into the second address.

[0082] In some embodiments, the terminal 110 executes the second code block to implement the first subprogram logic in the first program.

[0083] Illustratively, after the terminal 110 calls the second code block based on the address jump information, the terminal 110 executes the second code block to implement the first subprogram logic originally executed by the first code block, avoiding the occurrence of the first program running interruption.

[0084] It is worth noting that the terminal described above includes but is not limited to mobile terminals such as mobile phones, tablet computers, portable laptop computers, smart voice interaction devices, smart home appliances, and vehicle-mounted terminals, and can also be implemented as a desktop computer, etc. The server described above can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server.

[0085] In combination with the above-mentioned name introduction and application scenarios, the code block calling method provided by the present application is described. For example, as shown in Figure 2 The method includes the following steps 210 to 240.

[0086] Step 210, obtaining a program file of a first program.

[0087] Illustratively, the first program is a system program of the terminal; or, the first program is an application program built-in the terminal; or, the first program is an application program installed outside the terminal; or, the first program is a web program running on the terminal, etc. For example, the first program is a game application program installed on the terminal, or the first program is a health application program built-in the terminal, etc.

[0088] Illustratively, the first program corresponds to the program file, and the program file is a file for running the first program; or, the program file is a file for running at least one function in the first program, etc. The program file is implemented as a source code file, an executable file, a script file, etc. The operating system of the terminal includes but is not limited to a Windows system, a Linux system, an iPhone Operating System, an Android Operating System, etc. The hardware platform for running the operating system includes but is not limited to x86, x86_64, arm, arm64, etc.

[0089] The program file includes a plurality of code blocks, and the plurality of code blocks are used to jointly implement program logic of the first program.

[0090] Optionally, a program file generally includes a plurality of code blocks, and the plurality of code blocks jointly implement program logic of the first program. The plurality of code blocks include at least one of a function, a method, a class, a module, or any other logical encapsulation form.

[0091] Illustratively, a function and a method are the most basic code blocks, which are used to perform specific tasks. There can be multiple functions and methods in a program file, and each function and method is responsible for handling a part of the function of the program; in addition, conditional statements such as if, else if, else, switch, etc. are used to execute different code blocks based on specific conditions; loop statements such as for, while, do-while, etc. allow a piece of code to be repeatedly executed until a specific condition is met.

[0092] When writing a program, a developer will decompose the code logic into multiple code blocks as needed, which can improve the readability, maintainability, and reusability of the code; each code block has its specific responsibilities and can be tested and debugged independently of other code blocks; this modular approach helps to build complex and feature-rich programs.

[0093] Illustratively, the game application corresponds to a plurality of program files, and each program file includes a plurality of code blocks. Taking program file 1 as an example, the plurality of code blocks in program file 1 are used to jointly implement program logic of attack skills in the game application, etc.

[0094] In step 220, in the process of running the program file, in response to an exception of a first code block used to implement a first sub-program logic, configuration information related to the first code block is rewritten based on a second address to generate address jump information.

[0095] Illustratively, the first code block is any one of the plurality of code blocks; each code block is used to implement part of the program logic corresponding to the program file, such as the first code block used to implement the first sub-program logic. For example, the program logic corresponding to the program file is A, code block 1 in the program file is used to implement sub-logic program a1 in program logic A, code block 2 in the program file is used to implement sub-logic program a2 in program logic A, etc. That is, the first sub-program logic is regarded as a sub-program logic implemented by the first code block in the program logic corresponding to the program file.

[0096] Illustratively, if there is an exception in the first code block during the running of the program file, it means that the first code block cannot implement the first subprogram logic, and at this time, the implementation of the overall program logic corresponding to the program file has difficulties. Optionally, the case where the first code block has an exception includes at least one of the following.

[0097] (1) a syntax error in the first code block causes an exception during compilation or interpretation; (2) the first code block passes the compilation but produces an exception during running due to various reasons (such as division by zero, array out of bounds, etc.); (3) the first code block can be logically incorrect, causing the running behavior to be inconsistent with the expectation; (4) the first code block attempts to access uninitialized or unavailable resources (such as files, network connections, etc.), thereby causing an exception; (5) the first code block can have a memory leak or excessive use of memory, causing a memory overflow exception; (6) in a multi-threaded environment, the first code block can have a race condition, deadlock, or other concurrency-related problems that cause an exception, etc. without limitation.

[0098] The address jump information is obtained based on the configuration information related to the first code block after the configuration information is rewritten based on the second address.

[0099] Illustratively, if the first code block stored at the first address has an exception, and at this time, if the program file is to continue to run normally, other code blocks are needed to replace the first code block. Optionally, by adjusting the address to be jumped, the code block stored at the other address is obtained to replace the first code block, such as the second code block stored at the second address to replace the first code block.

[0100] Optionally, the configuration information related to the first code block is used to represent information for controlling the behavior of the code block or defining the execution environment of the code block. Illustratively, the configuration information is the preset configuration content of the first code block, such as the code header of the first code block; or the configuration information is the configuration information of the third code block for calling the first code block, such as the code tail of the third code block, etc.

[0101] Illustratively, the first code block is stored at the first address, and when the first code block at the first address has an exception, the terminal automatically generates address jump information, and the address jump information is used to indicate jumping to the second address.

[0102] Optionally, the terminal determines the second address based on the first address, and generates the address jump information based on the second address; or the terminal selects a free address as the second address, and generates the address jump information based on the second address, etc. without limitation.

[0103] Illustratively, the address jump information includes the second address; and the configuration information related to the first code block is overwritten by the second address to obtain the address jump information when the address jump information is generated based on the second address. For example, the code header of the first code block is overwritten by the second address to obtain the address jump information; or the code tail of a third code block used to call the first code block is overwritten by the second address to obtain the address jump information, and the like.

[0104] At step 230, the second code block is called from the second address based on the address jump information.

[0105] Illustratively, the address jump information is used to indicate the second address, and thus the address jump information is analyzed to jump to the second address, and the second code block is stored at the second address, and the second code block is used to replace the first code block to implement the first subprogram logic.

[0106] The second code block is written into the second address in the case that the first code block has an exception.

[0107] Illustratively, in the case that the first code block has an exception, in addition to generating the address jump information indicating the second address, the second code block used to replace the first code block is also written into the second address, so that after jumping to the second address based on the first jump information, the second code block written into the second address can be called.

[0108] Optionally, in the case that the first code block has an exception, the address jump information is generated based on the second address first, and then the second code block is written into the second address; or the second code block is written into the second address first, and then the address jump information is generated based on the second address; or the second code block is written into the second address at the same time when the address jump information is generated based on the second address, and the like.

[0109] In some embodiments, the second code block used to replace the first code block is a code block received by the terminal from a server, such as when the first code block has an exception, the terminal requests the server to issue the second code block used to replace the first code block, the server pre-stores the second code block, or the server instructs a developer to write the second code block used to replace the first code block, and the like; or the second code block is a code block obtained by the terminal based on the first code block, such as the terminal is deployed with a code modification model, the code modification model can correct simple code errors based on the first code block and obtain the second code block, and the like, and the manner of obtaining the second code block is not limited herein.

[0110] At step 240, the second code block is executed to implement the first subprogram logic in the first program.

[0111] To illustrate, after the second code block is read from the second address, since the second code block is a code block that is replaced by the first code block, the first subroutine logic corresponding to the first code block can be implemented by executing the second code block, so as to make up for the problem that the first code block cannot be executed normally and ensure the normal operation of the first program.

[0112] It is worth noting that the above are merely illustrative examples, and the embodiments of this application are not limited thereto.

[0113] In summary, the second code block, which writes to the second address when the first code block encounters an exception, not only specifically indicates the second address to be written by the second code block through the generated address jump information, but also achieves the purpose of specifically replacing the first code block with the second code block. This avoids the code redundancy problem that exists in the pre-stub code method, and also overcomes the problem of not being able to hot-fix other code that is not pre-stubbed. It can reduce the complexity of code writing during the code block writing process, and can also perform a more targeted hot-fix process on abnormal code at any location during program file execution, thereby helping to ensure the operational stability of the first program while ensuring its operational safety.

[0114] In an optional embodiment, when an exception occurs in the first code block used to implement the first subroutine logic, a second address is first obtained, and then the configuration information related to the first code block is rewritten based on the second address to generate address jump information. (Illustrative example, such as...) Figure 3 As shown above, Figure 2 The illustrated embodiment can also be implemented as steps 310 to 350 as follows; wherein step 220 can also be implemented as steps 320 to 330 as follows; and step 230 can also be implemented as step 340 as follows.

[0115] Step 310: Obtain the program file of the first program.

[0116] In illustrative terms, the first program may be a system program of the terminal; or, the first program may be an application program built into the terminal; or, the first program may be an application program installed externally on the terminal; or, the first program may be a web application running on the terminal, etc.

[0117] The program file includes multiple code blocks, which are used together to implement the program logic of the first program.

[0118] Optionally, a program file typically contains multiple code blocks that work together to implement the program logic of the first program. These code blocks include at least one of the following: functions, methods, classes, modules, or any other form of logical encapsulation.

[0119] Indicative, such as Figure 4The diagram shows a flowchart of the normal operation of a program file. After the program file starts running, if multiple code blocks are in a normal state (such as...), Figure 4 The code 410 indicates that multiple code blocks can run normally to achieve the program logic of the first program, and therefore will terminate normally until the end of the program.

[0120] Indicative, such as Figure 5 The diagram shows a flowchart illustrating abnormal program file execution. After the program file begins execution, if at least one code block is in a normal state (e.g., ...), ... Figure 5 Although there is normal code 510, there is also abnormal code 520, which means there is a code block in an abnormal state. This means that the current code blocks cannot run normally, so the program logic of the first program cannot be implemented. Usually, after executing abnormal code 520, it enters an abnormal termination state, and even if the subsequent code blocks are in a normal state, they cannot be executed effectively.

[0121] Optionally, if you want to run in a certain state Figure 5 If the first program can still continue running under certain circumstances, then it is necessary to promptly adjust the program during its execution. Figure 5 The problem of exception code 520 shown can be overcome, such as by replacing the original program logic of exception code 520 with normal code to replace exception code 520, thus avoiding the occurrence of abnormal termination. The process of repairing code during operation is usually called hotfix process.

[0122] Step 320: During the execution of the program file, in response to an exception occurring in the first code block used to implement the logic of the first subroutine, the second address is obtained.

[0123] The first code block is stored at the first address. (Illustrative example, as shown below) Figure 5 As shown, taking exception code 520 as the first code block as an example, exception code 520 is the code block that implements the logic of the first subroutine. Based on the existence of exception code 520, a second address other than the first address is obtained to store a second code block that replaces the first code block.

[0124] In an optional embodiment, an address mapping table is obtained.

[0125] To illustrate, the address mapping table is a table used by the terminal-based operating system during program execution. It is an important table used in the function call process of Dynamic Link Libraries (DLLs), meaning that the address mapping table is involved in the call process of multiple code blocks.

[0126] Optionally, the address mapping table is determined based on an operating system, such as an Import Address Table (IAT) of a Portable Executable (PE) on a Windows operating system, an Import Name Table (INT), an Export Address Table (EAT), a Procedure Linkage Table (PLT) of an Executable and Linking Format (ELF) on an Android operating system, a Global Offset Table, a function table of a Mach Object File Format (Mac-o) on an iOS operating system, such as a Dynamic Symbol Table, and the like.

[0127] Optionally, the address mapping table can be pre-configured based on an operating system, or can be received from a server, so as to make the implementation more flexible and facilitate wider application scenarios, which is not limited here.

[0128] The address mapping table is used to represent the address replacement relationship between a plurality of addresses.

[0129] In the dynamic linking process between a plurality of code blocks, the address mapping table is used to ensure that the functions in the DLL can be correctly called, even if the addresses of these functions are unknown at the time of compilation. Through the address replacement mechanism of the address mapping table, the DLL can also be dynamically linked at runtime, and the code block replacement process can be implemented.

[0130] Illustratively, the first code block is stored at a first address, and the first code block corresponding to the first address at the first identifier is originally called based on the dynamic linking process. When the first code block has an abnormal condition, a second code block for replacing the first code block is requested, the second code block is stored at a second address, and the second address is updated as an entry indicated by the first identifier. Thus, in the subsequent calling process, the first code block stored at the first address is not called, but the second code block written at the second address indicated by the first identifier based on the entry update is called, so as to achieve the purpose of redirection calling based on the identifier (such as the first identifier).

[0131] The above code block replacement process can be referred to as a dynamic hook table replacement technique. The implementation process can more explicitly indicate which code block needs to be replaced through identifiers in the table, and can also flexibly adjust the information indicated by the identifiers without changing the identifiers, thereby achieving a more targeted and flexible code block replacement process.

[0132] Illustratively, the address mapping table stores a plurality of addresses, and at least two of the plurality of addresses have an address replacement relationship. The address replacement relationship is used to represent the relationship of calling different addresses to implement the same program logic. For example, the address mapping table includes "address 1-address 2". If the code block A stored in address 1 has an exception, the code block B for implementing the code block A can be stored through address 2. If the code block A stored in address 2 has an exception, the code block B for implementing the code block A can be stored through address 1. Alternatively, the address mapping table includes "address 1-address 2-address 3". If the code block A stored in address 1 has an exception, the code block B for implementing the code block A can be stored through at least one of address 2 and address 3. If the code block A stored in address 2 has an exception, the code block B for implementing the code block A can be stored through at least one of address 1 and address 3.

[0133] In an optional embodiment, in response to the first code block for implementing the first subprogram logic having an exception, a second address having an address replacement relationship with the first address is found from the address mapping table.

[0134] Illustratively, the address replacement relationship is used to indicate calling different addresses to implement the same program logic. Therefore, if the first program block stored in the first address has an exception, the address mapping table can be searched based on the first address to determine a second address different from the first address but capable of storing and obtaining the second code block, i.e., a second address having an address replacement relationship is found.

[0135] For example, the address mapping table includes "address 1-address 2". If address 1 is the first address, address 2 can be used as the second address having an address replacement relationship through the address mapping table.

[0136] In an optional embodiment, in response to the first code block for implementing the first subprogram logic having an exception, a second address is dynamically determined from at least one free address.

[0137] Illustratively, the free address is a segment of address in the memory address space that is not used by the current program or process. If the first code block stored in the first address has an exception, an address can be dynamically determined from the free address as a second address for storing the second code block.

[0138] In an optional embodiment, the memory address such as the first address, the second address has an address length, the address length is used to represent the number of bits required by the memory address, the address length is within an address length range, the address length range determines the size of the memory space that can be directly addressed by the program. For example: in a 32-bit operating system, the address length range is 0 to 4 GB, if the size of the code block to be stored exceeds this address length, it cannot be stored; in addition, although theoretically 4 GB can be used in memory, because the operating system and other applications will also occupy memory, therefore the actually available address length range is not only less, and the available addresses are usually scattered.

[0139] In some embodiments, the second address meeting the preset length requirement is determined from the at least one free address.

[0140] The preset length requirement is a preset requirement for effectively storing the second code block.

[0141] Illustratively, when determining the second address, not only do we need to select a free address from the address length range, but we usually also set a relatively wide length requirement for the selection of the second address as the preset length requirement, such as the preset length requirement selected is: greater than the address length occupied by the first code block, etc.

[0142] Step 330, rewriting the configuration information related to the first code block based on the second address, generating address jump information.

[0143] The address jump information is obtained by rewriting the configuration information related to the first code block, the first code block is stored in the first address, and the address jump information is used to indicate jumping to the second address.

[0144] Illustratively, the configuration information is rewritten by the second address, and the configuration information is used to represent information that controls the behavior of the code block or defines the execution environment of the code block. Illustratively, the configuration information is the preset configuration content of the first code block, such as the code header of the first code block; or, the configuration information is the configuration information of the third code block used to call the first code block, such as the code tail of the third code block, etc.

[0145] Optionally, the second address is written into the configuration information related to the first code block, so that the generated address jump information includes the second address.

[0146] Step 340, in the case that the second code block exists at the second address, calling the second code block from the second address based on the address jump information.

[0147] Optionally, when the first code block has an exception, the terminal requests the server to obtain the second code block used to replace the first code block; when the terminal obtains the second code block, the second code block is written into the obtained second address.

[0148] In some embodiments, the second address is queried from the address mapping table based on the first address, and the writing of the second code block and the generation of the address jump information are implemented in the following forms.

[0149] (1) When the first code block has an exception, not only the address jump information can be generated based on the second address, but also the second code block can be written into the second address, that is, the writing of the address jump information and the second code block can be executed simultaneously.

[0150] (2) When the first code block has an exception, the address jump information can be generated based on the second address, and then the second code block is written into the second address, that is, the generation of the address jump information can be executed first, and then the writing of the second code block can be executed.

[0151] (3) When the first code block has an exception, the second code block can be written into the second address based on the first address, and then the address jump information can be generated based on the second address, that is, the writing of the second code block can be executed first, and then the generation of the address jump information can be executed.

[0152] In some embodiments, the second address is dynamically determined from the free address, and the writing of the second code block and the generation of the address jump information based on the first address are implemented in the following forms.

[0153] (1) When the first code block has an exception, the address jump information can be generated based on the second address, and the received second code block can be written into the dynamically determined second address, that is, the writing of the address jump information and the second code block can be executed simultaneously.

[0154] (2) When the first code block has an exception, the address jump information can be generated based on the second address, and then the second code block is written into the second address, that is, the generation of the address jump information can be executed first, and then the writing of the second code block can be executed.

[0155] (3) When the first code block has an exception, the second code block can be written into the second address dynamically determined from the free address, and then the address jump information can be generated based on the second address, that is, the writing of the second code block can be executed first, and then the generation of the address jump information can be executed.

[0156] It is worth noting that the above is only an illustrative example, and the embodiments of the present application are not limited thereto.

[0157] When jumping to the second address based on the address jump information, and the second code block is written in the second address, the second code block is called based on the address jump information, so as to execute the first subroutine logic of the first subroutine by the second code block instead of the first code block.

[0158] In step 350, the second code block is executed to implement the first subroutine logic in the first program.

[0159] Illustratively, after the second code block is read from the second address, since the second code block is a code block replaced based on the first code block, by executing the second code block, the first subroutine logic corresponding to the first code block can be implemented to make up for the problem that the first code block cannot be normally executed, and to guarantee the normal running of the first program.

[0160] In an optional embodiment, in the case that the fourth code block called by the first code block in the program file is a normal code block, the second subroutine logic of the fourth code block is executed by the second code block.

[0161] Illustratively, after the second code block is executed, if the fourth code block called by the first code block in the program file is a normal code block, that is, the fourth code block is in a normal state, after the second code block replaced the first code block is executed, the fourth code block after the first code block is called, so as to execute the second subroutine logic corresponding to the fourth code block.

[0162] It is worth noting that the above is only an illustrative example, and the embodiments of the present application are not limited thereto.

[0163] In summary, the second code block written in the second address as the first code block exists in the abnormal case, not only indicates the second address written by the second code block through the generated address jump information, but also realizes the purpose of replacing the first code block by the second code block, avoids the code redundancy problem existing in the pre-embedded stake code method, and overcomes the problem that other codes without pre-embedded stake codes cannot be hot repaired. It can reduce the complexity of code writing during the code block writing process, and can perform more targeted hot repair process on the abnormal code existing in any position during the program file running process, thereby helping to guarantee the running safety of the first program and the running stability of the first program.

[0164] In the embodiments of the present application, when the first code block has an exception, the second address is obtained, the second code block is written into the second address, and the content of the second code block is called from the second address. The second address can be obtained based on the address mapping table, so that the process of obtaining the second address is more intuitive, and the second address has a more targeted binding relationship with the first address. The second address can be used not only to generate address jump information, but also to store the second code block in the case of an exception of the first code block, so as to facilitate timely and targeted acquisition of the second code block from the second address through the address jump information, avoid program running exception problems, and simplify code writing complexity.

[0165] In an optional embodiment, when the first code block for implementing the first subprogram logic has an exception, a repair request for the first code block is first generated, so that the second code block is accepted based on the repair request and written into the second address, so that the configuration information related to the first code block is rewritten based on the second address, and the address jump information is generated. Illustratively, as shown in Figure 6 The embodiments shown in Figure 2 The embodiments shown in

[0166] Step 610, obtaining a program file of a first program.

[0167] The program file includes a plurality of code blocks, and the plurality of code blocks are used to jointly implement the program logic of the first program.

[0168] Step 610 has been described in steps 210 and 310 above, and will not be repeated here.

[0169] Step 620, in response to an exception of a first code block for implementing a first subprogram logic, generating a repair request for the first code block.

[0170] Illustratively, if the first code block has an exception, it means that the current first code block cannot execute the first subprogram logic, and the terminal can generate a repair request for the first code block based on this. The repair request is used to request to obtain a second code block to replace the first code block.

[0171] Optionally, the terminal sends the repair request to the server to request the server to send the second code block.

[0172] Illustratively, the first program is a game application program, and the program file corresponding to the first program is a file issued by a game background. Taking the server as the game background as an example, the terminal sends the repair request to the game background to request the server to issue the second code block to the terminal to replace the first code block.

[0173] Optionally, the first code block is included in the repair request. The server is connected with the development terminal, and the first code block is displayed on the development terminal after receiving the repair request. The developer writes a second code block for replacing the first code block based on the development terminal, and sends the second code block to the terminal through the server; or the server performs automatic rewriting on the first code block to obtain the second code block, and sends the second code block to the terminal; or the server corrects the simple code error of the first code block based on the code modification model, and obtains the second code block to send to the terminal, etc.

[0174] In step 630, the second code block is received, and the second code block is written into the second address.

[0175] Optionally, the terminal receives the second code block sent by the server; and then the terminal writes the second code block into the second address.

[0176] In an optional embodiment, an address mapping table is obtained; and in response to the existence of an exception in the first code block for implementing the first subprogram logic, the second address having an address replacement relationship with the first address is found from the address mapping table.

[0177] The address mapping table is used to represent the address replacement relationship between a plurality of addresses.

[0178] Optionally, after receiving the second code block, the terminal queries the address mapping table based on the first address to determine the second address, and writes the received second code block into the second address; or in the case that the first code block has an exception, the terminal queries the address mapping table based on the first address to determine the second address, and then directly writes the second code block into the second address after receiving the second code block, etc.

[0179] In an optional embodiment, in response to the existence of an exception in the first code block for implementing the first subprogram logic, the second address is dynamically determined from at least one free address.

[0180] Optionally, after receiving the second code block, the terminal dynamically determines an address from the free address as the second address, and writes the received second code block into the second address; or in the case that the first code block has an exception, the terminal dynamically determines an address from the free address as the second address, and then directly writes the second code block into the second address after receiving the second code block, etc.

[0181] In an optional embodiment, based on the code block length of the second code block, a second address meeting the address length requirement is obtained; and the second code block is written into the second address.

[0182] The address length requirement is a length requirement for effectively storing the second code block.

[0183] Optionally, the address length requirement is preset, for example, the address length of the selected second address is greater than the address length occupied by the first code block; or the address length requirement is determined flexibly after receiving the second code block, for example, the code block length of the second code block is determined, the code block length represents the address length required to store the second code block, and the address corresponding to the address length closest to the code block length is taken as the second address, so as to write the second code block into the second address. For example, traversal is performed from 0, until an address large enough is found so that the available address range contains the size of the second code block, and the second code block is written into the address, that is, the second address.

[0184] In step 640, the configuration information related to the first code block is rewritten based on the second address, and address jump information is generated.

[0185] Optionally, after the second code block is written into the second address, the configuration information related to the first code block is rewritten based on the written second address, so as to generate the address jump information.

[0186] The address jump information is obtained after the configuration information related to the first code block is rewritten, the first code block is stored in the first address, and the address jump information is used to indicate jumping to the second address.

[0187] In step 650, the second code block is called from the second address based on the address jump information.

[0188] The second code block is a code block written into the second address in the case that the first code block has an exception.

[0189] Illustratively, since the second code block has been written into the second address, the second code block can be called by reading the address jump information after the address jump information is generated, so as to replace the first code block and execute the first subprogram logic.

[0190] In step 660, the first subprogram logic in the first program is implemented by executing the second code block.

[0191] Illustratively, after the second code block is read from the second address, since the second code block is a code block replaced based on the first code block, the first subprogram logic corresponding to the first code block can be implemented by executing the second code block, so as to make up for the problem that the first code block cannot be normally executed, and guarantee the normal running of the first program.

[0192] It should be noted that the above is only an illustrative example, and the embodiments of the present application are not limited in this regard.

[0193] In summary, the second code block is written to the second address in the case that the first code block exists an exception, which not only indicates the second address written by the second code block through the generated address jump information, but also achieves the purpose of replacing the first code block through the second code block, avoids the code redundancy problem existing in the pre-embedded stub code mode, and overcomes the problem that other codes without pre-embedded stub codes cannot be hot repaired. The code writing complexity can be reduced during the code block writing process, and the more targeted hot repair process can be performed on the abnormal code existing in any position during the program file running process, thereby helping to ensure the running stability of the first program while ensuring the running safety of the first program.

[0194] In the embodiments of the present application, when the first code block exists an exception, the second code block is obtained through the repair request to be written to the second address, and the address jump information is generated based on the second address. Among them, the second code block is requested to be issued by the server instead of the first code block through the repair request, which avoids the problem of excessive redundancy of the program file, avoids the problem of invalid writing of the code block for repair, and is also helpful for the purposeful repair process of the problematic first code block; the address jump information is generated after the second code block is written to the second address, so that the second address jumped by the address jump information is more accurate, which can avoid the problem of invalid jump to a certain extent, and improve the running stability and safety of the program.

[0195] In an optional embodiment, when the first code block for implementing the first subprogram logic exists an exception, a third code block calling the first code block is determined, a first pointing value of a first register in the third code block is taken as configuration information corresponding to the first code block, the first pointing value is rewritten as a second pointing value, and address jump information is obtained. Illustratively, as shown in Figure 7 The step 220 shown in Figure 2 The step 220 shown in

[0196] In step 710, in response to the first code block for implementing the first subprogram logic existing an exception, a third code block calling the first code block is determined from a plurality of code blocks.

[0197] Illustratively, the first code block is one of the plurality of code blocks, and the first code block is a code block called by the third code block among the plurality of code blocks; the call usually refers to the behavior of triggering another program entity to execute by a program entity (such as a function, a method, etc.).

[0198] If the first code block exists an exception, a third program block calling the first program block can be determined based on the calling relationship between the program blocks.

[0199] The third code block includes a first pointing value pointing to the first address in the first register.

[0200] The register is a small storage unit for fast storage and operation of data in a computer, and the first register is usually a specific register (e.g., register A) in a central processing unit (CPU). The first register stores at least one address (memory address), and the at least one address includes a first address for storing the first code block. Each address is indicated by a unique pointing value, such as the first pointing value of the first register pointing to the first address. For example, the first pointing value of the first register X17 is 0x00000007ba52bc280[531052], which is used to point to the first address where the first code block is stored.

[0201] At step 720, the first pointing value is adjusted to a second pointing value based on the second address to obtain address jump information.

[0202] The different pointing values represent different addresses. If the first code block has an exception and it is desired to replace the execution of the first code block with another code block, the second address other than the first address can be determined from the first register where the first code block is stored. The second code block for replacing the first code block is stored in the second address, and the second code block is read from the second address.

[0203] The second pointing value is used to point to the second address in the first register.

[0204] Optionally, the second address is determined based on the first address (e.g., the address mapping table is searched based on the first address to determine the second address), and then the second pointing value indicating the second address is determined. The first pointing value in the first register is adjusted to the second pointing value, so that the information of the first register pointing to the second pointing value is obtained as the address jump information.

[0205] It is worth noting that the above is only an illustrative example, and the embodiments of the present application are not limited in this regard.

[0206] In some embodiments, the purpose of the above steps 710 to 720 is to rewrite the pointing value of the register in the third code block to jump to a new second address to call the second code block to execute the program logic process. The above steps 710 to 720 are used to rewrite the pointing value of the register in the third code block to jump to a new second address to call the second code block to execute the program logic process. Figure 2 As shown in FIG. 2, the program file includes three code blocks, and the above steps 710 to 720 are used to rewrite the pointing value of the register in the third code block to jump to a new second address to call the second code block to execute the program logic process. Figure 8 As shown in FIG. 2, the program file includes three code blocks, and the above steps 710 to 720 are used to rewrite the pointing value of the register in the third code block to jump to a new second address to call the second code block to execute the program logic process. Figure 2 The process of executing multiple code blocks can be implemented as follows.

[0207] After starting the program file, if the code block 810 in the program file is normal code, the program file is normally run; if the code block 810 calls the code block 820 which is abnormal code, and an exception is found after running the code block 820, the first pointing value of the first register in the code block 810 calling the code block 820 is rewritten as a second pointing value, so that the code block 830, i.e. new normal code, is called by the code block 810; then, based on the calling rule of the code block 840 called by the code block 820, the code block 830 calls the code block 840, and finally the program file is executed completely.

[0208] As shown in the schematic diagram, Figure 9 any third code block is shown, as shown in the schematic diagram, Figure 10 any first code block is shown; from Figures 9 to 10 the function is normally executed, as shown in the instruction "0x00000007ba52bc280[531052]", which represents that the execution is performed from the X17 register 910 in Figure 9 to "0x00000007ba52bc280" in Figure 10 .

[0209] Suppose Figure 10 is the first code block which needs to be hot-updated, i.e. the code block 1010 shown in the schematic diagram has an exception, so the first code block shown in the schematic diagram needs to be replaced. Figure 10 Figure 10 Optionally, the pointing value of the X17 register 910 in is adjusted, as shown in the schematic diagram,

[0210] wherein the pointing value of the X17 register 1110 is changed to "0x00000007ba9a841e0[531127]"; wherein Figure 9 and Figure 11 compared with Figure 9 , other function information does not change, such as still being "add x16,x16,#0x648$16:0x00000007ba63b4000[531069]" and the like. Figure 11 The adjustment process of Figure 11 represents that the first pointing value is adjusted to the second pointing value, and the purpose is to jump to the second address to call the second code block based on the address jump information.

[0211] As shown in the schematic diagram, Figure 12 the second code block 1210 stored in the second address is shown. Based on "0x00000007ba9a841e0[531127]", the second code block starting with "0x00000007ba9a841e0" is called, so as to replace the first code block shown in the schematic diagram. Figure 10 ​

[0212] It is worth noting that the above is only an illustrative example, and the embodiments of the present application do not limit this.

[0213] In summary, the second code block is written to the second address as the first code block in the case of an exception, which not only indicates the second address written by the second code block through the generated address jump information, but also achieves the purpose of replacing the first code block through the second code block, avoiding the code redundancy problem existing in the pre-embedded stub code method, and overcoming the problem that other codes without pre-embedded stub codes cannot be hot repaired. It can reduce the complexity of code writing during the code block writing process, and can perform more targeted hot repair process on the abnormal code existing in any position during the program file running process, thereby helping to ensure the running stability of the first program while ensuring the running safety of the first program.

[0214] In the embodiments of the present application, the pointing value of the register in the third code block calling the first code block is adjusted to achieve the purpose of obtaining address jump information. By rewriting the register pointing value, the function call has changed, and in the case of unmodified code, the first code block calling the first code block at the first address has become the second code block calling the second code block at the second address, effectively skipping the problematic first code block, so that the originally problematic first code block no longer has the opportunity to execute, achieving the purpose of dynamic hot repair, and without the need for pre-insertion of stubs, reducing the danger of code intrusion.

[0215] In an optional embodiment, when the first code block for implementing the first subprogram logic has an exception, the preset configuration content in the first code block is adjusted to a jump instruction to obtain address jump information. Illustratively, as shown in Figure 13 The step 220 shown in Figure 2 The step 220 shown in

[0216] Step 1310, in response to the first code block for implementing the first subprogram logic having an exception, adjusting the preset configuration content in the first code block to a jump instruction based on the second address to obtain address jump information.

[0217] Illustratively, if the first code block has an exception, the preset configuration content in the first code block is taken as the configuration information related to the first code block, and the preset configuration content is rewritten to obtain a jump instruction, which is used to indicate jumping to the second address calling the second code block.

[0218] Optionally, considering that the preset configuration content needs to indicate to stop executing the first code block and call the second code block, the preset configuration content is usually implemented as a code header of the first code block, and the code header usually refers to the beginning part of the code block, which usually contains necessary configuration, declaration and initialization content.

[0219] Illustratively, for the code header of the first code block, an absolute jump instruction is used as the jump instruction to jump to the second address indicated by the jump instruction immediately after the code header of the first code block is executed.

[0220] In an optional embodiment, a first instruction opcode corresponding to a first platform type of a hardware platform on which the program file is run is determined based on the first platform type.

[0221] The instruction opcode is used to represent an opcode of the hardware platform implementing a direct jump function.

[0222] Illustratively, the hardware platform includes but is not limited to x86, x86_64, arm, arm64, etc.; the instruction opcode implementing the direct jump function on x86 or x86_64 is jmp instruction; and the instruction opcode implementing the direct jump function on arm or arm64 is b instruction.

[0223] In an optional embodiment, the preset configuration content in the first code block is adjusted by the first instruction opcode and the second address to obtain the jump instruction as the address jump information.

[0224] Optionally, the second address is spliced after the first instruction opcode corresponding to the first jump type and replaces the preset configuration content in the first code block to obtain the jump instruction as the address jump information; or the second address is spliced after the first instruction opcode corresponding to the first jump type and placed before the preset configuration content in the first code block to obtain the jump instruction as the address jump information, etc.

[0225] Illustratively, taking the first platform type of the hardware platform on which the program file is run as arm64 as an example, the first instruction opcode corresponding to the first jump type is b instruction, and the code header in the first code block is adjusted by the b instruction and the second address to obtain the jump instruction as the address jump information. For example, the second address is spliced after the b instruction to obtain the jump instruction, which is used to replace the code header in the first code block to achieve the purpose of directly jumping to the second address through the address jump information.

[0226] It is worth noting that the above is only an illustrative example, and the embodiments of the present application are not limited thereto.

[0227] In some embodiments, the purpose of the above step 1310 is to modify the code header of the first code block to jump to a new second address and call the process of the second code block to execute the program logic. Figure 2 The step 220 shown is an example. For example, the program file includes three code blocks, as shown in Figure 14 The above Figure 2 The process of executing multiple code blocks can be implemented as follows.

[0228] After starting to run the program file, if the first platform type of the hardware platform on which the program file is run is arm64, the first instruction opcode corresponding to the first jump type is the b instruction; if the code block 1410 in the program file is normal code, it is normally run; if the code block 1410 calls the code block 1420 which is abnormal code, if an exception is found after running the code block 1420, the code header of the code block 1420 can be rewritten by the b instruction to obtain a jump instruction as address jump information, so as to jump from the header of the code block 1420 to the code block 1430 for execution, that is, to jump to execute new normal code; then, based on the calling rule of the code block 1420 to the code block 1440, the code block 1430 calls the code block 1440, and finally the program file is executed.

[0229] As shown in Figure 15 For any first code block shown, if the first code block has an exception and the first platform type of the hardware platform on which the program file is run is arm64 / arm, the code header 1510 of the first code block can be rewritten by the b instruction; for example, after rewriting, it is represented as Figure 16 address jump information 1610, wherein other functions remain unchanged, but the code header changes from "mov x8, #0xa7" to "b 0xed040", wherein the bold part represents the b instruction, which is used to jump to the second address.

[0230] As shown in Figure 17 The second code block 1710 stored at the second address is shown in the diagram, and the first subprogram logic can be completed by executing the second code block 1710 instead of the first code block.

[0231] It is worth noting that the above is only an illustrative example, and the embodiments of the present application are not limited in this regard.

[0232] In summary, the second code block is written to the second address in the case of an exception of the first code block, which not only indicates the second address written by the second code block through the generated address jump information, but also achieves the purpose of replacing the first code block by the second code block, avoids the code redundancy problem existing in the pre-embedded stub code method, and overcomes the problem that other codes without pre-embedded stub codes cannot be hot repaired. The code complexity can be reduced during the code block writing process, and the more targeted hot repair process can be performed on the abnormal code at any position during the program file running process, thereby helping to ensure the running stability of the first program while ensuring the running safety of the first program.

[0233] In the embodiment of the application, the code head of the abnormal first code block jumps to the normal second code block for replacing the first code block, and the first line is unconditionally jumped by the instruction operation code. Thus, the purpose of jumping from the code head of the problematic first code block to the new second code block is achieved, the problem code is bypassed, dynamic hot repair is achieved, and pre-insertion of a stub is not required.

[0234] In an optional embodiment, taking a first terminal running a program file as an example, when a first code block for implementing a first subprogram logic is abnormal, the first terminal sends a repair request to a server to obtain a second code block for replacing the first code block, and the server sends the second code block to the first terminal based on the repair request. Illustratively, the server executes a code block calling method corresponding to the code block calling method executed by the first terminal as shown in Figure 2 Figure 18 The flowchart of the code block calling method executed by the server is shown in

[0235] Step 1810, receiving a repair request sent by the first terminal.

[0236] The repair request is used to obtain a second code block for replacing a first code block, and the first code block is used to implement a first subprogram logic in a first program and is stored in a first address in the first terminal.

[0237] Optionally, the terminal sends a repair request to the server to request the server to send the second code block.

[0238] Illustratively, the first program is a game application program, and the program file corresponding to the first program is a file issued by a game background. Taking the server as the game background as an example, the terminal sends a repair request to the game background to request the server to issue a second code block for replacing the first code block to the terminal.

[0239] Step 1820, obtaining the second code block based on the repair request. ​

[0240] The second code block is used to replace the first code block to implement the first subprogram logic in the first program.

[0241] Optionally, the first code block is included in the repair request. The server is connected with the development terminal, and the first code block is displayed on the development terminal after the server receives the repair request. The developer writes the second code block for replacing the first code block based on the development terminal, and sends the second code block to the terminal through the server. Alternatively, the server performs automatic rewriting on the first code block to obtain the second code block, and sends the second code block to the terminal. Alternatively, the server corrects the simple code error of the first code block based on the code modification model, and obtains the second code block to send to the terminal, etc.

[0242] In addition, when the first code block of any one of the plurality of terminals has an exception in the process of running the program file, the terminal can call the second code block from the second address to implement the first subprogram logic.

[0243] In step 1830, the second code block is sent to the first terminal.

[0244] The second code block is used to write the second address in the case that the first code block has an exception. The second address is used to generate address jump information in the first terminal. The address jump information is information for jumping to the second address to call the second code block, which is obtained by rewriting the configuration information related to the first code block.

[0245] In an optional embodiment, the second code block is sent to the plurality of terminals. The plurality of terminals are used to write the second code block to the second address.

[0246] Optionally, the first terminal is any one of the plurality of terminals in a communication connection relationship with the server. If the first code block of the first terminal has an exception to request the server to send the second code block, the server can actively send the second code block for replacing the first code block to the plurality of terminals in order to avoid other terminals from sending repair requests to the server. The plurality of terminals can write the second code block to the second address.

[0247] Optionally, if the first code block of the first terminal has an exception to request the server to send the second code block, the server can efficiently send the second code block to other terminals after receiving the repair request sent by other terminals and directed to the first code block. Other terminals can write the second code block to the second address, etc.

[0248] In an optional embodiment, the address mapping table is sent to the first terminal.

[0249] The address mapping table is used to represent address replacement relationships among a plurality of addresses, and the address replacement relationship is used to represent a mutual replacement condition between at least two addresses; the first terminal finds a second address having an address replacement relationship with the first address from the address mapping table based on the first code block, and writes the second code block into the second address.

[0250] Illustratively, the server issues the address mapping table to the first terminal after receiving the repair request sent by the first terminal, so that the first terminal queries the second address based on the first address; or, the server issues the address mapping table to the first terminal in advance, and the first terminal can query the second address based on the first address where the first code block is located in the case where it is determined that the first code block has an exception.

[0251] It is worth noting that the above is only an illustrative example, and the embodiments of the present application do not limit this.

[0252] In summary, the second code block is written into the second address in the case where the first code block has an exception, which not only indicates the second address where the second code block is written through the generated address jump information, but also achieves the purpose of replacing the first code block through the second code block, avoids the code redundancy problem existing in the pre-embedded stub code method, and overcomes the problem that other codes that are not pre-embedded with stub codes cannot be hot repaired. It can reduce the complexity of code writing during code block writing, and can perform more targeted hot repair process on the abnormal code existing in any position during the running of the program file, thereby helping to ensure the running safety of the first program and the running stability of the first program.

[0253] In the embodiments of the present application, the content of the server sending the second code block to the terminal to replace the first code block is introduced. By receiving and sending the second code block by the server, the first code block can be repaired, the problem of code redundancy caused by pre-inserting stubs can be avoided, and the flexibility of repairing the code block with problems can be ensured, thereby ensuring the code security and the code running stability.

[0254] In an optional embodiment, the above-mentioned code block calling method can also be referred to as a "method of client code hot repair", and the client can be understood as a terminal. In the process of running the program file of the first program in the terminal, the hot repair scheme in the related art is implemented as Figure 19 and Figure 20 The flowchart is shown.

[0255] As Figure 19 shown, taking the pre-embedded stub scheme to implement code hot repair as an example, a judgment code 1920 is pre-embedded before the code 1910, and a code branch 1930 for repairing the normal code 1910.

[0256] If it is determined that code 1910 is normal code, that is, the code block is in a normal state, then it is determined that code 1920 will not execute code branch 1930 (dashed line indicates non-execution), and code 1910 (solid line indicates execution) will continue to be executed.

[0257] like Figure 20 As shown, Figure 19 Another corresponding implementation scenario is as follows: If code 2020 is determined to be abnormal code, meaning the code block is in an abnormal state, then code 2020 needs to be hot-fixed. In this case, code 2010 will change its path to code branch 2030 (i.e., new code needs to be populated), and the execution of code 2020 will be canceled. After that, code 2020 will be bypassed to execute the subsequent normal code 2040, thereby avoiding the program crash problem.

[0258] However, as Figure 20 As shown, the related technologies that use pre-embedded insertion points achieve the effect of hot repair through code pre-embedding, but have problems such as poor flexibility, strong invasiveness, poor stability and excessive redundancy.

[0259] In this embodiment, the code block invocation method described does not require pre-embedding of the business logic code. Therefore, the above-mentioned method is unnecessary. Figure 19 , Figure 20 The judgment structure shown is shown.

[0260] Optionally, when this solution requires hot-fix code, it will directly replace the code that needs fixing (the first code block mentioned above) through a dynamic hook, or jump from the beginning of the code that needs fixing (the first code block mentioned above) to the normal code, such as... Figure 8 and Figure 14 As shown.

[0261] Dynamic hooking is a technique primarily used to intercept and modify function calls or behavior of a program at runtime. This method is typically used for debugging or modifying program behavior without needing to modify the original code or restart the program. For example, it can be used to capture parameters, modify return values, or perform other additional operations. Its working principle includes: function interception, which uses techniques (such as modifying function pointers or replacing instructions) to intercept calls to specific functions; redirection, which redirects the call to a custom implementation (i.e., the hook function, the second code block used to replace the first code block), where custom logic can be added; and restoration of control, which calls the original function after the hook function completes to maintain the normal operation of the program.

[0262] This is an illustrative example of its actual application effect on the Android system—arm64 architecture (similar to other systems and hardware platforms). Figure 8 The effectiveness of the plan is Figures 9 to 12 Indicative expressionFigure 14 The scheme effect is that Figures 15 to 17 The schematic performance is shown.

[0263] The schematic performance is shown. Figure 9 And Figure 10 The normal execution path when the program file execution function is executed is shown, which is executed from the X17 register in Figure 9 to Figure 10 (if the code needs to be hot updated). Figure 10

[0264] That is, the parent function 0x7ba6.b2a90 jumps to 0x7ba52bc280 for execution through the br X17 at 0x7ba63b2a9c, if the function of Figure 10 is problematic, the table replacement needs to be performed. After the table replacement is performed, as shown in Figure 11 and Figure 12 , the function of Figure 9 can be directly executed to the function of Figure 11 and Figure 12 , so as to realize the direct replacement of the function.

[0265] After the table replacement is performed, the function call of 0x7ba63b2a90 in Figure 9 changes, and in the case of unmodified code, the call of 0x7ba52bc280 changes to the call of 0x07ba9a841e0, so as to skip the problematic function. The original code is completely replaced by the new code through the dynamic hook-table replacement, and the original code no longer has the opportunity to execute, so as to realize the dynamic hot repair, and the pre-insertion is not needed.

[0266] As shown in Figures 15 to 17 , the flowchart shown in Figure 14 is based on, although the abnormal code is passed, since the new normal code is directly jumped from the code header of the abnormal code, the remaining code is not executed, and thus the crash problem is not caused.

[0267] It is worth noting that the code block calling method applied to the android system-arm64 architecture is only a schematic example, and the code block calling method can be applied to the scene in which the code hot repair is needed in each operating system platform and hardware platform, which is not limited here.

[0268] ​In summary, the second code block is written into the second address in the case that the first code block exists an exception, the second address to which the second code block is written is indicated by the generated address jump information, the purpose of replacing the first code block by the second code block is achieved, the code redundancy problem existing in the pre-embedded stub code mode is avoided, the problem that other codes without pre-embedded stub codes cannot be hot repaired is overcome, the code complexity in the code block writing process can be reduced, the hot repair process for the exception code existing in any position in the program file running process can be performed, and thus the running stability of the first program is ensured in the case that the running safety of the first program is ensured.

[0269] In the embodiment of the present application, the dynamic hook technology is used without pre-embedding stubs, and various problems caused by pre-embedding stubs do not exist, the problems of poor flexibility, strong invasiveness, poor stability, and excessive redundancy existing in the related art can be solved, the code hot repair method has the characteristics of good flexibility, no invasiveness, good stability, and no redundancy, supports multi-language and multi-platform code hot repair, and helps the stability of application release.

[0270] Figure 21 is a structural block diagram of a code block calling apparatus provided by an exemplary embodiment of the present application, as shown in Figure 21 The apparatus includes the following parts:

[0271] The obtaining module 2110 is configured to obtain a program file of a first program, the program file including a plurality of code blocks, and the plurality of code blocks being used to jointly implement program logic of the first program.

[0272] The generating module 2120 is configured to, in a process of running the program file, in response to a first code block for implementing first sub-program logic existing an exception, rewrite configuration information related to the first code block based on a second address, and generate address jump information, the address jump information being obtained by rewriting the configuration information related to the first code block, the first code block being stored in a first address, and the address jump information being used to indicate jumping to the second address.

[0273] The calling module 2130 is configured to call a second code block from the second address based on the address jump information, the second code block being a code block written into the second address in the case that the first code block exists an exception.

[0274] The executing module 2140 is configured to execute the second code block to implement the first sub-program logic in the first program.

[0275] In an optional embodiment, the calling module 2130 is further configured to call a second code block from a second address based on the address jump information in a case that the second code block is written at the second address.

[0276] In an optional embodiment, the calling module 2130 is further configured to obtain an address mapping table, the address mapping table being used to represent an address replacement relationship between a plurality of addresses; in response to an exception existing in the first code block used to implement the first subprogram logic, find the second address having the address replacement relationship with the first address from the address mapping table; and rewrite the configuration information related to the first code block based on the second address.

[0277] In an optional embodiment, the generating module 2120 is further configured to dynamically determine the second address from at least one free address in response to an exception existing in the first code block used to implement the first subprogram logic; and rewrite the configuration information related to the first code block based on the second address to generate the address jump information.

[0278] In an optional embodiment, the generating module 2120 is further configured to determine the second address meeting a preset length requirement from the at least one free address, the preset length requirement being a preset requirement for effectively storing the second code block.

[0279] In an optional embodiment, the generating module 2120 is further configured to generate a repair request for the first code block in response to an exception existing in the first code block used to implement the first subprogram logic, the repair request being used to request to obtain the second code block replacing the first code block; receive the second code block, and write the second code block at the second address; and rewrite the configuration information related to the first code block based on the second address to generate the address jump information.

[0280] In an optional embodiment, the generating module 2120 is further configured to obtain the second address meeting an address length requirement based on a code block length of the second code block, the address length requirement being a length requirement for effectively storing the second code block; and write the second code block at the second address.

[0281] In an optional embodiment, the generating module 2120 is further configured to, in response to an exception existing in the first code block for implementing the first subprogram logic, determine a third code block from the plurality of code blocks, the third code block including a first pointing value pointing to the first address in the first register; adjust the first pointing value to a second pointing value based on the second address, to obtain the address jump information, the second pointing value being used to point to the second address in the first register.

[0282] In an optional embodiment, the generating module 2120 is further configured to, in response to an exception existing in the first code block for implementing the first subprogram logic, adjust preset configuration content in the first code block to a jump instruction based on the second address, to obtain the address jump information; the jump instruction being used to indicate a jump to the second address for calling the second code block.

[0283] In an optional embodiment, the generating module 2120 is further configured to determine a first instruction operation code corresponding to a first platform type of a hardware platform on which the program file is run; the instruction operation code being used to represent an operation code for implementing a direct jump function on a hardware platform; and adjust the preset configuration content in the first code block by using the first instruction operation code and the second address, to obtain the jump instruction as the address jump information.

[0284] In an optional embodiment, the executing module 2140 is further configured to, in a case where a fourth code block called by the first code block in the program file is a normal code block, execute a second subprogram logic in which the second code block calls the fourth code block.

[0285] In an optional embodiment, as shown in Figure 22 a code block calling apparatus includes:

[0286] The receiving module 2210 is configured to receive a repair request sent by a first terminal, the repair request being used to obtain a second code block for replacing a first code block, the first code block being used to implement a first subprogram logic in a first program, and the first code block being stored in a first address in the first terminal.

[0287] The obtaining module 2220 is configured to obtain the second code block based on the repair request, the second code block being used to replace the first code block to implement the first subprogram logic in the first program.

[0288] The sending module 2230 is configured to send the second code block to the first terminal, the second code block being used to write a second address in the case of an exception of the first code block, the second address being used to generate address jump information at the first terminal, the address jump information being information for jumping to the second address for calling the second code block after the configuration information related to the first code block is rewritten.

[0289] In an optional embodiment, the obtaining module 2220 is further configured to distribute the second code block to a plurality of terminals, the plurality of terminals being configured to write the second code block to the second address.

[0290] In an optional embodiment, the sending module 2230 is further configured to distribute an address mapping table to the first terminal, the address mapping table being used to represent the address replacement relationship between a plurality of addresses, the address replacement relationship being used to represent the mutual replacement between at least two addresses; wherein the first terminal finds the second address having the address replacement relationship with the first address from the address mapping table based on the first code block, and writes the second code block to the second address.

[0291] In summary, the second code block as the code block written to the second address in the case of an exception of the first code block not only indicates the second address written by the second code block through the generated address jump information, but also realizes the purpose of replacing the first code block through the second code block, avoids the code redundancy problem existing in the pre-embedded stake code mode, and overcomes the problem that other codes without pre-embedded stake codes cannot be hot repaired. The code block calling device can reduce the code writing complexity in the code block writing process, can perform more targeted hot repair process on the abnormal code existing at any position in the program file running process, and thus helps to ensure the running stability of the first program while ensuring the running safety of the first program.

[0292] It should be noted that: the code block calling device provided in the above embodiments is only exemplified by the division of the above functional modules. In actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the code block calling device and the code block calling method provided in the above embodiments belong to the same concept, and the specific implementation process is described in the method embodiments, which will not be repeated here.

[0293] Figure 23A structural block diagram of an electronic device 2300 provided by an example embodiment of the present application is shown. The electronic device 2300 can be a portable mobile terminal, such as a smartphone, a vehicle-mounted terminal, a tablet computer, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a notebook computer, or a desktop computer. The electronic device 2300 can also be referred to as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, or other names.

[0294] Generally, the electronic device 2300 includes a processor 2301 and a memory 2302.

[0295] The processor 2301 can include one or more processing cores. The processor 2301 can also include a main processor and a coprocessor.

[0296] The memory 2302 can include one or more computer-readable storage media that can be non-transitory. The memory 2302 can also include a high-speed random access memory, and a non-volatile memory such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 2302 is used to store at least one instruction for being executed by the processor 2301 to implement the code block calling method provided by the method embodiments in the present application.

[0297] In some embodiments, the electronic device 2300 further includes one or more sensors. The one or more sensors include, but are not limited to, a proximity sensor, a gyroscope sensor, a pressure sensor.

[0298] In some embodiments, the electronic device 2300 further includes other component parts, which can be understood by those skilled in the art, Figure 23 The structure shown in the above figure does not constitute a limitation on the electronic device 2300, and can include more or fewer components than those shown, or combine certain components, or use different component arrangements.

[0299] Embodiments of the present application also provide a computer device, which can be implemented as a terminal or a server as shown in Figure 1 The computer device includes a processor and a memory, and the memory stores at least one instruction, at least one program, a code set, or an instruction set, which are loaded and executed by the processor to implement the code block calling method provided by the above method embodiments.

[0300] An embodiment of the present application further provides a computer readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by a processor to implement the code block calling method provided by any of the above method embodiments.

[0301] An embodiment of the present application further provides a computer program product or a computer program, which comprises computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the code block calling method described in any of the above embodiments.

[0302] Optionally, the computer readable storage medium can include a read only memory (ROM), a random access memory (RAM), a solid state disk (SSD) or an optical disk. The random access memory can include a resistance random access memory (ReRAM) and a dynamic random access memory (DRAM). The above-mentioned serial numbers of embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0303] Those skilled in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by a program instructing relevant hardware to complete, and the program can be stored in a computer readable storage medium. The storage medium mentioned above can be a read only memory, a magnetic disk or an optical disk. The above-mentioned is only the optional embodiment of the present application, and does not limit the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method of code block invocation, characterized by, The method comprises: obtaining a program file of a first program, the program file comprising a plurality of code blocks for jointly implementing program logic of the first program; in a process of running the program file, in response to an exception of a first code block for implementing first subprogram logic, rewriting configuration information related to the first code block based on a second address, generating address jump information for indicating jumping to the second address; calling a second code block from the second address based on the address jump information, the second code block being a code block written into the second address in the case of the exception of the first code block; implementing the first subprogram logic in the first program by executing the second code block.

2. The method of claim 1, wherein, The calling of the second code block from the second address based on the address jump information comprises: in the case of the existence of the second code block written into the second address, calling the second code block from the second address based on the address jump information.

3. The method of claim 2, wherein, The rewriting of the configuration information related to the first code block based on the second address in response to the exception of the first code block for implementing the first subprogram logic comprises: obtaining an address mapping table for representing an address replacement relationship between a plurality of addresses; in response to the exception of the first code block for implementing the first subprogram logic, searching the address mapping table for the second address having the address replacement relationship with the first address; rewriting the configuration information related to the first code block based on the second address, and generating the address jump information.

4. The method of claim 2, wherein, The rewriting of the configuration information related to the first code block based on the second address in response to the exception of the first code block for implementing the first subprogram logic comprises: in response to the exception of the first code block for implementing the first subprogram logic, dynamically determining the second address from at least one free address; rewriting the configuration information related to the first code block based on the second address, and generating the address jump information.

5. The method of claim 4, wherein, The dynamic determination of the second address from the at least one free address comprises: determining the second address meeting a preset length requirement from the at least one free address, the preset length requirement being a preset requirement for effectively storing the second code block.

6. The method of claim 1, wherein, The rewriting of the configuration information related to the first code block based on the second address in response to the exception of the first code block for implementing the first subprogram logic comprises: in response to the exception of the first code block for implementing the first subprogram logic, generating a repair request for the first code block, the repair request being for requesting to obtain the second code block for replacing the first code block; receiving the second code block, and writing the second code block into the second address; rewriting the configuration information related to the first code block based on the second address, and generating the address jump information.

7. The method of claim 6, wherein, The writing of the second code block into the second address comprises: obtain the second address meeting an address length requirement based on a code block length of the second code block, the address length requirement being a length requirement for effectively storing the second code block; write the second code block into the second address.

8. The method according to any one of claims 1 to 7, characterized in that, In response to an exception of a first code block for implementing a first subprogram logic, rewrite configuration information related to the first code block based on a second address, and generate address jump information, including: In response to the exception of the first code block for implementing the first subprogram logic, determine a third code block from the plurality of code blocks, the third code block including a first pointing value pointing to the first address in a first register; adjust the first pointing value to a second pointing value based on the second address, to obtain the address jump information, the second pointing value being used to point to the second address in the first register.

9. The method according to any one of claims 1 to 7, characterized in that, In response to an exception of a first code block for implementing a first subprogram logic, rewrite configuration information related to the first code block based on a second address, and generate address jump information, including: In response to the exception of the first code block for implementing the first subprogram logic, adjust preset configuration content in the first code block to a jump instruction based on the second address, to obtain the address jump information; the jump instruction is used to instruct to jump to the second address for calling the second code block.

10. The method of claim 9, wherein, The adjusting of the preset configuration content in the first code block to the jump instruction based on the second address to obtain the address jump information includes: determine a first instruction operation code corresponding to a first platform type of a hardware platform on which the program file is run, the instruction operation code being used to represent an operation code for implementing a direct jump function on the hardware platform; adjust the preset configuration content in the first code block through the first instruction operation code and the second address, to obtain the jump instruction as the address jump information.

11. The method according to any one of claims 1 to 7, characterized in that, After the execution of the second code block to implement the first subprogram logic in the first program, the method further includes: in a case where a fourth code block called by the first code block in the program file is a normal code block, execute a second subprogram logic in which the second code block calls the fourth code block.

12. A code block invocation method, characterized by, The method is executed by a server, and includes: receive a repair request sent by a first terminal, the repair request being used to obtain a second code block for replacing a first code block, the first code block being used to implement a first subprogram logic in a first program, the first code block being stored in a first address in the first terminal; obtain the second code block based on the repair request, the second code block being used to replace the first code block to implement the first subprogram logic in the first program; The second code block is sent to the first terminal, and the second code block is used to write a second address in the case of an exception of the first code block, the second address is used to generate address jump information in the first terminal, and the address jump information is information obtained by rewriting configuration information related to the first code block and used for jumping to the second address to call the second code block.

13. The method of claim 12, wherein, After the second code block is obtained based on the repair request, the method further includes: The second code block is sent to the first terminal, and the second code block is used to write a second address in the case of an exception of the first code block, the second address is used to generate address jump information in the first terminal, and the address jump information is information obtained by rewriting configuration information related to the first code block and used for jumping to the second address to call the second code block.

14. The method of claim 12, wherein, The method further includes: An address mapping table is sent to the first terminal, and the address mapping table is used to represent the address replacement relationship between a plurality of addresses, and the address replacement relationship is used to represent the mutual replacement between at least two addresses. The first terminal finds the second address having the address replacement relationship with the first address from the address mapping table based on the first code block, and writes the second code block into the second address.

15. A code block invoking apparatus characterized by comprising: The device includes: An obtaining module is configured to obtain a program file of a first program, the program file including a plurality of code blocks, and the plurality of code blocks being used to jointly implement program logic of the first program. A generating module is configured to, in a process of running the program file, generate address jump information in response to an exception of a first code block used to implement first sub-program logic, the address jump information being obtained by rewriting configuration information related to the first code block based on a second address, the first code block being stored in a first address, and the address jump information being used to indicate jumping to the second address. A calling module is configured to call a second code block from the second address based on the address jump information, the second code block being a code block written into the second address in the case of the exception of the first code block. An executing module is configured to execute the second code block to implement the first sub-program logic in the first program.

16. A code block invoking apparatus characterized by comprising: The device includes: A receiving module is configured to receive a repair request sent by a first terminal, the repair request being used to obtain a second code block replacing a first code block, the first code block being used to implement first sub-program logic in a first program, and the first code block being stored in a first address in the first terminal. An obtaining module is configured to obtain the second code block based on the repair request, the second code block being used to replace the first code block to implement the first sub-program logic in the first program. A sending module is configured to send the second code block to the first terminal, the second code block being used to write a second address in the case of an exception of the first code block, the second address being used to generate address jump information in the first terminal, and the address jump information being information obtained by rewriting configuration information related to the first code block and used for jumping to the second address to call the second code block.

17. A computer device, comprising: The computer device comprises a processor and a memory, and the memory stores at least one program, which is loaded and executed by the processor to implement the code block calling method according to any one of claims 1-14.

18. A computer-readable storage medium, characterized in that, The storage medium stores at least one program, which is loaded and executed by the processor to implement the code block calling method according to any one of claims 1-14.

19. A computer program product, characterised in that, The computer program product comprises computer instructions, which are executed by the processor to implement the code block calling method according to any one of claims 1-14.