CN115167905A - Uninterrupted running updating method for C + + code and computer system - Google Patents
Uninterrupted running updating method for C + + code and computer system Download PDFInfo
- Publication number
- CN115167905A CN115167905A CN202110353639.8A CN202110353639A CN115167905A CN 115167905 A CN115167905 A CN 115167905A CN 202110353639 A CN202110353639 A CN 202110353639A CN 115167905 A CN115167905 A CN 115167905A
- Authority
- CN
- China
- Prior art keywords
- function
- program
- old
- running
- name
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
- G06F8/656—Updates while running
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
本发明公开了一种C++代码不中断运行更新方法及计算机系统。该方法通过在待更新的C++程序中增设一个协议处理函数,利用进程间通信机制,通过请求‑响应的方式实现在所述C++程序运行时,采用动态库中新函数代替运行的所述C++程序中同名的旧函数进行执行。通过本发明提供的方案能够实现不中断所述C++程序运行的基础上对其进行热更新。当采用本发明提供方案对服务器上运行的C++服务程序进行更新时、无需重启服务器、无需中断服务器与客户端的连接,不会对服务器提供的业务/服务造成影响。
The invention discloses a C++ code running update method and computer system without interruption. In the method, a protocol processing function is added to the C++ program to be updated, and the inter-process communication mechanism is used to realize that when the C++ program is running, a new function in the dynamic library is used to replace the running C++ program by means of a request-response method. to execute the old function of the same name. The solution provided by the present invention can realize hot updating of the C++ program without interrupting the running of the C++ program. When using the solution provided by the present invention to update the C++ service program running on the server, the server does not need to be restarted, and the connection between the server and the client does not need to be interrupted, and the business/service provided by the server will not be affected.
Description
技术领域technical field
本发明公开了一种C++代码不中断运行更新方法及计算机系统,涉及计算机运行代码更新领域。通过本发明提供的技术方案实现C++可执行程序在不停止运行/不重启的前提下,更新其中的功能函数并即时生效;尤其适用于更新服务器上正在运行、对外提供服务的C++可执行程序。The invention discloses a C++ code uninterrupted running update method and computer system, and relates to the field of computer running code update. The technical solution provided by the present invention realizes that the C++ executable program can update the function functions and take effect immediately under the premise of not stopping or restarting; it is especially suitable for updating the C++ executable program running on the server and providing services to the outside world.
背景技术Background technique
开发服务器运行程序时、为追求最好的性能一般会采用C++语言。为了实现开发的C++程序在运行时热更新、并且不停止对外提供服务,通常还会搭配其它脚本语言来进行开发和部署。虽然脚本可以热更新、但是如果运行的C++程序本身的功能逻辑有修改,对该C++程序更新时就需要重启服务器。而重启服务器会造成客户端连接的中断,重启时服务器进行数据/程序初始化也需要一定的时间;重启完成后、客户端重新连接服务器,往往需要再进行一次鉴权。如果服务器重启前连接的客户端较多(比如有五六千个),这些客户端在服务器重启完成后都将重新连接该服务器,这种情况下重启服务器成本太高,会对该服务器提供的服务、处理的业务会造成很大的影响。When developing server running programs, C++ language is generally used in pursuit of the best performance. In order to realize the hot update of the developed C++ program at runtime and not stop providing services to the outside world, it is usually developed and deployed with other scripting languages. Although the script can be hot updated, if the functional logic of the running C++ program is modified, the server needs to be restarted when the C++ program is updated. Restarting the server will interrupt the connection of the client, and it also takes a certain amount of time for the server to initialize data/programs during restart. After the restart is complete, the client reconnects to the server and often needs to perform authentication again. If there are many clients connected before the server restarts (for example, there are five or six thousand), these clients will reconnect to the server after the server restarts. In this case, the cost of restarting the server is too high, and the server will provide The service and processing business will have a great impact.
为了避免在更新服务器中运行的程序代码时重启服务器,有些开发人员会增加脚本的比重,甚至以纯脚本的形式来开发服务器运行的程序。这种方式随着后期代码量的不断增多,服务器的性能会有明显的下降;特别是在运营两到三年后,随着服务器上的业务逻辑的不断增加而连接的客户端的数量并没有下降,服务器对外提供业务处理的性能将会受到严重影响。此时、由于之前采用脚本编写的辑辑太多,若再去采用C++重写、将带来的非常高的开发成本。In order to avoid restarting the server when the program code running in the server is updated, some developers increase the proportion of scripts, or even develop programs that run on the server in the form of pure scripts. In this way, with the continuous increase of the amount of code in the later stage, the performance of the server will decrease significantly; especially after two to three years of operation, the number of connected clients does not decrease as the business logic on the server continues to increase. , the performance of the server to provide external business processing will be seriously affected. At this point, because there are too many scripts written in the past, if we use C++ to rewrite, it will bring very high development costs.
为了解决服务器运行程序更新时存在的上述问题/不足,使运行的C++代码也能进行热更新成为程序开发人员经常采用的程序开发指导方向。若实现热更新服务器运行的C++程序,服务器不需要重启、客户端也就不需要重新连接而且能够保留C++代码的优越性能。In order to solve the above-mentioned problems/deficiencies when the server running program is updated, making the running C++ code also hot update has become a program development guidance direction often adopted by program developers. If the C++ program running on the hot update server is implemented, the server does not need to be restarted, the client does not need to reconnect, and the superior performance of the C++ code can be retained.
目前用于对运行的C++程序代码进行热更新的方法,包括以下两种:Currently, there are two methods for hot updating the running C++ program code:
1.修改got表来实现热更新:这种方法需要把现有的C++源代码先编译成一个动态库,然后再编译一次这个源代码;把所述动态库隐式引用到第二编译成的可执行代码中。这种方法更新前要编译两次,并且需要打开进程的内存模块信息、解析ELF文件头遍历elf文件的节区表以获取相应的got表。1. Modify the got table to achieve hot update: this method requires compiling the existing C++ source code into a dynamic library, and then compiling the source code again; implicitly referencing the dynamic library to the second compiled in executable code. This method needs to be compiled twice before updating, and needs to open the memory module information of the process, parse the ELF file header and traverse the section table of the elf file to obtain the corresponding got table.
2.另起一个进程直接修改代码段:这种方式需要遍历内存页的方式去寻找要替换的函数,通过另起一个进程调用Linux系统的ptrace函数将新的代码附加到需要修改的进程中。这种方法需要保存要修改进程的寄存器且需要恢复寄存器现场;并且调用ptrace函数会导致目标进程暂停,如果暂停时间较长会对原C++程序执行进程的逻辑产生影响。2. Start another process to directly modify the code segment: In this way, you need to traverse the memory page to find the function to be replaced, and call the ptrace function of the Linux system through another process to attach the new code to the process that needs to be modified. This method needs to save the registers of the process to be modified and restore the register scene; and calling the ptrace function will cause the target process to suspend, and if the suspend time is long, it will affect the logic of the original C++ program execution process.
以上两种方式都可以达到热更新C++代码的目的。但仍然存在一定的缺点:第一种需要编译两次,找到got表和got表里面的函数地址操作比较复杂;第二种另起一个进程的操作成本比较高且遍历内存页耗时严重,且调用ptrace函数会导致目标进程暂停。The above two methods can achieve the purpose of hot updating the C++ code. But there are still some shortcomings: the first one needs to be compiled twice, and the operation of finding the got table and the function address in the got table is more complicated; the second is the operation cost of starting another process is relatively high and the traversal of memory pages is time-consuming, and Calling the ptrace function causes the target process to pause.
发明内容SUMMARY OF THE INVENTION
针对传统方案存在的上述不足,本发明提供一种C++代码不中断运行更新方案。该方案通过预设的协议处理函数实现采用所述动态库中新函数代替待更新C++程序中相应旧函数在所述C++程序运行时执行;实现在不重启服务器,不中断服务器与客户端的连接的基础上,对所述服务器上运行C++程序的进行热更新。Aiming at the above-mentioned shortcomings of the traditional scheme, the present invention provides a C++ code running update scheme without interruption. The scheme realizes that the new function in the dynamic library is used to replace the corresponding old function in the C++ program to be updated to be executed when the C++ program is running through the preset protocol processing function; On the basis, hot update is performed on the C++ program running on the server.
本发明的目的通过如下技术方案来实现:The object of the present invention is achieved through the following technical solutions:
一种C++代码不中断运行更新方法,所述方法包括:将用于代替运行的C++程序中的旧函数、且与该旧函数同名的新函数编译到一个动态库中;对所述C++程序增设一个支持其采用所述动态库进行热更新的协议处理函数;在运行所述C++程序的计算机中启动一个进程,该进程接收到热更新所述C++程序的请求时调用所述协议处理函数实现采用所述动态库中、与指定旧函数同名的新函数来代替正在运行的所述C++程序中的所述指定旧函数执行。优选地、在编译所述动态库时所采用的编译环境与编译所述C++程序的编译环境相同。A C++ code uninterrupted running update method, the method comprises: compiling into a dynamic library a new function for replacing an old function in a running C++ program and a new function with the same name as the old function; adding to the C++ program A protocol processing function that supports hot updating by using the dynamic library; a process is started in the computer running the C++ program, and when the process receives a request for hot updating the C++ program, the protocol processing function is called to implement the In the dynamic library, a new function with the same name as the designated old function is executed instead of the designated old function in the running C++ program. Preferably, the compilation environment used when compiling the dynamic library is the same as the compilation environment for compiling the C++ program.
其中、所述协议处理函数实现为:根据预设的路径查找并加载用于代替所述旧函数执行的动态库,在内存中的所述C++程序的可执行文件中找到所述旧函数的地址,然后修改代码段、在所述地址处填入机器码使处理器在执行到所述机器码时跳转到所述动态库中与所述旧函数同名的新函数处执行,执行完后返回内存中所述旧函数的下一个地址处继续执行。所述协议处理函数包括两个参数:所述C++程序中旧函数的名称,以及包含代替所述旧函数执行、与所述旧函数同名的新函数的动态库的名称;所述两个参数的取值在所述请求中指定。Wherein, the protocol processing function is implemented as: searching and loading a dynamic library for executing in place of the old function according to a preset path, and finding the address of the old function in the executable file of the C++ program in the memory , then modify the code segment, fill in the machine code at the address to make the processor jump to the new function in the dynamic library with the same name as the old function when executing the machine code, and return after execution Execution continues at the next address in memory of the old function described. The protocol processing function includes two parameters: the name of the old function in the C++ program, and the name of the dynamic library that contains the new function that is executed in place of the old function and has the same name as the old function; The value is specified in the request.
进一步地、所述C++程序在Linux操作系统中执行,所述旧函数的名称为所述旧函数在该C++程序的动态符号表中对应的符号名字。其中、所述动态符号表为所述C++程序在Linux的编译环境中采用g++编译器进行编译时,增加编译选项-rdynamic和-g生成的。可以通过调用Linux系统的dlsym函数找到在该C++程序的可执行文件中、所述旧函数的符号名字的内存地址A;调用所述dlsym函数获取在所述加载的动态库中、所述符号名字的内存地址B。Further, the C++ program is executed in the Linux operating system, and the name of the old function is the symbol name corresponding to the old function in the dynamic symbol table of the C++ program. Wherein, the dynamic symbol table is generated by adding the compilation options -rdynamic and -g when the C++ program is compiled using the g++ compiler in the Linux compilation environment. The memory address A of the symbolic name of the old function in the executable file of the C++ program can be found by calling the dlsym function of the Linux system; the dlsym function is called to obtain the symbolic name in the loaded dynamic library. memory address B.
进一步地、所述修改代码段、在所述地址处填入机器码、使处理器在执行到所述机器码时跳转到所述动态库中与该旧函数同名的新函数处执行,具体为:调用Linux系统提供的mprotect函数把所述地址A所在的内存页及其后紧邻的一个内存页的保护标记设置为可写。在相关内存可写后,调用Linux操作系统的相关函数(例如函数memset和memcpy)把汇编指令mov rax B和jmp rax对应的机器码依次写入所述地址A开始的内存中后、把所述两个内存页的保护标记修改为只读;其中所述rax为寄存器名称。Further, the modifying the code segment, filling in the machine code at the address, so that the processor jumps to the new function with the same name as the old function in the dynamic library when executing the machine code. To: call the mprotect function provided by the Linux system to set the protection flag of the memory page where the address A is located and a memory page immediately after it as writable. After the relevant memory is writable, the relevant functions of the Linux operating system (such as functions memset and memcpy) are called to sequentially write the machine codes corresponding to the assembly instructions mov rax B and jmp rax into the memory starting from the address A, and then the The protection flags of the two memory pages are modified to read-only; the rax is the register name.
与上述方法相对应、本发明还提供一种C++代码不中断运行更新的计算机系统,其特征在于,所述计算机系统采用上述C++代码不中断运行更新方法对其上运行的所述C++程序的可执行文件进行函数更新。优选地、所述计算机系统为通过运行所述C++程序对连接的客户端提供服务。Corresponding to the above method, the present invention also provides a computer system with a C++ code that does not interrupt running and updating, characterized in that the computer system adopts the above-mentioned C++ code that does not interrupt the running and updating method to update the C++ program running on it. Execute the file for function update. Preferably, the computer system provides services to connected clients by running the C++ program.
附图说明Description of drawings
图1为本发明提供的C++代码不中断运行更新方法的流程示意图。FIG. 1 is a schematic flow chart of a method for updating the running of C++ code without interruption provided by the present invention.
具体实施方式Detailed ways
为了使本发明所解决的技术问题、技术方案以及有益效果更加清楚明白,以下结合附图对本发明进行进一步详细说明。应该理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the technical problems, technical solutions and beneficial effects solved by the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.
如图1所示、本发明提供一种C++代码不中断运行更新方法,该方法包括以下步骤:As shown in Figure 1, the present invention provides a C++ code running update method without interruption, and the method comprises the following steps:
a.将用于代替运行的C++程序中的旧函数、且与该旧函数同名的新函数编译到一个动态库(也叫动态链接库)中。在编译该动态库时为了避免由于编译环境差异造成的可能的不兼容情况,优选地、在编译所述动态库时所采用的编译环境与所述C++程序编译环境相同。a. Compile a new function with the same name as the old function used to replace the old function in the running C++ program into a dynamic library (also called a dynamic link library). When compiling the dynamic library, in order to avoid possible incompatibility caused by differences in the compilation environment, preferably, the compilation environment used when compiling the dynamic library is the same as the C++ program compilation environment.
动态库(so文件)有助于共享数据和资源,多个应用程序可同时访问内存中单个so文件副本的内容。在一个传统的非共享库中,一部分代码简单地附加到调用的程序上。如果两个程序调用同一个子程序,就会出现两份那段代码。相反,许多应用共享的代码能够切分到一个so文件中,在硬盘上存为一个文件,在内存中使用一个所述动态库的实例(instance),这样可以大大节约应用程序所需的磁盘和内存空间。将程序需要调用/需要修改后的函数代码编译到动态库中(又叫动态链接库),使该程序的执行进程可以调用不属于其可执行代码的函数。Dynamic libraries (so files) help to share data and resources, and multiple applications can simultaneously access the contents of a single copy of the so file in memory. In a traditional non-shared library, a portion of the code is simply attached to the calling program. If two programs call the same subroutine, there will be two copies of that code. On the contrary, the code shared by many applications can be divided into a so file, stored as a file on the hard disk, and an instance of the dynamic library is used in memory, which can greatly save the disk and disk required by the application program. memory space. The function code that the program needs to call/need to be modified is compiled into a dynamic library (also called a dynamic link library), so that the execution process of the program can call functions that do not belong to its executable code.
b.对所述C++程序增设一个支持其采用所述动态库进行热更新的协议处理函数。该协议处理函数在开发所述C++程序时增加,用于在所述C++程序运行时实现采用所述动态库中新函数代替该C++程序中同名的旧函数执行。b. Add a protocol processing function to the C++ program to support hot update by using the dynamic library. The protocol processing function is added when the C++ program is developed, and is used to implement the execution of using the new function in the dynamic library to replace the old function with the same name in the C++ program when the C++ program is running.
所述协议处理函数实现为:根据预设的路径查找并加载(例如、调用Linux系统的dlopen函数进行动态库加载)用于代替所述旧函数执行的动态库。在内存中的所述C++程序的可执行文件中找到所述旧函数的地址,然后修改代码段、在所述地址处填入机器码使处理器在执行到所述机器码时跳转到所述动态库中与所述旧函数同名的新函数处执行,执行完后返回内存中所述旧函数的下一个地址处继续执行。The protocol processing function is implemented as: searching and loading (for example, calling the dlopen function of the Linux system to load a dynamic library) according to a preset path, a dynamic library for replacing the execution of the old function. Find the address of the old function in the executable file of the C++ program in the memory, then modify the code segment, and fill in the machine code at the address to make the processor jump to the address when the machine code is executed. It executes the new function in the dynamic library with the same name as the old function, and returns to the next address of the old function in the memory to continue execution after the execution.
优选地、设置所述协议处理函数至少包括以下两个参数:所述C++程序中旧函数的名称,以及包含代替所述旧函数执行、与所述旧函数同名的新函数的动态库的名称。所述C++程序为在Linux操作系统中执行的服务器端程序。所述旧函数的名称为所述旧函数在该C++程序的动态符号表中对应的符号名字;其中、所述动态符号表为所述C++程序在Linux的编译环境中编译时对g++编译器增加编译选-rdynamic和-g生成的。参数-g用来告诉编译器g++在生成可执行文件的时候需要生成供调试器调试使用的调试信息,包括扩展的动态符号表、行号、局部或外部变量信息等。参数-rdynamic用来告诉链接器将所有的符号都添加到动态符号表中。Preferably, setting the protocol processing function includes at least the following two parameters: the name of the old function in the C++ program, and the name of a dynamic library that contains a new function with the same name as the old function executed instead of the old function. The C++ program is a server-side program executed in the Linux operating system. The name of the old function is the symbol name corresponding to the old function in the dynamic symbol table of the C++ program; wherein, the dynamic symbol table is the addition to the g++ compiler when the C++ program is compiled in the Linux compilation environment Compiled with -rdynamic and -g. The parameter -g is used to tell the compiler that g++ needs to generate debugging information for debugger debugging when generating executable files, including extended dynamic symbol table, line number, local or external variable information, etc. The parameter -rdynamic is used to tell the linker to add all symbols to the dynamic symbol table.
在Linux中通过nm命令和grep命令在动态符号表里搜索源代码里面的某个函数的函数名即可找到对应的符号名字。当查找的结果有多个符号名字时,可以使用c++filt命令传入上述查找得到的多个符号名字以得到该符号对应的源代码里面函数的完整定义,能过比较就可以确定具体的符号名字才是我们需要的(C++filt命令得到结果里面如果有形参只有形参的类型,没有形参的名字,只通过形参类型就可以确定结果)。In Linux, you can find the corresponding symbol name by searching the function name of a function in the source code through the nm command and the grep command in the dynamic symbol table. When the search result has multiple symbol names, you can use the c++filt command to pass in the multiple symbol names obtained by the above search to obtain the complete definition of the function in the source code corresponding to the symbol. The name of the symbol is what we need (if the C++filt command gets the result, if there is a formal parameter with only the type of the formal parameter, and there is no name of the formal parameter, the result can be determined only by the type of the formal parameter).
在查找到旧函数对应的符号名字后、通过调用Linux系统的dlsym函数找到在该C++程序的可执行文件中、所述旧函数的符号名字的内存地址A,调用所述dlsym函数获取在所述加载的动态库中、所述符号名字的内存地址B;即需要调用dlsym函数两次。具体地,第一次调用dlsym函数时将其第一个参数设置为NULL,第二个参数设置为所述从动态符号表中获得的所述旧函数的符号名字,获取该符号名字在所述C++程序的执行进程代码段中的内存地址A。第二次调用dlysm函数将其第一个参数设置为加载所述动态库所得的句柄handle,第二个参数设置为所述从动态符号表中获得的所述旧函数的符号名字(由于新函数和待替换的旧函数同名),获取该符号名字在加载的所述动态库中的内存地址B。如果取到的地址A或地址B等于0,则所述协议处理函数体返回失败,不再继续执行。After finding the symbol name corresponding to the old function, find the memory address A of the symbol name of the old function in the executable file of the C++ program by calling the dlsym function of the Linux system, and call the dlsym function to obtain the memory address A of the symbol name of the old function in the executable file of the C++ program. In the loaded dynamic library, the memory address B of the symbol name; that is, the dlsym function needs to be called twice. Specifically, when calling the dlsym function for the first time, the first parameter is set to NULL, and the second parameter is set to the symbol name of the old function obtained from the dynamic symbol table, and the symbol name is obtained in the The memory address A in the execution process code segment of the C++ program. The second call to the dlysm function sets its first parameter to the handle obtained by loading the dynamic library, and the second parameter to the symbol name of the old function obtained from the dynamic symbol table (due to the new function It has the same name as the old function to be replaced), and obtains the memory address B of the symbol name in the loaded dynamic library. If the obtained address A or address B is equal to 0, the protocol processing function body returns a failure and does not continue to execute.
所述修改代码段、在所述地址处填入机器码、使处理器在执行到所述机器码时跳转到所述动态库中与所述旧函数同名的新函数处执行,具体为:调用Linux系统提供的mprotect函数把所述地址A所在的内存页及其后紧邻的一个内存页的保护标记从只读改为可写。在相关内存可写后,调用Linux操作系统的相关函数(例如函数memset和memcpy)把汇编指令mov rax B和jmp rax对应的机器码依次写入所述地址A开始的内存中后、把所述两个内存页的保护标记重新修改为只读;其中、所述rax为寄存器名称。The modifying the code segment, filling in the machine code at the address, and causing the processor to jump to a new function with the same name as the old function in the dynamic library to execute when the machine code is executed, specifically: The mprotect function provided by the Linux system is called to change the protection mark of the memory page where the address A is located and a memory page immediately following it from read-only to write-able. After the relevant memory is writable, the relevant functions of the Linux operating system (such as functions memset and memcpy) are called to sequentially write the machine codes corresponding to the assembly instructions mov rax B and jmp rax into the memory starting from the address A, and then the The protection marks of the two memory pages are re-modified to read-only; wherein, the rax is a register name.
c.在运行所述C++程序的计算机中启动一个对接收的所述C++程序的热更新请求进行处理的进程。所述热更新请求需要指明的参数取值至少包括以下两种:所述C++程序中旧函数的名称,以及包含代替所述旧函数执行、与所述旧函数同名的新函数的动态库的名称。上述两种参数的取值在所述进程调用所述协议处理函数时作为该协议处理函数的入参。c. Initiate a process of processing the received hot update request of the C++ program in the computer running the C++ program. The parameter values that need to be specified in the hot update request include at least the following two: the name of the old function in the C++ program, and the name of the dynamic library that includes a new function that is executed in place of the old function and has the same name as the old function . The values of the above two parameters are used as input parameters of the protocol processing function when the process calls the protocol processing function.
d.所述进程接收到所述请求,调用所述协议处理函数实现采用所述动态库中、与指定旧函数同名的新函数来代替所述C++程序中的所述指定旧函数执行。d. The process receives the request, and calls the protocol processing function to implement a new function in the dynamic library with the same name as the specified old function to replace the specified old function in the C++ program for execution.
与上述方法相对应,本发明还提供一种C++代码不中断运行更新的计算机系统,所述计算机系统采用上述C++代码不中断运行更新方法对其上运行的所述C++程序的可执行文件进行函数更新。优选地、所述计算机系统为通过运行所述C++程序对连接的客户端提供服务。Corresponding to the above method, the present invention also provides a computer system whose C++ code is not interrupted to run and update. renew. Preferably, the computer system provides services to connected clients by running the C++ program.
与现有的技术相比,本发明提供的技术方案采用动态库中新函数代替待更新C++程序中相应旧函数在所述C++程序运行时执行,能够在不重启服务器、不中断服务器与客户端的连接的基础上对所述服务器上运行C++程序的进行热更新。Compared with the prior art, the technical solution provided by the present invention adopts the new function in the dynamic library to replace the corresponding old function in the C++ program to be updated to be executed when the C++ program is running, which can be executed without restarting the server and without interrupting the communication between the server and the client. On the basis of the connection, the C++ program running on the server is hot updated.
Claims (9)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110353639.8A CN115167905A (en) | 2021-04-01 | 2021-04-01 | Uninterrupted running updating method for C + + code and computer system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110353639.8A CN115167905A (en) | 2021-04-01 | 2021-04-01 | Uninterrupted running updating method for C + + code and computer system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN115167905A true CN115167905A (en) | 2022-10-11 |
Family
ID=83476135
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202110353639.8A Pending CN115167905A (en) | 2021-04-01 | 2021-04-01 | Uninterrupted running updating method for C + + code and computer system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115167905A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115794183A (en) * | 2022-11-09 | 2023-03-14 | 网易(杭州)网络有限公司 | Upgrade method, upgrade device, electronic device, and computer-readable storage medium |
| WO2025025542A1 (en) * | 2023-07-28 | 2025-02-06 | 京东科技信息技术有限公司 | Data communication protocol implementation method, apparatus, and system |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060080682A1 (en) * | 2004-10-12 | 2006-04-13 | Picsel Research Ltd. | Run time dynamic linking |
| CN103294457A (en) * | 2012-02-27 | 2013-09-11 | 百度在线网络技术(北京)有限公司 | Method and device for dynamically substituting C/C + + function in main program |
| CN108762825A (en) * | 2018-04-20 | 2018-11-06 | 烽火通信科技股份有限公司 | The realization method and system of dynamic base heavy duty |
-
2021
- 2021-04-01 CN CN202110353639.8A patent/CN115167905A/en active Pending
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060080682A1 (en) * | 2004-10-12 | 2006-04-13 | Picsel Research Ltd. | Run time dynamic linking |
| CN103294457A (en) * | 2012-02-27 | 2013-09-11 | 百度在线网络技术(北京)有限公司 | Method and device for dynamically substituting C/C + + function in main program |
| CN108762825A (en) * | 2018-04-20 | 2018-11-06 | 烽火通信科技股份有限公司 | The realization method and system of dynamic base heavy duty |
Non-Patent Citations (1)
| Title |
|---|
| DAYDAYUPPPPPP: "一种基于so的C/C++服务热更新方案", pages 1 - 6, Retrieved from the Internet <URL:https://www.jianshu.com/p/b7c7102119fa> * |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115794183A (en) * | 2022-11-09 | 2023-03-14 | 网易(杭州)网络有限公司 | Upgrade method, upgrade device, electronic device, and computer-readable storage medium |
| WO2025025542A1 (en) * | 2023-07-28 | 2025-02-06 | 京东科技信息技术有限公司 | Data communication protocol implementation method, apparatus, and system |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US7516441B2 (en) | Method and system for program editing and debugging in a common language runtime environment | |
| US6795963B1 (en) | Method and system for optimizing systems with enhanced debugging information | |
| US5325531A (en) | Compiler using clean lines table with entries indicating unchanged text lines for incrementally compiling only changed source text lines | |
| US5732210A (en) | Use of dynamic translation to provide fast debug event checks | |
| US5201050A (en) | Line-skip compiler for source-code development system | |
| JP5415557B2 (en) | User script code conversion for debugging | |
| US9134973B2 (en) | Dynamic compiling and loading at runtime | |
| US8745596B2 (en) | Program debugging with dynamically inserted instrumentation | |
| JP2000181725A (en) | Method and system for altering executable code and giving addition function | |
| US20120198427A1 (en) | Ensuring Register Availability for Dynamic Binary Optimization | |
| US20130263094A1 (en) | Setting breakpoints in optimized instructions | |
| US20190114165A1 (en) | Using semantic annotations to control compatibility behaviors | |
| JP4833206B2 (en) | Generation of unwind information for optimized programs | |
| US12260222B2 (en) | Exception handling method and related apparatus | |
| CN104391717A (en) | Method for dynamically updating code during debugging | |
| CN102364433B (en) | Method for realizing Wine construction tool transplanting on ARM (Advanced RISC Machines) processor | |
| CN115167905A (en) | Uninterrupted running updating method for C + + code and computer system | |
| EP4399597A1 (en) | Hot reloading a running application with an unsaved source code change | |
| US10452364B2 (en) | Method and system for preparing code to be executed by programmable control devices | |
| US10747514B2 (en) | Reduced save and restore instructions for call-clobbered registers | |
| CN112882701A (en) | Executable file static pile inserting technical framework supporting multiple architectures | |
| CN101782860B (en) | Method and device for linking program | |
| US10671397B2 (en) | Reduced save and restore instructions for call-clobbered registers | |
| CN117234953B (en) | Kernel debugging method based on shadow code cache | |
| US20080141225A1 (en) | Method for migrating files |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |