CN106294134B - The collapse localization method and device of code - Google Patents

The collapse localization method and device of code Download PDF

Info

Publication number
CN106294134B
CN106294134B CN201610619744.0A CN201610619744A CN106294134B CN 106294134 B CN106294134 B CN 106294134B CN 201610619744 A CN201610619744 A CN 201610619744A CN 106294134 B CN106294134 B CN 106294134B
Authority
CN
China
Prior art keywords
collapse
code
information
exception
project
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.)
Active
Application number
CN201610619744.0A
Other languages
Chinese (zh)
Other versions
CN106294134A (en
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.)
Tencent Technology Shenzhen Co Ltd
Tencent Cloud Computing Beijing Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610619744.0A priority Critical patent/CN106294134B/en
Publication of CN106294134A publication Critical patent/CN106294134A/en
Application granted granted Critical
Publication of CN106294134B publication Critical patent/CN106294134B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3636Software debugging by tracing the execution of the program

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses the collapse localization method and device of a kind of code, belong to field of computer technology.Methods described includes:Exception stack information is obtained, the exception stack information is used to indicate each collapse object that each terminal reports during item destination code is run;The first abnormality code information that acquisition is scanned to obtain to the item destination code, the first abnormality code information are used to indicate each exception object that code error in the item destination code be present;According to the exception stack information and the first abnormality code information, it is determined that each exception object associated by collapse object;Position of the exception object in the code associated by each collapse object of positioning.The present invention is associated with exception object by collapse object, position of the exception object associated with collapse object in code is determined, solve the problems, such as code content more and cause the collapse location efficiency of code relatively low, reached the effect for the collapse location efficiency for improving code.

Description

The collapse localization method and device of code
Technical field
The present invention relates to field of computer technology, the collapse localization method and device of more particularly to a kind of code.
Background technology
With the raising of the complexity of application program, in the running of application program, application program often be present The problem of collapse.When application crash, developer needs in time to position the code for causing collapse, to repair in time This multiple partial code.
At present, application program uploads exception stack information after collapse to server, and the exception stack information comprises at least Code call relation during application crash, developer are artificially carried out to the code call relation in exception stack information Analysis, the code for causing collapse is determined, then the position of the code is positioned into the code of application program.
Because developer needs first artificially to analyze the code for causing collapse, then the position of the code is positioned into code Put, when the code content of code is more, developer can not fast positioning go out the position of code, so as to cause the collapse of code What is positioned is less efficient.
The content of the invention
Cause the collapse location efficiency of code relatively low to solve the problems, such as code content more, the embodiment of the present invention carries The collapse localization method and device of a kind of code are supplied.The technical scheme is as follows:
First aspect, there is provided a kind of collapse localization method of code, methods described include:
Exception stack information is obtained, the exception stack information is used to indicate mistake of each terminal in operation item destination code The each collapse object reported in journey, the collapse object is the object for causing collapse in the code;
The first abnormality code information that acquisition is scanned to obtain to the item destination code, the first abnormality code letter Cease each exception object for indicating to have code error in the item destination code;
According to the exception stack information and the first abnormality code information, it is determined that each different associated by collapse object Normal object;
Position of the exception object in the code associated by each collapse object of positioning.
Second aspect, there is provided a kind of collapse positioner of code, described device include:
Stack information acquisition module, for obtaining exception stack information, the exception stack information is used to indicate each end The each collapse object reported during item destination code is run is held, the collapse object is to cause collapse in the code Object;
First information acquisition module, believe for obtaining the first abnormality code for being scanned to obtain to the item destination code Breath, the first abnormality code information are used to indicate each exception object that code error in the item destination code be present;
Exception object determining module, for the exception stack information that is obtained according to the stack information acquisition module and The first abnormality code information that the first information acquisition module obtains, it is determined that the exception each associated by collapse object is right As;
Exception object locating module, determined for positioning the exception object determining module associated by each collapse object Position of the exception object in the code.
The third aspect, there is provided a kind of computer-readable recording medium, be stored with the computer-readable recording medium Program, described program are used for the collapse localization method for realizing code as described in relation to the first aspect.
The beneficial effect of technical scheme provided in an embodiment of the present invention is:
By obtaining exception stack information, the exception stack information is used to indicate each terminal in operation item destination code During each collapse object for reporting;Obtain and obtained the first abnormality code information is scanned to item destination code, this One abnormality code information is used in indication item destination code each exception object that code error be present;According to exception stack information With the first abnormality code information, position of the exception object associated by each collapse object in code is positioned, so, will be collapsed Object is associated with exception object, it is determined that position of the exception object associated with collapse object in code, solves generation Digital content is more and the problem of cause the collapse location efficiency of code relatively low, reached the effect for the collapse location efficiency for improving code Fruit.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, make required in being described below to embodiment Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings Accompanying drawing.
Fig. 1 is the method flow diagram of the collapse localization method for the code that one embodiment of the invention provides;
Fig. 2 is the method flow diagram of the collapse localization method for the code that another embodiment of the present invention provides;
Fig. 3 is the method flow diagram that the code information that one embodiment of the invention provides obtains;
Fig. 4 is the project information configuration interface that one embodiment of the invention provides;
Fig. 5 is the method flow diagram that the exception object that one embodiment of the invention provides determines;
Fig. 6 is the schematic diagram for the server interaction that one embodiment of the invention provides;
Fig. 7 is the interface schematic diagram that a kind of collapse object that one embodiment of the invention provides associates with exception object;
Fig. 8 is the structured flowchart of the collapse positioner for the code that one embodiment of the invention provides;
Fig. 9 is the structured flowchart of the collapse positioner for the code that yet another embodiment of the invention provides.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to embodiment party of the present invention Formula is described in further detail.
Fig. 1 is refer to, the method flow of the collapse localization method of the code provided it illustrates one embodiment of the invention Figure.The collapse localization method of the code can apply in server, and the collapse localization method of the code includes:
Step 101, exception stack information is obtained, exception stack information is used to indicate each terminal in operation item destination code During each collapse object for reporting, collapse object is the object for causing collapse in code.
Step 102, obtain and obtained the first abnormality code information is scanned to item destination code, the first abnormality code letter Cease for each exception object of code error in indication item destination code be present.
Step 103, according to exception stack information and the first abnormality code information, it is determined that each different associated by collapse object Normal object.
Step 104, position of the exception object associated by each collapse object of positioning in code.
In summary, the collapse localization method of code provided in an embodiment of the present invention, should by obtaining exception stack information Exception stack information is used to indicate each collapse object that each terminal reports during item destination code is run;Acquisition pair Item destination code is scanned the first obtained abnormality code information, and the first abnormality code information is used for indication item destination code The middle each exception object that code error be present;According to exception stack information and the first abnormality code information, it is determined that each collapse Exception object associated by object;Position of the exception object in code associated by each collapse object of positioning, so, will collapse Object of bursting is associated with exception object, it is determined that position of the exception object associated with collapse object in code, solves Code content is more and the problem of cause the collapse location efficiency of code relatively low, reached the collapse location efficiency that improves code Effect.
Fig. 2 is refer to, the method flow of the collapse localization method of the code provided it illustrates another embodiment of the present invention Figure.The collapse localization method of the code can apply in server, and the collapse localization method of the code includes:
Step 201, exception stack information is obtained, exception stack information is used to indicate each terminal in operation item destination code During each collapse object for reporting, collapse object is the object for causing collapse in code.
In the present embodiment, project is the application program being made up of code.For example, project can be game, chat tool, purchase The application programs such as thing website.Terminal can be from server download items, and run item destination code in the terminal, so as to terminal User provide function.
, therefore, may during terminal operating item destination code because item destination code there may be code error The phenomenon of collapse occurs, is referred to as collapsing object by the object for causing collapse in code in the present embodiment.For example, when the generation of project When some pointer is not directed to significant internal memory in code, terminal can nothing when by some function call pointer reading data Method determines wherefrom to read data, collapsed so as to cause that the function is referred to as collapsing object by the present embodiment.
In order to make developer quickly find collapse object, to be repaired to collapse object, terminal can also be When there is collapse phenomenon in code, the object of record collapse opening position and the object for calling the object, by the information of these objects Stack information is recorded as, stack information is reported into server.In the present embodiment, heap that multiple one project of terminal-pair are reported Stack information is referred to as exception stack information.Wherein, object can be at least one in file or function or file and function Kind and function parameter.Wherein, file can be libNativeRQD.so, and function can be OnMoveNext (), function parameter Can be k.
In an example, stack information can be as follows:
#00pc 00007807/data/app-lib/com.tencent.rqd.rqdtest-1/libNativeRQD.so (doACrash+55)
#01pc 0000787b/data/app-lib/com.tencent.rqd.rqdtest-1/libNativeRQD.so (Java_com_tencent_feedback_eup_jni_NativeExceptionUpload_doNativeCrashForTe st+59)
#02pc 0007bb9f/system/lib/libdvm.so(dvmPlatformInvoke+79)
#03pc 000056af<unknown>
#04pc 000d9eac/system/lib/libdvm.so(dvmCallJNIMethod(unsigned int const*,JValue*,Method const*,Thread*)+412)
#05pc 00212eb9/system/lib/libdvm.so
#06pc 00008c9f<unknown>
#07pc 00091219/system/lib/libdvm.so(dvmInterpret(Thread*,Method const*,JValue*)+201)
In the present embodiment, it is necessary to analyze exception stack information after server gets exception stack information, from And determine collapse object.In one implementation, server is analyzed all stack informations in exception stack information, To determine to collapse object.
Due to some collapse be by the exception object in code caused by, some collapse be not as caused by exception object, And collapse could change code to repair by developer only caused by exception object, therefore, in order to avoid to that can not lead to Cross reparation exception object and analyzed wasted resource come the collapse object repaired, in another implementation, server Before analyzing exception stack information, it is not the stack information collapsed as caused by exception object that may filter out. Wherein, exception object is the object for existing in a destination code code error.For example, some pointer is not in the item destination code When pointing to significant internal memory, server determines to call the function of the pointer to write mistake, and the present embodiment is referred to as different by the function Normal object.
Generally, collapse has fixed type as caused by exception object, and server can read institute from exception stack information There is the collapse type of stack information, collapse type is retained for the stack information of the first kind, be non-the to collapse type The stack information of one type is deleted, and obtains exception stack information.That is, exception stack information is obtained, including:Obtain collapse class Type is the exception stack information of the first kind, and the first kind is the type collapsed as caused by exception object.
Wherein, the first kind can include SIGSEGV and SIGBUS.SIGSEGV is when invalid address is quoted in code The collapse type of caused collapse, SIGBUS are the types of caused collapse when illegal address is quoted in code.
Step 202, obtain and obtained the first abnormality code information is scanned to item destination code, the first abnormality code letter Cease for each exception object of code error in indication item destination code be present.
In the present embodiment, server is scanned using default code scans instrument to item destination code, and scanning is tied Fruit is as the first abnormality code information.Wherein, server can first scan code, obtained the first abnormality code information is carried out Caching, the first abnormality code information is read when getting exception stack information again;Exception stack information can also be first obtained, then Scan code obtains the first abnormality code information;Abnormal heap can also be obtained when scan code obtains the first abnormality code information Stack information, the present embodiment are not construed as limiting.
In the present embodiment, code corresponding to code corresponding to exception stack information and the first abnormality code information needs phase Together, therefore, Fig. 3 is refer to, obtains and obtained the first abnormality code information is scanned to item destination code, in addition to:
Step 2021, project label corresponding to exception stack information is read.
Project label is used to identify project during code scans, and project label can be that server creates the project time-division What match somebody with somebody or server distributed in the project of issue, the present embodiment is not construed as limiting.Wherein, project label can be app_id。
Step 2022, project key assignments corresponding with project label is determined in the first incidence relation, the first incidence relation is used In recording the corresponding relation between different project labels and different project key assignments.
Project key assignments is used to identify project during collapse reports, and project key assignments can be server in the project of establishment Distribution or that server distributes when receiving the collapse object that terminal reports, the present embodiment is not construed as limiting.Its In, project key assignments can be project key.
In the present embodiment, user also needs to establish the first incidence relation for project label and project key assignments, to associate exception Stack information and the first abnormality code information.Therefore, project key assignments corresponding with project label is determined in the first incidence relation Before, in addition to:Receive the configuration operation that user triggers in the first abnormality code information of the project of checking;Display includes project Project key assignments configuration interface;Receive the project label that user inputs in configuration interface;By project key assignments and project label It is corresponding to be added in the first incidence relation.
Fig. 4 is refer to, after code scans instrument obtains the first abnormality code information, server display configures and first is different The configuration interface of the associated exception stack information of normal code information, now, configuration interface includes first abnormality code letter Project key assignments corresponding to breath, the input frame of project label is also included in configuration interface, as user in the input frame cuit When identifying, and triggering association control, server establishes the first incidence relation of project key assignments and project label.
Optionally, project name, language form, whether regularly version number, the information such as association are also included in configuration interface, its In, project name is used for described project, and language form is used for the language of the code of described project, and version number is used for described project Version, if fixed pattern associates whether timing associates the first abnormality code information and exception stack information for describing.
Step 2023, the item destination code identified project indicated by key assignments.
Step 2024, obtain and obtained the first abnormality code information is scanned to item destination code.
After code scans instrument is scanned to item destination code, the obtained corresponding exception of every scanning result is right As, and a scanning result includes exception object, type of error, line number etc..
In the present embodiment, it is necessary to enter to the first abnormality code information after server gets the first abnormality code information Row analysis, so that it is determined that exception object.In one implementation, server is to all scannings in the first abnormality code information As a result analyzed, to determine exception object.
Because some exception objects can't cause collapse, and collapse could be by exploit person only as caused by exception object Member changes code to repair, therefore, in order to avoid being analyzed the exception object that can not cause collapse wasted resource, In another implementation, for server before analyzing the first abnormality code, may filter out will not cause collapse Exception object scanning result.
Generally, the exception object of collapse can be caused have fixed type, server can be from the first abnormality code information The type of error in all scanning results is read, type of error is retained for the scanning result of Second Type, to wrong class The scanning result of the non-Second Type of type is deleted, and obtains exception stack information.That is, obtain and item destination code is scanned The the first abnormality code information arrived, including:Item destination code is scanned, it is second that type of error is obtained from scanning result First abnormality code information of type, Second Type are the types for the exception object for causing collapse.
Wherein, Second Type is related to the code speech of code.When code speech is C++, Second Type can include Null pointer and cross the border.Null pointer refers to that code middle finger pin is not directed to significant internal memory, cross the border refer to be not just in code The pointer storage allocation space.When code speech is C#, it is abnormal and empty that Second Type can include overflow exception, index range Quote abnormal.Overflow exception refers to arithmetical operation, type conversion or the conversion operation conducted in the context chosen in code Cause to overflow, when index range is referred in code by index accesses data extremely, index the index range beyond setting, it is empty It is sky to quote the content for referring to be quoted in code.
Step 203, according to exception stack information and the first abnormality code information, it is determined that each different associated by collapse object Normal object.
Fig. 5 is refer to, according to exception stack information and the first abnormality code information, it is determined that each associated by collapse object Exception object, including:
Step 2031, the first mark of each collapse object is extracted from exception stack information.
First identifies for indicating collapse object.For example when it is the function in file to collapse object, the first mark can be with It is filename and function name or the first cryptographic Hash calculated according to filename and calculated according to function name second Cryptographic Hash, the present embodiment are not construed as limiting.
Specifically, the first mark of each collapse object is extracted from exception stack information, including:Read exception stack letter Every stack information in breath, every stack information includes the n-layer information recorded in a corresponding storehouse, and is recorded in storehouse The 0th layer of information be to collapse the information of opening position object, the i+1 layer information recorded in storehouse is the information of i+1 layer object, The i+1 layer object be call i-th layer of object object, 0≤i≤n;For every stack information, detect in stack information Whether the object in jth layer information is collapse object, when the object in jth layer information is collapse object, reads jth layer information In object first mark;When the object in jth layer information is not collapse object, j is updated to j+1, continues executing with inspection Survey the step of whether object in stack information in jth layer information is collapse object, 0≤j≤n.
By taking the stack information in step 201 as an example, #00 records are the 0th layer of information, and #01 records are the 1st layer of information, The like, #07 records are the 7th layer of information.Wherein, in example, one layer of information can include terminal type, memory address, The offset of file and function hereof.Certainly, every layer of information can also include the other informations such as function, function parameter, The present embodiment is not construed as limiting.
Call relation be present between the i+1 layer object recorded in stack information and i-th layer of object, i.e. i+1 layer information It is the information for the object for calling i-th layer of object.
For example, stack information have recorded 4 layers of information, respectively the 0th layer of information, the 1st layer of information, the 2nd layer of information and the 3rd layer Information.1st layer of information is the information for the object that have invoked the 0th layer of object, and the 2nd layer of information is to have invoked the object of the 1st layer of object Information, the 3rd layer of information is the information for the object that have invoked the 2nd layer of object.
When server is analyzed stack information, first detect whether the object in the 0th layer of information is collapse object, if Object in 0th layer of information is collapse object, then reads the first mark of the collapse object, terminate analysis process;If the 0th layer of letter Object in breath is not collapse object, then detects whether the object in the 1st layer of information is collapse object, if in the 1st layer of information Object is collapse object, then reads the first mark of the collapse object, terminate analysis process;If the object in the 1st layer of information is not It is collapse object, then detects whether the object in the 2nd layer of information is collapse object, the rest may be inferred, until detecting collapse object Untill.
Wherein, when whether detection object is collapse object, whether server can be that can get specifically with detection object The object of code;When object is can to get the object of specific code, it is collapse object to determine the object;When object is not The function of specific code can be got, for example, when object is the function in function library, it is not collapse object to determine the object.
In actual implementation process, because i numerical value is bigger, the object of i-th layer of object reference is more, now, analysis i-th The reason for layer object collapse, is more complicated, and therefore, generally, server only analyzes the 0th layer of object and the 1st layer of object.
Step 2032, the second mark of each exception object is extracted from the first abnormality code information.
Second identifies for indicating exception object.For example when exception object is the function in file, the second mark can be with It is filename and function name or the first cryptographic Hash calculated according to filename and calculated according to function name second Cryptographic Hash, the present embodiment are not construed as limiting.
Step 2033, it is when first to match mark and the second mark be present, the indicated exception of the second mark is right The exception object associated by collapse object as indicated by being defined as the first mark.
First mark refers to that the first mark is identical with the second mark with the second mark matching, or, the Hash of the first mark It is worth identical with the cryptographic Hash of the second mark.For example, the first mark is OnMoveNext (), the second mark is OnMoveNext (), Then server determines that the first mark and the second mark match.
The present embodiment includes filename and function name to the mark of matching first and second with the first mark and the second mark The process of mark illustrates, and whether the filename that server can be detected first in the first mark and the second mark is identical, in text Part famous prime minister simultaneously, then detect the first mark and second mark in function name it is whether identical, when function name is identical, determine first Mark and the second mark match.
Step 204, position of the exception object associated by each collapse object of positioning in code.
It is to determine due to line number of the exception object in code, therefore, is determining to collapse the exception associated by object After object, developer can be directly targeted to the code indicated by the line number, and the code is modified, to repair collapse pair As.
Because server may orient position of the exception object in code associated by multiple collapse objects, and service Device is probably to repair collapse object according to tab order prompting developer, and now, developer enters to collapse object successively Row is repaired.Because the number of users of some collapse object influences is more, the number of users of some collapse object influences is few, therefore, server Collapse object can also be ranked up according to the number of users that collapse object is influenceed, to prompt developer preferentially to repair influence Collapse object more than number of users, to ensure most of users' energy normal use projects, now perform step 205.
Step 205, for each collapse object, the quantity for reporting the terminal for collapsing object is obtained.
Wherein, the quantity for reporting the terminal of collapse object is to collapse the number of users of object influences.
Step 206, according to the descending order of the quantity of the terminal reported, each collapse object is ranked up.
Step 207, the first prompt message is shown, the first prompt message is used to prompt the preferential preceding collapse pair of reparation sequence As.
In one implementation, server selected and sorted in the quantity of preceding n positions, and can generate from the quantity of sequence For indicating the first prompt message of collapse object corresponding to every kind of quantity.Wherein, n is positive integer, for example, n is 10,50,100 Etc..
For example, the quantity for reporting the terminal of collapse object 1 is 500, the quantity for reporting the terminal of collapse object 2 is 1500, The quantity for reporting the terminal of collapse object 3 is 2500, and the quantity for reporting the terminal of collapse object 4 is 2000, and n is 2, then services Device is generated for indicating collapse object 3 and collapsing the first prompt message of object 4.
In the present embodiment, server can also be according to the exception object associated by collapse object, to there may be in project Collapse object be predicted, with reduce collapse probability of happening, improve code quality.Now, in each collapse object of positioning After position of the associated exception object in code, in addition to:Obtain and what is obtained is scanned to the code of sundry item The each different of code error be present in code for indicating sundry item in the second abnormality code information, the second abnormality code information Normal object;According to the collapse object and the second incidence relation of exception object determined in project, predicting will in each exception object Cause the exception object of collapse;The second prompt message is shown, the second prompt message is used to prompt to repair to predict that obtained exception is right As.
Associated for example, collapsing object 1 in project 1 with exception object 1, now, the second incidence relation includes collapsing object 1 With the incidence relation of exception object 1, then after exception object 1 being determined in project 2, server can be according to the second incidence relation Collapse may be caused by predicting exception object 1, and the object collapsed is probably collapse object 1, now, server prompts exploitation Personnel repair to collapse object 1.
Certainly, server can also extract the general character between each exception object for causing collapse, when from sundry item When scanning the exception object with general character, then the collapse object that there is the exception object of general character to associate is predicted, it is pre- to improve The accuracy of survey.
In the present embodiment, Fig. 6 is refer to, server can include bugly servers, TSC match servers, TSC scannings Server, TSC web page servers, and TSC match servers take with bugly servers, TSC scanning servers, TSC webpages respectively Business device is connected.Wherein, bugly servers are the background servers of bugly platforms, and it is different that bugly platforms are that receiving terminal reports The platform of normal stack information, TSC scanning servers are the background servers of TSC scanning platforms, and TSC scanning platforms are to use TscanCode (code scans instrument) is scanned to obtain the platform of the first abnormality code information, TSC matchings to item destination code Server is the server matched to exception object information and the first abnormality code information, and TSC web page servers are to be used for The server of the association of displaying collapse object and exception object.
Fig. 7 is refer to, it illustrates a kind of schematic diagram that collapse object associates with exception object, wherein, show in region 701 The exception object for being collapse object, collapse object association being shown in region 702 shown.
In summary, the collapse localization method of code provided in an embodiment of the present invention, should by obtaining exception stack information Exception stack information is used to indicate each collapse object that each terminal reports during item destination code is run;Acquisition pair Item destination code is scanned the first obtained abnormality code information, and the first abnormality code information is used for indication item destination code The middle each exception object that code error be present;According to exception stack information and the first abnormality code information, it is determined that each collapse Exception object associated by object;Position of the exception object in code associated by each collapse object of positioning, so, will collapse Object of bursting is associated with exception object, it is determined that position of the exception object associated with collapse object in code, solves Code content is more and the problem of cause the collapse location efficiency of code relatively low, reached the collapse location efficiency that improves code Effect.
By the quantity for obtaining the terminal for reporting collapse object;According to the order that the quantity of the terminal reported is descending, Each collapse object is ranked up;The first prompt message is shown, the first prompt message is used to prompt preferential repair to sort preceding Collapse object, developer can be prompted preferentially to repair the big collapse object of the terminal quantity reported, to ensure most of use Family can normal use project.
The second obtained abnormality code information is scanned to the code of sundry item by obtaining;Determined according in project Collapse object and exception object the second incidence relation, the exception object of collapse will be caused by predicting in each exception object;It is aobvious Show the second prompt message, the second prompt message is used to prompt to repair the exception object that prediction obtains, so, can be according to scanning Exception object prediction may existing collapse object, to prompt developer to repair the collapse object in advance, avoid and collapse Routed generation, to improve code quality.
Fig. 8 is refer to, the structured flowchart of the collapse positioner of the code provided it illustrates one embodiment of the invention. The collapse positioner of the code can apply in server, the collapse positioner of the code, including:
Stack information acquisition module 810, for obtaining exception stack information, exception stack information is used to indicate each terminal The each collapse object reported during item destination code is run, collapse object is the object for causing collapse in code;
First information acquisition module 820, believe for obtaining the first abnormality code for being scanned to obtain to item destination code Breath, the first abnormality code information are used in indication item destination code each exception object that code error be present;
Exception object determining module 830, for the exception stack information obtained according to stack information acquisition module 810 and The first abnormality code information that one data obtaining module 820 obtains, it is determined that each exception object associated by collapse object;
Exception object locating module 840, it is true for positioning each exception object determining module 830 collapsed associated by object Position of the fixed exception object in code.
In summary, the collapse positioner of code provided in an embodiment of the present invention, should by obtaining exception stack information Exception stack information is used to indicate each collapse object that each terminal reports during item destination code is run;Acquisition pair Item destination code is scanned the first obtained abnormality code information, and the first abnormality code information is used for indication item destination code The middle each exception object that code error be present;According to exception stack information and the first abnormality code information, it is determined that each collapse Exception object associated by object;Position of the exception object in code associated by each collapse object of positioning, so, will collapse Object of bursting is associated with exception object, it is determined that position of the exception object associated with collapse object in code, solves Code content is more and the problem of cause the collapse location efficiency of code relatively low, reached the collapse location efficiency that improves code Effect.
Fig. 9 is refer to, the structured flowchart of the collapse positioner of the code provided it illustrates yet another embodiment of the invention. The collapse positioner of the code can apply in server, the collapse positioner of the code, including:
Stack information acquisition module 910, for obtaining exception stack information, exception stack information is used to indicate each terminal The each collapse object reported during item destination code is run, collapse object is the object for causing collapse in code;
First information acquisition module 920, believe for obtaining the first abnormality code for being scanned to obtain to item destination code Breath, the first abnormality code information are used in indication item destination code each exception object that code error be present;
Exception object determining module 930, for the exception stack information obtained according to stack information acquisition module 910 and The first abnormality code information that one data obtaining module 920 obtains, it is determined that each exception object associated by collapse object;
Exception object locating module 940, determined for positioning the exception object determining module associated by each collapse object Position of the exception object in code.
Optionally, exception object determining module 930, including:
First marker extraction unit 931, for extracting the first mark of each collapse object from exception stack information;
Second marker extraction unit 932, for extracting the second mark of each exception object from the first abnormality code information Know;
Exception object determining unit 933, for when the first mark that the first marker extraction unit 931 to match extraction be present When knowing the second mark with the extraction of the second marker extraction unit 932, the indicated exception object of the second mark is defined as first Exception object associated by the indicated collapse object of mark.
Optionally, the first marker extraction unit 931, is additionally operable to:
Every stack information in exception stack information is read, every stack information includes recording in a corresponding storehouse N-layer information, and the 0th layer of information recorded in storehouse is to collapse the information of opening position object, the i+1 layer letter recorded in storehouse Breath is the information of i+1 layer object, the i+1 layer object be call i-th layer of object object, 0≤i≤n;
For every stack information, detect whether the object in stack information in jth layer information is collapse object, work as jth When object in layer information is collapse object, the first mark of the object in jth layer information is read;Pair in jth layer information During as not being collapse object, j being updated to j+1, continuing executing with whether the object in detection stack information in jth layer information collapses The step of routed object, 0≤j≤n.
Optionally, stack information acquisition module 910, it is additionally operable to obtain exception stack letter of the collapse type for the first kind Breath, the first kind are the type collapsed as caused by exception object;
First information acquisition module 920, it is additionally operable to be scanned item destination code, wrong class is obtained from scanning result Type is the first abnormality code information of Second Type, and Second Type is the type for the exception object for causing collapse.
Optionally, device also includes:
Quantity acquisition module 950 is reported, for for each collapse object, obtaining the number for reporting the terminal for collapsing object Amount;
Collapse object order module 960, for according to report the quantity of the terminal reported that quantity acquisition module obtains by Small order is arrived greatly, and each collapse object is ranked up;
First prompting display module 970, for showing the first prompt message, the first prompt message is used to prompt preferentially to repair Sort preceding collapse object.
Optionally, first information acquisition module 920, including:
Project key assignments reading unit 921, for reading project key assignments corresponding to exception stack information;
Project label determining unit 922, for determining to read with project key assignments reading unit 921 in the first incidence relation Project key assignments corresponding to project label, the first incidence relation be used for record different project key assignments and different project labels it Between corresponding relation;
Item code determining unit 923, for identifying project indicated by the project label of the mark determination of determining unit 922 Item destination code;
First information acquiring unit 924, the item destination code that item code determining unit 923 determines is carried out for obtaining Scan the first obtained abnormality code information.
Optionally, first information acquisition module 920, in addition to:
Configuration operation receiving unit 925, the configuration triggered for receiving user in the exception stack information for the project of checking Operation;
Configuration interface display unit 926, for showing the configuration interface for the project key assignments for including project;
Project label receiving unit 927, the project label inputted for receiving user in configuration interface;
Incidence relation adding device 928, for the project key assignments and project label of configuration interface display module configuration to be connect The project label that module receives is received correspondingly to be added in the first incidence relation.
Optionally, device also includes:
Second data obtaining module 980, for obtaining is scanned to the code of sundry item the second obtained abnormal generation Each exception object of code error in code for indicating sundry item be present in code information, the second abnormality code information;
Exception object prediction module 990, for being associated according to the collapse object determined in project with the second of exception object Relation, predict the exception object that will cause collapse in each exception object;
Second prompting display module 991, for showing the second prompt message, the second prompt message is used to prompt to repair prediction Obtained exception object.
In summary, the collapse positioner of code provided in an embodiment of the present invention, should by obtaining exception stack information Exception stack information is used to indicate each collapse object that each terminal reports during item destination code is run;Acquisition pair Item destination code is scanned the first obtained abnormality code information, and the first abnormality code information is used for indication item destination code The middle each exception object that code error be present;According to exception stack information and the first abnormality code information, it is determined that each collapse Exception object associated by object;Position of the exception object in code associated by each collapse object of positioning, so, will collapse Object of bursting is associated with exception object, it is determined that position of the exception object associated with collapse object in code, solves Code content is more and the problem of cause the collapse location efficiency of code relatively low, reached the collapse location efficiency that improves code Effect.
By the quantity for obtaining the terminal for reporting collapse object;According to the order that the quantity of the terminal reported is descending, Each collapse object is ranked up;The first prompt message is shown, the first prompt message is used to prompt preferential repair to sort preceding Collapse object, developer can be prompted preferentially to repair the big collapse object of the terminal quantity reported, to ensure most of use Family can normal use project.
The second obtained abnormality code information is scanned to the code of sundry item by obtaining;Determined according in project Collapse object and exception object the second incidence relation, the exception object of collapse will be caused by predicting in each exception object;It is aobvious Show the second prompt message, the second prompt message is used to prompt to repair the exception object that prediction obtains, so, can be according to scanning Exception object prediction may existing collapse object, to prompt developer to repair the collapse object in advance, avoid and collapse Routed generation, to improve code quality.
It should be noted that:The collapse positioner for the code that above-described embodiment provides positions in the collapse for entering line code When, only with the division progress of above-mentioned each functional module for example, in practical application, above-mentioned function can be divided as needed With by different functional module completions, i.e., the internal structure of the collapse positioner of code is divided into different functional modules, To complete all or part of function described above.In addition, collapse positioner and the generation of the code that above-described embodiment provides The collapse localization method embodiment of code belongs to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that hardware can be passed through by realizing all or part of step of above-described embodiment To complete, by program the hardware of correlation can also be instructed to complete, described program can be stored in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only storage, disk or CD etc..
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and Within principle, any modification, equivalent substitution and improvements made etc., it should be included in the scope of the protection.

