Abnormal problem analysis method and device, equipment and storage medium
Patent Information
- Application Number
- CN202310186928.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-10
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-02-10
AI Technical Summary
因此当前对应用运行异常的原因进行定位耗时较长,且对技术人员的专业水平要求较高,需要投入较大的人力、物力成本
[0018]This application provides an anomaly analysis method, apparatus, device, and storage medium, applied to scenarios involving locating the causes of JAVA card application runtime anomalies, thereby improving the efficiency of locating the causes of JAVA card application runtime anomalies. When locating the cause of a JAVA card application runtime anomaly, a JAVA card is connected, and a target application pre-written on the JAVA card is run on the JAVA card. The system monitors in real time the target parameters corresponding to multiple functions called by the target application during runtime, including the application identifier of the target application, the class corresponding to each function, and basic information of each function. Furthermore, when a runtime anomaly occurs in the target application, the target function causing the runtime anomaly is determined based on the target parameter information. Through this method, when a runtime anomaly occurs in the target application, the location of the target function causing the runtime anomaly can be quickly determined based on the target parameter information corresponding to the target application during runtime, thereby achieving rapid location of the cause of JAVA card application runtime anomalies and improving the efficiency of locating the causes of JAVA card application runtime anomalies.
Smart Images

Figure CN116302644B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an anomaly analysis method, apparatus, device, and storage medium. Background Technology
[0002] Currently, with the development of technology, JAVA cards are widely used in scenarios such as Universal Subscriber Identity Modules (USIM), bank cards, security chips, and public transportation cards. JAVA cards are an open standard specified for smart card development platforms, defining a unified development environment and application program interface (API) so that JAVA applets (applications) conforming to this open standard can run on smart cards that support the JAVA API.
[0003] However, in current technologies, when a Java applet running on a Java card encounters an exception, technical personnel need to analyze log files, add debug logs, modify code logic, and change code flow to determine the cause of the application's runtime exception in order to carry out subsequent repairs. Therefore, locating the cause of application runtime exceptions is currently time-consuming, requires a high level of expertise from technical personnel, and necessitates significant investment of human and material resources. Consequently, the efficiency of locating the cause of Java card application runtime exceptions is currently poor. Summary of the Invention
[0004] This application provides an anomaly analysis method, apparatus, device, and storage medium to improve the efficiency of locating the causes of JAVA card application runtime anomalies.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] Firstly, an anomaly analysis method is provided. This method includes: connecting a JAVA card and running a target application on the JAVA card, the target application being an application pre-written into the JAVA card; real-time monitoring of target parameter information corresponding to the target application during its execution, the target parameter information being information corresponding to multiple functions called by the target application during its execution, the target parameter information including at least one of the following: the application identifier of the target application, the class corresponding to each of the multiple functions, and basic information of each function; when a runtime exception occurs during the execution of the target application, determining the target function causing the runtime exception based on the target parameter information, the target function being a function among the multiple functions.
[0007] In one possible implementation, the target parameter information corresponding to the target application during its operation is monitored in real time, including: determining the target running type of the target application during the process of calling multiple functions through the target application, wherein the target running type is any one of the following: application debugging mode, application execution mode; if the running type of the target application is application debugging mode, saving the target parameter information corresponding to the multiple functions called by the target application during its operation; and deleting the target parameter information when no running exception occurs during the operation of the target application.
[0008] In one possible implementation, the method further includes: when the target application is running in application execution mode, there is no need to monitor the target parameter information corresponding to the target application during its operation in real time.
[0009] In one possible implementation, when a runtime exception occurs during the execution of the target application, the target function causing the runtime exception is determined based on the target parameter information. This includes: when a runtime exception occurs during the execution of the target application, obtaining the target parameter information from the JAVA card based on preset instructions; and determining the target function causing the runtime exception from multiple functions based on the application identifier of the target application, the class corresponding to each function in the multiple functions, and the basic information of each function.
[0010] In one possible implementation, the target parameter information further includes at least one of the following: input parameters of each function, output parameters of each function, and exception reasons corresponding to each function. The method further includes: when a runtime exception occurs during the operation of the target application, determining the cause of the runtime exception of the target application based on the input parameters of each function, the output parameters of each function, the exception reasons corresponding to each function, and the exception prompt information displayed by the target application.
[0011] Secondly, an anomaly analysis device is provided, comprising: a running unit, a processing unit, and a determining unit; the running unit is used to connect to a JAVA card and run a target application on the JAVA card, the target application being an application pre-written into the JAVA card; the processing unit is used to monitor in real time the target parameter information corresponding to the target application during its operation, the target parameter information being information corresponding to multiple functions called by the target application during its operation, the target parameter information including at least one of the following: the application identifier of the target application, the class corresponding to each of the multiple functions, and the basic information of each function; the determining unit is used to determine the target function causing the target application's operation error based on the target parameter information when a running error occurs during the operation of the target application, the target function being a function among multiple functions.
[0012] In one possible implementation, a determining unit is used to determine the target running type of the target application during the process of calling multiple functions through the target application. The target running type is any one of the following: application debugging mode or application execution mode. A processing unit is used to save the target parameter information corresponding to the multiple functions called by the target application during the running process when the running type of the target application is application debugging mode. A processing unit is used to delete the target parameter information when no running exception occurs during the running process of the target application.
[0013] In one possible implementation, when the target application is running in application execution mode, there is no need to monitor the target parameter information corresponding to the target application during its execution in real time.
[0014] In one possible implementation, the exception analysis device further includes: an acquisition unit; the acquisition unit is used to acquire target parameter information from the JAVA card based on preset instructions when a runtime exception occurs during the operation of the target application; and a determination unit is used to determine the target function of the runtime exception from multiple functions based on the application identifier of the target application, the class corresponding to each function in multiple functions, and the basic information of each function.
[0015] In one possible implementation, the target parameter information further includes at least one of the following: input parameters of each function, output parameters of each function, and exception cause corresponding to each function. The determining unit is used to determine the cause of the target application's runtime exception based on the input parameters of each function, the output parameters of each function, the exception cause corresponding to each function, and the exception message displayed by the target application when a runtime exception occurs during the execution of the target application.
[0016] Thirdly, an electronic device is provided, comprising: a processor and a memory; wherein the memory is used to store one or more programs, the one or more programs including computer-executable instructions, and when the electronic device is running, the processor executes the computer-executable instructions stored in the memory to cause the electronic device to perform an anomaly analysis method as described in the first aspect.
[0017] Fourthly, a computer-readable storage medium is provided for storing one or more programs, the one or more programs including instructions that, when executed by a computer, cause the computer to perform an anomaly analysis method as described in the first aspect.
[0018] This application provides an anomaly analysis method, apparatus, device, and storage medium, applied to scenarios involving locating the causes of JAVA card application runtime anomalies, thereby improving the efficiency of locating the causes of JAVA card application runtime anomalies. When locating the cause of a JAVA card application runtime anomaly, a JAVA card is connected, and a target application pre-written on the JAVA card is run on the JAVA card. The system monitors in real time the target parameters corresponding to multiple functions called by the target application during runtime, including the application identifier of the target application, the class corresponding to each function, and basic information of each function. Furthermore, when a runtime anomaly occurs in the target application, the target function causing the runtime anomaly is determined based on the target parameter information. Through this method, when a runtime anomaly occurs in the target application, the location of the target function causing the runtime anomaly can be quickly determined based on the target parameter information corresponding to the target application during runtime, thereby achieving rapid location of the cause of JAVA card application runtime anomalies and improving the efficiency of locating the causes of JAVA card application runtime anomalies. Attached Figure Description
[0019] Figure 1 A schematic diagram of an anomaly analysis system structure provided for an embodiment of this application;
[0020] Figure 2 A flowchart illustrating an anomaly analysis method provided for embodiments of this application. Figure 1 ;
[0021] Figure 3 A flowchart illustrating an anomaly analysis method provided for embodiments of this application. Figure 2 ;
[0022] Figure 4 A flowchart illustrating an anomaly analysis method provided for embodiments of this application. Figure 3 ;
[0023] Figure 5 A flowchart illustrating an anomaly analysis method provided for embodiments of this application. Figure 4 ;
[0024] Figure 6 A flowchart illustrating an anomaly analysis method provided for embodiments of this application. Figure 5 ;
[0025] Figure 7 A flowchart illustrating an anomaly analysis method provided for embodiments of this application. Figure 6 ;
[0026] Figure 8A schematic diagram of an anomaly analysis device provided for an embodiment of this application;
[0027] Figure 9 This is a schematic diagram of an electronic device structure provided for an embodiment of this application. Detailed Implementation
[0028] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0029] In the description of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. "And / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" and "multiple" refer to two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.
[0030] The present application provides an abnormal problem analysis method that can be applied to an abnormal problem analysis system. Figure 1 A schematic diagram of the structure of this anomaly analysis system is shown. For example... Figure 1 As shown, the anomaly analysis system 20 includes: a JAVA card 21 and an electronic device 22.
[0031] The anomaly analysis system 20 can be used in the Internet of Things. The anomaly analysis system 20 (such as JAVA card 21 and electronic device 22) may include hardware such as multiple central processing units (CPUs), multiple memories, and storage devices storing multiple operating systems.
[0032] JAVA card 21 is used to run JAVA applets, such as Figure 1 As shown, the JAVA card 21 is an operating system in hardware. This operating system implements the Java Virtual Machine and provides the API for the JAVA card through the virtual machine, such as... Figure 1 The Java Card Standard API and Java Card Private API are used to run Java applets on the API.
[0033] Optionally, taking the implementation of Application 1 and Application 2 as examples, the workflow of the JAVA card can be as follows a1-a4:
[0034] a1. Power on JAVA card 21;
[0035] a2. Electronic device 22 sends request APDU, selects application 1 → JAVA card 21, schedules application 1 → send function APDU → application 1 response function APDU;
[0036] a3. Electronic device 22 sends request APDU, selects application 2 → JAVA card 21 schedules application 2 → sends function APDU → application 2 responds function APDU;
[0037] a4, JAVA card 21 power off.
[0038] Optionally, powering on the JAVA card can be understood as establishing a communication connection between the JAVA card 21 and the electronic device 22 running the JAVA card 21; powering off the JAVA card can be understood as terminating the communication connection between the JAVA card 21 and the electronic device 22 running the JAVA card 21.
[0039] It should be noted that the Java Card Virtual Machine can be understood as the tool used to interpret and execute Java bytecode instructions; the Java Card Standard API is the standard API defined by the Java specification; the Java Card Private API is a custom API used to provide additional functionality; and the Java applet, or Java Card application, can be a system-provided application or a user-written application. The system refers to the operating system of the Java Card.
[0040] It should be noted that for the system's built-in applications, a security domain needs to be set up to manage functions such as uploading, installing, and deleting applications, in order to improve the security of the JAVA card.
[0041] Optionally, when an application is run via JAVA card 21, the application will run automatically through the system after JAVA card 21 is powered on.
[0042] Electronic device 22 can be used for the Internet of Things, to run a JAVA card, and to perform anomaly analysis, such as... Figure 1 As shown, when an application in the JAVA card 21 malfunctions, the electronic device 22 interacts with the JAVA card 21 to analyze the malfunction.
[0043] Optionally, the electronic device can be a physical host or other device capable of running a JAVA card.
[0044] Optionally, after the JAVA card 21 is powered on and the system runs automatically, the electronic device 22 can send application protocol data units (APDUs) to access the functions of the JAVA card 21.
[0045] It should be noted that the JAVA card 21 only accepts two types of APDUs: APDUs for selecting an application (request APDUs) and APDUs for implementing application functions (function APDUs). The APDU for selecting an application can be implemented by the JAVA card 21 system, while the APDU for implementing application functions can be implemented by the application (target application).
[0046] Optionally, APDU can be understood as information that defines the data format for interaction between electronic device 22 and JAVA card 21. JAVA card 21 can process APDU through the process method.
[0047] The following describes an abnormal problem analysis method provided by an embodiment of this application with reference to the accompanying drawings.
[0048] like Figure 2 As shown, an anomaly analysis method provided in this application includes steps S201-S203:
[0049] S201. Connect the JAVA card and run the target application on the JAVA card.
[0050] The target application is an application pre-written into the JAVA card.
[0051] Optionally, you can connect a JAVA card, which can be understood as powering on the JAVA card so that the JAVA card can run the target application normally.
[0052] Optionally, the target application can be a Java applet.
[0053] For example, the structure of the target application T (i.e., the structure of the Java applet) can be in the following form:
[0054] import JAVAcard.framework.*; / / Imported packages
[0055] public class appletname extends Applet / / Class name, entry class
[0056] {
[0057] private byte[] echoBytes; / / Variables, constants, etc.
[0058] public static void install(byte[] bArray, short bOffset, byte bLength) / / Function to be called during installation
[0059] {}
[0060] public void process(APDU apdu) / / Function to process the incoming APDU request command.
[0061] {
[0062] selfClassName.A1(); / / Call the custom function A1
[0063] systemClassName.B1(); / / Call system function B1 ......
[0065] }
[0066] }
[0067] public class selfClassName / / Custom class
[0068] {
[0069] public void A1() / / Custom function A1
[0070] {
[0071] selfClassName.A2(10); / / Call the custom function A2
[0072] systemClassName.B2(); / / Call system function B2 ......
[0074] }
[0075] public void A2(short offset) / / User-defined function A2
[0076] {
[0077] ...... / / May call other functions
[0078] } ......
[0080] }
[0081] It is understandable that, based on the structure of the target application T, during its operation, the target application T first needs to call function A1, then call function B1, and function A1, in turn, needs to call functions A2 and B2.
[0082] Optionally, as shown in the above structure, the functions called by the target application can be diverse. For example, function A1 may also nest and call other functions, function A2 may also nest and call other functions, etc. In this embodiment, the example is only taken as the target application T involving only functions A1, A2, B1 and B2.
[0083] It should be noted that JAVA applets can be identified in JAVA cards using an application identifier (AID).
[0084] Optionally, a Java applet is a class structure. A class can contain variables and functions. Functions can call other functions (such as user-defined functions or system functions), and functions can be nested.
[0085] S202. Monitor the target parameter information corresponding to the target application during its operation in real time.
[0086] The target parameter information consists of information corresponding to multiple functions called by the target application during its operation. The target parameter information includes at least one of the following: the application identifier of the target application, the class corresponding to each of the multiple functions, and the basic information of each function.
[0087] Optionally, the JAVA card can be designed and adjusted to enable it to monitor the target parameter information of the target application in real time during its operation.
[0088] Optionally, real-time monitoring of the target application's corresponding target parameter information during operation can be understood as determining the target application's corresponding target parameter information during operation in real time and recording the target parameter information.
[0089] Optionally, the JAVA card operating system can save the target parameter information corresponding to the target application during its operation by calling a preset function.
[0090] Optional, such as Figure 3 When the target application is running, after each function is executed, the target parameter information corresponding to that function can be saved by calling the function, and an APDU response can be returned in a timely manner when an error occurs during a function call.
[0091] Optional, Figure 3 External entities in the context can refer to devices that establish a communication connection with the JAVA card, such as the host computer.
[0092] Optionally, a system-level function saveToQueue can be defined to save the target parameter information.
[0093] Optionally, the basic information of each function can be the identification information corresponding to each function, which is used to indicate the function from multiple functions.
[0094] Optionally, the basic information for each function can also be the function itself.
[0095] It should be noted that since a JAVA card may run multiple target applications simultaneously during operation, when monitoring the target parameter information corresponding to the target application during operation, it is also necessary to monitor the application identifier of the target application and the class corresponding to the function.
[0096] Optionally, a queue structure (stack structure) can be created in the JAVA card to take advantage of its last-in-first-out (LIFO) characteristic. The information of the first function called is stored at the bottom of the queue, and the information of the function called later is stored at the top of the queue. This ensures that the last function information stored is the information of the function that erred, and that the function information can be queried first.
[0097] S203. When a runtime exception occurs during the operation of the target application, the target function that caused the runtime exception is determined based on the target parameter information.
[0098] The objective function is one of several functions.
[0099] In this embodiment, when locating the cause of a JAVA card application's malfunction, a JAVA card is accessed, and a target application pre-written on the JAVA card is run on the JAVA card. The system monitors in real time the target parameters of multiple functions called by the target application during its execution, including the application identifier of the target application, the class of each function, and basic information of each function. Furthermore, when a malfunction occurs during the execution of the target application, the target function causing the malfunction is determined based on the target parameter information. Through this method, when a malfunction occurs in the target application, the location of the target function causing the malfunction can be quickly determined based on the target parameter information corresponding to the target application during its execution. This enables rapid location of the cause of the JAVA card application's malfunction, improving the efficiency of locating the cause of the JAVA card application's malfunction.
[0100] In one possible implementation, such as Figure 4 As shown, in the anomaly analysis method provided in this application embodiment, the above-mentioned S202 includes S301-S303:
[0101] S301. During the process of calling multiple functions through the target application, determine the target execution type of the target application.
[0102] The target running type is any one of the following: application debugging mode or application execution mode.
[0103] S302. When the target application is running in application debug mode, save the target parameter information corresponding to the multiple functions called by the target application during its operation.
[0104] S303. If no runtime exception occurs during the operation of the target application, delete the target parameter information.
[0105] It should be noted that the application debug mode can be understood as a mode that requires running and debugging the parameters of the target application (or JAVA card) to determine whether the target application (or JAVA card) can run normally; the application execution mode can be understood as the normal usage mode of the JAVA card after it has been determined that the target application (or JAVA card) can run normally.
[0106] Optionally, the target runtime type of the target application can be adjusted according to specific business needs.
[0107] Optionally, the running type of the target application can be adjusted by using a preset private instruction Y1.
[0108] For example, the default private instruction Y1 can be a request APDU in the format shown in Table 1:
[0109] Table 1
[0110]
[0111] Wherein, CLA is the instruction type of the command message, INS is the instruction code, P1 and P2 are the instruction parameters, Lc is the number of bytes in the instruction data field, and data is the data bit string sent by the instruction.
[0112] Optionally, the response APDU corresponding to the request APDU can be 9000 or not, where 9000 indicates that the run type setting was successful, and not 9000 indicates that the run type setting was incorrect.
[0113] Optional, such as Figure 3 As shown, after executing each function, the running type of the target application can be determined, and when the running type is application debug mode, the target parameter information of the function is saved.
[0114] Optionally, the running type of the target application can be determined before execution, and if the running type of the target application is application debug mode, the target parameter information corresponding to the target application during execution can be monitored in real time, that is, the running type of the function is determined only after the first function is executed.
[0115] In this embodiment, by combining business requirements, multiple operation types are set up to continuously record target parameter information when it is necessary to monitor the target parameters corresponding to the target application during operation. When the target application encounters an operation abnormality during operation, the location of the target function causing the operation abnormality can be determined in a timely manner based on the target parameter information, thereby improving the efficiency of locating the cause of the JAVA card application operation abnormality.
[0116] In one possible implementation, such as Figure 5 As shown, the anomaly analysis method provided in this application embodiment further includes S401:
[0117] S401. When the target application is running in application execution mode, there is no need to monitor the target parameter information corresponding to the target application during its operation in real time.
[0118] Optionally, when the target application is running in application execution mode and an exception occurs, the running type can be changed to application debug mode, and the target application can be rerun.
[0119] In this embodiment of the application, by combining business requirements, multiple running types are set so that target parameter information is not monitored when it is not necessary to monitor the target application during its operation. This improves the running performance of the JAVA card when running the target application and enhances the user experience.
[0120] In one possible implementation, such as Figure 6 As shown, in the anomaly analysis method provided in this application embodiment, the above-mentioned S203 includes S501-S502:
[0121] S501. When the target application encounters a runtime exception during operation, the target parameter information is obtained from the JAVA card based on preset instructions.
[0122] Optionally, a preset space can be reserved in the JAVA card to store the target parameter information corresponding to the target application during its operation.
[0123] Optionally, when setting the preset space, you also need to set the space size and space entry address.
[0124] Optionally, when a runtime exception occurs during the operation of the target application, the corresponding target parameter information can be obtained from the preset storage space based on preset private instructions, and the target function that caused the runtime exception of the target application can be determined based on the target parameter information.
[0125] Optionally, the default instruction Y2 includes multiple fields. For example, these multiple fields may include: the instruction category CLA of the command message, the instruction code INS, the instruction parameters P1 and P2, the number of bytes Lc present in the instruction data field, the data bit string data sent by the instruction, and the maximum expected number of data bytes Le in the response data field.
[0126] For example, the default private instruction Y2 can be a request APDU in the format shown in Table 2:
[0127] Table 2
[0128]
[0129] Wherein, CLA is the instruction type of the command message, INS is the instruction code, P1 and P2 are the instruction parameters, Lc is the number of bytes in the instruction data field, data is the data bit string sent by the instruction, and Le is the maximum expected number of data bytes in the response data field.
[0130] Optionally, the response APDU corresponding to the request APDU is the returned target parameter information.
[0131] Optionally, if no runtime exception occurs during the operation of the target application, the target parameter information can be deleted.
[0132] Optionally, the response APDU returned by the request APDU can be used to determine whether the target application has encountered a runtime exception during operation.
[0133] It should be noted that, for the private instructions in this application embodiment, before executing the private instructions, it is necessary to select the main security domain or the security domain where the applet is located and perform mutual authentication.
[0134] S502. Based on the application identifier of the target application, the class corresponding to each function in the multiple functions, and the basic information of each function, determine the target function that is running abnormally from the multiple functions.
[0135] For example, the target parameter information can be stored in a preset storage space with the following structure:
[0136] {
[0137] Application AID
[0138] kind
[0139] function
[0140] }
[0141] In this embodiment, target parameter information is obtained from the JAVA card through preset instructions, and then the target function is determined based on the target parameter information, thereby realizing the rapid location of the target function that is running abnormally, so as to improve the efficiency of locating the cause of the JAVA card application running abnormally.
[0142] In one possible implementation, the target parameter information also includes at least one of the following: the input parameters of each function, the output parameters of each function, and the exception reason corresponding to each function, such as... Figure 7 As shown, the anomaly analysis method provided in this application embodiment further includes S601:
[0143] S601. When a runtime exception occurs during the operation of the target application, the cause of the runtime exception is determined based on the input parameters of each function, the output parameters of each function, the exception cause corresponding to each function, and the exception message displayed by the target application.
[0144] For example, target parameter information can be stored in a preset storage space with the following structure: {
[0145] Application AID
[0146] kind
[0147] function
[0148] Add ginseng
[0149] Out of the dinosaur
[0150] Error reason (this field is 0 if correct; otherwise, the reason)
[0151] }
[0152] Here, input parameters refer to the input parameters of the function, which can be understood as the parameters that the target application inputs to the function when calling the function; output parameters refer to the output parameters of the function, which can be understood as the parameters that the function returns after the target application calls the function; error messages refer to the exception reasons corresponding to the function, which are the format and reasons for the exception when the target application encounters an exception while calling the function.
[0153] For example, when the target application calls a function, it may encounter runtime errors due to function nesting issues, incorrect input parameter formats, or incorrect output parameter formats. When an error occurs, the cause of the error can be stored in the target parameter information corresponding to that function.
[0154] Optionally, as shown in the target parameter information format above, when a function call does not encounter an exception, the exception reason field corresponding to that function is 0.
[0155] Optionally, the exception message displayed by the target application can be the error status word returned when the target application encounters an exception, i.e., the error status word returned when the JAVA card executes the request APDU.
[0156] It is understandable that the abnormal reasons of the functions included in the target parameter information are objective reasons for the target application's runtime (such as format problems, call errors, etc.). At this time, administrators need to further combine the input parameters, output parameters, and abnormal prompt information to determine the true reason for the abnormal operation of the target application.
[0157] For example, if the error reason for the function in the target parameter information is that the input parameter does not meet the format requirements, but after the administrator judges that the input parameter is normal, and determines that the reason for the abnormal operation of the target application is that the function to be used needs to be adjusted or changed.
[0158] In this embodiment of the application, the function call flow of the target application and the cause of the exception are analyzed by using the target parameter information. Furthermore, by combining the error status word returned by the JAVA card when executing the request APDU due to the running exception, the code location of the target application running exception is quickly located, thereby realizing the analysis of the cause of the target application running exception.
[0159] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0160] This application embodiment can divide an anomaly analysis device into functional modules based on the above method example. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. Optionally, the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0161] Figure 8 This is a schematic diagram of an anomaly analysis device provided in an embodiment of this application. Figure 8 As shown, the anomaly analysis device 40 is used to improve the efficiency of locating the causes of JAVA card application runtime anomalies, for example, for executing... Figure 2 An anomaly analysis method is shown. The anomaly analysis device 40 includes: an operation unit 401, a processing unit 402, and a determination unit 403.
[0162] The running unit 401 is used to connect to a JAVA card and run a target application on the JAVA card. The target application is an application pre-written in the JAVA card.
[0163] The processing unit 402 is used to monitor the target parameter information corresponding to the target application during its operation in real time. The target parameter information is the information corresponding to multiple functions called by the target application during its operation. The target parameter information includes at least one of the following: the application identifier of the target application, the class corresponding to each of the multiple functions, and the basic information of each function.
[0164] The determining unit 403 is used to determine the target function that caused the target application to run abnormally when the target application runs abnormally. The target function is a function among multiple functions.
[0165] In one possible implementation, the determining unit 403 is used to determine the target running type of the target application during the process of calling multiple functions through the target application. The target running type is any one of the following: application debugging mode or application execution mode.
[0166] The processing unit 402 is used to save the target parameter information corresponding to the multiple functions called by the target application during its operation when the target application is running in application debug mode.
[0167] The processing unit 402 is used to delete the target parameter information when the target application does not encounter any runtime exceptions during operation.
[0168] In one possible implementation, when the target application is running in application execution mode, there is no need to monitor the target parameter information corresponding to the target application during its execution in real time.
[0169] In one possible implementation, such as Figure 8 As shown, the anomaly analysis device 40 also includes an acquisition unit 404.
[0170] The acquisition unit 404 is used to acquire target parameter information from the JAVA card based on preset instructions when the target application encounters a runtime exception during operation.
[0171] The determination unit 403 is used to determine the target function that is running abnormally from multiple functions based on the application identifier of the target application, the class corresponding to each function in the multiple functions, and the basic information of each function.
[0172] In one possible implementation, the target parameter information may also include at least one of the following: the input parameters of each function, the output parameters of each function, and the exception reason for each function.
[0173] The determining unit 403 is used to determine the cause of the target application's runtime exception when the target application encounters a runtime exception during operation, based on the input parameters of each function, the output parameters of each function, the exception cause corresponding to each function, and the exception prompt information displayed by the target application.
[0174] In the case where the functions of the integrated modules described above are implemented in hardware, this application provides a possible structural schematic diagram of the electronic device involved in the above embodiments. For example... Figure 9 As shown, an electronic device 70 is used to improve the efficiency of locating the cause of JAVA card application runtime anomalies, for example, for executing... Figure 2 This illustrates an anomaly analysis method. The electronic device 70 includes a processor 701, a memory 702, and a bus 703. The processor 701 and the memory 702 are connected via the bus 703.
[0175] Processor 701 is the control center of the communication device. It can be a single processor or a collective term for multiple processing elements. For example, processor 701 can be a general-purpose central processing unit (CPU) or other general-purpose processors. Among them, the general-purpose processor can be a microprocessor or any conventional processor.
[0176] As one embodiment, processor 701 may include one or more CPUs, for example Figure 9 CPU 0 and CPU 1 are shown in the diagram.
[0177] The memory 702 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0178] As one possible implementation, the memory 702 can exist independently of the processor 701. The memory 702 can be connected to the processor 701 via a bus 703 and is used to store instructions or program code. When the processor 701 calls and executes the instructions or program code stored in the memory 702, it can implement the abnormal problem analysis method provided in the embodiments of this application.
[0179] In another possible implementation, the memory 702 can also be integrated with the processor 701.
[0180] Bus 703 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. This bus can be divided into address bus, data bus, and control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0181] It should be pointed out that, Figure 9 The structure shown does not constitute a limitation on the electronic device 70. Except... Figure 9 In addition to the components shown, the electronic device 70 may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0182] As an example, combined Figure 8 The functions implemented by the operation unit 401, processing unit 402, determination unit 403, and acquisition unit 404 in the abnormal problem analysis device 40 are the same as those of the operation unit 401, processing unit 402, determination unit 403, and acquisition unit 404. Figure 9 The processor 701 in it has the same function.
[0183] Optional, such as Figure 9 As shown, the electronic device 70 provided in this application embodiment may further include a communication interface 704.
[0184] Communication interface 704 is used to connect with other devices via a communication network. This communication network can be Ethernet, a wireless access network, a wireless local area network (WLAN), etc. Communication interface 704 may include a receiving unit for receiving data and a transmitting unit for transmitting data.
[0185] In one design, the communication interface in the electronic device provided in this application embodiment can also be integrated into the processor.
[0186] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional units is used as an example. In practical applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the device can be divided into different functional units to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0187] This application also provides a computer-readable storage medium storing instructions. When a computer executes these instructions, the computer performs each step of the method flow shown in the above-described method embodiments.
[0188] Embodiments of this application provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform an anomaly analysis method as described in the above method embodiments.
[0189] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof, or any other form of computer-readable storage medium in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In the embodiments of this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0190] Since the electronic devices, computer-readable storage media, and computer program products in the embodiments of this application can be applied to the above methods, the technical effects they can achieve can also be referred to the above method embodiments. The embodiments of this application will not be repeated here.
[0191] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the scope of protection of this application.
Claims
1. An anomaly analysis method, characterized in that, The method includes: Connect a JAVA card and run a target application on the JAVA card, wherein the target application is an application pre-written in the JAVA card; During the process of calling multiple functions through the target application, the target execution type of the target application is determined, and the target execution type is any one of the following: application debugging mode, application execution mode; When the target application is running in the application execution mode and an error occurs during its operation, the target application's running type is adjusted to the application debug mode using a preset private instruction, and the target application is then re-run. When the target application is running in the application debug mode, the target parameter information corresponding to the target application during its operation is monitored and saved in real time. This includes: establishing a stack structure or queue structure in the JAVA card, using the stack structure or queue structure to save the target parameter information, such that the information of the last called function is located at the top of the stack structure or queue structure; wherein, the target parameter information is information corresponding to multiple functions called by the target application during its operation, and the target parameter information includes at least one of the following: the application identifier of the target application, the class corresponding to each of the multiple functions, and the basic information of each function; When the target application encounters a runtime exception during operation, the target parameter information is obtained from the JAVA card based on a preset instruction, and the target function that caused the runtime exception of the target application is determined based on the target parameter information. The target function is a function among the plurality of functions.
2. The method according to claim 1, characterized in that, The method further includes deleting the target parameter information when the target application does not experience any operational abnormalities during operation.
3. The method according to claim 1, characterized in that, The method further includes: When the target application is running in the application execution mode, there is no need to monitor the target parameter information corresponding to the target application during its operation in real time.
4. The method according to claim 1, characterized in that, The target parameter information further includes at least one of the following: input parameters of each function, output parameters of each function, and the exception reason corresponding to each function. The method further includes: When the target application encounters a runtime exception, the cause of the runtime exception is determined based on the input parameters of each function, the output parameters of each function, the exception reason corresponding to each function, and the exception prompt information displayed by the target application.
5. An anomaly analysis device, characterized in that, The anomaly analysis device includes: an operation unit, a processing unit, a determination unit, and an acquisition unit; The running unit is used to connect to a JAVA card and run a target application on the JAVA card, wherein the target application is an application pre-written in the JAVA card; The determining unit is used to determine the target running type of the target application during the process of calling multiple functions through the target application. The target running type is any one of the following: application debugging mode, application execution mode; The processing unit is configured to, when the target application's running type is the application execution mode and the target application encounters an error, adjust the target application's running type to the application debugging mode using a preset private instruction and rerun the target application; when the target application's running type is the application debugging mode, monitor and save the target parameter information corresponding to the target application during its operation in real time, including: establishing a stack structure or queue structure in the JAVA card, using the stack structure or queue structure to save the target parameter information, such that the information of the last called function is located at the top of the stack structure or queue structure; wherein, the target parameter information is information corresponding to multiple functions called by the target application during its operation, and the target parameter information includes at least one of the following: the application identifier of the target application, the class corresponding to each of the multiple functions, and the basic information of each function; The acquisition unit is used to acquire the target parameter information from the JAVA card based on a preset instruction when the target application encounters a running exception during operation. The determining unit is used to determine the target function that caused the target application to run abnormally when the target application runs abnormally during operation, based on the target parameter information. The target function is one of the plurality of functions.
6. The anomaly analysis device according to claim 5, characterized in that, The processing unit is used to delete the target parameter information when the target application does not encounter any operational abnormalities during operation.
7. The anomaly analysis device according to claim 5, characterized in that, When the target application is running in the application execution mode, there is no need to monitor the target parameter information corresponding to the target application during its operation in real time.
8. The anomaly analysis device according to claim 5, characterized in that, The target parameter information also includes at least one of the following: the input parameters of each function, the output parameters of each function, and the exception reason corresponding to each function; The determining unit is used to determine the cause of the target application's runtime abnormality when the target application encounters a runtime abnormality during operation, based on the input parameters of each function, the output parameters of each function, the abnormality cause corresponding to each function, and the abnormality prompt information displayed by the target application.
9. An electronic device, characterized in that, include: A processor and a memory; wherein the memory is used to store one or more programs, the one or more programs including computer execution instructions, wherein when the electronic device is running, the processor executes the computer execution instructions stored in the memory to cause the electronic device to perform an anomaly analysis method according to any one of claims 1-4.
10. A computer-readable storage medium for storing one or more programs, characterized in that, The one or more programs include instructions that, when executed by a computer, cause the computer to perform an anomaly analysis method according to any one of claims 1-4.
Citation Information
Patent Citations
Method for testing software by applying across function analysis
CN101894064A
Program debugging method and system
CN107885650A
Program running processing method and device and computer readable storage medium
CN110471832A
Application program test exception analysis method and device
CN113094269A