CN116069612A - Abnormality positioning method and device and electronic equipment - Google Patents

Abnormality positioning method and device and electronic equipment Download PDF

Info

Publication number
CN116069612A
CN116069612A CN202111277702.0A CN202111277702A CN116069612A CN 116069612 A CN116069612 A CN 116069612A CN 202111277702 A CN202111277702 A CN 202111277702A CN 116069612 A CN116069612 A CN 116069612A
Authority
CN
China
Prior art keywords
application program
function
information
running track
track information
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
CN202111277702.0A
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.)
Beijing Sogou Technology Development Co Ltd
Original Assignee
Beijing Sogou Technology Development 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 Beijing Sogou Technology Development Co Ltd filed Critical Beijing Sogou Technology Development Co Ltd
Priority to CN202111277702.0A priority Critical patent/CN116069612A/en
Publication of CN116069612A publication Critical patent/CN116069612A/en
Pending legal-status Critical Current

Links

Images

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/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Abstract

The embodiment of the invention provides an abnormality positioning method, an abnormality positioning device and electronic equipment, wherein a preset instrumentation code is inserted into an application program, and the method comprises the following steps: recording function running track information based on the preset instrumentation code when the application program runs; acquiring crash stack information of the application program when the application program is abnormal; and carrying out exception positioning on the application program based on the function running track information and the collapse stack information. According to the embodiment of the invention, the function running track information is recorded based on the preset instrumentation code in the application program, the collapse stack information of the application program is obtained when the application program is abnormal, and the application program can be accurately positioned abnormally by combining the function running track information and the collapse stack information, so that the problem of the abnormality of the application program can be solved according to the result of the abnormality positioning.

Description