Claims (17)

1. the collapse localization method of a kind of code, it is characterised in that methods described includes:
Exception stack information is obtained, the exception stack information is used to indicate each terminal during item destination code is run The each collapse object reported, the collapse object is the object for causing collapse in the code;
The first abnormality code information that acquisition is scanned to obtain to the item destination code, the first abnormality code information are used In each exception object for indicating to have code error in the item destination code;
According to the exception stack information and the first abnormality code information, it is determined that the exception each associated by collapse object is right As;
Position of the exception object in the code associated by each collapse object of positioning.
2. according to the method for claim 1, it is characterised in that described according to the exception stack information and described first different Normal code information, it is determined that each exception object associated by collapse object, including:
The first mark of each collapse object is extracted from the exception stack information;
The second mark of each exception object is extracted from the first abnormality code information;
When first to match mark and the second mark be present, the indicated exception object of the described second mark is defined as institute State the exception object associated by the collapse object indicated by the first mark.
3. according to the method for claim 2, it is characterised in that described that each collapse is extracted from the exception stack information First mark of object, including:
Every stack information in the exception stack information is read, every stack information includes recording in a corresponding storehouse N-layer information, and the 0th layer of information recorded in the storehouse is to collapse the information of opening position object, is recorded in the storehouse I+1 layer information is the information of i+1 layer object, and the i+1 layer object is the object for calling i-th layer of object, 0≤i≤n;
For every stack information, detect whether the object in the stack information in jth layer information is collapse object, when described When object in jth layer information is collapse object, the first mark of the object in the jth layer information is read;When the jth layer When object in information is not collapse object, j is updated to j+1, jth layer in the detection stack information is continued executing with and believes The step of whether object in breath is collapse object, 0≤j≤n.
4. according to the method for claim 1, it is characterised in that
The acquisition exception stack information, including:Obtain the exception stack information that collapse type is the first kind, the first kind Type is the type collapsed as caused by exception object;
The first abnormality code information that the acquisition is scanned to obtain to the item destination code, including:To the project Code is scanned, and the first abnormality code information that type of error is Second Type, second class are obtained from scanning result Type is the type for the exception object for causing collapse.
5. according to the method for claim 1, it is characterised in that right in the exception associated by each collapse object of the positioning After the position in the code, in addition to:
For each collapse object, the quantity for reporting the terminal for collapsing object is obtained;
According to the order that the quantity of the terminal reported is descending, each collapse object is ranked up;
The first prompt message is shown, first prompt message is used to prompt preferential reparation sequence preceding collapse object.
6. according to the method for claim 1, it is characterised in that the acquisition is scanned to obtain to the item destination code The first abnormality code information, including:
Read project label corresponding to the exception stack information;
Project key assignments corresponding with the project label is determined in the first incidence relation, first incidence relation is used to record Corresponding relation between different project labels and different project key assignments;
Determine the item destination code indicated by the project key assignments;
The first abnormality code information that acquisition is scanned to obtain to the item destination code.
7. according to the method for claim 6, it is characterised in that determined and the project in the first incidence relation described Before project key assignments corresponding to mark, in addition to:
Receive the configuration operation that user triggers in the first abnormality code information of the project of checking;
Display includes the configuration interface of the project key assignments of the project;
Receive the project label that the user inputs in the configuration interface;
The project key assignments and the project label are correspondingly added in first incidence relation.
8. method according to any one of claims 1 to 7, it is characterised in that associated by each collapse object of the positioning Position of the exception object in the code after, in addition to:
Obtain and the second obtained abnormality code information is scanned to the code of sundry item, the second abnormality code information is used Each exception object of code error in the code for indicating the sundry item be present;
According to the collapse object and the second incidence relation of exception object determined in the project, each exception object is predicted The middle exception object that will cause collapse;
The second prompt message is shown, second prompt message is used to prompt to repair the exception object that prediction obtains.
9. the collapse positioner of a kind of code, it is characterised in that described device includes:
Stack information acquisition module, for obtaining exception stack information, the exception stack information is used to indicate that each terminal exists The each collapse object reported during operation item destination code, the collapse object is pair for causing collapse in the code As;
First information acquisition module, the first abnormality code information for being scanned to obtain to the item destination code for acquisition, The first abnormality code information is used to indicate each exception object that code error in the item destination code be present;
Exception object determining module, for the exception stack information that is obtained according to the stack information acquisition module and described The first abnormality code information that first information acquisition module obtains, it is determined that each exception object associated by collapse object;
Exception object locating module, it is different associated by each collapse object of the exception object determining module determination for positioning Normal position of the object in the code.
10. device according to claim 9, it is characterised in that the exception object determining module, including:
First marker extraction unit, for extracting the first mark of each collapse object from the exception stack information;
Second marker extraction unit, for extracting the second mark of each exception object from the first abnormality code information;
Exception object determining unit, for when the first mark and the second mark that the first marker extraction unit to match extraction be present When knowing the second mark of extraction unit extraction, the indicated exception object of the described second mark is defined as the first mark institute Exception object associated by the collapse object of instruction.
11. device according to claim 10, it is characterised in that first marker extraction unit, be additionally operable to:
Every stack information in the exception stack information is read, every stack information includes recording in a corresponding storehouse N-layer information, and the 0th layer of information recorded in the storehouse is to collapse the information of opening position object, is recorded in the storehouse I+1 layer information is the information of i+1 layer object, and the i+1 layer object is the object for calling i-th layer of object, 0≤i≤n;
For every stack information, detect whether the object in the stack information in jth layer information is collapse object, when described When object in jth layer information is collapse object, the first mark of the object in the jth layer information is read;When the jth layer When object in information is not collapse object, j is updated to j+1, jth layer in the detection stack information is continued executing with and believes The step of whether object in breath is collapse object, 0≤j≤n.
12. device according to claim 9, it is characterised in that
The stack information acquisition module, be additionally operable to obtain collapse type be the first kind exception stack information, described first Type is the type collapsed as caused by exception object;
The first information acquisition module, it is additionally operable to be scanned the item destination code, mistake is obtained from scanning result Type is the first abnormality code information of Second Type, and the Second Type is the type for the exception object for causing collapse.
13. device according to claim 9, it is characterised in that described device also includes:
Quantity acquisition module is reported, it is right for positioning each exception collapsed associated by object in the exception object locating module After the position in the code, for each collapse object, the quantity for reporting the terminal for collapsing object is obtained;
Collapse object order module, for according to it is described report quantity acquisition module obtain the terminal reported quantity by greatly to Small order, each collapse object is ranked up;
First prompting display module, for showing the first prompt message, first prompt message is used to prompt the preferential row of reparation The preceding collapse object of sequence.
14. device according to claim 9, it is characterised in that the first information acquisition module, including:
Project label reading unit, for reading project label corresponding to the exception stack information;
Project key assignments determining unit, for described in the determination in the first incidence relation and project label reading unit reading Project key assignments corresponding to project label, first incidence relation are used to record different project labels and different project key assignments Between corresponding relation;
Item code determining unit, the item indicated by the project key assignments determined for determining the project key assignments determining unit Destination code;
First information acquiring unit, swept for obtaining the item destination code determined to the item code determining unit Retouch the first obtained abnormality code information.
15. device according to claim 14, it is characterised in that the first information acquisition module, in addition to:
Configuration operation receiving unit, for being determined in the project key assignments determining unit in the first incidence relation and the project Before project key assignments corresponding to mark, the configuration operation that user triggers in the first abnormality code information of the project of checking is received;
Configuration interface display unit, for showing the configuration interface for the project key assignments for including the project;
Project label receiving unit, the project label inputted for receiving the user in the configuration interface;
Incidence relation adding device, for the item target for receiving the project key assignments and the project label receiving unit Know corresponding be added in first incidence relation.
16. according to any described device of claim 9 to 15, it is characterised in that described device also includes:
Second data obtaining module, the second obtained abnormality code information is scanned to the code of sundry item for obtaining, Each exception object of code error in code for indicating the sundry item be present in the second abnormality code information;
Exception object prediction module, for being associated according to the collapse object determined in the project with the second of exception object System, predict the exception object that will cause collapse in each exception object;
Second prompting display module, for showing the second prompt message, second prompt message is used to prompt to repair to measure in advance The exception object arrived.
A kind of 17. computer-readable recording medium, it is characterised in that had program stored therein in the computer-readable recording medium, Described program is used for the collapse localization method for realizing the code as described in any one of claim 1 to 8.
CN201610619744.0A 2016-07-29 2016-07-29 The collapse localization method and device of code Active CN106294134B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610619744.0A CN106294134B (en) 2016-07-29 2016-07-29 The collapse localization method and device of code

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610619744.0A CN106294134B (en) 2016-07-29 2016-07-29 The collapse localization method and device of code

Publications (2)

Publication Number Publication Date
CN106294134A CN106294134A (en) 2017-01-04
CN106294134B true CN106294134B (en) 2018-02-23

Family

ID=57663960

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610619744.0A Active CN106294134B (en) 2016-07-29 2016-07-29 The collapse localization method and device of code

Country Status (1)

Country Link
CN (1) CN106294134B (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107168881A (en) * 2017-06-07 2017-09-15 成都四象联创科技有限公司 Code positioning and processing method extremely
CN108268332A (en) * 2017-08-10 2018-07-10 广州神马移动信息科技有限公司 Webpage abnormality monitoring method, equipment and system
CN107506256B (en) * 2017-09-07 2021-05-25 北京京东尚科信息技术有限公司 Method and device for monitoring crash data
CN108132850B (en) * 2017-12-22 2021-06-01 蚂蚁矿池科技有限公司 Code positioning method and device and electronic equipment
CN108170609A (en) * 2018-01-11 2018-06-15 五八有限公司 Localization method, device, computer equipment and the readable storage medium storing program for executing of program bug
CN108647106B (en) * 2018-05-11 2023-06-30 深圳市腾讯网络信息技术有限公司 Application exception handling method, storage medium and computer device
CN110795259A (en) * 2018-08-01 2020-02-14 北京京东尚科信息技术有限公司 Method and device for analyzing application collapse
CN110908819B (en) * 2018-09-17 2023-07-04 千寻位置网络有限公司 Method and device for locating code operation breakdown, terminal and memory
CN109445973A (en) * 2018-09-26 2019-03-08 中国平安人寿保险股份有限公司 Position the method and device of application crash
CN109491923B (en) * 2018-12-14 2021-11-12 东软集团股份有限公司 Method, device, medium and electronic equipment for determining newly added abnormal code
CN109800100B (en) * 2018-12-25 2023-02-28 福建天晴在线互动科技有限公司 Method and terminal for preventing IOS project from being crashed
CN110413509B (en) * 2019-06-27 2021-08-03 武汉大学 Software crash reproduction method and system based on test generation
CN111367796B (en) * 2020-02-26 2023-06-16 浪潮通用软件有限公司 Application program debugging method and device
CN112882943A (en) * 2021-03-11 2021-06-01 腾讯音乐娱乐科技(深圳)有限公司 Interface updating collapse risk detection method and device, electronic equipment and storage medium
CN114490368B (en) * 2022-01-19 2022-10-14 上海驻云信息科技有限公司 Method for filtering user-defined Python script function call stack

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102768639A (en) * 2012-06-11 2012-11-07 北京奇虎科技有限公司 Operating system kernel-level error positioning method and device
CN103164322A (en) * 2013-04-15 2013-06-19 腾讯科技(深圳)有限公司 Signature method and signature device for program crashing
CN105224463A (en) * 2015-10-28 2016-01-06 南京大学 A kind of software defect Code location method based on collapse stack data

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102768639A (en) * 2012-06-11 2012-11-07 北京奇虎科技有限公司 Operating system kernel-level error positioning method and device
CN103164322A (en) * 2013-04-15 2013-06-19 腾讯科技(深圳)有限公司 Signature method and signature device for program crashing
CN105224463A (en) * 2015-10-28 2016-01-06 南京大学 A kind of software defect Code location method based on collapse stack data

Also Published As

Publication number Publication date
CN106294134A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN106294134B (en) The collapse localization method and device of code
CA2824922C (en) Formatting data by example
US9740506B2 (en) Automating interactions with software user interfaces
US9690788B2 (en) File type recognition analysis method and system
CN108628748B (en) Automatic test management method and automatic test management system
US8904350B2 (en) Maintenance of a subroutine repository for an application under test based on subroutine usage information
CN110287696B (en) Detection method, device and equipment for rebound shell process
CN109871319A (en) Item code scan method, device, computer equipment and storage medium
CN110990411B (en) Data structure generation method and device, and calling method and device
CN104268473B (en) Method and device for detecting application programs
CN109783356A (en) A kind of automated testing method and terminal
CN104899016A (en) Call stack relationship obtaining method and call stack relationship obtaining device
US20200073738A1 (en) Error incident fingerprinting with unique static identifiers
CN111709026B (en) Static security detection method, device, computer equipment and storage medium
US20150106701A1 (en) Input support method and information processing system
CN110032505A (en) Software quality determining device, software quality determine that method and software quality determine program
CN114328168A (en) Anomaly detection method and device, computer equipment and storage medium
WO2023151397A1 (en) Application program deployment method and apparatus, device, and medium
CN116881925A (en) System safety test method and system based on demand analysis
CN113805861B (en) Code generation method based on machine learning, code editing system and storage medium
CN115481025A (en) Script recording method and device for automatic test, computer equipment and medium
CN113765731A (en) Information processing method, device and computer readable storage medium
CN113760696A (en) Program problem positioning method and device, electronic equipment and storage medium
CN112445391B (en) Service data generation method, device and computer readable storage medium
CN117555955B (en) Data conversion method, data conversion device, computer device, and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230919

Address after: 518057 Tencent Building, No. 1 High-tech Zone, Nanshan District, Shenzhen City, Guangdong Province, 35 floors

Patentee after: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd.

Patentee after: TENCENT CLOUD COMPUTING (BEIJING) Co.,Ltd.

Address before: 2, 518000, East 403 room, SEG science and Technology Park, Zhenxing Road, Shenzhen, Guangdong, Futian District

Patentee before: TENCENT TECHNOLOGY (SHENZHEN) Co.,Ltd.

TR01 Transfer of patent right