WO2018227822A1 - 异常堆栈信息获取方法、装置及计算机可读存储介质 - Google Patents

异常堆栈信息获取方法、装置及计算机可读存储介质 Download PDF

Info

Publication number
WO2018227822A1
WO2018227822A1 PCT/CN2017/105018 CN2017105018W WO2018227822A1 WO 2018227822 A1 WO2018227822 A1 WO 2018227822A1 CN 2017105018 W CN2017105018 W CN 2017105018W WO 2018227822 A1 WO2018227822 A1 WO 2018227822A1
Authority
WO
WIPO (PCT)
Prior art keywords
abnormal
stack information
information
abnormal stack
server
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.)
Ceased
Application number
PCT/CN2017/105018
Other languages
English (en)
French (fr)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to SG11201901803SA priority Critical patent/SG11201901803SA/en
Priority to US16/088,831 priority patent/US11010227B2/en
Priority to JP2018553347A priority patent/JP6648306B2/ja
Publication of WO2018227822A1 publication Critical patent/WO2018227822A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • G06F11/0772Means for error signaling, e.g. using interrupts, exception flags, dedicated error registers
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/0721Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment within a central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • G06F11/0778Dumping, i.e. gathering error/state information after a fault for later diagnosis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • G06F11/0787Storage of error reports, e.g. persistent data storage, storage using memory protection
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, and a computer readable storage medium for acquiring abnormal stack information.
  • the APP has an abnormality in the program design
  • the user may experience a crash and flashback due to the abnormal operation of the APP during the process of using the APP, and the APP may not be used normally. Therefore, for the APP developer, it is necessary to obtain the abnormal stack information generated by the application when an abnormality occurs, and timely locate and analyze the code of the abnormal problem generated in the application.
  • the existing way to obtain the exception stack information is generally: after the application is abnormal and crashes, when the program starts again, the exception stack information is obtained locally and uploaded. However, this processing method has certain defects. If the application does not start the application again after the application has an abnormality and crashes, it cannot be uploaded.
  • the present invention provides a method, an apparatus, and a computer readable storage medium for acquiring abnormal stack information, and the main purpose thereof is to solve the technical problem that it is difficult to timely acquire and upload abnormal stack information in an application program in the prior art.
  • the present invention provides an abnormal stack information obtaining method, which includes:
  • the abnormal signal processing function is called and executed to obtain the first abnormal stack information of the native layer;
  • the first abnormal stack information and the second abnormal stack information are assembled and reported to the server, and the project is exited after the report is completed.
  • the step of calling and executing the abnormal signal processing function to obtain the first abnormal stack information of the native layer includes:
  • the exception signal processing function corresponding to the version information of the operating system is called and executed, the address information in which the abnormality occurs is acquired, and the first abnormal stack information is generated according to the address information.
  • the step of invoking and executing the abnormal signal processing function corresponding to the version information of the operating system, acquiring the address information of the abnormality, and generating the first abnormal stack information according to the address information includes:
  • the first abnormal stack information is generated by assembling the signal type with the abnormal stack data.
  • the step of assembling the first abnormal stack information and the second abnormal stack information to the server, and exiting the project after the reporting is completed includes:
  • the third abnormal stack information is assembled with the second abnormal stack information and reported to the server, and the project is exited after the reporting is completed.
  • the present invention further provides an abnormal stack information acquiring apparatus, the apparatus comprising: a memory, a processor, and an abnormal stack information acquiring program stored on the memory and operable on the processor,
  • the exception stack information acquisition program is executed by the processor to implement the following steps:
  • the abnormal signal processing function is called and executed to obtain the first abnormal stack information of the native layer;
  • the first abnormal stack information and the second abnormal stack information are assembled and reported to the server, and the project is exited after the report is completed.
  • the step of calling and executing the abnormal signal processing function to obtain the first abnormal stack information of the native layer includes:
  • the exception signal processing function corresponding to the version information of the operating system is called and executed, the address information in which the abnormality occurs is acquired, and the first abnormal stack information is generated according to the address information.
  • the step of invoking and executing the abnormal signal processing function corresponding to the version information of the operating system, acquiring the address information of the abnormality, and generating the first abnormal stack information according to the address information includes:
  • the first abnormal stack information is generated by assembling the signal type with the abnormal stack data.
  • the step of assembling the first abnormal stack information and the second abnormal stack information to the server, and exiting the project after the reporting is completed includes:
  • the third abnormal stack information is assembled with the second abnormal stack information and reported to the server, and the project is exited after the reporting is completed.
  • the reading the stored symbol table, and performing a restoration process on the acquired first abnormal stack information based on the symbol table to convert the first abnormal stack information into the server readable The steps of the three exception stack information include:
  • the information restoration script is started, and the function name in the first abnormal stack information is sequentially matched with the function name in the symbol table one by one according to the information restoration script, and acquired in the first abnormal stack information.
  • the present invention further provides a computer readable storage medium having an abnormal stack information acquisition program stored thereon, and the exception stack information acquisition program is executed by a processor to implement the following steps :
  • the abnormal signal processing function is called and executed to obtain the first abnormal stack information of the native layer;
  • the first abnormal stack information and the second abnormal stack information are assembled and reported to the server, and the project is exited after the report is completed.
  • the abnormal stack information acquiring method and device and the computer readable storage medium provided by the present invention call and execute an abnormal signal processing function to acquire the first abnormal stack information of the native layer when the preset abnormal signal is detected during the running of the project. And reading the second abnormal stack information recorded by the application layer when the abnormal signal is detected, assembling the abnormal stack information of the native layer and the application layer, reporting the information to the server, and exiting the project after the report is completed, avoiding detecting After the exception is reached, the project is directly forcibly closed, and the invention can upload the complete abnormal stack information including the first abnormal stack information of the native layer to the server through the predefined abnormal signal processing function in time, and can comprehensively monitor the occurrence of the abnormality. Reporting exception stack information in real time, for developers, you can find application exceptions in time, so as to quickly locate and solve problems.
  • FIG. 1 is a flowchart of a first embodiment of an abnormal stack information acquisition method according to the present invention
  • step S30 is a schematic flowchart of the refinement of step S30 in the second embodiment of the method for acquiring abnormal stack information according to the present invention
  • FIG. 3 is a schematic diagram of a preferred embodiment of an abnormal stack information acquiring apparatus according to the present invention.
  • FIG. 4 is a schematic diagram of functional blocks of an abnormal stack information acquisition program in the abnormal stack information acquiring apparatus of the present invention.
  • the invention provides a method for acquiring abnormal stack information.
  • FIG. 1 it is a flowchart of a first embodiment of an abnormal stack information acquisition method according to the present invention.
  • the method can be performed by a device that can be implemented by software and/or hardware.
  • the method for obtaining the abnormal stack information includes:
  • step S10 during the running of the project, when a preset abnormal signal is detected, the abnormal signal processing function is called and executed to acquire the first abnormal stack information of the native layer.
  • the item is an application consisting of code.
  • the terminal can download the project from the server and install it. During the operation of the project on the terminal, the project's operation status is detected in real time. Preset various abnormal types of preset signals, for example, ⁇ /br>
  • the corresponding exception signal is triggered to notify the process that an asynchronous event has occurred.
  • the preset abnormal signal processing function is called and executed to obtain the first abnormal stack information of the native layer.
  • the exception signal handler needs to be preconfigured for invocation.
  • the exception signal processing function can be implemented by the following code:
  • the function _skn ⁇ _signal ⁇ _handler_ is the function executed after detecting the abnormal signal, and the acquisition of the abnormal stack information is performed in this function.
  • step S10 may include the following refinement steps:
  • the first preset function is called to obtain the address information of the abnormality, and the function name corresponding to the address information and the so library information are obtained by the dladdr function;
  • the second preset function is called from the preset path by the dlopen function to obtain the address information of the abnormality, and the function name corresponding to the address information and the so library information are obtained by the dladdr function.
  • the first preset function is a pre-configured abnormal signal processing function
  • the second preset function is a function defined by the operating system, and does not need to be pre-configured by the user, and only needs to be in a specific path when detecting the abnormal signal.
  • the abnormal stack information mainly includes a function name in which an abnormality occurs and so library information.
  • the default version is Android 5.0. Since Android 5.0 starts Android with ART virtual machine, the exception information needs to be obtained under Android 5.0 and above and Android 5.0.
  • the unwind method is used above Android 5.0.
  • the Android lib below uses the libcorkscrew.so method. Specifically, regarding the use of the unwind method, you can introduce the unwind.h header file into the code, obtain the address information of the exception generated by the ⁇ _Unwind ⁇ _Backtrace function, and then obtain the function name and so library information corresponding to the address information through the dladdr function. .
  • the above preset path may be the /system/lib/ path of the Android 4.x version, and the corresponding library is opened by the dlopen function, thereby calling the libcorkscrew.so method, and the address generating the exception is queried based on the method.
  • Information based on the address information to find the corresponding function name and so library information.
  • the first abnormal stack information further includes the signal type of the detected abnormal signal.
  • the abnormal signal processing function corresponding to the version information acquires the address information of the abnormality; acquires the abnormal stack data according to the address information, and acquires the detected signal type of the abnormal signal; and the signal type and the abnormality
  • the first abnormal stack information is generated after the stack data is assembled.
  • the exception stack data includes the function name and so library information of the above-mentioned found exception.
  • the first abnormal stack information can be acquired and saved locally in the native layer, and the native layer sends a notification message to the application layer to notify the application layer to read.
  • the application layer is the Java layer.
  • Step S20 reading the second abnormal stack information recorded by the application layer when the abnormal signal is detected.
  • Step S30 the first abnormal stack information and the second abnormal stack information are assembled and reported to the server, and the project is exited after the reporting is completed.
  • the terminal when the terminal detects an abnormal signal, its application layer records its abnormal stack information. Generally, it is stored in a fixed path according to the setting of the system. Therefore, when an abnormal signal is detected, the stored abnormality information can be directly read from the set path as the second abnormal stack information.
  • the first abnormal stack information of the obtained native layer and the second abnormal stack information of the application layer of the read record are encapsulated and reported to the server, so that the developer can timely generate the code that generates the abnormality in the application. Positioning is not an analysis, and the application is maintained and updated in a timely manner. After the report is completed, exit the current project.
  • the way of obtaining the native layer exception stack is generally large, such as Google BreakPad, or the system root permission, such as tombstone, can read the relevant stack information, and the process is too cumbersome.
  • the abnormal stack information obtaining method proposed in this embodiment acquires the abnormal stack information of the native layer through a pre-defined function when the preset abnormal signal is detected during the running of the project, and the code amount is small, and no root authority is required. And reading the second abnormal stack information recorded by the application layer when the abnormal signal is detected, and the two abnormal stack information is encapsulated and uploaded to the server, and then the application is exited, so as to directly forcibly close the application after detecting the abnormality. Therefore, the complete abnormal stack information including the native layer can be uploaded to the server in time, and the abnormality can be monitored comprehensively, and the abnormal stack information can be reported in real time, so that the developer can timely find the abnormality of the application, so as to be fast. Target and solve problems.
  • step S30 includes the following refinement steps:
  • Step S31 reading the stored symbol table, and performing the acquired first abnormal stack information based on the symbol table. a restoration process to convert the first exception stack information into the third exception stack information readable by the server;
  • Step S32 assembling the third abnormal stack information and the second abnormal stack information, reporting the information to the server, and exiting the project after the reporting is completed.
  • the first exception stack information obtained by the above method is relatively readable for the developer, and the function name can only be easily seen from the first abnormal information, and the abnormality cannot be directly understood.
  • the first abnormal stack information is restored by using the symbol table matched by the application, to obtain a file name including the function name and the function name, and The third exception stack information for the line number.
  • the symbol table is a data structure for a language translator in which each identifier in the program source code is bound to its declaration or usage information, in this embodiment, in the project
  • each function name has its corresponding file name and its line number.
  • Each version of the project corresponds to a symbol table. If the project is upgraded, its symbol table needs to be updated.
  • the symbol table may be stored in the server, and after receiving the abnormal stack information reported by the terminal, the server restores the first abnormal stack information according to the stored symbol table. .
  • an information restoration script is pre-configured, and after acquiring the first abnormal stack information, an information restoration script is started, and the function name in the first abnormal stack information is sequentially and the symbol based on the information restoration script.
  • the function names in the table are matched one by one, and the file name and the line number corresponding to the function name in the first abnormal stack information are obtained; the obtained file name and the line number are added to the original first abnormal stack information, and the generated The third exception stack information readable by the server.
  • the information restoration script can be:
  • crash.txt is the unrecovered exception information, that is, the first exception stack information
  • symbol.txt is the symbol table
  • result.txt is the restored exception information, that is, the third exception stack information.
  • the method proposed in this embodiment restores the first abnormal stack information of the obtained native layer to improve the readability of the server, so that the developer can obtain more complete abnormal information.
  • FIG. 3 it is a schematic diagram of a preferred embodiment of the abnormal stack information acquiring apparatus of the present invention.
  • the abnormal stack information acquiring device may be a smart phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player, and an MP4 (Moving Picture).
  • MP3 Motion Picture Experts Group Audio Layer III
  • MP4 Motion Picture
  • Experts Group Audio Layer IV dynamic video experts compress standard audio layers 4) Players, portable computers and other portable terminal devices with display functions.
  • the abnormal stack information device includes a memory 11, a processor 12, a communication bus 13, and a network interface 14.
  • the communication bus 13 is used to implement connection communication between these components.
  • the network interface 14 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface).
  • the memory 11 may be a high speed RAM memory or a non-volatile memory such as a magnetic disk memory.
  • the memory 11 may be an internal storage unit of the abnormal stack information acquisition means, such as a hard disk of the abnormal stack information acquisition means, in some embodiments.
  • the memory 11 may also be an external storage device of the abnormal stack information acquiring device in other embodiments, such as a plug-in hard disk equipped on the abnormal stack information acquiring device, a smart memory card (SMC), and a secure digital (Secure) Digital, SD) cards, flash cards, etc.
  • the memory 11 may also include both an internal storage unit of the abnormal stack information acquiring device and an external storage device.
  • the memory 11 can be used not only for storing application software and various types of data installed in the abnormal stack information acquiring device, such as code of the abnormal stack information acquiring program, but also for temporarily storing data that has been output or is to be output.
  • the processor 12 may be a Central Processing Unit (CPU), microprocessor or other data processing chip for running program code or processing data stored in the memory 11, such as executing exception stack information. Get programs, etc.
  • CPU Central Processing Unit
  • microprocessor or other data processing chip for running program code or processing data stored in the memory 11, such as executing exception stack information. Get programs, etc.
  • Figure 3 shows only the exception stack information acquisition means with components 11-14 and the exception stack information acquisition procedure, but it should be understood that not all illustrated components may be implemented, and alternative implementations may be implemented more or less. Component.
  • the device may further include a user interface
  • the user interface may include a display, an input list
  • a keyboard For example, a keyboard, an optional user interface may also include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch sensor, or the like.
  • the display is for displaying information processed in the abnormal stack information acquiring device and a user interface for displaying the visualization.
  • the device may further include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like.
  • sensors such as light sensors, motion sensors, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein if the device is a mobile terminal, the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may move when the mobile terminal moves to the ear. , turn off the display and / or backlight.
  • the gravity acceleration sensor can detect the magnitude of acceleration in each direction (usually three axes), and can detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of the mobile terminal (such as horizontal and vertical screen switching, Related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the mobile terminal can also be equipped with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. No longer.
  • an operating system and an exception stack information acquisition program may be included in the memory 11 as a computer storage medium; the network interface 14 is mainly used to connect to a server, perform data communication with the server; When the execution of the exception stack information acquisition program stored in the memory 11 is performed, the following steps are implemented:
  • the abnormal signal processing function is called and executed to obtain the first abnormal stack information of the native layer;
  • the first abnormal stack information and the second abnormal stack information are assembled and reported to the server, and the project is exited after the report is completed.
  • the item is an application consisting of code.
  • the terminal can download the project from the server and install it. During the operation of the project on the terminal, the project's operation status is detected in real time. Preset various abnormal types of preset signals, for example, ⁇ /br>
  • the corresponding abnormal signal is triggered to notify the process.
  • An asynchronous event has occurred.
  • the abnormal signal detected by the terminal belongs to the preset abnormal signal
  • the preset abnormal signal processing function is called and executed to obtain the first abnormal stack information of the native layer.
  • the exception signal handler needs to be preconfigured for invocation.
  • the exception signal processing function can be implemented by the following code:
  • the function _skn ⁇ _signal ⁇ _handler_ is the function executed after detecting the abnormal signal, and the acquisition of the abnormal stack information is performed in this function.
  • the first preset function is called to obtain the address information of the abnormality, and the function name corresponding to the address information and the so library information are obtained by the dladdr function; if the version of the operating system is higher than or equal to In the preset version, the second preset function is called from the preset path by the dlopen function to obtain the address information of the abnormality, and the function name corresponding to the address information and the so library information are obtained by the dladdr function.
  • the first preset function is a pre-configured abnormal signal processing function
  • the second preset function is a function defined by the operating system, and does not need to be pre-configured by the user, and only needs to be in a specific path when detecting the abnormal signal.
  • the abnormal stack information mainly includes a function name in which an abnormality occurs and so library information.
  • the default version is Android 5.0. Since Android 5.0 starts Android with ART virtual machine, the exception information needs to be obtained under Android 5.0 and above and Android 5.0.
  • the unwind method is used above Android 5.0.
  • the Android lib below uses the libcorkscrew.so method. Specifically, regarding the use of the unwind method, you can introduce the unwind.h header file into the code, obtain the address information of the exception generated by the ⁇ _Unwind ⁇ _Backtrace function, and then obtain the function name and so library information corresponding to the address information through the dladdr function. .
  • the above preset path may be the /system/lib/ path of the Android 4.x version, and the corresponding library is opened by the dlopen function, thereby calling the libcorkscrew.so method, and the address generating the exception is queried based on the method.
  • Information based on the address information to find the corresponding function name and so library information.
  • the first abnormal stack information further includes the signal type of the detected abnormal signal.
  • the abnormal signal processing function corresponding to the version information acquires the address information of the abnormality; acquires the abnormal stack data according to the address information, and acquires the detected signal type of the abnormal signal; and the signal type and the abnormal stack data
  • the first abnormal stack information is generated after assembly.
  • the abnormal stack data After acquiring the corresponding abnormal stack data according to the address information of the abnormality, when the abnormal signal is detected, Recording the signal type of the abnormal signal, assembling the signal type with the abnormal stack data to generate first abnormal stack information, and the abnormal stack data includes the function name and the so library information of the found abnormality.
  • the first abnormal stack information can be acquired and saved locally in the native layer, and the native layer sends a notification message to the application layer to notify the application layer to read.
  • the application layer is the Java layer.
  • the terminal when the terminal detects an abnormal signal, its application layer records its abnormal stack information. Generally, it is stored in a fixed path according to the setting of the system. Therefore, when an abnormal signal is detected, the stored abnormality information can be directly read from the set path as the second abnormal stack information.
  • the first abnormal stack information of the obtained native layer and the second abnormal stack information of the application layer of the read record are encapsulated and reported to the server, so that the developer can timely generate the code that generates the abnormality in the application. Positioning is not an analysis, and the application is maintained and updated in a timely manner. After the report is completed, exit the current project.
  • the way of obtaining the native layer exception stack is generally large, such as Google BreakPad, or the system root permission, such as tombstone, can read the relevant stack information, and the process is too cumbersome.
  • the abnormal stack information obtaining apparatus acquires the abnormal stack information of the native layer through a pre-defined function when the preset abnormal signal is detected during the running of the project, and the code amount is small, and no root authority is required. And reading the second abnormal stack information recorded by the application layer when the abnormal signal is detected, and the two abnormal stack information is encapsulated and uploaded to the server, and then the application is exited, so as to directly forcibly close the application after detecting the abnormality. Therefore, the complete abnormal stack information including the native layer can be uploaded to the server in time, and the abnormality can be monitored comprehensively, and the abnormal stack information can be reported in real time, so that the developer can timely find the abnormality of the application, so as to be fast. Target and solve problems.
  • a second embodiment of the abnormal stack information acquiring apparatus of the present invention is proposed based on the first embodiment.
  • the exception stack information acquisition program is executed by the processor 12, the following steps are also implemented:
  • the third abnormal stack information is assembled with the second abnormal stack information and reported to the server, and the project is exited after the reporting is completed.
  • the first exception stack information obtained by the above method is relatively readable for the developer, and the function name can only be easily seen from the first abnormal information, and the abnormality cannot be directly understood.
  • the number table restores the first exception stack information to obtain a third exception stack information including a function name, a file name corresponding to the function name, and a line number.
  • the symbol table is a data structure for a language translator in which each identifier in the program source code is bound to its declaration or usage information, in this embodiment, in the project
  • each function name has its corresponding file name and its line number.
  • Each version of the project corresponds to a symbol table. If the project is upgraded, its symbol table needs to be updated.
  • the symbol table may be stored in the server, and after receiving the abnormal stack information reported by the terminal, the server restores the first abnormal stack information according to the stored symbol table. .
  • the information restoration script is pre-configured, and after acquiring the first abnormal stack information, the processor 12 executes the abnormal stack information acquisition program to implement the following steps:
  • the information restoration script is started, and the function name in the first abnormal stack information is sequentially matched with the function name in the symbol table one by one according to the information restoration script, and acquired in the first abnormal stack information.
  • the information restoration script can be:
  • crash.txt is the unrecovered exception information, that is, the first exception stack information
  • symbol.txt is the symbol table
  • result.txt is the restored exception information, that is, the third exception stack information.
  • the apparatus provided in this embodiment performs the restoration processing on the first abnormal stack information of the native layer acquired by the abnormal stack information acquisition program, so as to improve the readability of the server and facilitate the developer to obtain more complete abnormal information.
  • the exception stack information acquisition program may also be divided into one or more modules, one or more modules are stored in the memory 11 and executed by one or more processors (this implementation) The example is executed by the processor 12) to complete the present invention.
  • module refers to a series of computer program instruction segments capable of performing a specific function for describing the execution process of the abnormal stack information acquisition program in the abnormal stack information acquisition device.
  • the abnormal stack information obtaining program may be divided into the obtaining module 10 and the reporting module 20, and as shown in FIG. 4, it is a functional module diagram of the abnormal stack information acquiring program in the abnormal stack information acquiring device of the present invention. ,among them:
  • the obtaining module 10 is configured to: when the preset abnormal signal is detected during the running of the project, call and execute the abnormal signal processing function to obtain the first abnormal stack information of the native layer, and read the detected The second abnormal stack information recorded by the application layer when the abnormal signal is described;
  • the reporting module 20 is configured to assemble the first abnormal stack information and the second abnormal stack information to report to the server, and exit the project after the reporting is completed.
  • an embodiment of the present invention further provides a computer readable storage medium.
  • the computer readable storage medium stores an abnormal stack information acquiring program.
  • the abnormal stack information acquiring program is executed by the processor, the following operations are implemented:
  • the abnormal signal processing function is called and executed to obtain the first abnormal stack information of the native layer;
  • the first abnormal stack information and the second abnormal stack information are assembled and reported to the server, and the project is exited after the report is completed.
  • the exception signal processing function corresponding to the version information of the operating system is called and executed, the address information in which the abnormality occurs is acquired, and the first abnormal stack information is generated according to the address information.
  • the first abnormal stack information is generated by assembling the signal type with the abnormal stack data.
  • the third abnormal stack information is assembled with the second abnormal stack information and reported to the server, and the project is exited after the reporting is completed.
  • portions of the technical solution of the present invention that contribute substantially or to the prior art may be embodied in the form of a software product stored in a storage medium (such as a ROM/RAM as described above). , a disk, an optical disk, including a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • a terminal device which may be a mobile phone, a computer, a server, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Debugging And Monitoring (AREA)
  • Retry When Errors Occur (AREA)
  • Executing Machine-Instructions (AREA)
  • Stored Programmes (AREA)

Abstract

一种异常堆栈信息获取方法、装置以及计算机可读存储介质,该方法包括:在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息(S10);读取侦测到所述异常信号时应用层记录的第二异常堆栈信息(S20);将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目(S30)。该方法解决了现有技术中难以及时地获取应用程序中的异常堆栈信息并上传的技术问题。

Description

异常堆栈信息获取方法、装置及计算机可读存储介质
优先权申明
本申请基于巴黎公约申明享有2017年06月12日递交的申请号为CN 201710440288.8、名称为“异常堆栈信息获取方法、装置及计算机可读存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。
技术领域
本发明涉及计算机技术领域,尤其涉及一种异常堆栈信息获取方法、装置及计算机可读存储介质。
背景技术
目前,如果APP在程序设计中存在异常,则用户在使用APP的过程中,会出现因APP的运行异常而发生崩溃闪退的现象,导致APP不能正常使用。因此,对于APP开发者来说,需要获取到应用程序在发生异常时产生的异常堆栈信息,及时地对应用程序中产生的异常问题的代码进行定位并分析。
而现有的获取异常堆栈信息的方式一般是,在应用程序发生异常并崩溃后,程序再次启动时,会从本地获取异常堆栈信息并上传。但是这种处理方式存在一定的缺陷,如果应用程发生异常并崩溃后,用户没有再次启动应用,则无法上传。
发明内容
本发明提供一种异常堆栈信息获取方法、装置及计算机可读存储介质,其主要目的在于解决现有技术中难以及时地获取应用程序中的异常堆栈信息并上传的技术问题。
为实现上述目的,本发明提供一种异常堆栈信息获取方法,该方法包括:
在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息;
读取侦测到所述异常信号时应用层记录的第二异常堆栈信息;
将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
可选地,所述在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息的步骤包括:
在所述项目的运行过程中,当侦测到预设的异常信号时,确定运行所述项目的操作系统的版本信息;
调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息。
可选地,所述调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息的步骤包括:
调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息;
根据所述地址信息获取异常堆栈数据,获取侦测到的所述异常信号的信号类型;
将所述信号类型与所述异常堆栈数据组装后生成所述第一异常堆栈信息。
可选地,所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目的步骤包括:
读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
此外,为实现上述目的,本发明还提供一种异常堆栈信息获取装置,该装置包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的异常堆栈信息获取程序,所述异常堆栈信息获取程序被所述处理器执行时实现如下步骤:
在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息;
读取侦测到所述异常信号时应用层记录的第二异常堆栈信息;
将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
可选地,所述在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息的步骤包括:
在所述项目的运行过程中,当侦测到预设的异常信号时,确定运行所述项目的操作系统的版本信息;
调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息。
可选地,所述调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息的步骤包括:
调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息;
根据所述地址信息获取异常堆栈数据,获取侦测到的所述异常信号的信号类型;
将所述信号类型与所述异常堆栈数据组装后生成所述第一异常堆栈信息。
可选地,所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目的步骤包括:
读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
可选地,所述读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息的步骤包括:
启动信息还原脚本,基于所述信息还原脚本,将所述第一异常堆栈信息中的函数名依次与所述符号表中的函数名进行一一匹配,获取到所述第一异常堆栈信息中的函数名对应的文件名和行号;
将获取的文件名和行号添加至原始的第一异常堆栈信息,生成所述服务器可读的第三异常堆栈信息。
此外,为实现上述目的,本发明还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有异常堆栈信息获取程序,所述异常堆栈信息获取程序被处理器执行时实现如下步骤:
在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息;
读取侦测到所述异常信号时应用层记录的第二异常堆栈信息;
将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
本发明提出的异常堆栈信息获取方法、装置及计算机可读存储介质,在项目的运行过程中侦测到预设的异常信号时,调用并执行异常信号处理函数获取native层的第一异常堆栈信息,并且读取侦测到异常信号时应用层记录的第二异常堆栈信息,将上述native层和应用层的异常堆栈信息进行组装后上报至服务器,并且在上报完成后退出该项目,避免在检测到异常后,直接强制关闭项目,并且该发明能够通过预先定义的异常信号处理函数及时获取native层的第一异常堆栈信息在内的完整异常堆栈信息上传至服务器,能够全面的监控异常的发生,实时上报异常堆栈信息,对于开发人员来说,可以及时发现应用的异常,以便于快速进行异常定位和解决问题。
附图说明
图1为本发明异常堆栈信息获取方法第一实施例的流程图;
图2为本发明异常堆栈信息获取方法第二实施例中步骤S30的细化流程示意图;
图3为本发明异常堆栈信息获取装置较佳实施例的示意图;
图4为本发明异常堆栈信息获取装置中的异常堆栈信息获取程序的功能模块示意图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明提供一种异常堆栈信息获取方法。参照图1所示,为本发明异常堆栈信息获取方法第一实施例的流程图。该方法可以由一个装置执行,该装置可以由软件和/或硬件实现。
在本实施例中,该异常堆栈信息获取方法包括:
步骤S10,在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息。
本发明实施例中,项目是由代码构成的应用程序。终端可以从服务器下载项目,并安装运行。项目在终端上的运行过程中,对项目的运行情况进行实时检测。预先设置各种预设类型的异常信号,例如,</br>
_SIGABRT:由调用abort函数产生,进程非正常退出</br>_
_SIGILL:非法指令异常</br>_
_SIGBUS:某种特定的硬件异常,通常有内存访问引起</br>_
_SIGFPE:数学相关异常,如被除0、浮点移除等</br>_
_SIGSEGV:非法内存访问</br>_
在项目的运行过程中,当项目发生相关异常时,会触发对应的异常信号,来通知进程发生了异步事件。当终端侦测到的异常信号属于预设的异常信号时,调用并执行预设的异常信号处理函数,以获取native层的第一异常堆栈信息。异常信号处理函数需要预先配置,以供调用。
作为一种实施方式,异常信号处理函数可以通过以下代码实现:
Figure PCTCN2017105018-appb-000001
其中,函数_skn\_signal\_handler_就是检测到异常信号后执行的函数,异常堆栈信息的获取就是在这个函数中进行的。
由于终端使用的操作系统的版本不同,配置的异常信号处理函数也不相同。因此,步骤S10可以包括以下细化步骤:
在所述项目的运行过程中,当侦测到预设的异常信号时,确定运行所述项目的操作系统的版本信息;调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息。
具体地,若操作系统的版本低于预设版本,则调用第一预设函数获取发生异常的地址信息,通过dladdr函数获取与地址信息对应的函数名以及so库信息;若操作系统的版本高于或等于预设版本,则通过dlopen函数从预设路径中调用第二预设函数获取发生异常的地址信息,通过dladdr函数获取与地址信息对应的函数名以及so库信息。其中,第一预设函数为预先配置的异常信号处理函数,第二预设函数为操作系统定义的函数,不需要用户预先配置,只需在侦测到的异常信号时,从特定的路径中调用即可。在本实施例中,异常堆栈信息主要包括发生异常的函数名以及so库信息。
以下以Android系统为例,预设版本为Android 5.0,由于Android 5.0开始Android采用ART虚拟机,所以异常信息的获取在Android5.0以上和Android5.0以下需要两种方案,Android 5.0以上使用unwind方法,Android 5.0以下使用libcorkscrew.so方法。具体的,关于unwind方法的使用,可以在代码中引入unwind.h头文件,通过\_Unwind\_Backtrace函数获取到产生异常的地址信息后,再通过dladdr函数获取到地址信息对应的函数名和so库信息。关于libcorkscrew.so方法的使用,上述预设路径可以是Android4.x版本的/system/lib/路径,通过dlopen函数打开对应的库,从而调用libcorkscrew.so方法,基于该方法查询到产生异常的地址信息,在基于该地址信息查找对应的函数名和so库信息。
优选地,作为一种实施方式,为了使开发人员能够了解到异常信号的具体信息,第一异常堆栈信息还包括侦测到的异常信号的信号类型。
调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息的步骤包括:调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息;根据所述地址信息获取异常堆栈数据,获取侦测到的所述异常信号的信号类型;将所述信号类型与所述异常 堆栈数据组装后生成所述第一异常堆栈信息。
根据发生异常的地址信息获取到对应的有异常堆栈数据后,获取侦测到异常信号时记录的该异常信号所述的信号类型,将该信号类型与上述异常堆栈数据组装以生成第一异常堆栈信息,异常堆栈数据包括上述查找到的异常的函数名和so库信息。其中,第一异常堆栈信息可以在native层获取并保存在本地后,由native层向应用层发送通知信息,通知应用层读取,对于Android系统老说,应用层即Java层。在native层组装信号类型与异常堆栈数据时,使用预设的分隔符进行分隔,以便于应用层区分。
步骤S20,读取侦测到所述异常信号时应用层记录的第二异常堆栈信息。
步骤S30,将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
一般情况下,终端在侦测到异常信号时,其应用层会对其异常堆栈信息进行记录。一般根据系统的设置会存储在固定的路径中,因此,可以在检测到异常信号时,直接从设定的路径中读取存储的异常信息,作为上述第二异常堆栈信息。
将获取到的native层的第一异常堆栈信息和读取到的记录的应用层的第二异常堆栈信息进行封装处理,并上报到服务器,以供开发人员及时对应用程序中产生异常的代码进行定位并非分析,进而及时地对应用程序进行维护并更新。在上报完成后,退出当前的项目。
现有技术中获取native层异常堆栈的方式,一般代码量大,如Google BreakPad,或者需要系统root权限,如tombstone,才能够读取相关堆栈信息,且过程过于繁琐。
本实施例提出的异常堆栈信息获取方法,在项目的运行过程中侦测到预设的异常信号时,通过预先定义的函数获取到native层的异常堆栈信息,代码量小,且不需要root权限并且读取侦测到异常信号时应用层记录的第二异常堆栈信息,将两个异常堆栈信息封装后上传到服务器,再退出应用,避免在检测到异常后,直接强制关闭应用。因此能够及时的获取到包括native层在内的完整异常堆栈信息上传至服务器,能够全面的监控异常的发生,实时上报异常堆栈信息,对于开发人员来说,可以及时发现应用的异常,以便于快速定位和解决问题。
基于第一实施例提出本发明异常堆栈信息获取方法的第二实施例。参照图2所示,在本实施例中,步骤S30包括以下细化步骤:
步骤S31,读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行 还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
步骤S32,将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
一般情况下,通过上述方式获取到的第一异常堆栈信息,对于开发者来说,可读性比较低,从第一异常信息中只能简单的看出其函数名,无法直接了解到异常所在的文件名以及所在的行号。为了提高其可读性,在获取到第一异常堆栈信息后,通过该应用匹配的符号表来对第一异常堆栈信息进行还原处理,以得到包含有函数名、该函数名对应的文件名以及行号的第三异常堆栈信息。其中,符号表是一种用于语言翻译器的数据结构,在符号表中,程序源代码中每个标识符都和它的声明或者使用信息绑定在一起,在该实施例中,在项目的符号表中,每一个函数名都有其对应的文件名及所在的行号。每一个版本的项目对应一个符号表,若项目升级,则需要对其符号表进行更新。
优选地,在其他实施例中,为了提高项目信息的安全性,可以将符号表存放在服务器,服务器接收到终端上报的异常堆栈信息后,根据存储的符号表对第一异常堆栈信息进行还原处理。
本实施例中,预先配置有信息还原脚本,获取到第一异常堆栈信息后,启动信息还原脚本,基于所述信息还原脚本,将所述第一异常堆栈信息中的函数名依次与所述符号表中的函数名进行一一匹配,获取到所述第一异常堆栈信息中的函数名对应的文件名和行号;将获取的文件名和行号添加至原始的第一异常堆栈信息,生成所述服务器可读的第三异常堆栈信息。
信息还原脚本可以是:
<code><pre>
./SknSymbol.sh crash.txt symbol.txt>result.txt
</code></pre>
其中,crash.txt为未还原的异常信息,即第一异常堆栈信息;symbol.txt为符号表;result.txt为还原后的异常信息,即第三异常堆栈信息。
例如,若获取到的异常信息为:
<code><pre>
\_Z2aav/data/app/com.pingan.pad_demo-2/lib/arm/libcrash.so
</code></pre>
经过上述信息还原脚本还原后的异常信息为:
<code><pre>
Z2aav
/Users/duyuan797/Workspace/sky-eye/sky-eye/src/main/cpp/./src/skncrash.cp
p:72/data/app/com.pingan.pad_demo-2/lib/arm/libcrash.so
</code></pre>
本实施例提出的方法,通过对获取到的native层的第一异常堆栈信息进行还原处理,以提高服务器对其的可读性,便于开发者获取到更加完整的异常信息。
参照图3所示,为本发明异常堆栈信息获取装置较佳实施例的示意图。
在本实施例中,异常堆栈信息获取装置可以是智能手机、平板电脑、电子书阅读器、MP3(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)播放器、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、便携计算机等具有显示功能的可移动式终端设备。
该异常堆栈信息装置包括存储器11、处理器12,通信总线13,以及网络接口14。其中,通信总线13用于实现这些组件之间的连接通信。网络接口14可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器11可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。
存储器11在一些实施例中可以是异常堆栈信息获取装置的内部存储单元,例如该异常堆栈信息获取装置的硬盘。存储器11在另一些实施例中也可以是异常堆栈信息获取装置的外部存储设备,例如异常堆栈信息获取装置上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括异常堆栈信息获取装置的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于异常堆栈信息获取装置的应用软件及各类数据,例如异常堆栈信息获取程序的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行异常堆栈信息获取程序等。
图3仅示出了具有组件11-14以及异常堆栈信息获取程序的异常堆栈信息获取装置,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。
可选地,该装置还可以包括用户接口,用户接口可以包括显示器(Display)、输入单 元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。显示器用于显示在异常堆栈信息获取装置中处理的信息以及用于显示可视化的用户界面。
可选地,该装置还可以包括摄像头、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi模块等等。其中,传感器比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,若该装置为移动终端,环境光传感器可根据环境光线的明暗来调节显示屏的亮度,接近传感器可在移动终端移动到耳边时,关闭显示屏和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别移动终端姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;当然,移动终端还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
在图3所示的装置实施例中,作为一种计算机存储介质的存储器11中可以包括操作系统、以及异常堆栈信息获取程序;网络接口14主要用于连接服务器,与服务器进行数据通信;处理器12执行存储器11中存储的异常堆栈信息获取程序时实现如下步骤:
在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息;
读取侦测到所述异常信号时应用层记录的第二异常堆栈信息;
将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
本发明实施例中,项目是由代码构成的应用程序。终端可以从服务器下载项目,并安装运行。项目在终端上的运行过程中,对项目的运行情况进行实时检测。预先设置各种预设类型的异常信号,例如,</br>
_SIGABRT:由调用abort函数产生,进程非正常退出</br>_
_SIGILL:非法指令异常</br>_
_SIGBUS:某种特定的硬件异常,通常有内存访问引起</br>_
_SIGFPE:数学相关异常,如被除0、浮点移除等</br>_
_SIGSEGV:非法内存访问</br>_
在项目的运行过程中,当项目发生相关异常时,会触发对应的异常信号,来通知进程 发生了异步事件。当终端侦测到的异常信号属于预设的异常信号时,调用并执行预设的异常信号处理函数,以获取native层的第一异常堆栈信息。异常信号处理函数需要预先配置,以供调用。
作为一种实施方式,异常信号处理函数可以通过以下代码实现:
Figure PCTCN2017105018-appb-000002
其中,函数_skn\_signal\_handler_就是检测到异常信号后执行的函数,异常堆栈信息的获取就是在这个函数中进行的。
由于终端使用的操作系统的版本不同,配置的异常信号处理函数也不相同。因此,异 常堆栈信息获取程序被处理器12执行时还实现如下步骤:
在所述项目的运行过程中,当侦测到预设的异常信号时,确定运行所述项目的操作系统的版本信息;调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息。
具体地,异常堆栈信息获取程序被处理器12执行时还实现如下步骤:
若操作系统的版本低于预设版本,则调用第一预设函数获取发生异常的地址信息,通过dladdr函数获取与地址信息对应的函数名以及so库信息;若操作系统的版本高于或等于预设版本,则通过dlopen函数从预设路径中调用第二预设函数获取发生异常的地址信息,通过dladdr函数获取与地址信息对应的函数名以及so库信息。
其中,第一预设函数为预先配置的异常信号处理函数,第二预设函数为操作系统定义的函数,不需要用户预先配置,只需在侦测到的异常信号时,从特定的路径中调用即可。在本实施例中,异常堆栈信息主要包括发生异常的函数名以及so库信息。
以下以Android系统为例,预设版本为Android 5.0,由于Android 5.0开始Android采用ART虚拟机,所以异常信息的获取在Android5.0以上和Android5.0以下需要两种方案,Android 5.0以上使用unwind方法,Android 5.0以下使用libcorkscrew.so方法。具体的,关于unwind方法的使用,可以在代码中引入unwind.h头文件,通过\_Unwind\_Backtrace函数获取到产生异常的地址信息后,再通过dladdr函数获取到地址信息对应的函数名和so库信息。关于libcorkscrew.so方法的使用,上述预设路径可以是Android4.x版本的/system/lib/路径,通过dlopen函数打开对应的库,从而调用libcorkscrew.so方法,基于该方法查询到产生异常的地址信息,在基于该地址信息查找对应的函数名和so库信息。
优选地,作为一种实施方式,为了使开发人员能够了解到异常信号的具体信息,第一异常堆栈信息还包括侦测到的异常信号的信号类型。
异常堆栈信息获取程序被处理器12执行时还实现如下步骤:
调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息的步骤包括:调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息;根据所述地址信息获取异常堆栈数据,获取侦测到的所述异常信号的信号类型;将所述信号类型与所述异常堆栈数据组装后生成所述第一异常堆栈信息。
根据发生异常的地址信息获取到对应的有异常堆栈数据后,获取侦测到异常信号时记 录的该异常信号所述的信号类型,将该信号类型与上述异常堆栈数据组装以生成第一异常堆栈信息,异常堆栈数据包括上述查找到的异常的函数名和so库信息。其中,第一异常堆栈信息可以在native层获取并保存在本地后,由native层向应用层发送通知信息,通知应用层读取,对于Android系统老说,应用层即Java层。在native层组装信号类型与异常堆栈数据时,使用预设的分隔符进行分隔,以便于应用层区分。
一般情况下,终端在侦测到异常信号时,其应用层会对其异常堆栈信息进行记录。一般根据系统的设置会存储在固定的路径中,因此,可以在检测到异常信号时,直接从设定的路径中读取存储的异常信息,作为上述第二异常堆栈信息。
将获取到的native层的第一异常堆栈信息和读取到的记录的应用层的第二异常堆栈信息进行封装处理,并上报到服务器,以供开发人员及时对应用程序中产生异常的代码进行定位并非分析,进而及时地对应用程序进行维护并更新。在上报完成后,退出当前的项目。
现有技术中获取native层异常堆栈的方式,一般代码量大,如Google BreakPad,或者需要系统root权限,如tombstone,才能够读取相关堆栈信息,且过程过于繁琐。
本实施例提出的异常堆栈信息获取装置,在项目的运行过程中侦测到预设的异常信号时,通过预先定义的函数获取到native层的异常堆栈信息,代码量小,且不需要root权限并且读取侦测到异常信号时应用层记录的第二异常堆栈信息,将两个异常堆栈信息封装后上传到服务器,再退出应用,避免在检测到异常后,直接强制关闭应用。因此能够及时的获取到包括native层在内的完整异常堆栈信息上传至服务器,能够全面的监控异常的发生,实时上报异常堆栈信息,对于开发人员来说,可以及时发现应用的异常,以便于快速定位和解决问题。
基于第一实施例提出本发明异常堆栈信息获取装置的第二实施例。在本实施例中,异常堆栈信息获取程序被处理器12执行时还实现如下步骤:
读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
一般情况下,通过上述方式获取到的第一异常堆栈信息,对于开发者来说,可读性比较低,从第一异常信息中只能简单的看出其函数名,无法直接了解到异常所在的文件名以及所在的行号。为了提高其可读性,在获取到第一异常堆栈信息后,通过该应用匹配的符 号表来对第一异常堆栈信息进行还原处理,以得到包含有函数名、该函数名对应的文件名以及行号的第三异常堆栈信息。其中,符号表是一种用于语言翻译器的数据结构,在符号表中,程序源代码中每个标识符都和它的声明或者使用信息绑定在一起,在该实施例中,在项目的符号表中,每一个函数名都有其对应的文件名及所在的行号。每一个版本的项目对应一个符号表,若项目升级,则需要对其符号表进行更新。
优选地,在其他实施例中,为了提高项目信息的安全性,可以将符号表存放在服务器,服务器接收到终端上报的异常堆栈信息后,根据存储的符号表对第一异常堆栈信息进行还原处理。
本实施例中,预先配置有信息还原脚本,获取到第一异常堆栈信息后,处理器12执行异常堆栈信息获取程序,实现如下步骤:
启动信息还原脚本,基于所述信息还原脚本,将所述第一异常堆栈信息中的函数名依次与所述符号表中的函数名进行一一匹配,获取到所述第一异常堆栈信息中的函数名对应的文件名和行号;将获取的文件名和行号添加至原始的第一异常堆栈信息,生成所述服务器可读的第三异常堆栈信息。
信息还原脚本可以是:
<code><pre>
./SknSymbol.sh crash.txt symbol.txt>result.txt
</code></pre>
其中,crash.txt为未还原的异常信息,即第一异常堆栈信息;symbol.txt为符号表;result.txt为还原后的异常信息,即第三异常堆栈信息。
例如,若获取到的异常信息为:
<code><pre>
\_Z2aav/data/app/com.pingan.pad_demo-2/lib/arm/libcrash.so
</code></pre>
经过上述信息还原脚本还原后的异常信息为:
<code><pre>
Z2aav
/Users/duyuan797/Workspace/sky-eye/sky-eye/src/main/cpp/./src/skncrash.cpp:72/data/app/com.pingan.pad_demo-2/lib/arm/libcrash.so
</code></pre>
本实施例提出的装置,通过异常堆栈信息获取程序获取到的native层的第一异常堆栈信息进行还原处理,以提高服务器对其的可读性,便于开发者获取到更加完整的异常信息。
可选地,在其他的实施例中,异常堆栈信息获取程序还可以被分割为一个或者多个模块,一个或者多个模块被存储于存储器11中,并由一个或多个处理器(本实施例为处理器12)所执行,以完成本发明。本发明所称的模块是指能够完成特定功能的一系列计算机程序指令段,用于描述异常堆栈信息获取程序在异常堆栈信息获取装置中的执行过程。
例如,在一实施例中,异常堆栈信息获取程序可以被分割为获取模块10和上报模块20,参照图4所示,为本发明异常堆栈信息获取装置中的异常堆栈信息获取程序的功能模块示意图,其中:
获取模块10,用于在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息,以及读取侦测到所述异常信号时应用层记录的第二异常堆栈信息;
上报模块20,用于将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
此外,本发明实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有异常堆栈信息获取程序,所述异常堆栈信息获取程序被处理器执行时实现如下操作:
在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息;
读取侦测到所述异常信号时应用层记录的第二异常堆栈信息;
将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
进一步地,所述异常堆栈信息获取程序被处理器执行时还实现如下操作:
在所述项目的运行过程中,当侦测到预设的异常信号时,确定运行所述项目的操作系统的版本信息;
调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息。
进一步地,所述异常堆栈信息获取程序被处理器执行时还实现如下操作:
调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地 址信息;
根据所述地址信息获取异常堆栈数据,获取侦测到的所述异常信号的信号类型;
将所述信号类型与所述异常堆栈数据组装后生成所述第一异常堆栈信息。
进一步地,所述异常堆栈信息获取程序被处理器执行时还实现如下操作:
读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (20)

  1. 一种异常堆栈信息获取方法,其特征在于,所述方法包括:
    在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息;
    读取侦测到所述异常信号时应用层记录的第二异常堆栈信息;
    将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
  2. 根据权利要求1所述的异常堆栈信息获取方法,其特征在于,所述在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息的步骤包括:
    在所述项目的运行过程中,当侦测到预设的异常信号时,确定运行所述项目的操作系统的版本信息;
    调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息。
  3. 根据权利要求2所述的异常堆栈信息获取方法,其特征在于,所述调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息的步骤包括:
    调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息;
    根据所述地址信息获取异常堆栈数据,获取侦测到的所述异常信号的信号类型;
    将所述信号类型与所述异常堆栈数据组装后生成所述第一异常堆栈信息。
  4. 根据权利要求2所述的异常堆栈信息获取方法,其特征在于,所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目的步骤包括:
    读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
    将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
  5. 根据权利要求3所述的异常堆栈信息获取方法,其特征在于,所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目的 步骤包括:
    读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
    将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
  6. 根据权利要求3所述的异常堆栈信息获取方法,其特征在于,所述读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息的步骤包括:
    启动信息还原脚本,基于所述信息还原脚本,将所述第一异常堆栈信息中的函数名依次与所述符号表中的函数名进行一一匹配,获取到所述第一异常堆栈信息中的函数名对应的文件名和行号;
    将获取的文件名和行号添加至原始的第一异常堆栈信息,生成所述服务器可读的第三异常堆栈信息。
  7. 根据权利要求4所述的异常堆栈信息获取方法,其特征在于,所述读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息的步骤包括:
    启动信息还原脚本,基于所述信息还原脚本,将所述第一异常堆栈信息中的函数名依次与所述符号表中的函数名进行一一匹配,获取到所述第一异常堆栈信息中的函数名对应的文件名和行号;
    将获取的文件名和行号添加至原始的第一异常堆栈信息,生成所述服务器可读的第三异常堆栈信息。
  8. 一种异常堆栈信息获取装置,其特征在于,所述装置包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的异常堆栈信息获取程序,所述异常堆栈信息获取程序被所述处理器执行时实现如下步骤:
    在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息;
    读取侦测到所述异常信号时应用层记录的第二异常堆栈信息;
    将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
  9. 根据权利要求8所述的异常堆栈信息获取装置,其特征在于,所述在项目的运行 过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息的步骤包括:
    在所述项目的运行过程中,当侦测到预设的异常信号时,确定运行所述项目的操作系统的版本信息;
    调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息。
  10. 根据权利要求8所述的异常堆栈信息获取装置,其特征在于,所述调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息的步骤包括:
    调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息;
    根据所述地址信息获取异常堆栈数据,获取侦测到的所述异常信号的信号类型;
    将所述信号类型与所述异常堆栈数据组装后生成所述第一异常堆栈信息。
  11. 根据权利要求9所述的异常堆栈信息获取装置,其特征在于,所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目的步骤包括:
    读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
    将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
  12. 根据权利要求10所述的异常堆栈信息获取装置,其特征在于,所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目的步骤包括:
    读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
    将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
  13. 根据权利要求10所述的异常堆栈信息获取装置,其特征在于,所述读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息的步骤包括:
    启动信息还原脚本,基于所述信息还原脚本,将所述第一异常堆栈信息中的函数名依次与所述符号表中的函数名进行一一匹配,获取到所述第一异常堆栈信息中的函数名对应的文件名和行号;
    将获取的文件名和行号添加至原始的第一异常堆栈信息,生成所述服务器可读的第三异常堆栈信息。
  14. 根据权利要求11所述的异常堆栈信息获取装置,其特征在于,所述读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息的步骤包括:
    启动信息还原脚本,基于所述信息还原脚本,将所述第一异常堆栈信息中的函数名依次与所述符号表中的函数名进行一一匹配,获取到所述第一异常堆栈信息中的函数名对应的文件名和行号;
    将获取的文件名和行号添加至原始的第一异常堆栈信息,生成所述服务器可读的第三异常堆栈信息。
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有异常堆栈信息获取程序,所述异常堆栈信息获取程序被处理器执行时实现如下步骤:
    在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息;
    读取侦测到所述异常信号时应用层记录的第二异常堆栈信息;
    将所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目。
  16. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述在项目的运行过程中,当侦测到预设的异常信号时,调用并执行异常信号处理函数,以获取native层的第一异常堆栈信息的步骤包括:
    在所述项目的运行过程中,当侦测到预设的异常信号时,确定运行所述项目的操作系统的版本信息;
    调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息。
  17. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息,并根据所述地址信息生成第一异常堆栈信息的步骤包括:
    调用并执行与所述操作系统的版本信息对应的异常信号处理函数,获取发生异常的地址信息;
    根据所述地址信息获取异常堆栈数据,获取侦测到的所述异常信号的信号类型;
    将所述信号类型与所述异常堆栈数据组装后生成所述第一异常堆栈信息。
  18. 根据权利要求16所述的计算机可读存储介质,其特征在于,所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目的步骤包括:
    读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
    将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
  19. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述第一异常堆栈信息和所述第二异常堆栈信息进行组装后上报至服务器,并在上报完成后退出所述项目的步骤包括:
    读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息;
    将所述第三异常堆栈信息与所述第二异常堆栈信息进行组装后上报至所述服务器,并在上报完成后退出所述项目。
  20. 根据权利要求17所述的计算机可读存储介质,其特征在于,所述读取存储的符号表,并基于所述符号表对获取到的第一异常堆栈信息进行还原处理,以将所述第一异常堆栈信息转换为所述服务器可读的第三异常堆栈信息的步骤包括:
    启动信息还原脚本,基于所述信息还原脚本,将所述第一异常堆栈信息中的函数名依次与所述符号表中的函数名进行一一匹配,获取到所述第一异常堆栈信息中的函数名对应的文件名和行号;
    将获取的文件名和行号添加至原始的第一异常堆栈信息,生成所述服务器可读的第三异常堆栈信息。
PCT/CN2017/105018 2017-06-12 2017-09-30 异常堆栈信息获取方法、装置及计算机可读存储介质 Ceased WO2018227822A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
SG11201901803SA SG11201901803SA (en) 2017-06-12 2017-09-30 Exception stack information acquisition method and device and computer-readable storage medium
US16/088,831 US11010227B2 (en) 2017-06-12 2017-09-30 Exception stack information acquisition method and device and computer-readable storage medium
JP2018553347A JP6648306B2 (ja) 2017-06-12 2017-09-30 異常スタック情報取得方法、装置及びコンピュータ読み取り可能な記憶媒体

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710440288.8A CN107704356B (zh) 2017-06-12 2017-06-12 异常堆栈信息获取方法、装置及计算机可读存储介质
CN201710440288.8 2017-06-12

Publications (1)

Publication Number Publication Date
WO2018227822A1 true WO2018227822A1 (zh) 2018-12-20

Family

ID=61170175

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/105018 Ceased WO2018227822A1 (zh) 2017-06-12 2017-09-30 异常堆栈信息获取方法、装置及计算机可读存储介质

Country Status (5)

Country Link
US (1) US11010227B2 (zh)
JP (1) JP6648306B2 (zh)
CN (1) CN107704356B (zh)
SG (1) SG11201901803SA (zh)
WO (1) WO2018227822A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457154A (zh) * 2019-07-25 2019-11-15 Oppo广东移动通信有限公司 异常服务处理方法及装置、存储介质、通信终端
CN111159051A (zh) * 2019-12-31 2020-05-15 北京天融信网络安全技术有限公司 死锁检测方法、装置、电子设备及可读存储介质
CN113297052A (zh) * 2020-02-21 2021-08-24 腾讯科技(深圳)有限公司 应用程序的卡顿事件定位方法、装置、存储介质和设备
CN114253825A (zh) * 2020-09-22 2022-03-29 腾讯科技(深圳)有限公司 内存泄漏检测方法、装置、计算机设备和存储介质
CN115048271A (zh) * 2022-06-29 2022-09-13 中国平安财产保险股份有限公司 服务异常分析方法、装置、设备及存储介质

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110275791A (zh) * 2018-03-14 2019-09-24 普天信息技术有限公司 一种应用程序异常处理方法及装置
CN108763060A (zh) * 2018-04-27 2018-11-06 广州华多网络科技有限公司 Android系统中Native层崩溃溯源方法、装置、存储介质及终端
CN108846287A (zh) * 2018-06-26 2018-11-20 北京奇安信科技有限公司 一种检测漏洞攻击的方法及装置
CN112181695A (zh) * 2019-07-01 2021-01-05 顺丰科技有限公司 异常应用处理方法、装置、服务器及存储介质
CN110750375B (zh) * 2019-07-16 2023-07-21 许昌许继软件技术有限公司 一种嵌入式设备及其异常信息处理方法
CN111176869B (zh) * 2019-08-01 2022-05-10 腾讯云计算(北京)有限责任公司 超时检测方法、装置、设备及存储介质
CN112395119B (zh) * 2019-08-12 2024-03-12 北京达佳互联信息技术有限公司 异常数据处理方法、装置、服务器及存储介质
CN111414270B (zh) * 2020-03-24 2023-05-09 北京字节跳动网络技术有限公司 一种异常处理方法及装置
CN111767164B (zh) * 2020-05-18 2022-08-09 福建天晴数码有限公司 一种组装产品中定位崩溃堆栈所属组件的方法及其系统
CN113900914B (zh) * 2020-06-22 2025-08-22 阿里巴巴集团控股有限公司 异常处理方法、装置、电子设备及计算机存储介质
CN113760588A (zh) * 2020-11-04 2021-12-07 北京沃东天骏信息技术有限公司 一种软件系统的异常信息获取方法和装置
CN114968347B (zh) * 2021-02-20 2025-10-31 腾讯科技(深圳)有限公司 堆栈还原方法、装置、存储介质及电子设备
CN115114649A (zh) * 2021-03-22 2022-09-27 武汉斗鱼鱼乐网络科技有限公司 一种Android平台so文件保护方法及系统
CN113867847A (zh) * 2021-11-30 2021-12-31 统信软件技术有限公司 一种异常插件处理方法、装置及计算设备
CN114020540A (zh) * 2022-01-05 2022-02-08 湖南新云网科技有限公司 一种app重启方法、系统、装置及计算机可读存储介质
CN115016968A (zh) * 2022-06-02 2022-09-06 深圳市元征科技股份有限公司 一种异常处理方法、装置、设备及介质
CN115357424A (zh) * 2022-08-19 2022-11-18 展讯通信(天津)有限公司 内存故障定位方法、装置及终端设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009146612A1 (zh) * 2008-06-03 2009-12-10 华为技术有限公司 嵌入式c语言环境下异常处理方法及装置
CN104424090A (zh) * 2013-08-22 2015-03-18 腾讯科技(深圳)有限公司 一种标识崩溃的方法、装置和系统
CN105446822A (zh) * 2015-11-13 2016-03-30 上海斐讯数据通信技术有限公司 基于Linux的软件异常处理系统及方法
US20160299832A1 (en) * 2013-11-29 2016-10-13 Gemalto Sa Method for loading a native code on a secure element

Family Cites Families (30)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6996829B2 (en) * 2000-02-25 2006-02-07 Oracle International Corporation Handling callouts made by a multi-threaded virtual machine to a single threaded environment
US7003778B2 (en) * 2001-10-24 2006-02-21 Sun Microsystems, Inc. Exception handling in java computing environments
CN1328638C (zh) * 2005-08-04 2007-07-25 西安交通大学 Windows环境下的主机入侵检测方法
US20070294675A1 (en) * 2006-06-20 2007-12-20 Transitive Limited Method and apparatus for handling exceptions during binding to native code
US7962924B2 (en) * 2007-06-07 2011-06-14 International Business Machines Corporation System and method for call stack sampling combined with node and instruction tracing
US8291381B2 (en) * 2007-09-27 2012-10-16 Microsoft Corporation Call stack parsing in multiple runtime environments
US20090013208A1 (en) * 2008-03-31 2009-01-08 Dimuzio Thomas M Real time automated exception notification and reporting solution
CN100570581C (zh) * 2008-04-09 2009-12-16 中兴通讯股份有限公司 故障定位的方法和装置
US8799904B2 (en) * 2011-01-21 2014-08-05 International Business Machines Corporation Scalable system call stack sampling
JP5800777B2 (ja) * 2012-08-21 2015-10-28 三菱電機株式会社 情報処理装置及び情報処理方法及びプログラム
CN103152381B (zh) * 2013-01-07 2016-06-29 北京奇虎科技有限公司 一种对浏览器崩溃数据进行处理的方法和服务器系统
CN103092746B (zh) * 2013-02-05 2015-12-02 上海大唐移动通信设备有限公司 线程异常的定位方法及系统
CN103544447B (zh) * 2013-05-30 2016-10-12 Tcl集团股份有限公司 一种基于安卓系统的防止机密信息泄露的方法和终端
US9852041B2 (en) * 2013-09-27 2017-12-26 Microsoft Technology Licensing, Llc Systems and methods for categorizing exceptions and logs
CN103544096A (zh) * 2013-10-21 2014-01-29 Tcl集团股份有限公司 Android终端运行异常时的信息反馈方法及系统
CN104021063B (zh) * 2014-05-14 2015-03-11 南京大学 一种基于硬件虚拟化的模块化计算机取证系统及其方法
CN105320572B (zh) * 2014-06-27 2019-02-22 腾讯科技(深圳)有限公司 浏览器异常处理方法、装置及系统
CN104598313A (zh) * 2015-02-04 2015-05-06 广州市久邦数码科技有限公司 一种应用进程被停止后自动重启的实现方法及其系统
CN106155877B (zh) * 2015-03-23 2019-07-09 Tcl集团股份有限公司 一种Android应用的模糊测试方法及系统
CN104899111B (zh) * 2015-06-09 2018-03-20 烽火通信科技股份有限公司 一种处理家庭网关系统内核崩溃的方法及系统
CN105204990B (zh) * 2015-08-21 2017-11-28 上海斐讯数据通信技术有限公司 一种异常调试方法及系统
CN105450731A (zh) * 2015-11-05 2016-03-30 珠海多玩信息技术有限公司 实现web层和native层通信的方法和装置
CN105653432B (zh) * 2015-12-22 2019-02-15 北京奇虎科技有限公司 一种崩溃数据的处理方法和装置
CN105930139A (zh) * 2016-01-16 2016-09-07 平安科技(深圳)有限公司 应用程序控件动态配置方法及电子设备
CN105844157A (zh) * 2016-04-20 2016-08-10 北京鼎源科技有限公司 一种针对Android系统App行为的监控方法
CN106293629B (zh) * 2016-08-16 2019-08-06 北京小米移动软件有限公司 堆栈获取方法及装置
CN106649107B (zh) * 2016-12-09 2020-06-12 武汉斗鱼网络科技有限公司 安卓系统稳定性的自动化测试方法及装置
CN106598770B (zh) * 2016-12-19 2020-08-18 北京奇虎科技有限公司 Android系统中Native层异常上报处理方法及装置
WO2019113216A1 (en) * 2017-12-05 2019-06-13 Agile Stacks Inc. Machine generated automation code for software development and infrastructure operations
US10782945B1 (en) * 2019-04-04 2020-09-22 International Business Machines Corporation Escape analysis supporting on-stack replacement

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009146612A1 (zh) * 2008-06-03 2009-12-10 华为技术有限公司 嵌入式c语言环境下异常处理方法及装置
CN104424090A (zh) * 2013-08-22 2015-03-18 腾讯科技(深圳)有限公司 一种标识崩溃的方法、装置和系统
US20160299832A1 (en) * 2013-11-29 2016-10-13 Gemalto Sa Method for loading a native code on a secure element
CN105446822A (zh) * 2015-11-13 2016-03-30 上海斐讯数据通信技术有限公司 基于Linux的软件异常处理系统及方法

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457154A (zh) * 2019-07-25 2019-11-15 Oppo广东移动通信有限公司 异常服务处理方法及装置、存储介质、通信终端
CN110457154B (zh) * 2019-07-25 2023-12-22 Oppo广东移动通信有限公司 异常服务处理方法及装置、存储介质、通信终端
CN111159051A (zh) * 2019-12-31 2020-05-15 北京天融信网络安全技术有限公司 死锁检测方法、装置、电子设备及可读存储介质
CN111159051B (zh) * 2019-12-31 2023-07-04 北京天融信网络安全技术有限公司 死锁检测方法、装置、电子设备及可读存储介质
CN113297052A (zh) * 2020-02-21 2021-08-24 腾讯科技(深圳)有限公司 应用程序的卡顿事件定位方法、装置、存储介质和设备
CN113297052B (zh) * 2020-02-21 2024-04-26 腾讯科技(深圳)有限公司 应用程序的卡顿事件定位方法、装置、存储介质和设备
CN114253825A (zh) * 2020-09-22 2022-03-29 腾讯科技(深圳)有限公司 内存泄漏检测方法、装置、计算机设备和存储介质
CN115048271A (zh) * 2022-06-29 2022-09-13 中国平安财产保险股份有限公司 服务异常分析方法、装置、设备及存储介质

