CN117370178A - Software tracking method and device, storage medium and electronic equipment - Google Patents

Software tracking method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN117370178A
CN117370178A CN202311332113.7A CN202311332113A CN117370178A CN 117370178 A CN117370178 A CN 117370178A CN 202311332113 A CN202311332113 A CN 202311332113A CN 117370178 A CN117370178 A CN 117370178A
Authority
CN
China
Prior art keywords
software
tracking
target
dynamic link
link library
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311332113.7A
Other languages
Chinese (zh)
Inventor
张辉
王成磊
寇栋
胡爱涛
石加圣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhirui Electronic Technology Co ltd
Original Assignee
Shanghai Zhirui Electronic Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Zhirui Electronic Technology Co ltd filed Critical Shanghai Zhirui Electronic Technology Co ltd
Priority to CN202311332113.7A priority Critical patent/CN117370178A/en
Publication of CN117370178A publication Critical patent/CN117370178A/en
Pending legal-status Critical Current

Links

Classifications

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

Landscapes

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

Abstract

The application relates to the technical field of computers, and provides a software tracking method and device, a storage medium and electronic equipment. The software tracking method is applied to a first dynamic link library loaded into a process corresponding to target software, and specifically comprises the following steps: calling a software tracking interface provided by target software, and configuring and/or controlling the function of generating software tracking information in the target software so as to open the function of generating the required first software tracking information; and receiving and outputting first software tracking information generated by the target software in the running process. The method can realize complex configuration and/or flexible control of the function of generating the software tracking information, thereby accurately acquiring the required software tracking information and analyzing the software errors more efficiently. In addition, the resource expense for acquiring the software tracking information is small, and the target software does not need to be modified and compiled, so that the method is simple and efficient to realize.

Description

Software tracking method and device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a software tracking method and apparatus, a storage medium, and an electronic device.
Background
Software tracking is one of the main methods for analyzing and solving software operation errors, and may refer to recording and outputting specific status information of software execution during the software operation, which is called software tracking information. The software developer can understand the occurrence scene and condition of the software operation error by reading and analyzing the software tracking information, so as to find a solution for eliminating the software operation error.
However, in the prior art, since the acquired software trace information is not accurate enough, it is disadvantageous to analyze software errors.
Disclosure of Invention
An objective of the embodiments of the present application is to provide a software tracking method and apparatus, a storage medium, and an electronic device, so as to improve at least some of the above technical problems.
In order to achieve the above purpose, the present application provides the following technical solutions:
in a first aspect, an embodiment of the present application provides a software tracking method applied to a first dynamic link library loaded into a process corresponding to target software, where the method includes: calling a software tracking interface provided by the target software, and configuring and/or controlling the function of generating the software tracking information in the target software so as to open the function of generating the required first software tracking information; and receiving and outputting the first software tracking information generated by the target software in the running process.
The method realizes the configuration and/or control of the function of generating the software tracking information in the target software by calling the software tracking interface through the first dynamic link library, and whether the first dynamic link library or the software tracking interface is programmable, thereby realizing the complex configuration and/or flexible control of the function of generating the software tracking information, accurately acquiring the required software tracking information (the first software tracking information), and further analyzing the software errors more efficiently. In addition, the method can accurately acquire the required software tracking information, but not acquire all available software tracking information, so that the resource cost for acquiring the information is small. In addition, the method obtains and outputs the software tracking information through the first dynamic link library loaded in the process corresponding to the target software, so that modification and compiling of the target software are not needed, and the method is simple and efficient to realize.
In an implementation manner of the first aspect, before the target software runs, the first dynamic link library is loaded into a process corresponding to the target software by means of preferential loading.
In the above implementation manner, the first dynamic link library is loaded preferentially before the target software is run, so that the configuration and/or control of the function of generating the software tracking information in the target software can be completed before the target software is run, and the software tracking information (if needed) generated in the running process of the target software can be acquired by the first dynamic link library.
In an implementation manner of the first aspect, if the operating system in which the target software is located is a linux system, a system environment variable ld_reload is configured to include the first dynamic link library, so as to support preferential loading of the first dynamic link library.
The implementation mode provides a method for configuring preferential loading under a linux system.
In one implementation of the first aspect, the target software includes a main program and at least one second dynamic link library, and the software tracking interface is provided by the main program and/or the second dynamic link library.
In the above implementation manner, the software tracking interface may be implemented by the main program and/or the second dynamic link library, which is relatively flexible.
In an implementation manner of the first aspect, the calling a software tracking interface provided by the target software includes: and calling a software tracking interface provided by the target software when the construction function of the global object in the first dynamic link library is triggered to be executed.
Since the construction of the global object is performed prior to the entry function of the target software, in the above implementation, the operation of calling the software trace interface may be performed in the construction function of the global object, so that the configuration and/or control of the function of generating the software trace information in the target software is completed before the target software is run.
In an implementation manner of the first aspect, the receiving and outputting the first software trace information generated by the target software during the running process includes: caching first software tracking information generated by the target software in the running process; and outputting all the cached first software tracking information when the destructor of the global object is triggered to be executed.
In the implementation manner, all cached first software tracking information is not output until the target software is finished in operation and the global object is destructed, so that frequent data output operation can be avoided, and the pressure of the central processing unit is reduced.
In one implementation manner of the first aspect, the method further includes: creating an information processing thread when the constructor of the global object is triggered to be executed; the receiving and outputting the first software tracking information generated by the target software in the running process includes: caching first software tracking information generated by the target software in the running process; when the information processing thread is in an operating state, outputting first software tracking information of the current cache; and when the destructor of the global object is triggered to be executed, if the cached first software tracking information is not yet output, outputting the rest first software tracking information.
In the implementation manner, the first software trace information of the current cache is output whenever the information processing thread is in the running state, so that the problem of first software trace information loss of the cache caused by unexpected termination of the target software can be avoided.
In a second aspect, embodiments of the present application provide a software tracking device, including: the interface calling module is used for calling a software tracking interface provided by the target software by using a first dynamic link library loaded in a process corresponding to the target software, and configuring and/or controlling a function of generating software tracking information in the target software so as to open a function of generating required first software tracking information; and the tracking information processing module is used for receiving and outputting the first software tracking information generated by the target software in the running process by utilizing the first dynamic link library.
In a third aspect, embodiments of the present application provide a computer program product comprising computer program instructions which, when read and executed by a processor, perform the method provided by the first aspect or any one of the possible implementations of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having stored thereon computer program instructions which, when read and executed by a processor, perform the method provided by the first aspect or any one of the possible implementations of the first aspect.
In a fifth aspect, embodiments of the present application provide an electronic device, including: a memory and a processor, the memory having stored therein computer program instructions which, when read and executed by the processor, perform the method of the first aspect or any one of the possible implementations of the first aspect.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 illustrates a possible working principle of a software tracking method provided in an embodiment of the present application;
FIG. 2 illustrates a possible flow of a software tracking method provided by an embodiment of the present application;
FIG. 3 shows functional modules that may be included in the software tracking device provided in an embodiment of the present application;
fig. 4 shows a possible structure of the electronic device provided in the embodiment of the present application.
Detailed Description
In the normal running process of the software, in order to reduce unnecessary time and computing resource expenditure, software trace information is not generated generally, and only when software running errors are encountered, the function of generating the software trace information is opened by some methods, so that the software trace information is collected to analyze and solve the problem.
In the comparative embodiment, the function of opening and configuring the generated software trace information may employ the following method: (1) Recompilation of versions containing functions to generate software trace information; (2) Configuring system environment variables, and opening and configuring a software tracking information function according to values set by the system environment variables when software runs; (3) When the software is started, corresponding command options are input to open and configure the software tracking information generating function.
However, the above method has some drawbacks: the method (1) requires recompilation to generate new version software, increases the complexity of version control and easily causes version confusion; the environment variable in the method (2) and the command option function in the method (3) are relatively simple, and complex configuration and flexible control on the function of generating the software tracking information are difficult to realize; the method (3) requires the main program of the software to provide support, i.e. the main program must be able to recognize and process the corresponding command options, increasing the burden on the developer.
According to the software tracking method, the software tracking device, the computer-readable storage medium and the electronic equipment, the complex configuration and/or flexible control of the function of generating the software tracking information in the target software are realized in a programmable mode, so that the problems in the method are solved.
It should be noted that the new technical solutions of the embodiments of the present application, as well as the defects of the comparative embodiments mentioned above, are obtained by long-term research experiments by the inventor, and should be regarded as contributions of the inventor based on the prior art, not what already exists in the prior art.
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The terms "first," "second," and the like, are used merely to distinguish one entity or action from another entity or action, and are not to be construed as indicating or implying any actual such relationship or order between such entities or actions.
Fig. 1 shows a possible working principle of the software tracking method provided in the embodiment of the present application. Referring to fig. 1, the method can be divided into two layers, a user plane and a system plane, respectively.
Colloquially explained, the user plane is content that the user can directly contact, e.g., content of the user plane is either user configurable (e.g., tracking configuration files, system environment variables), or presentable to the user (e.g., tracking information files), and so forth.
The system plane is the content of the program execution plane (the program is executed on an operating system) and comprises a first dynamic link library and target software. The software to be tracked is called target software, the software tracking information is collected by the target software, and the running problem (such as running error, performance bottleneck, etc.) of the target software is also to be analyzed based on the software tracking information. The target software may include a main program and at least one second dynamic link library called by the main program, two second dynamic link libraries are shown in FIG. 1, labeled second dynamic link library-1 and second dynamic link library-2, respectively, although other numbers of second dynamic link libraries are possible.
The first dynamic link library may be used to perform a software tracking method provided by embodiments of the present application, and specific steps of the method will be described later. In order to facilitate data interaction with the target software, the first dynamic link library needs to be loaded into a process corresponding to the target software, and the loading method is not limited, for example, a preferential loading mode (details are described later) or other dynamic link library injection modes can be adopted.
Further details of FIG. 1 will be described in connection with FIG. 2, and it should be noted that some of the components of FIG. 1 are optional, e.g., tracking information files may not be used in every implementation of a software tracking method.
Fig. 2 shows a flow of a software tracking method according to an embodiment of the present application. The method may be performed by, but is not limited to, the electronic device in fig. 4, with reference to the description of fig. 4 below regarding possible structures of the electronic device. Specifically, the method may be performed by a first dynamic link library loaded into a process corresponding to the target software, and referring to fig. 2, the software tracking method includes:
step S110: the first dynamic link library calls a software tracking interface provided by the target software, and configures and/or controls the function of generating the software tracking information in the target software so as to open the function of generating the required first software tracking information.
Step S110 may be performed after the first dynamic link library is loaded, and if the first dynamic link library is loaded before the target software is run, step S110 is performed before the target software is run. The target software starts to run, which may refer to the main program of the target software starting to run, and the main program of the target software starting to run, which may refer to the entry function of the main program being called.
The target software may provide one or more software interfaces for the first dynamically linked library to call, referred to as software trace interfaces, for configuring and/or controlling the functions in the target software that generate the software trace information.
The software trace information of the target software may refer to information generated during the operation of the target software for describing the operation state of the target software. For example, during the running of the target software, the parameters of each call of a certain service interface, the number of times a certain service interface is called, the duration of each call of a certain service interface, etc.
The code for generating the software trace information in the target software may be distributed in various locations of the target software, such as in the code of the main program and/or the second dynamically linked library, which may provide the functionality of generating the software trace information.
The software tracking interface controls the function of generating the software tracking information in the target software, and can refer to the control of opening or closing the function of generating the software tracking information. For example, by default, the function of generating the software trace information is turned off, the code of generating the software trace information is not executed, and once the operation of the target software is in error, the function of generating the software trace information can be turned on by loading the first dynamic link library and calling the software trace interface, and then the code of generating the software trace information is executed when the target software is re-operated.
Optionally, there may be one or more software trace interfaces, where there are multiple software trace interfaces, each interface may only be responsible for generating a portion of the software trace information, so that different software trace interfaces are invoked to flexibly control the generation of different software trace information.
The software trace interface may configure the functionality of the target software that generates the software trace information, and may refer to specific configurations of which software trace information to obtain and/or how to obtain such software trace information.
For example, by calling a certain software tracking interface, a collection function (collected data is software tracking information) of 100 total parameters in a certain functional module of the target software can be controlled to be opened, but the 100 parameters may not be all parameters to be checked by a user, so when the software tracking interface is called, 10 parameters can be configured as parameters to be collected (for example, 10 parameters to be collected can be specified in calling parameters of the software tracking interface).
For another example, the target software is a piece of software capable of controlling the hardware, and the software tracking information includes some information obtained from the hardware, but to obtain the information from the hardware, some configuration needs to be performed on the hardware first so that the hardware can generate the information, and therefore, the software tracking interface can be called to implement the pre-configuration on the hardware, so that the software tracking information can be successfully obtained.
When the software tracking interface is called, the control and configuration operations can be performed only by one or both of the control and configuration operations, and the control and configuration operations can be performed according to specific requirements. For example, if the function for generating the software trace information is opened by default, only the function for generating the software trace information may be further configured without opening it. For another example, if all the software trace information is required by the user, only the function of generating the software trace information may be turned on without further configuration. For another example, it is necessary to both turn on the function of generating the software trace information and further configure it to designate the information items that some users need to collect.
The software tracking interface is programmable for configuring and/or controlling the function of generating the software tracking information in the target software, and a developer can write the internal logic of the software tracking interface according to the requirement to realize more complex configuration and/or more flexible control functions.
Alternatively, the software tracking interface may be implemented as part of the main program and/or the second dynamically linked library. For example, the main program may implement a portion of the software trace interface for configuring and/or controlling functions of the main program that generate software trace information; the second dynamic link library-1 may implement a part of the software tracking interface, which is used to configure and/or control the function of generating the software tracking information in the second dynamic link library-1; the second dynamic link library-2 may implement part of a software trace interface for configuring and/or controlling the functionality of generating software trace information in the second dynamic link library-2. For another example, the main program may implement all software tracking interfaces for configuring and/or controlling the functions of the main program, the second dynamic link library-1, and the second dynamic link library-2 that generate the software tracking information; in particular, the software trace interface may also be implemented as a separate second dynamic link library, different from the second dynamic link library implementing the business functions of the target software.
The first dynamic link library is also programmable, and a developer can write the internal logic of the first dynamic link library as required, determine which software trace interfaces to call, the order of the calls, etc.
Optionally, referring to fig. 1, the first dynamic link library may also read a trace configuration file, and call the software trace interface according to the trace configuration file. For example, the tracking configuration file may configure the functional modules interested by the user according to a custom grammar, that is, the user wants to obtain the software tracking information in the functional modules, and after the first dynamic link library parses the tracking configuration file, the software tracking interface corresponding to the functional modules is called. In the alternative, the information in the tracking profile may also be replaced with information from a user interface, and so on.
In step S110, the software trace information required by the user in all the software trace information that can be generated by the target software is referred to as the first software trace information, and by reasonably configuring and/or controlling the functions for generating the software trace information in the software trace interfaces and reasonably selecting which software trace interfaces to call in the first dynamic link library, only the functions for generating the first software trace information in the target software can be opened, so that only the first software trace information is generated when the target software runs.
Step S120: the first dynamic link library receives and outputs first software tracking information generated by the target software in the running process.
Based on the operation in step S110, the target software generates first software trace information during the running process, and sends the first software trace information to the first dynamic link library. Note that "sending" here may be understood as an act of handing over the handling right of the first software trace information from the target software to the first dynamic link library. For example, the target software writes the first software trace information into a buffer area accessible by a certain first dynamic link library, which belongs to a sending behavior; for another example, the target software may transfer the first software trace information to the first dynamic link library via a data transfer pipeline, and may also be a sending action, etc.
After the first dynamic link library receives the first tracking information, the first tracking information can be output, wherein the output can be understood as a behavior of transmitting the first tracking information to the outside of the first dynamic link library, and after the first tracking information is output, a user can acquire the first tracking information, so that the running problem of the target software can be analyzed based on the first tracking information. For example, the first dynamic link library may write first tracking information into a file, such as the tracking information file in fig. 1, for viewing by a user; for another example, the first dynamic link library may send the first tracking information to another software other than the target software, the software may present the first tracking information on a user interface, and so on.
Optionally, before outputting the first tracking information, the first dynamic link library may further perform preprocessing on the first tracking information, and output the processed first tracking information. The preprocessing may include one or more of statistics, filtering, format conversion, and the like. For example, the first tracking information includes the time length of each service interface called each time, the first dynamic link library counts all the first tracking information received from the beginning to the end of the running of the target software, obtains the total time length of each service interface called during the running of the target software, determines the total time length of the top 10, and outputs the total time lengths and the information of the corresponding service interfaces as the processed first tracking information, so that after obtaining the information, a user can determine which service interfaces are mainly the performance bottleneck of the target software, and further can optimize the internal logic of the service interfaces.
The first dynamic link library may output the first software trace information at a time, for example, immediately after receiving the first software trace information, when certain conditions are met (e.g., at a time), when the target software is finished running, etc., which will be described further below.
Briefly summarizing the method in fig. 2, the method invokes the software tracking interface through the first dynamic link library to implement configuration and/or control of the function of generating the software tracking information in the target software, where both the first dynamic link library and the software tracking interface are programmable, so that complex configuration and/or flexible control of the function of generating the software tracking information can be implemented, and the required software tracking information (first software tracking information) can be accurately obtained, so that software errors can be more efficiently analyzed.
In addition, the method can accurately acquire the required software tracking information, but not acquire all available software tracking information, so that the resource cost for acquiring the information is small.
In addition, the method obtains and outputs the software tracking information through the first dynamic link library loaded in the process corresponding to the target software, so that modification and compiling of the target software are not needed, and the method is simple and efficient to realize. Note that the software trace interface implemented in the target software belongs to the code necessary to acquire the software trace information, and is not regarded as modification of the target software in the usage link.
In one implementation of the software tracking method, the first dynamic link library may be loaded into a process corresponding to the target software by means of preferential loading before the target software is run.
For example, if the operating system in which the target software is located is a linux system, the system environment variable ld_reload may be configured to include the first dynamic link library to support preferential loading of the first dynamic link library. Specifically, after ld_reload is configured, if the first dynamic link library is loaded first in the system as long as the software is started (even if the software is not the target software), the call of the first dynamic link library to the software tracking interface is not responded, and only the target software responds to the call of the first dynamic link library to the software tracking interface, since the software tracking interface is not realized in other software except the target software. In fig. 1, the system environment variable in the upper right corner is the ld_reload variable.
For example, if the second dynamic link library-1 implements the software tracking interface, the second dynamic link library-1 may be loaded in an explicit or implicit manner when the first dynamic link library is loaded, so that the software tracking interface may be invoked in the first dynamic link library. Wherein, explicitly loading the second dynamic link library-1 may refer to loading by using codes in the first dynamic link library; the implicit loading of the second dynamic link library-1 may refer to configuring the dependency of the second dynamic link library-1 and the first dynamic link library, such that when the operating system loads the first dynamic link library, the second dynamic link library-1 is also loaded according to the dependency.
For the case that the operating system where the target software is located is other operating systems, similar functions can also be realized based on the preferential loading mechanism provided by the corresponding operating system.
In the above implementation manner, the first dynamic link library is loaded preferentially before the target software is run, so that the configuration and/or control of the function of generating the software tracking information in the target software can be completed before the target software is run, and the software tracking information (if needed) generated in the running process of the target software can be acquired by the first dynamic link library.
In one implementation of the software tracking method, a global object may be implemented in the first dynamic link library, and a software tracking interface provided by the target software is invoked in a constructor of the global object. Since the construction of the global object is performed prior to the execution of the entry function of the main program of the target software (the global object may be constructed when the first dynamic link library is loaded), the operation of calling the software trace interface is put into the construction function of the global object for execution, so that the configuration and/or control of the function of generating the software trace information in the target software can be completed before the target software is run, and thus, the software trace information generated by the target software in the running process (if needed) can be acquired by the first dynamic link library.
Next, in the case that the global object is implemented in the first dynamic link library, the possible implementation manner of step S120 is described further:
mode 1
Step S120 may be implemented as: caching first software tracking information generated in the running process of target software; when the destructor of the global object is triggered to be executed, all the cached first software trace information is output.
For example, in the construction function of the global object in the first dynamic link library, a memory may be applied as a buffer, the first trace information generated by the target software is written into the buffer (i.e., the target software sends the first trace information to the first dynamic link library, the first dynamic link library caches the received first trace information), after the running of the target software is finished, the global object is destructed, at this time, the destructing function of the global object is called, and in the destructing function of the global object, all the first software trace information cached in the buffer is output.
In the mode 1, all cached first software tracking information is not output until the running of the target software is finished and the global object is destructed, so that frequent data output operation can be avoided, the pressure of a central processing unit is reduced, and the starting of the software tracking function does not cause too great influence on the running of the target software.
Mode 2
In addition to invoking the software trace interface, an information processing thread is created in the constructor of the global object, which is subsequently used to output the first trace information.
Step S120 may be implemented as: caching first software tracking information generated in the running process of target software; when the information processing thread is in an operating state, outputting first software tracking information of the current cache; when the destructor of the global object is triggered to be executed, if the cached first software tracking information is not yet output, outputting the rest first software tracking information.
For example, in the constructor of the global object in the first dynamic link library, a block of memory may be applied as a buffer into which the first trace information generated by the target software is written (i.e., the target software sends the first trace information to the first dynamic link library, which caches the received first trace information).
When the information processing thread is in an operating state, the first software tracking information currently cached in the buffer area is output. For example, the information processing thread may be in a sleep state after being created, and wake up when certain trigger conditions are met, and each time the information processing thread wakes up (the thread is in a running state), the first software trace information currently cached in the buffer is output. The trigger condition may include one or a combination of the following: the current time is a preset wake-up time (such as timed wake-up), data is written in the buffer area, and the data in the buffer reaches a certain quantity.
After the running of the target software is finished, the global object is destructed, at the moment, a destructing function of the global object is called, and in the destructing function of the global object, if the cached first software tracking information still exists in the buffer zone and is not yet output, the remaining first software tracking information in the buffer zone is output, and meanwhile, the operations of releasing the resources of the information processing thread and the like can be executed.
In mode 2, whenever the information processing thread is in an operating state, the first software trace information of the current cache is output, so that the problem of loss of the first software trace information of the cache caused by unexpected termination of the target software can be avoided.
Fig. 3 illustrates functional modules that may be included in the software tracking device 200 provided in an embodiment of the present application. Referring to fig. 3, the software tracking device 200 includes:
an interface calling module 210, configured to call a software trace interface provided by the target software by using a first dynamic link library loaded into a process corresponding to the target software, and configure and/or control a function of generating software trace information in the target software, so as to open a function of generating required first software trace information;
and the tracking information processing module 220 is configured to receive and output the first software tracking information generated by the target software in the running process by using the first dynamic link library.
In one implementation of the software tracking device 200, before the target software runs, the first dynamic link library is loaded into a process corresponding to the target software by means of preferential loading.
In one implementation of the software tracking apparatus 200, if the operating system in which the target software is located is a linux system, a system environment variable ld_reload is configured to include the first dynamic link library, so as to support preferential loading of the first dynamic link library.
In one implementation of the software tracking device 200, the target software includes a main program and at least one second dynamic link library, the software tracking interface being provided by the main program and/or the second dynamic link library.
In one implementation of the software tracking device 200, the interface calling module 210 uses the first dynamic link library to call the software tracking interface provided by the target software, including: and calling a software tracking interface provided by the target software when the construction function of the global object in the first dynamic link library is triggered to be executed.
In one implementation of the software tracking device 200, the tracking information processing module 220 receives and outputs the first software tracking information generated by the target software during the running process using the first dynamic link library, including: caching first software tracking information generated by the target software in the running process; and outputting all the cached first software tracking information when the destructor of the global object is triggered to be executed.
In one implementation of the software tracking device 200, the interface call module 210 is further configured to: creating an information processing thread when the constructor of the global object is triggered to be executed; the trace information processing module 220 receives and outputs the first software trace information generated by the target software in the running process by using the first dynamic link library, including: caching first software tracking information generated by the target software in the running process; when the information processing thread is in an operating state, outputting first software tracking information of the current cache; and when the destructor of the global object is executed, if the cached first software tracking information is not yet output, outputting the rest first software tracking information.
The software tracking device 200 provided in the embodiment of the present application may be used to perform the software tracking method provided in the embodiment of the present application, and its implementation principle and the technical effects that result are described in the foregoing method embodiments, and for a brief description, reference may be made to the corresponding content in any of the foregoing method embodiments where the device embodiment portion is not mentioned.
Fig. 4 shows one possible structure of an electronic device 300 provided in an embodiment of the present application. Referring to fig. 4, the electronic device 300 includes: processor 310, memory 320, and communication unit 330, which are interconnected and communicate with each other by a communication bus 340 and/or other forms of connection mechanisms (not shown).
The processor 310 includes one or more (only one shown), which may be an integrated circuit chip, with signal processing capabilities. The processor 310 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a micro control unit (Micro Controller Unit, MCU), a network processor (Network Processor, NP), or other conventional processor; but may also be a special purpose processor including a graphics processor (Graphics Processing Unit, GPU), a Neural network processor (Neural-network Processing Unit, NPU for short), a digital signal processor (Digital Signal Processor, DSP for short), an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short), a field programmable gate array (Field Programmable Gate Array, FPGA for short) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. Also, when the processor 310 is plural, some of them may be general-purpose processors, and another may be special-purpose processors.
The Memory 320 includes one or more (Only one shown in the drawings), which may be, but is not limited to, a random access Memory (Random Access Memory, RAM), a Read Only Memory (ROM), a programmable Read Only Memory (Programmable Read-Only Memory, PROM), an erasable programmable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable programmable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), and the like.
The processor 310, as well as other possible components, may access, read, and/or write data from, the memory 320. In particular, one or more computer program instructions may be stored in memory 320 that may be read and executed by processor 310 to implement the software tracking methods provided by embodiments of the present application.
The communication unit 330 includes one or more (only one is shown) that may be used to communicate directly or indirectly with other devices for data interaction. The communication unit 330 may be a wired and/or wireless communication module.
It is to be understood that the configuration shown in fig. 4 is illustrative only, and that electronic device 300 may also include more or fewer components than shown in fig. 4, or have a different configuration than shown in fig. 4. For example, if the electronic device 300 does not need to communicate with other devices, the communication unit 330 may not be included.
The components shown in fig. 4 may be implemented in hardware, software, or a combination thereof. The electronic device 300 may be a physical device such as a PC, a mobile phone, a server, a robot, etc., or may be a virtual device such as a virtual machine, a container, etc. The electronic device 300 is not limited to a single device, and may be a combination of a plurality of devices or a cluster of a large number of devices.
The present application also provides a computer readable storage medium, on which computer program instructions are stored, which when read and executed by a processor, perform the software tracking method provided by the embodiments of the present application. For example, the computer-readable storage medium may be implemented as memory 320 in electronic device 300 in FIG. 4.
The present embodiments also provide a computer program product comprising computer program instructions which, when read and executed by a processor, perform the software tracking method provided by the embodiments of the present application. For example, these computer program instructions may be stored within memory 320 in electronic device 300 in FIG. 4.
The foregoing is merely exemplary embodiments of the present application and is not intended to limit the scope of the present application, and various modifications and variations may be suggested to one skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims (10)

1. A method of software tracking, applied to a first dynamic link library loaded into a process corresponding to target software, the method comprising:
calling a software tracking interface provided by the target software, and configuring and/or controlling the function of generating the software tracking information in the target software so as to open the function of generating the required first software tracking information;
and receiving and outputting the first software tracking information generated by the target software in the running process.
2. The software tracking method according to claim 1, wherein the first dynamic link library is loaded into a process corresponding to the target software by means of preferential loading before the target software is run.
3. The software tracking method according to claim 2, wherein if the operating system in which the target software is located is a linux system, a system environment variable ld_reload is configured to include the first dynamic link library to support preferential loading of the first dynamic link library.
4. The software tracking method according to claim 1, characterized in that the target software comprises a main program and at least one second dynamic link library, the software tracking interface being provided by the main program and/or the second dynamic link library.
5. The software tracking method of claim 2, wherein the invoking the software tracking interface provided by the target software comprises:
and calling a software tracking interface provided by the target software when the construction function of the global object in the first dynamic link library is triggered to be executed.
6. The software trace method according to claim 5, wherein said receiving and outputting the first software trace information generated by the target software during operation comprises:
caching first software tracking information generated by the target software in the running process;
and outputting all the cached first software tracking information when the destructor of the global object is triggered to be executed.
7. The software tracking method of claim 5, further comprising:
creating an information processing thread when the constructor of the global object is triggered to be executed;
the receiving and outputting the first software tracking information generated by the target software in the running process includes:
caching first software tracking information generated by the target software in the running process;
when the information processing thread is in an operating state, outputting first software tracking information of the current cache;
and when the destructor of the global object is triggered to be executed, if the cached first software tracking information is not yet output, outputting the rest first software tracking information.
8. A software tracking device, comprising:
the interface calling module is used for calling a software tracking interface provided by the target software by using a first dynamic link library loaded in a process corresponding to the target software, and configuring and/or controlling a function of generating software tracking information in the target software so as to open a function of generating required first software tracking information;
and the tracking information processing module is used for receiving and outputting the first software tracking information generated by the target software in the running process by utilizing the first dynamic link library.
9. A computer readable storage medium, having stored thereon computer program instructions which, when read and executed by a processor, perform the method of any of claims 1-7.
10. An electronic device, comprising: a memory and a processor, the memory having stored therein computer program instructions that, when read and executed by the processor, perform the method of any of claims 1-7.
CN202311332113.7A 2023-10-13 2023-10-13 Software tracking method and device, storage medium and electronic equipment Pending CN117370178A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311332113.7A CN117370178A (en) 2023-10-13 2023-10-13 Software tracking method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311332113.7A CN117370178A (en) 2023-10-13 2023-10-13 Software tracking method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117370178A true CN117370178A (en) 2024-01-09

Family

ID=89403612

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311332113.7A Pending CN117370178A (en) 2023-10-13 2023-10-13 Software tracking method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117370178A (en)

Similar Documents

Publication Publication Date Title
US11829787B2 (en) Multi-process model for cross-platform applications
CN108958729B (en) Data processing method, device and storage medium
JP5436696B2 (en) Dynamic language execution with metadata extraction
KR20140144250A (en) Terminal device and method for operating the same
CN108334779B (en) Application processing method, device and computing storage medium
CN111209122B (en) Interface calling method and device, electronic equipment and storage medium
US9304762B2 (en) Automatically customizing a computer-executable application at runtime
CN109684573B (en) Target picture display method and device, storage medium and electronic equipment
WO2022199283A1 (en) Method and apparatus for determining object of call stack frame, device, and medium
US11010144B2 (en) System and method for runtime adaptable applications
CN112214388A (en) Memory monitoring method, device, equipment and computer readable storage medium
US11930096B2 (en) Systems and methods for rendering interactive web pages
US7418714B2 (en) Employing three parameter buffer access in connection with SMBus notifications
KR20210034558A (en) Artificial intelligence development platform managing method, device, and medium
CN113434131A (en) Programming method and device, computer equipment and storage medium
CN112035270A (en) Interface adaptation method, system, device, computer readable medium and electronic equipment
CN113900896A (en) Code operation monitoring method, device, equipment and storage medium
WO2021108362A1 (en) Method and apparatus for data interaction
CN117370178A (en) Software tracking method and device, storage medium and electronic equipment
CN112860235B (en) Method, device, equipment and storage medium for processing text
CN111124627A (en) Method, device, terminal and storage medium for determining application program caller
CN113050962B (en) Mobile service upgrading method, device and terminal
CN112764729A (en) Application software development method and device, computer equipment and readable storage medium
CN112650502A (en) Batch processing task processing method and device, computer equipment and storage medium
CN111352644A (en) Applet updating method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination