CN110321141A - Native layers of application program real-time restorative procedure, equipment and system - Google Patents

Native layers of application program real-time restorative procedure, equipment and system Download PDF

Info

Publication number
CN110321141A
CN110321141A CN201910493115.1A CN201910493115A CN110321141A CN 110321141 A CN110321141 A CN 110321141A CN 201910493115 A CN201910493115 A CN 201910493115A CN 110321141 A CN110321141 A CN 110321141A
Authority
CN
China
Prior art keywords
repaired
module
application program
memory
agreement
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
Application number
CN201910493115.1A
Other languages
Chinese (zh)
Inventor
周志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201910493115.1A priority Critical patent/CN110321141A/en
Publication of CN110321141A publication Critical patent/CN110321141A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

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)
  • Stored Programmes (AREA)

Abstract

The invention discloses a kind of application program native layers real-time restorative procedure, storage medium, equipment, it is related to field of software development, this method includes that the equipment for running application program receives the bugfix type protocol that server end defines, and includes the repair data field for being repaired to application program module to be repaired in the agreement;Capable parsing is taken in docking, obtains repair data, while knowing module title to be repaired corresponding to repair data;Based on the module title to be repaired known, obtains application program and be located at the module to be repaired in memory;Modify memory attribute be it is writeable and readable, the legacy data at the reparation position for the module to be repaired that will acquire is substituted for repair data, then is revised as can be performed by memory attribute.The agreement specifically includes the offset field and protocol type field of repair data field, module title field to be repaired, module to be repaired.The present invention carries out function reparation by the way of real-time online reparation, to the application program being currently running in equipment.

Description

Native layers of application program real-time restorative procedure, equipment and system
Technical field
The present invention relates to field of software development, and in particular to a kind of application program native layers of real-time restorative procedure, storage Medium, equipment.
Background technique
With popularizing for smart phone, the use of mobile terminal application program is also more and more common.The end Android is applied For program, mainly by Java layers of application code and native layers (being developed using C Plus Plus, the bottom relative to Java layers) Code composition leads to the function existing defects of application program, then needs to be repaired in time when there are bug for native layers of codes It is multiple.
Then application program is once issue and by user according to in mobile device, the shadow of human factor when being used by user It ringing, the update of application program will be more slow, once there are bug for the native layer of discovery application program, even if server end The application program latest edition for having repaired bug is issued, but the downloading that user does not carry out application program actively updates, Yong Hushe The bug of the application program of standby upper installation still exists, and influences user for the usage experience of application program.
Summary of the invention
In view of the deficiencies in the prior art, in real time the purpose of the present invention is to provide a kind of application program native layers Restorative procedure, storage medium, equipment, by the way of real-time online reparation, to the application program being currently running in equipment Carry out function reparation.
First aspect present invention provides a kind of application program native layers of real-time restorative procedure, is suitable for the end Android, packet Include following steps:
The equipment of operation application program receives the bugfix type protocol that server end defines, and includes being used in the agreement The repair data field that application program module to be repaired is repaired;
It is parsed to agreement is received, obtains repair data, while knowing module name to be repaired corresponding to repair data Claim;
Based on the module title to be repaired known, the module to be repaired in application program is obtained;
Modifying memory attribute is writeable and readable, the legacy data replacement of the module to be repaired that will acquire repaired at position At repair data, then memory attribute is revised as can be performed.
With reference to first aspect, in the first possible implementation, the agreement specifically include repair data field, to The offset field and protocol type field of repair module name field, module to be repaired.
The first possible implementation with reference to first aspect, in the second possible implementation, described pair of reception association View is parsed, and obtains repair data, while knowing module title to be repaired, specific steps corresponding to repair data are as follows:
After equipment receives agreement, and create the instance objects of message parsing type;
Agreement is parsed using the instance objects of creation, obtains repair data, module title to be repaired, mould to be repaired The offset of block and protocol type;
Include based on obtained repair data, module title to be repaired, the offset of module to be repaired and protocol type, creation Repair data, module title to be repaired, the reparation network protocol of the offset of module to be repaired and protocol type.
The first possible implementation with reference to first aspect, it is in the third possible implementation, described to be based on knowing Module title to be repaired, obtain the module to be repaired in application program, specific steps include:
Memory mapping information is obtained, includes of all modules of application program in memory in the memory mapping information Beginning address and size;
Circulation reads every a line content of the memory mapping information, judges whether contain mould to be repaired in current line content Block title, if so, the initial address of module to be repaired in memory is obtained from current line content, if it is not, then reading next Row content.
The third possible implementation with reference to first aspect, it is in the fourth possible implementation, described to will acquire Legacy data at the reparation position of module to be repaired is substituted for repair data, and specific steps include:
The memory address that module to be repaired repairs position is calculated, the calculation of the memory address is module to be repaired Initial address in memory adds the offset of module to be repaired;
Data at calculated memory address are substituted for repair data, complete to repair.
With reference to first aspect, in a fifth possible implementation,
The modification memory attribute is writeable and readable, and memory attribute is revised as can be performed, and specially uses API Function mprotect modifies to the attribute of memory, and the prototype of function mprotect is
intmprotect(void*addr,size_tlen,intprot)
Wherein, int is a kind of data type, indicates integer variable, and void* indicates that pointer, addr are to be repaired Memory address, size_tlen indicate that the memory size for needing to modify since addr, intprot indicate modified memory category Property is as a result, memory attribute result includes PROT_READ, PROT_WRITE, PROT_EXEC and PROT_NONE, PROT_READ table Show readable, PROT_WRITE indicates writeable, and PROT_EXEC indicates executable, and PROT_NONE indicates inaccessible;
The modification memory attribute be it is writeable and readable, the specific function that executes is
mprotect((void*)PAGE_START(addr),PAGE_SIZE,PROT_READ|PROT_WRITE)
Wherein, PAGE_SIZE indicates that the memory size of modification, PAGE_START (addr) are indicated from module reparation to be repaired Start to modify at the memory address of position;
Described to be revised as can be performed by memory attribute, the specific function that executes is
mprotect((void*)PAGE_START(addr),PAGE_SIZE,PROT_EXEC)。
With reference to first aspect, in a sixth possible implementation,
The equipment receives agreement and is stored in the disk of equipment, and when application program starts every time, equipment will apply journey The version number of sequence is sent to server end, and server end judgement judges whether application program needs to repair based on received version number It is multiple:
If it is not, being then not processed;
If so, further judge whether the agreement for being repaired has been issued to equipment, if having issued, using setting The agreement stored in standby disk repairs application program, if not issuing, issues to equipment for answering current version number The agreement repaired with program, and the newest agreement issued is stored into equipment disk, while sweep equipment disk Central Plains The agreement first stored.
Second aspect of the present invention provides a kind of server apparatus, and the server apparatus is for executing following steps:
A bugfix type protocol is defined, includes for being repaired to application program module to be repaired in the agreement Repair data field;
The agreement of definition is sent to the equipment that operation needs repairing applications.
Third aspect present invention provides a kind of intelligent terminal, and the intelligent terminal operation has application to be repaired Program, which is characterized in that the intelligent terminal is for executing following steps:
It receives agreement and parses, obtain repair data, while knowing module title to be repaired corresponding to repair data, institute Stating includes repair data field for being repaired to application program module to be repaired in agreement;
Based on the module title to be repaired known, the module to be repaired in application program is obtained;
Modifying memory attribute is writeable and readable, the legacy data replacement of the module to be repaired that will acquire repaired at position At repair data, then memory attribute is revised as can be performed.
Fourth aspect present invention provides a kind of application program native layers of Real-time healing system, comprising:
Server, the server include:
Definition module is used to define a bugfix type protocol, includes for be repaired to application program in the agreement The repair data field that multiple module is repaired;
Sending module, the agreement for being used to define definition unit are sent to the equipment that operation needs repairing applications;
Operation needs the terminal device of repairing applications, and the equipment includes:
Receiving module is used to receive the agreement of server transmission;
Parsing module is used to parse the received agreement of receiving unit, obtains repair data, while knowing repair data Corresponding module title to be repaired;
Module is obtained, the module title to be repaired known based on parsing module is used for, is obtained to be repaired in application program Multiple module;
Replacement module, being used to modify memory attribute is writeable and readable, the reparation position for the module to be repaired that will acquire The legacy data at place is substituted for repair data, then is revised as can be performed by memory attribute.
In conjunction with fourth aspect, in the first possible implementation, the agreement specifically include repair data field, to The offset field and protocol type field of repair module name field, module to be repaired.
The first possible implementation in conjunction with fourth aspect, in the second possible implementation, described pair of reception association View is parsed, and obtains repair data, while knowing module title to be repaired, specific steps corresponding to repair data are as follows:
After equipment receives agreement, and create the instance objects of message parsing type;
Agreement is parsed using the instance objects of creation, obtains repair data, module title to be repaired, mould to be repaired The offset of block and protocol type;
Include based on obtained repair data, module title to be repaired, the offset of module to be repaired and protocol type, creation Repair data, module title to be repaired, the reparation network protocol of the offset of module to be repaired and protocol type.
The first possible implementation in conjunction with fourth aspect, it is in the third possible implementation, described to be based on knowing Module title to be repaired, obtain the module to be repaired in application program, specific steps include:
Memory mapping information is obtained, includes of all modules of application program in memory in the memory mapping information Beginning address and size;
Circulation reads every a line content of the memory mapping information, judges whether contain mould to be repaired in current line content Block title, if so, the initial address of module to be repaired in memory is obtained from current line content, if it is not, then reading next Row content.
Compared with the prior art, the advantages of the present invention are as follows: by issuing agreement, repair data is issued to application program, Legacy data at the reparation position of module to be repaired is substituted for repair data, by the way of real-time online reparation, to setting The application program being currently running in standby carries out function reparation, so that user is not necessarily to download the application program of latest edition Stablize using application program, user is effectively ensured for the usage experience of application program.
Detailed description of the invention
Fig. 1 is a kind of flow chart of application program native layers of real-time restorative procedure in the embodiment of the present invention;
Fig. 2 is a kind of structural schematic diagram of application program native layers of Real-time healing system in the embodiment of the present invention.
Specific embodiment
The embodiment of the present invention provides a kind of application program native layers of real-time restorative procedure, by issuing agreement, using reality When the mode repaired online, bug is carried out to the application program being currently running in equipment or not perfect function is repaired, is made Obtaining user can stablize without downloading the application program of latest edition using application program, and user is effectively ensured for using journey The usage experience of sequence.The embodiment of the present invention has also correspondingly provided a kind of server apparatus, intelligent terminal and application program Native layers of Real-time healing system.
In process of application development, due to various reasons, so that the application program for writing completion and publication was being run There are the not perfect problems of function in journey, for example, prompt statement is made mistake, there are wrong word, activity reward or ginsengs for verbal description With calculated result inaccuracy caused by the constant mistake write in condition setting mistake, application program native layer identification code etc., on State the not perfect problem of function can through the embodiment of the present invention native layers of application program real-time restorative procedure carry out it is online It repairs.
It is shown in Figure 1, a kind of application program native layers of real-time restorative procedure provided in an embodiment of the present invention, including with Lower step:
S1: the equipment for running application program receives the bugfix type protocol that server end defines, and includes being used in agreement The repair data field that application program module to be repaired is repaired.Bugfix indicates loophole reparation.Repair data refers to Correct description data at code, such as somewhere number should be " 6 " in application code, but mistake has been write as " 5 ", then corresponds to When being repaired with this problem of program, repair data content is digital " 6 ".Such as class application program, barrage are broadcast live to Mr. Yu In the barrage agreement of module, the processing logic for barrage message is that less than 6 grades sent out barrages of user of grade shield, and lose Barrage content is abandoned, code mistake has been write as 5, error code are as follows:
MOVr0, #5//by the numerical value of the sent out barrage of class 5 user are assigned to register r0;
CMPr1, r0//r1 register store the grade of current barrage, and current barrage grade is compared with 5;
BlsBranch//and if it is greater than the code for then executing branch Branch, it otherwise executes in the case of being less than or equal to Code;
In the embodiment of the present invention, agreement specifically includes repair data field, module title field to be repaired, module to be repaired Offset field and protocol type field.For the definition procedure of agreement, the type of agreement is defined first, then re-defines agreement In each field.Due to the different problem reparations of application program, corresponding agreement is different, therefore for the expressed intact of agreement Form, it is assumed that application software to be repaired is live streaming class software, and module to be repaired is barrage module, then corresponding agreement are as follows:
Type@=bugfix/modulename@=danmu/moduleoffset@=46780/data@=deabc09 8732aabcde099223daabbcc9876eaf@=37 datalen
Wherein, type@=bugfix presentation protocol type field repairs type, modulename@=danmu for loophole It indicates module title field to be repaired, is barrage module, moduleoffset@=46780 indicates the offset word of module to be repaired Section, data@=deabc098732aabcde099223daabbcc9876eaf indicate repair data field ,@=37 datalen Indicate the data length of entire agreement.
In a kind of possible embodiment, if there is the agreement that many places need to repair, and issue in application program In modulename@=danmu ,@=46780 moduleoffset and data@=deabc098732aabcde099223d Aabbcc9876eaf be it is multiple, each problem goes out corresponding a modulename@=danmu ,@=46780 moduleoffset With data@=deabc098732aabcde099223daabbcc9876eaf, then each problem is repaired one by one.
In the implementation of step S1, in a device for application program operation, server end can not be directly to using journey Sequence is modified scene, and an agreement is defined in server end, the agreement of definition is then sent to equipment by network, is realized Remote online reparation for application program, without directly operating to equipment, and application program will necessarily connect at runtime Being connected to server end and carrying out data interaction can operate normally, thus the agreement that defines of server end also can be easily sent to Equipment, to realize subsequent application program reparation.
S2: it is parsed to agreement is received, obtains repair data, while knowing module to be repaired corresponding to repair data Title, the step specifically:
S201: after equipment receives agreement, and creating the instance objects of message parsing type, and the function of message parsing is DataDecoder。
The instance objects of function DataDecoder are DataDecoder*pDecoder=newDataDecoder (), P expression parameter before pDecoder, is the classification of the variable of auto-complete, and Decoder expression is converted to encoded byte sequence One group of character;After the completion of instance objects creation, it can start to parse message, execution code is pDecoder- > Parse (buf), Parse (buf) indicates parsing message.
S202: parsing agreement using the instance objects of creation, obtain repair data, module title to be repaired, to The offset of repair module and protocol type.Resolving are as follows:
The protocol type in agreement is parsed using code stringtype=pDecoder- > GetItemAs (" type ") Field learns that the agreement is suitable for carrying out vulnerability of application program reparation, and specifically for the native layer to application program into Row is repaired;It is parsed from agreement using code stringmdn=pDecoder- > GetItemAs (" modulename ") to be repaired Multiple module title field;Using code stringmdo=pDecoder- > GetItemAs (" moduleoffset ") from agreement Parse the offset field mdo of module to be repaired;It uses code stringdata=pDecoder- > GetItemAs (" data ") Repair data field is parsed from agreement;So far, repair data, module title to be repaired, module to be repaired have just been obtained Offset and protocol type.
S203: based on obtained repair data, module title to be repaired, the offset of module to be repaired and protocol type, wound The reparation network protocol including repair data, module title to be repaired, the offset of module to be repaired and protocol type is built, that is, is incited somebody to action To repair data, module title to be repaired, the offset of module to be repaired and protocol type integrated, form a reparation net Network agreement, if it is repairing to the software of live streaming class application program, then the reparation network protocol created can be with are as follows:
@=6 type@=bugfix/modulename@=danmu/moduleoffset@=480/data
Wherein, protocol type bugfix, loophole reparation, module to be repaired are barrage module, the offset of module to be repaired It is 480, repair data content is " 6 ".
In the implementation of step S2 of the present invention, is parsed to agreement is received, repair data is obtained, for server end It is sent to the agreement of equipment, to reduce the volume of transmitted data between server end and equipment, server end is sent to the association of equipment View data will do it compression, reduce the volume of transmitted data between server end and equipment with this, therefore after equipment receives agreement, Agreement is parsed, the offset and protocol class of the repair data, module title to be repaired, module to be repaired that convenient can obtain Type, thus based on obtained obtained repair data, module title to be repaired, the offset of module to be repaired and protocol type, with Application program is repaired convenient for subsequent.
S3: it based on the module title to be repaired known, obtains application program and is located at the module to be repaired in memory, the step It specifically includes:
S301: obtaining memory mapping information, include in memory mapping information all modules of application program in memory Initial address and size.
Instruction functions/proc/self/maps is provided in android system to obtain the memory mapping of current process letter Breath, the embodiment of the present invention are repaired online to the application program being currently running, therefore will necessarily include to be repaired in current process The process of multiple application program, so obtaining memory mapping information by instruction functions/proc/self/maps, and then obtains to be repaired The initial address and size of all modules of multiple application program in memory.Memory mapping information is obtained, specific steps include:
A: one is defined for reading the handle of memory information, code is expressed as:
*fp;charline[1024];
B: it defines a variable and reads data line, code is expressed as:
Uintptr_tbase_addr=0;
C: it defines a variable and is used for the initial position of memory module in memory, the institute that then can be read into memory There is memory mapping information, execute code are as follows:
Fp=fopen ("/proc/self/maps ", " r "))
Wherein, fopen is system function, and for reading memory information, parameter "/proc/self/maps ", which indicates to obtain, to be worked as The entire memory mapping information of preceding process, parameter " r " indicate to read information.
Whether S302: circulation reads every a line content of the memory mapping information, judge in current line content containing needing Repair module title, if so, the initial address of module to be repaired in memory is obtained from current line content, if it is not, then reading Remove a line content.
In the embodiment of the present invention, the content as contained by memory mapping information is more, can write a circulation to read Every a line content of memory mapping information is taken, and judges whether the content read is module to be repaired.It is with module to be repaired The citing of barrage module, executes code are as follows:
In the implementation of step S3 of the present invention, module when because of application program operation in memory is multiple, progress The module of reparation, i.e., module to be repaired can be solely one of them, thus need to find out application program be located at it is to be repaired in memory Module can realize the reparation of corresponding application program, therefore obtain memory mapping letter by instruction functions/proc/self/maps Breath, and then the initial address and size of all modules of application program to be repaired in memory are obtained, a circulation is write to read The every a line content for taking memory mapping information, can accurately obtain module to be repaired, quickly search, to reduce application program Entire repair time.
S4: modification memory attribute is writeable and readable, the legacy data of the module to be repaired that will acquire repaired at position It is substituted for repair data, then is revised as can be performed by memory attribute.Wherein, at the reparation position for the module to be repaired that will acquire Legacy data be substituted for repair data, specific steps are as follows:
S401: the memory address that module to be repaired repairs position is calculated, the calculation of memory address is mould to be repaired The initial address of block in memory adds the offset of module to be repaired,
S402: being substituted for repair data for the data at calculated memory address, completes to repair.Number at memory address According to repair data is substituted for, code is executed are as follows:
Memcpy(addr,data,datalen);
Wherein, Memcpy is system function, and the repair data for issuing server copies the memory of Android to In, parameter data is the repair data content that server issues, and parameter datalen is the length of repair data.
In the embodiment of the present invention, modification memory attribute is writeable and readable, and memory attribute is revised as can be performed, and is had Body is to be modified using attribute of the api function mprotect to memory, and the prototype of function mprotect is
intmprotect(void*addr,size_tlen,intprot)
Wherein, int is a kind of data type, indicates integer variable, and void* indicates that pointer, addr are to be repaired Memory address, size_tlen indicate that the memory size for needing to modify since addr, intprot indicate modified memory category Property is as a result, memory attribute result includes PROT_READ, PROT_WRITE, PROT_EXEC and PROT_NONE, PROT_READ table Show readable, PROT_WRITE indicates writeable, and PROT_EXEC indicates executable, and PROT_NONE indicates inaccessible;
In the embodiment of the present invention, modification memory attribute be it is writeable and readable, the specific function that executes is
mprotect((void*)PAGE_START(addr),PAGE_SIZE,PROT_READ|PROT_WRITE)
Wherein, PAGE_SIZE indicates that the memory size of modification, PAGE_START (addr) are indicated from module reparation to be repaired Start to modify at the memory address of position;
In the embodiment of the present invention, memory attribute is revised as can be performed, the specific function that executes is
mprotect((void*)PAGE_START(addr),PAGE_SIZE,PROT_EXEC)。
In the implementation of the embodiment of the present invention, application program is operation starting state, and process is located in memory, memory In process all have the readable writeable attribute of memory, the code run in memory the present invention be directed to application program is repaired Change, memory attribute refers to the attribute that memory can be written and read, and is that can read execute and cannot write there are also exactly memory Attribute, operating system segment memory attribute to protect process.Since all modules of application program are held in program All in memory, it is all read-only memory attribute that operating system protects functional module to its all code when row, and this Inventive embodiments need modify functional module default be also the read-only memory attribute that can be executed, if directly modification meeting because Lead to program crashing for no modification authority, therefore is weighed by the corresponding api function mprotect that system provides to modify memory Limit can be written data after the completion of memory attribute modification into memory, realize the modification of application code.
Application program is completed after repairing, needs for memory attribute to be reduced to attribute-executable, application program can be just Often execute, modification before, to memory be written data, cause memory attribute be it is not executable, for each function of application program Module can operate normally, therefore need to revert to memory attribute into attribute-executable, provide at this time or by system corresponding Api function mprotect modifies memory permission, passes through the modification to memory attribute, i.e. completion repairing for application code Change, while realizing that function is repaired, also ensures that application program can operate normally.
Native layers of real-time restorative procedure of application program of the embodiment of the present invention, by issuing agreement, under application program Repair data is sent out, the legacy data at the reparation position of module to be repaired is substituted for repair data, using real-time online reparation Mode, function reparation is carried out to the application program that is currently running in equipment, so that user is without downloading latest edition Application program can be stablized, and user is effectively ensured using application program for the usage experience of application program.
Optionally, on the basis of above-mentioned Fig. 1 corresponding embodiment, a kind of application program provided in an embodiment of the present invention In first alternative embodiment of native layers of real-time restorative procedure, equipment receives agreement and is stored in the disk of equipment, when answering When being started every time with program, the version number of application program is sent to server end by equipment, and server end judgement is based on received Version number judges whether application program needs to repair, if it is not, being then not processed;If so, further judging for being repaired Agreement whether be issued to equipment, if having issued, application program is repaired using the agreement stored in equipment disk, If not issuing, the agreement for being repaired to current version application program is issued to equipment, and by the newest association issued Discuss the agreement for storing into equipment disk, while originally storing in sweep equipment disk.
Because the embodiment of the present invention is deposited into journey by way of code inside modifying the application program being currently running, realize It is repaired online to application program is currently running, after the completion of reparation, if user closes client, modifies page and disappear therewith, therefore Every secondary program requires to be repaired when starting, and in order to avoid each server requires to issue equipment repair data, and repairs The data volume of complex data is also possible to larger, therefore in order to reduce server to the data distributing amount of equipment, agreement is stored in and is set In standby disk, when each application program launching, need to only report the brief of the agreement stored in version number and disk to server Abstract.When place to be repaired is many places, if only modifying to somewhere, it need to only judge that corresponding agreement is at this No to be present in disk, processing mode is similar to the above.
In the implementation of the embodiment of the present invention, to reduce the volume of transmitted data between equipment and server end, avoid because Cause data to be transmitted when application program is repaired online, because of the excessive delay issue of data volume, corresponds to making for application program to user With affecting, therefore equipment receives agreement and is stored in the disk of equipment, and when application program starts every time, equipment will only be applied The version number of program is sent to server end, due to only sending version number data, data volume is ignored, and reduces equipment with this Volume of transmitted data between server end uses the agreement pair being buffered in equipment hard disk when application program needs to repair Application program is repaired, and is avoided when needing the application program repaired to start every time, and server end is required to send agreement extremely Equipment effectively reduces the volume of transmitted data of equipment and server end.
The present invention also provides a kind of server apparatus, server apparatus is for executing following steps:
A bugfix type protocol is defined, includes for being repaired to application program module to be repaired in the agreement Repair data field;
The agreement of definition is sent to the equipment that operation needs repairing applications.
The server apparatus of the embodiment of the present invention can be the server in live streaming platform, then corresponding application program is Application program is broadcast live, it is assumed that in the barrage agreement of live streaming application program barrage module, the processing logic for barrage message is Less than 6 grades the sent out barrages of user of grade shield, and abandon barrage content, and code mistake has been write as 5, and mistake is at grade less than 5 Grade the sent out barrage of user shields, and such mistake is affected to the usage experience of paying customer, it is therefore desirable to carry out in time Repair, native layer real-time restorative procedure of application program through the embodiment of the present invention, definition one bugfix type protocol and under It is sent to the equipment for running application program, repair data field is that class 5 is changed to class 6 in agreement,.
The present invention also provides a kind of intelligent terminal, intelligent terminal can be smart phone, Intelligent flat etc., intelligence Energy terminal device is for executing following steps:
It receives agreement and parses, obtain repair data, while knowing module title to be repaired corresponding to repair data, institute Stating includes repair data field for being repaired to application program module to be repaired in agreement;
Based on the module title to be repaired known, the module to be repaired in application program is obtained;
Legacy data at the reparation position for the module to be repaired that will acquire is substituted for repair data.
In the embodiment of the present invention, when server apparatus is the server being broadcast live in platform, then intelligent terminal is The smart machine of operation live streaming application program, smart machine receive the agreement that live streaming Platform Server is sent and parsing, are repaired Complex data, while knowing module title to be repaired corresponding to repair data, it is then based on the module title to be repaired known, is obtained Cut-off broadcasts the module to be repaired in application program, and the legacy data at the reparation position for the module to be repaired that will acquire, which is substituted for, to be repaired The function reparation of live streaming application program can be completed in complex data, realizes that user without downloading new edition live streaming application version, is led to The mode repaired online is crossed, the reparation of live streaming application program is completed.
The present invention also provides a kind of storage medium, storage medium is for driving server apparatus and intelligent terminal to execute The step of being executed.Storage medium can be using any combination of one or more computer-readable media.Computer can Reading medium can be computer-readable signal media or computer readable storage medium.Computer readable storage medium for example may be used To be but not limited to: electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above group It closes.The more specific example (non exhaustive list) of computer readable storage medium includes: the electricity with one or more conducting wires Connection, portable computer diskette, hard disk, random access memory (RAM), read-only memory (ROM), erasable type are programmable only Read memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic storage Device or above-mentioned any appropriate combination.In this document, computer readable storage medium, which can be, any include or deposits The tangible medium of program is stored up, which can be commanded execution system, device or device use or in connection.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned Any appropriate combination.
The computer for executing operation of the present invention can be write with one or more programming languages or combinations thereof Program code, described program design language include object oriented program language, such as Java, Smalltalk, C++, also Including conventional procedural programming language-such as " C " language or similar programming language.Program code can be complete It executes, partly executed on the user computer on the user computer entirely, being executed as an independent software package, part Part executes on the remote computer or executes on a remote computer or server completely on the user computer.It is relating to And in the situation of remote computer, remote computer can pass through the network of any kind, including local area network (LAN) or wide area network (WAN), it is connected to subscriber computer, or, it may be connected to outer computer (such as led to using ISP Cross internet connection).
It is shown in Figure 2, a kind of application program native layers of Real-time healing system provided in an embodiment of the present invention, including clothes Business device and operation need the terminal device of repairing applications.
Server includes:
Definition module, is used to define a bugfix type protocol, includes for application program mould to be repaired in agreement The repair data field that block is repaired;Agreement specifically includes repair data field, module title field to be repaired, mould to be repaired The offset field and protocol type field of block.
Sending module, the agreement for being used to define definition unit are sent to the equipment that operation needs repairing applications.
Terminal device includes:
Receiving module is used to receive the agreement of server transmission;
Parsing module is used to parse the received agreement of receiving unit, obtains repair data, while knowing repair data Corresponding module title to be repaired;
Module is obtained, the module title to be repaired known based on parsing module is used for, is obtained to be repaired in application program Multiple module;
Replacement module, the legacy data being used at the reparation position by module to be repaired are substituted for repair data.
Native layers of Real-time healing system of application program of the embodiment of the present invention, by issuing agreement, under application program Repair data is sent out, the legacy data at the reparation position of module to be repaired is substituted for repair data, using real-time online reparation Mode, function reparation is carried out to the application program that is currently running in equipment, so that user is without downloading latest edition Application program can be stablized, and user is effectively ensured using application program for the usage experience of application program.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from Under the premise of the principle of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as protection of the invention Within the scope of.The content being not described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.

Claims (10)

1. a kind of application program native layers of real-time restorative procedure, which comprises the following steps:
The equipment of operation application program receives the bugfix type protocol that server end defines, and includes for corresponding in the agreement The repair data field repaired with program module to be repaired;
It is parsed to agreement is received, obtains repair data, while knowing module title to be repaired corresponding to repair data;
Based on the module title to be repaired known, obtains application program and be located at the module to be repaired in memory;
Modify memory attribute be it is writeable and readable, the legacy data at the reparation position for the module to be repaired that will acquire, which is substituted for, to be repaired Then memory attribute is revised as can be performed by complex data.
2. a kind of application program native layers of real-time restorative procedure as described in claim 1, it is characterised in that: the agreement tool Body includes the offset field and protocol type field of repair data field, module title field to be repaired, module to be repaired.
3. a kind of application program native layers of real-time restorative procedure as claimed in claim 2, which is characterized in that described pair of reception Agreement is parsed, and repair data is obtained, while knowing module title to be repaired, specific steps corresponding to repair data are as follows:
After equipment receives agreement, the instance objects of creation one message parsing type;
Agreement is parsed using the instance objects of creation, obtains repair data, module title to be repaired, module to be repaired Offset and protocol type;
Based on obtained repair data, module title to be repaired, the offset of module to be repaired and protocol type, creation includes repairing Data, module title to be repaired, the reparation network protocol of the offset of module to be repaired and protocol type.
4. a kind of application program native layers of real-time restorative procedure as claimed in claim 2, which is characterized in that described to be based on obtaining The module title to be repaired known obtains application program and is located at the module to be repaired in memory, and specific steps include:
Memory mapping information is obtained, includes the starting point of all modules of application program in memory in the memory mapping information Location and size;
Circulation reads every a line content of the memory mapping information, judges whether contain module name to be repaired in current line content Claim, if so, the initial address of module to be repaired in memory is obtained from current line content, if it is not, then reading in next line Hold.
5. a kind of application program native layers of real-time restorative procedure as claimed in claim 4, which is characterized in that described to will acquire Module to be repaired reparation position at legacy data be substituted for repair data, specific steps include:
The memory address that module to be repaired repairs position is calculated, including the calculation of the memory address is module to be repaired Initial address in depositing adds the offset of module to be repaired;
Data at calculated memory address are substituted for repair data, complete to repair.
6. a kind of application program native layers of real-time restorative procedure as claimed in claim 5, it is characterised in that:
The modification memory attribute is writeable and readable, and memory attribute is revised as can be performed, and specially uses api function Mprotect modifies to the attribute of memory, and the prototype of function mprotect is
int mprotect(void*addr,size_t len,int prot)
Wherein, int is a kind of data type, indicates integer variable, and void* indicates pointer, memory addr to be repaired Address, size_t len indicate that the memory size for needing to modify since addr, int prot indicate modified memory attribute As a result, memory attribute result includes PROT_READ, PROT_WRITE, PROT_EXEC and PROT_NONE, PROT_READ is indicated Readable, PROT_WRITE indicates writeable, and PROT_EXEC indicates executable, and PROT_NONE indicates inaccessible;
The modification memory attribute be it is writeable and readable, the specific function that executes is
mprotect((void*)PAGE_START(addr),PAGE_SIZE,PROT_READ|PROT_WRITE)
Wherein, PAGE_SIZE indicates that the memory size of modification, PAGE_START (addr) indicate to repair position from module to be repaired Memory address at start to modify;
Described to be revised as can be performed by memory attribute, the specific function that executes is
mprotect((void*)PAGE_START(addr),PAGE_SIZE,PROT_EXEC)。
7. a kind of application program native layers of real-time restorative procedure as described in claim 1, which is characterized in that
The equipment receives agreement and is stored in the disk of equipment, and when application program starts every time, equipment is by application program Version number is sent to server end, and server end judgement judges whether application program needs to repair based on received version number:
If it is not, being then not processed;
If so, judge whether the agreement for being repaired has been issued to equipment, if having issued, using being deposited in equipment disk The agreement of storage repairs application program, if not issuing, issues to equipment for carrying out to current version application program The agreement of reparation, and the association that the newest agreement issued is stored into equipment disk, while originally stored in sweep equipment disk View.
8. a kind of server apparatus, which is characterized in that the server apparatus is for executing following steps:
A bugfix type protocol is defined, includes the reparation for being repaired to application program module to be repaired in the agreement Data field;
The agreement of definition is sent to the equipment that operation needs repairing applications.
9. a kind of intelligent terminal, the intelligent terminal operation has application program to be repaired, which is characterized in that described Intelligent terminal is for executing following steps:
It receives agreement and parses, obtain repair data, while knowing module title to be repaired corresponding to repair data, the association It include the repair data field for being repaired to application program module to be repaired in view;
Based on the module title to be repaired known, obtains application program and be located at the module to be repaired in memory;
Modify memory attribute be it is writeable and readable, the legacy data at the reparation position for the module to be repaired that will acquire, which is substituted for, to be repaired Then memory attribute is revised as can be performed by complex data.
10. a kind of application program native layers of Real-time healing system characterized by comprising
Server, the server include:
Definition module, is used to define a bugfix type protocol, includes for application program mould to be repaired in the agreement The repair data field that block is repaired;
Sending module, the agreement for being used to define definition unit are sent to the equipment that operation needs repairing applications;
Operation needs the terminal device of repairing applications, and the equipment includes:
Receiving module is used to receive the agreement of server transmission;
Parsing module is used to parse the received agreement of receiving unit, obtains repair data, while knowing that repair data institute is right The module title to be repaired answered;
Module is obtained, the module title to be repaired known based on parsing module is used for, application program is obtained and is located in memory Module to be repaired;
Replacement module, be used to modify memory attribute be it is writeable and readable, at the reparation position for the module to be repaired that will acquire Legacy data is substituted for repair data, then is revised as can be performed by memory attribute.
CN201910493115.1A 2019-06-06 2019-06-06 Native layers of application program real-time restorative procedure, equipment and system Pending CN110321141A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910493115.1A CN110321141A (en) 2019-06-06 2019-06-06 Native layers of application program real-time restorative procedure, equipment and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910493115.1A CN110321141A (en) 2019-06-06 2019-06-06 Native layers of application program real-time restorative procedure, equipment and system

Publications (1)

Publication Number Publication Date
CN110321141A true CN110321141A (en) 2019-10-11

Family

ID=68119484

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910493115.1A Pending CN110321141A (en) 2019-06-06 2019-06-06 Native layers of application program real-time restorative procedure, equipment and system

Country Status (1)

Country Link
CN (1) CN110321141A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022052730A1 (en) * 2020-09-08 2022-03-17 华为技术有限公司 Method and apparatus for repairing abnormal application exit, and electronic device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101540755A (en) * 2008-03-18 2009-09-23 华为技术有限公司 Method, system and device for recovering data
CN104834555A (en) * 2015-03-30 2015-08-12 百度在线网络技术(北京)有限公司 Method for invoking functional module, related device and device repairing method
CN106598680A (en) * 2016-12-20 2017-04-26 北京金山安全软件有限公司 Method and device for program repair and content promotion and electronic equipment
CN106776125A (en) * 2016-11-25 2017-05-31 武汉斗鱼网络科技有限公司 It is a kind of to realize the method and device that pc client software is repaired in real time

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101540755A (en) * 2008-03-18 2009-09-23 华为技术有限公司 Method, system and device for recovering data
CN104834555A (en) * 2015-03-30 2015-08-12 百度在线网络技术(北京)有限公司 Method for invoking functional module, related device and device repairing method
CN106776125A (en) * 2016-11-25 2017-05-31 武汉斗鱼网络科技有限公司 It is a kind of to realize the method and device that pc client software is repaired in real time
CN106598680A (en) * 2016-12-20 2017-04-26 北京金山安全软件有限公司 Method and device for program repair and content promotion and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022052730A1 (en) * 2020-09-08 2022-03-17 华为技术有限公司 Method and apparatus for repairing abnormal application exit, and electronic device

Similar Documents

Publication Publication Date Title
CN106707848A (en) Control program organization structure of control system and download method
CN107885540A (en) A kind of method, apparatus and terminal of loading application programs static resource
CN111221572B (en) Method, device, medium and equipment for automatically adapting to running environment
CN102904878A (en) Method and system for download of data package
CN108829431A (en) Update method, device, equipment and the storage medium of iOS application program
CN112100081B (en) Upgrade test method and device based on double-core intelligent electric meter and computer equipment
CN108108483A (en) The methods, devices and systems of DAO layers of verification SQL are intercepted based on SpringAop
CN111258832A (en) Interface parameter checking method, device, equipment and medium
CN110471663A (en) A kind of code compiling method, device and electronic equipment
CN104536398A (en) Frequency converter monitoring method and system
CN113687858A (en) Configuration file checking method and device, electronic equipment and storage medium
CN105791080A (en) Group-sending message processing method and system as well as electronic device
CN110321141A (en) Native layers of application program real-time restorative procedure, equipment and system
US8266589B2 (en) Optimizing the handling of source code requests between a software configuration management (SCM) system and a software integrated development environment (IDE) using projected ancillary data
CN113407932B (en) Channel identifier reporting method, system and storage medium
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN113760242A (en) Data processing method, device, server and medium
CN104881336A (en) Data backup method and device
CN114265722A (en) Database repairing method and electronic equipment
CN107515757A (en) Software program upgrading method and system and terminal
CN115604113B (en) FAN network equipment rapid upgrading method, system, equipment and medium
CN109558375B (en) Optimized file storage method, storage medium, equipment and system
CN116155350A (en) Method and system for generating instructions of satellite in batches, storage medium and electronic equipment
CN115390873A (en) Time frequency equipment firmware upgrading method based on single chip microcomputer and readable access medium
CN109408098A (en) Dynamic updating method, system, electronic equipment and the storage medium of application

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20191011