Abnormality positioning method and device and electronic equipment
Technical Field
The embodiment of the invention relates to the technical field of Internet, in particular to an anomaly locating method, an anomaly locating device and electronic equipment.
Background
In the running process of the application program, some abnormal conditions, such as program crash, or stuck or unresponsive, affect the user experience, or even affect the normal running of the application program, so that a developer needs to sample abnormal information of the application program to perform abnormal positioning on the application program, thereby solving the abnormal problem of the application program.
When an application program crashes, the system will output the current crash stack information, and various environment information is contained in the crash stack information, however, it is difficult to accurately locate an abnormality of the application program based on the crash stack information only.
Disclosure of Invention
The embodiment of the invention provides an abnormality positioning method for accurately positioning an abnormality of an application program so as to solve the problem of the abnormality of the application program.
Correspondingly, the embodiment of the invention also provides an abnormality positioning device and electronic equipment, which are used for ensuring the realization and application of the method.
In order to solve the above problems, an embodiment of the present invention discloses an anomaly locating method, which inserts a preset instrumentation code into an application program, and specifically includes:
recording function running track information based on the preset instrumentation code when the application program runs;
acquiring crash stack information of the application program when the application program is abnormal;
and carrying out exception positioning on the application program based on the function running track information and the collapse stack information.
Optionally, the function running track information at least comprises a function identifier, a function running time and a function reference relation of the application program; the crash stack information includes context information.
Optionally, the method further comprises: acquiring a byte code file of the application program; scanning the function of the byte code file and determining the pile inserting position of the byte code file; and inserting a preset instrumentation code at the instrumentation position in the byte code file.
Optionally, the recording function running track information based on the preset instrumentation code when the application program runs includes: and when the application program runs to the instrumentation position, recording function running track information of a function in the application program based on the preset instrumentation code corresponding to the instrumentation position.
Optionally, the performing exception positioning on the application program based on the function running track information and the crash stack information includes: determining target function running track information associated with the collapse stack information from the function running track information; and positioning the position corresponding to the objective function running track information in the application program as the position where the abnormality occurs in the application program.
Optionally, the performing exception positioning on the application program based on the function running track information and the crash stack information includes: and reporting the function running track information and the collapse stack information to a log analysis platform so as to locate the abnormality of the application program through the log analysis platform.
The embodiment of the invention also discloses an abnormality positioning device, which inserts a preset instrumentation code into an application program, and comprises the following steps:
the track information acquisition module is used for recording function running track information based on the preset instrumentation code when the application program runs;
the stack information acquisition module is used for acquiring crash stack information of the application program when the application program is abnormal;
and the exception positioning module is used for carrying out exception positioning on the application program based on the function running track information and the collapse stack information.
Optionally, the function running track information at least comprises a function identifier, a function running time and a function reference relation of the application program; the crash stack information includes context information.
Optionally, the apparatus further comprises: the program instrumentation module is used for acquiring the byte code file of the application program; scanning the function of the byte code file and determining the pile inserting position of the byte code file; and inserting a preset instrumentation code at the instrumentation position in the byte code file.
Optionally, the track information obtaining module is configured to record, when the application program runs to the instrumentation position, function running track information of a function in the application program based on the preset instrumentation code corresponding to the instrumentation position.
Optionally, the anomaly positioning module is configured to determine, from the function running track information, target function running track information associated with the crash stack information when the crash stack information is acquired; and positioning the position corresponding to the objective function running track information in the application program as the position where the abnormality occurs in the application program.
Optionally, the exception positioning module is configured to report the function running track information and the crash stack information to a log analysis platform, so as to perform exception positioning on the application program through the log analysis platform.
The embodiment of the invention also discloses a readable storage medium, which enables the electronic equipment to execute the abnormality locating method according to any one of the embodiments of the invention when the instructions in the storage medium are executed by the processor of the electronic equipment.
The embodiment of the invention also discloses an electronic device which comprises a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs are configured to be executed by one or more processors and comprise a method for performing the abnormality positioning according to any one of the embodiments of the invention.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, when an application program runs, function running track information is recorded based on a preset instrumentation code in the application program, when the application program is abnormal, crash stack information of the application program is obtained, and the application program is abnormally positioned based on the function running track information and the crash stack information. According to the embodiment of the invention, the function running track information is recorded based on the preset instrumentation code in the application program, the collapse stack information of the application program is obtained when the application program is abnormal, and the application program can be accurately positioned abnormally by combining the function running track information and the collapse stack information, so that the problem of the abnormality of the application program can be solved according to the result of the abnormality positioning.
Drawings
FIG. 1 is a flow chart of steps of an embodiment of an anomaly localization method of the present invention;
FIG. 2 is a flow chart of steps of an alternate embodiment of an anomaly locating method of the present invention;
FIG. 3 is a block diagram of an embodiment of an anomaly locating device of the present invention;
FIG. 4 is a block diagram illustrating a configuration of an electronic device for anomaly localization, according to an example embodiment;
fig. 5 is a schematic structural view of an electronic device for abnormality localization according to another exemplary embodiment of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
In practice, most of the anomalies of the application programs are difficult to locate accurately, and the anomalies are often related to the machine performance of the terminal equipment, the running environment, and the application programs themselves, even the operation preferences. The exception of the application program is generally obtained from the feedback of the user, and is generally expressed as "new version becomes blocked", "is not opened", "is frequently unresponsive", and it is difficult for a developer to directly locate the location of the exception in the application program based on these descriptions, so as to solve the problem of the exception in the application program.
In view of the above problems, an embodiment of the present invention provides an exception positioning method, which determines, by scanning an application program, a position where a preset instrumentation code for recording function running track information needs to be inserted into the application program, so that exception positioning can be accurately performed on the application program to solve exception problems based on the function running track information recorded by the preset instrumentation code and crash stack information acquired when the application program crashes.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of an anomaly locating method according to the present invention, a preset instrumentation code is inserted into an application program, which may specifically include the following steps:
and 102, recording function running track information based on the preset instrumentation code when the application program runs.
The function running track information at least comprises a function identifier, a function running time and a function reference relation of the application program.
Specifically, the functions of the application program are written and implemented by logic codes, and each function may include a plurality of functions (method instructions), and the functions are the minimum units for implementing logic or functions, have names or numbers and other identifiers, and may have function reference relationships such as inheritance, reference or call between the functions. The function running track information comprises functions and information such as names, function running time, reference relations and the like of the functions when the application program runs. For example, the function identification includes A, B, C, the function runtime includes 10 minutes, 5 minutes, 3 minutes, and the function reference relationship includes function B referencing function a, and function C referencing function B.
In the embodiment of the invention, before the application program runs, the program instrumentation process can be performed in the application program, specifically, the program instrumentation process refers to inserting some preset instrumentation codes into the application program on the basis of ensuring the original logic integrity of the application program, wherein the preset instrumentation codes are essentially code segments for information acquisition, can be assignment statements or function calls for acquiring coverage information, and the like, and can be used for accurately positioning the abnormality of the application program based on the preset instrumentation codes inserted in advance when the application program runs in an electronic device such as a smart phone, a tablet computer, a personal computer and the like.
Step 104, obtaining crash stack information of the application program when the application program is abnormal.
Wherein the stack information may include environment information. Specifically, the environment information may include an operating system at the time of application running, configuration information of a terminal device at the time of application running, such as a CPU, a memory, a display card, a hard disk, and the like.
In practice, a stack is a data structure in which data items are ordered, and data items can be inserted and deleted only at one end (called the top of stack top). The operating system of the terminal device will set a stack for each application program (process and thread), and stack information is stored in the stack. In the embodiment of the invention, when an abnormality occurs in an application program, for example, when the program crashes (for example, the memory is insufficient), or a jam occurs (for example, the interface of the application program jams), or no response occurs (for example, a button in the program is clicked without feedback), the current stack information is extracted from the stack of the application program as the crash stack information.
And 106, carrying out exception positioning on the application program based on the function running track information and the collapse stack information.
When the application program is abnormal, crash stack data can be obtained from the stack, at the moment, function running track information can be further obtained, and the function running track information is supplemented to the crash stack information, so that accurate abnormal positioning can be performed based on the crash stack information and the function running track information, and the abnormal problem of the application program can be solved more pertinently.
In the above-mentioned abnormality locating method, when the application program runs, function running track information is recorded based on a preset instrumentation code in the application program, when the application program is abnormal, crash stack information of the application program is obtained, and abnormality locating is carried out on the application program based on the function running track information and the crash stack information. According to the embodiment of the invention, the function running track information is recorded based on the preset instrumentation code in the application program, the collapse stack information of the application program is obtained when the application program is abnormal, and the application program can be accurately positioned abnormally by combining the function running track information and the collapse stack information, so that the problem of the abnormality of the application program can be solved according to the result of the abnormality positioning.
Referring to fig. 2, a flowchart illustrating steps of an alternative embodiment of an anomaly locating method according to the present invention, inserting a preset instrumentation code into an application program may specifically include the following steps:
step 202, acquiring a byte code file of the application program.
Step 204, scanning the function of the byte code file, and determining the instrumentation position of the byte code file.
Step 206, inserting a preset instrumentation code at the instrumentation position in the byte code file.
The byte code file (class file) refers to a file that is generated into a byte code format after compiling the source code of the application program, and is also commonly referred to as an executable file.
In the embodiment of the invention, a Java byte code modification tool can be utilized to collect all generated class files during compiling of source codes of application programs, and then all functions (method instructions) in the class files are scanned out for unified program instrumentation processing. As an alternative example, the entry position of the function in the class file may be used as the instrumentation position, and then a preset instrumentation code may be inserted at the instrumentation position, so that when the application program runs, the function running track information of the application program may be obtained according to the preset instrumentation code.
Alternatively, the preset instrumentation code may be inserted at the entry locations of all functions, or at the entry locations of some designated functions, which is not a limitation of the embodiments of the present invention. The method comprises the steps of inserting a preset instrumentation code at the entry position of a specified function, and rapidly positioning the abnormality of the application program without embedding a large number of points in the application program, so that the abnormality solving efficiency is improved.
And step 208, when the application program runs to the instrumentation position, recording function running track information of a function in the application program based on the preset instrumentation code corresponding to the instrumentation position.
Specifically, the application program may be run in the terminal device according to the setting logic, where when the application program runs to a instrumentation position where a preset instrumentation code is inserted, the preset instrumentation code of the instrumentation position may be run, so as to obtain function running track information of the function. For example, assuming that a preset instrumentation code is inserted at a function a of an application program, and the function a refers to a function B, and assuming that an abnormality occurs at the function a, the function running track information of the function a may be obtained, which may specifically include: function a function identification: A. function a's function references.
Step 210, obtaining crash stack information of the application program when the application program is abnormal.
Step 212, determining the related objective function running track information when the collapse stack information is acquired from the function running track information.
Step 214, locating the position corresponding to the objective function running track information in the application program as the position where the abnormality occurs in the application program.
In practical application, whether the application program is abnormal can be detected in real time, wherein a rule of whether the application program is abnormal can also be set in advance according to practical requirements, for example, when the function running time of a certain function in the application program exceeds a preset time, for example, exceeds 1 second, the application program can be determined to be abnormal, or when the function running time of a certain function in the application program exceeds a preset time, for example, exceeds 3 times, the application program can be determined to be abnormal.
When an abnormality of the application program is detected, current stack information can be obtained from the stack as collapse stack information, and when the collapse stack information is obtained from the stack information, associated objective function running track information is obtained from the function running track information, namely, the objective function running track information is related function running track information when the abnormality of the application program occurs, so that a position where the abnormality exists in the function running in the application program can be accurately positioned based on the objective function running track information. For example, assume that when an abnormality occurs in an application, the determined objective function running track information includes a function identification: function x, function reference relationship: and calling the function y of the function x, and determining the position of the abnormality in the application program as the positions of the function x and the function y.
In an optional embodiment of the present invention, the step 212 of locating the abnormality of the application program based on the function running track information and the crash stack information may include the following steps:
and reporting the function running track information and the collapse stack information to a log analysis platform so as to locate the abnormality of the application program through the log analysis platform.
In the embodiment of the invention, the terminal equipment can perform exception positioning on the application program according to the function running track information and the collapse stack information, and also can report the exception positioning on the application program by the function running track information and the collapse stack information to the log analysis platform, so that the exception positioning on the application program can be performed based on the log analysis platform. Optionally, the log analysis platform may combine the function running track information and crash stack information previously uploaded by the application to perform exception positioning on the application.
In the embodiment of the invention, the function list can be preset, so that the exception analysis can be performed on the application program based on the function list. For example, a function white list may be set, where a function identifier or class file name is included in the function white list, when determining the object function running track information, if the function is not considered as abnormal in the function white list, for example, if there are a function a, a function B, and a function C in the object function running track information, if it is determined by analysis that the function a and the function C are abnormal, but the function a includes the function identifier a in the function white list (for example, the function white list includes the function identifier a, or the function a is a function in a class file corresponding to the class file name in the function white list), then only the location of the function C may be determined as the location where the abnormality exists in the application program. Similarly, a function blacklist or a function gray list and the like can be set to specifically locate the abnormality in the application program, so that the abnormality of the application program can be located more accurately.
In the exception positioning method, when an application program is compiled, the program instrumentation processing is carried out on the byte code file of the application program, so that function running track information of the application program is recorded in the inserted preset instrumentation code, when the application program is abnormal, collapse stack information is obtained from a stack, and the function running track information and the collapse stack information are reported to a log analysis platform together, so that the log analysis platform can accurately carry out exception positioning, and further the problem existing in the abnormal position in the application program can be better solved.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 3, a block diagram of an embodiment of an abnormality locating device according to the present invention is shown, and a preset instrumentation code is inserted into an application program, which may specifically include the following modules:
the track information acquisition module 302 is configured to record function running track information based on the preset instrumentation code when the application program runs;
a stack information obtaining module 304, configured to obtain crash stack information of the application program when an exception occurs in the application program;
and the exception positioning module 306 is configured to perform exception positioning on the application program based on the function running track information and the crash stack information.
In an exemplary embodiment, the function running track information at least includes a function identifier, a function running time and a function reference relationship of the application program; the crash stack information includes context information.
In an exemplary embodiment, the apparatus further comprises: the program instrumentation module is used for acquiring the byte code file of the application program; scanning the function of the byte code file and determining the pile inserting position of the byte code file; and inserting a preset instrumentation code at the instrumentation position in the byte code file.
In an exemplary embodiment, the track information obtaining module 302 is configured to record, when the application program runs to the instrumentation location, function running track information of a function in the application program based on the preset instrumentation code corresponding to the instrumentation location.
In an exemplary embodiment, the anomaly positioning module 306 is configured to determine, from the function running track information, target function running track information associated with when the crash stack information is acquired; and positioning the position corresponding to the objective function running track information in the application program as the position where the abnormality occurs in the application program.
In an exemplary embodiment, the exception positioning module 306 is configured to report the function running track information and the crash stack information to a log analysis platform, so as to perform exception positioning on the application program through the log analysis platform.
In summary, in the embodiment of the invention, when an application program runs, function running track information is recorded based on a preset instrumentation code in the application program, when the application program is abnormal, crash stack information of the application program is obtained, and the application program is abnormally positioned based on the function running track information and the crash stack information. According to the embodiment of the invention, the function running track information is recorded based on the preset instrumentation code in the application program, the collapse stack information of the application program is obtained when the application program is abnormal, and the application program can be accurately positioned abnormally by combining the function running track information and the collapse stack information, so that the problem of the abnormality of the application program can be solved according to the result of the abnormality positioning.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Fig. 4 is a block diagram illustrating a configuration of an electronic device 400 for anomaly localization, according to an example embodiment. For example, electronic device 400 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, smart wearable device, and the like.
Referring to fig. 4, an electronic device 400 may include one or more of the following components: a processing component 402, a memory 404, a power component 404, a multimedia component 408, an audio component 410, an input/output (I/O) interface 412, a sensor component 414, and a communication component 416.
The processing component 402 generally controls overall operation of the electronic device 400, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing element 402 may include one or more processors 420 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 402 can include one or more modules that facilitate interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate interaction between the multimedia component 408 and the processing component 402.
Memory 404 is configured to store various types of data to support operations at device 400. Examples of such data include instructions for any application or method operating on electronic device 400, contact data, phonebook data, messages, pictures, videos, and the like. The memory 404 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power component 404 provides power to the various components of the electronic device 400. Power component 404 can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for electronic device 400.
The multimedia component 408 includes a screen between the electronic device 400 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front camera and/or a rear camera. When the electronic device 400 is in an operational mode, such as a shooting mode or a video mode, the front-facing camera and/or the rear-facing camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 410 is configured to output and/or input audio signals. For example, the audio component 410 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 400 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 404 or transmitted via the communication component 416. In some embodiments, audio component 410 further includes a speaker for outputting audio signals.
The I/O interface 412 provides an interface between the processing component 402 and peripheral interface modules, which may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage buttons, volume buttons, on buttons, and lock buttons.
The sensor assembly 414 includes one or more sensors for providing status assessment of various aspects of the electronic device 400. For example, the sensor assembly 414 may detect an on/off state of the device 400, a relative positioning of components, such as a display and keypad of the electronic device 400, a change in position of the electronic device 400 or a component of the electronic device 400, the presence or absence of a user's contact with the electronic device 400, an orientation or acceleration/deceleration of the electronic device 400, and a change in temperature of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. The sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 414 is configured to facilitate communication between the electronic device 400 and other devices, either wired or wireless. The electronic device 400 may access a wireless network based on a communication standard, such as WiFi,2G, or 3G, or a combination thereof. In one exemplary embodiment, the communication part 414 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 414 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 400 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, such as memory 404, that includes instructions executable by processor 420 of electronic device 400 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform an anomaly localization method, the method comprising: recording function running track information based on the preset instrumentation code when the application program runs; acquiring crash stack information of the application program when the application program is abnormal; and carrying out exception positioning on the application program based on the function running track information and the collapse stack information.
Optionally, the function running track information at least comprises a function identifier, a function running time and a function reference relation of the application program; the crash stack information includes context information.
Optionally, the method further comprises: acquiring a byte code file of the application program; scanning the function of the byte code file and determining the pile inserting position of the byte code file; and inserting a preset instrumentation code at the instrumentation position in the byte code file.
Optionally, the recording function running track information based on the preset instrumentation code when the application program runs includes: and when the application program runs to the instrumentation position, recording function running track information of a function in the application program based on the preset instrumentation code corresponding to the instrumentation position.
Optionally, the performing exception positioning on the application program based on the function running track information and the crash stack information includes: determining target function running track information associated with the collapse stack information from the function running track information; and positioning the position corresponding to the objective function running track information in the application program as the position where the abnormality occurs in the application program.
Optionally, the performing exception positioning on the application program based on the function running track information and the crash stack information includes: and reporting the function running track information and the collapse stack information to a log analysis platform so as to locate the abnormality of the application program through the log analysis platform.
Fig. 5 is a schematic structural view of an electronic device 500 for anomaly localization according to another exemplary embodiment of the present invention. The electronic device 500 may be a server, which may vary in configuration or performance, and may include one or more central processing units (central processing units, CPU) 522 (e.g., one or more processors) and memory 532, one or more storage media 530 (e.g., one or more mass storage devices) that store applications 542 or data 544. Wherein memory 532 and storage medium 530 may be transitory or persistent. The program stored in the storage medium 530 may include one or more modules (not shown), each of which may include a series of instruction operations on a server. Still further, the central processor 522 may be configured to communicate with a storage medium 530 and execute a series of instruction operations in the storage medium 530 on a server.
The server(s) may also include one or more power supplies 526, one or more wired or wireless network interfaces 550, one or more input/output interfaces 558, one or more keyboards 556, and/or one or more operating systems 541, such as Windows ServerTM, mac OS XTM, unixTM, linuxTM, freeBSDTM, etc.
An electronic device comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs comprising instructions for: recording function running track information based on the preset instrumentation code when the application program runs; acquiring crash stack information of the application program when the application program is abnormal; and carrying out exception positioning on the application program based on the function running track information and the collapse stack information.
Optionally, the function running track information at least comprises a function identifier, a function running time and a function reference relation of the application program; the crash stack information includes context information.
Optionally, the method further comprises: acquiring a byte code file of the application program; scanning the function of the byte code file and determining the pile inserting position of the byte code file; and inserting a preset instrumentation code at the instrumentation position in the byte code file.
Optionally, the recording function running track information based on the preset instrumentation code when the application program runs includes: and when the application program runs to the instrumentation position, recording function running track information of a function in the application program based on the preset instrumentation code corresponding to the instrumentation position.
Optionally, the performing exception positioning on the application program based on the function running track information and the crash stack information includes: determining target function running track information associated with the collapse stack information from the function running track information; and positioning the position corresponding to the objective function running track information in the application program as the position where the abnormality occurs in the application program.
Optionally, the performing exception positioning on the application program based on the function running track information and the crash stack information includes: and reporting the function running track information and the collapse stack information to a log analysis platform so as to locate the abnormality of the application program through the log analysis platform.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The foregoing has described in detail a method for locating anomalies, a device for locating anomalies and an electronic device, according to the present invention, wherein specific examples are used to illustrate the principles and embodiments of the invention, and the above examples are only used to help understand the method and core ideas of the invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (14)

1. An anomaly locating method, characterized in that a preset instrumentation code is inserted into an application program, the method comprising:
recording function running track information based on the preset instrumentation code when the application program runs;
acquiring crash stack information of the application program when the application program is abnormal;
and carrying out exception positioning on the application program based on the function running track information and the collapse stack information.
2. The method according to claim 1, wherein the function execution trace information includes at least a function identification, a function execution time, and a function reference relationship of the application program; the crash stack information includes context information.
3. The method as recited in claim 1, further comprising:
acquiring a byte code file of the application program;
scanning the function of the byte code file and determining the pile inserting position of the byte code file;
and inserting a preset instrumentation code at the instrumentation position in the byte code file.
4. The method according to claim 3, wherein the recording function running trace information based on the preset instrumentation code at the time of the application program running includes:
and when the application program runs to the instrumentation position, recording function running track information of a function in the application program based on the preset instrumentation code corresponding to the instrumentation position.
5. The method of claim 1, wherein said exception locating the application based on the function trace information and the crash stack information comprises:
determining target function running track information associated with the collapse stack information from the function running track information;
and positioning the position corresponding to the objective function running track information in the application program as the position where the abnormality occurs in the application program.
6. The method of any of claims 1 to 5, wherein said exception locating the application based on the function trace information and the crash stack information comprises:
and reporting the function running track information and the collapse stack information to a log analysis platform so as to locate the abnormality of the application program through the log analysis platform.
7. An abnormality locating device, characterized by inserting a preset instrumentation code in an application program, the device comprising:
the track information acquisition module is used for recording function running track information based on the preset instrumentation code when the application program runs;
the stack information acquisition module is used for acquiring crash stack information of the application program when the application program is abnormal;
and the exception positioning module is used for carrying out exception positioning on the application program based on the function running track information and the collapse stack information.
8. The apparatus of claim 7, wherein the function execution trace information includes at least a function identification, a function execution time, and a function reference relationship of the application program; the crash stack information includes context information.
9. The apparatus of claim 7, wherein the apparatus further comprises: the program instrumentation module is used for acquiring the byte code file of the application program; scanning the function of the byte code file and determining the pile inserting position of the byte code file; and inserting a preset instrumentation code at the instrumentation position in the byte code file.
10. The apparatus of claim 9, wherein the track information obtaining module is configured to record, when the application program runs to the instrumentation location, function running track information of a function in the application program based on the preset instrumentation code corresponding to the instrumentation location.
11. The apparatus of claim 7, wherein the exception positioning module is configured to determine, from the function running trace information, objective function running trace information associated with acquiring the crash stack information; and positioning the position corresponding to the objective function running track information in the application program as the position where the abnormality occurs in the application program.
12. The apparatus according to any one of claims 7 to 11, wherein the exception positioning module is configured to report the function running track information and the crash stack information to a log analysis platform, so as to perform exception positioning on the application program through the log analysis platform.
13. An electronic device comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs comprising means for performing the anomaly localization method of any one of method claims 1-6.
14. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the anomaly localization method of any one of the method claims 1-6.
CN202111277702.0A 2021-10-29 2021-10-29 Abnormality positioning method and device and electronic equipment Pending CN116069612A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111277702.0A CN116069612A (en) 2021-10-29 2021-10-29 Abnormality positioning method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111277702.0A CN116069612A (en) 2021-10-29 2021-10-29 Abnormality positioning method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN116069612A true CN116069612A (en) 2023-05-05

Family

ID=86170308

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111277702.0A Pending CN116069612A (en) 2021-10-29 2021-10-29 Abnormality positioning method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN116069612A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116909800A (en) * 2023-09-13 2023-10-20 深圳市智慧城市科技发展集团有限公司 Method and device for locating crash information and storage medium
CN117149667A (en) * 2023-10-31 2023-12-01 宁德时代新能源科技股份有限公司 Abnormal data acquisition method, device, equipment and computer readable storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116909800A (en) * 2023-09-13 2023-10-20 深圳市智慧城市科技发展集团有限公司 Method and device for locating crash information and storage medium
CN116909800B (en) * 2023-09-13 2024-03-08 深圳市智慧城市科技发展集团有限公司 Method and device for locating crash information and storage medium
CN117149667A (en) * 2023-10-31 2023-12-01 宁德时代新能源科技股份有限公司 Abnormal data acquisition method, device, equipment and computer readable storage medium
CN117149667B (en) * 2023-10-31 2024-04-05 宁德时代新能源科技股份有限公司 Abnormal data acquisition method, device, equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
EP3076646B1 (en) Methods and devices for labeling a number
CN111274131A (en) Interface testing method and device, electronic equipment and storage medium
CN111221733A (en) Information processing method and device, mobile terminal and storage medium
CN116069612A (en) Abnormality positioning method and device and electronic equipment
CN111538502A (en) Installation package processing method and device, electronic equipment and storage medium
CN111813932B (en) Text data processing method, text data classifying device and readable storage medium
CN111209195B (en) Method and device for generating test case
CN112256563A (en) Android application stability testing method and device, electronic equipment and storage medium
CN106354595B (en) Mobile terminal, hardware component state detection method and device
CN112383661B (en) Mobile terminal automatic test method and device, electronic equipment and storage medium
CN111240927B (en) Method, device and storage medium for detecting time consumption of method in program
CN111290882B (en) Data file backup method, data file backup device and electronic equipment
CN107526683B (en) Method and device for detecting functional redundancy of application program and storage medium
CN111831292A (en) Method and device for generating installation package, storage medium and electronic equipment
CN107193622B (en) Code compiling processing method and device and terminal
CN113806227B (en) Information processing method, device, electronic equipment and storage medium
CN114554283B (en) Target object display method and device, electronic equipment and storage medium
CN112612516B (en) Code processing method and device
CN114020504B (en) Data processing method and device, electronic equipment and storage medium
CN110659081B (en) File processing method and device for program object and electronic equipment
CN113946346B (en) Data processing method and device, electronic equipment and storage medium
CN111538486B (en) Layout file nesting layer number screening method and device and electronic equipment
CN111611156B (en) Function test method, function test device, and computer-readable storage medium
CN109947640B (en) Regression test-based core function coverage statistical method and device
CN110311968B (en) Method and device for loading file in streaming mode and intelligent equipment

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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40085714

Country of ref document: HK