Also Published As

Publication number Publication date
US20210096942A1 (en) 2021-04-01
CN107704356A (zh) 2018-02-16
SG11201901803SA (en) 2019-04-29
US11010227B2 (en) 2021-05-18
CN107704356B (zh) 2019-06-28
JP6648306B2 (ja) 2020-02-14
JP2019525275A (ja) 2019-09-05

Similar Documents

Publication Publication Date Title
WO2018227822A1 (zh) 异常堆栈信息获取方法、装置及计算机可读存储介质
US12429833B1 (en) Method and system of running an application
US9448776B1 (en) Method and apparatus for converting a website into a native mobile application
CN109726067B (zh) 一种进程监控方法以及客户端设备
CN111459715A (zh) 应用异常恢复
WO2019019668A1 (zh) 应用程序启动方法、装置、计算机设备和存储介质
EP2807541B1 (en) Image-based application automation
CN107025174A (zh) 用于设备的用户界面异常测试的方法、装置和可读储介质
CN105809028B (zh) 在移动设备中运行相同应用的多个实例的装置和方法
CN104813679A (zh) 屏幕截图抓取和共享的方法、设备和系统
CN110865837B (zh) 一种进行系统升级的方法和终端
CN107798064B (zh) 页面处理方法、电子设备及计算机可读存储介质
WO2019137280A1 (zh) 终端异常的修复方法、装置、移动终端及存储介质
US20130081010A1 (en) Template and server content download using protocol handlers
CN112817831A (zh) 应用性能监测方法、装置、计算机系统和可读存储介质
CN106201602B (zh) 一种标签提供方法、获取方法、服务器及电子设备
JP6238221B2 (ja) ソフトウェアの実行を監視する装置、方法およびプログラム
CN112394906A (zh) 一种应用切换运行的方法及设备
US20130083194A1 (en) Video monitoring server and method
US9201576B2 (en) Display method and portable device
CN114398164A (zh) 在应用程序检测终端处执行的方法及应用程序检测终端
CN104239112A (zh) 一种设备驱动程序安装方法及装置
CN108388616A (zh) 数据收集装置、方法、系统及计算机可读存储介质
CN108009039B (zh) 终端信息的记录方法、装置、存储介质及电子设备
US11500759B2 (en) Information processing system, information processing method, and development apparatus

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2018553347

Country of ref document: JP

Kind code of ref document: A

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17913194

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17913194

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 06.05.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17913194

Country of ref document: EP

Kind code of ref document: A1