CN114238107A - Tracking debugging method, system and computer readable storage medium - Google Patents

Tracking debugging method, system and computer readable storage medium Download PDF

Info

Publication number
CN114238107A
CN114238107A CN202111529106.7A CN202111529106A CN114238107A CN 114238107 A CN114238107 A CN 114238107A CN 202111529106 A CN202111529106 A CN 202111529106A CN 114238107 A CN114238107 A CN 114238107A
Authority
CN
China
Prior art keywords
tracking point
debugging
program
tracking
point
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
CN202111529106.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.)
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Original Assignee
Beijing Topsec Technology Co Ltd
Beijing Topsec Network Security Technology Co Ltd
Beijing Topsec Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Topsec Technology Co Ltd, Beijing Topsec Network Security Technology Co Ltd, Beijing Topsec Software Co Ltd filed Critical Beijing Topsec Technology Co Ltd
Priority to CN202111529106.7A priority Critical patent/CN114238107A/en
Publication of CN114238107A publication Critical patent/CN114238107A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

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 provides a trace debugging method, a system and a computer readable storage medium, wherein each trace point in a trace point set is predefined, a program sequentially passes through each trace point and then configures trace point variables for outputting debugging log information at a target trace point, a debugging switch corresponding to the target trace point is turned on through a debugging command, and the target trace point can be appointed to output the debugging log information by controlling the log output function of each trace point through the switch, so that the generation of other log information is reduced, and sufficient information can be obtained while the debugging log information cannot be interfered by a large amount of log information. The variable counting tracking adopted by the application can quickly locate abnormal information in the program running process, improve the efficiency of locating program debugging problems and reduce the influence on the program performance.

Description

Tracking debugging method, system and computer readable storage medium
Technical Field
The present application relates to the field of application software technologies, and in particular, to a trace debugging method, system, and computer-readable storage medium.
Background
With the rapid development of computer technology and network technology, application software plays an increasingly important role in daily life, study and work of people. With the continuous expansion of application software, debugging for programs is also more and more important.
Logging is a debugging method commonly used by developers. In the linux development environment, it is more convenient to print a structure with many variables directly into a log file than to use a gdb (debugging tool under UNIX and UNIX-like) debugger. In addition, the execution order of the functions can be clearly observed by printing the log. However, logging files have a great influence on program performance, and therefore, the method is not suitable for use in performance-sensitive scenarios, such as network devices, and in scenarios where transaction transactions are frequent, the efficiency of locating program debugging problems is also affected by the large number of logs generated by the debugging method.
Disclosure of Invention
An object of the embodiments of the present application is to provide a trace debugging method, system and computer readable storage medium, which are used in the prior art, when log records are used to cause low program performance and transaction transactions are very frequent, a large amount of generated logs affect the efficiency of program debugging problem location.
The tracking debugging method provided by the embodiment of the application comprises the following steps:
configuring a tracking point variable in a program; the tracking point variable is used for outputting debugging log information at a target tracking point;
running a program; in the program operation, tracking point variables sequentially pass through each tracking point in a tracking point set;
acquiring a debugging command, wherein the debugging command is used for indicating a target tracking point and opening a debugging switch corresponding to the target tracking point;
and outputting the debugging log information at the target tracking point.
In the technical scheme, each trace point in the trace point set is predefined, a program sequentially passes through each trace point and then configures trace point variables for outputting debugging log information at a target trace point, a debugging switch corresponding to the target trace point is turned on through a debugging command, and the log output function of each trace point is controlled through the switch, so that the target trace point can be appointed to output the debugging log information, thereby reducing the generation of other log information, ensuring that enough information can be obtained and not interfered by a large amount of log information. Therefore, the variable counting and tracking method and device can quickly locate abnormal information in the program running process, improve the efficiency of locating program debugging problems, and reduce the influence of the recorded log files on the program performance.
In some optional embodiments, before configuring the tracking point variable in the program, further comprising:
by macro definition, a tracking point variable is introduced.
In the technical scheme, the definition of the tracking point variable is automatically completed through macro definition, so that the development efficiency is improved, and the maintenance difficulty is reduced.
In some optional embodiments, the tracking point variable is introduced by macro definition, including:
and carrying out aggregation operation on the variables and the target tracking points and the debugging switches corresponding to the variables to obtain tracking point variables.
Configuring tracking point variables in a program, comprising:
initializing variables of the tracking point variables, the target tracking point and a debugging switch.
According to the technical scheme, the process that the variables and the target tracking points corresponding to the variables and the debugging switches are subjected to aggregation operation to obtain the tracking point variables is automatically completed through macro definition, development efficiency is improved, and maintenance difficulty is reduced.
In some optional embodiments, before running the program, the method further comprises:
and generating a tracking point set according to all variables, and placing the tracking point set in a tracking section of the program by using a compiler.
In some optional embodiments, the debug command is further configured to:
and traversing the tracking section of the program, and matching a target tracking point by using a pcre matching mode.
In some optional embodiments, running the program, the tracking point variable sequentially passing through each tracking point in the tracking point set includes:
through macro definition, when a tracking point variable passes through each tracking point, the corresponding position count of a tracking point count array is added with 1; and each thread is distributed with an array of N tracking point counts, wherein N is the total number of the tracking points in the tracking point set.
In the technical scheme, the macro definition is utilized to automatically form the counting rule of the tracking point, and the subscript of the tracking point can be calculated by subtracting the address of the first tracking point from the address of the current tracking point, so that the position of the tracking point can be acquired.
In some optional embodiments, further comprising:
and judging the turning-on or turning-off of the debugging switch by utilizing the macro definition, and outputting debugging log information when the debugging switch corresponding to the target tracking point is turned on.
In some alternative embodiments, the program is a C/C + + program, the compiler is a gcc compiler, and the macro definition is a macro definition in C/C + +.
In the technical scheme, aiming at the C/C + + program, the trace debugging method capable of being integrated into the program is realized by utilizing the macro definition and the gcc compiler of the C/C + + program and some preset control command logics, so that the high performance of variable counting trace debugging can be achieved, the detailed output of log information is realized, the development efficiency is improved, and the maintenance difficulty is reduced.
The tracking and debugging system provided by the embodiment of the application comprises:
the configuration module is used for configuring tracking point variables in the program; the tracking point variable is used for outputting debugging log information at a target tracking point;
the running module is used for running the program; in the program operation, tracking point variables sequentially pass through each tracking point in a tracking point set;
the command acquisition module is used for acquiring a debugging command, wherein the debugging command is used for indicating a target tracking point and opening a debugging switch corresponding to the target tracking point;
and the output module is used for outputting the debugging log information at the target tracking point.
According to the technical scheme, the configuration module, the operation module, the command acquisition module and the output module are utilized to realize the log output function of controlling each tracking point through the switch, and the target tracking point can be appointed to output debugging log information, so that the generation of other log information is reduced, sufficient information can be acquired while the debugging log information is not interfered by a large amount of log information, the program performance is improved, and the efficiency of positioning the program debugging problem is improved.
In some optional embodiments, the configuration module is further configured to: by macro definition, a tracking point variable is introduced.
In the technical scheme, the configuration module is used for adopting macro definition, and the definition of the tracking point variable is converted into automatic completion, so that the development efficiency is improved, and the maintenance difficulty is reduced.
In some optional embodiments, the configuration module is further configured to: carrying out aggregation operation on the variables and target tracking points and debugging switches corresponding to the variables to obtain tracking point variables; and initializing variables of the tracking point variables, the target tracking point and the debugging switch.
In the technical scheme, the configuration module is used for adopting macro definition, and the process that the variables and the target tracking points corresponding to the variables and the debugging switches are subjected to aggregation operation to obtain the tracking point variables is automatically completed, so that the development efficiency is improved, and the maintenance difficulty is reduced.
In some optional embodiments, the configuration module is further configured to: and generating a tracking point set according to all variables, and placing the tracking point set in a tracking section of the program by using a compiler.
In some optional embodiments, the execution module is further configured to: and traversing the tracking section of the program, and matching a target tracking point by using a pcre (Perl Compatible Regular Expressions) matching mode.
In some optional embodiments, the execution module is further configured to: through macro definition, when a tracking point variable passes through each tracking point, the corresponding position count of a tracking point count array is added with 1; and each thread is distributed with an array of N tracking point counts, wherein N is the total number of the tracking points in the tracking point set.
In the technical scheme, the operation module is used for adopting macro definition, and the subscript of the tracking point can be calculated by subtracting the address of the first tracking point from the address of the current tracking point, so that the position of the tracking point can be acquired, and the counting rule of the tracking point can be automatically formed.
In some optional embodiments, the command acquisition module is further configured to: and judging the turning-on or turning-off of the debugging switch by utilizing the macro definition, and outputting debugging log information when the debugging switch corresponding to the target tracking point is turned on.
In some alternative embodiments, the program is a C/C + + program, the compiler is a gcc compiler, and the macro definition is a macro definition in C/C + +.
In the technical scheme, aiming at the C/C + + program, the trace debugging method capable of being integrated into the program is realized by utilizing the macro definition and the gcc compiler of the C/C + + program and some preset control command logics, so that the high performance of variable counting trace debugging can be achieved, the detailed output of log information is realized, the development efficiency is improved, and the maintenance difficulty is reduced.
An electronic device provided in an embodiment of the present application includes: a processor and a memory, the memory storing machine-readable instructions executable by the processor, the machine-readable instructions, when executed by the processor, performing a method as in any above.
A computer-readable storage medium is provided in an embodiment of the present application, and computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are read and executed by a processor, the computer-readable storage medium executes any one of the above methods.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used 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 therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a flowchart illustrating steps of a trace debugging method according to an embodiment of the present application;
fig. 2 is a flowchart illustrating a trace debugging method according to an embodiment of the present application;
fig. 3 is a functional block diagram of a trace debugging system according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Icon: 1-configuration module, 2-operation module, 3-command acquisition module, 4-output module, 51-processor, 52-memory, 53-communication interface, 54-communication bus.
Detailed Description
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.
The variable counting trace debugging scheme traces the flow in the program in a counting mode, defines corresponding variables and names for each point needing to be traced in advance, and adds an operation to the corresponding variables each time the program runs to the corresponding position. Finally, the technology outputs all variable names and values through a command line, and a program flow tracking mode can be obtained. In the mode, the condition of program abnormity can be quickly positioned only by adding corresponding tracking points in the main process and the abnormal process.
The code trace debugging method implemented by the predefined variables has very high performance, but every time a trace point is added, the definition, use, statistics and output codes of related variables need to be added, the maintenance cost is high, and due to the lack of more specific data output, the use scenes are limited.
Logging is also a debugging method commonly used by developers. In the linux development environment, it is more convenient to print a structure with numerous variables directly into a log file than to use a gdb debugger. In addition, the execution order of the functions can be clearly observed by printing the log.
The applicant finds that the problem of insufficient data output in a variable counting trace debugging scheme can be solved by debugging in a log file recording mode, but the log file recording can have great influence on performance, so that the method is not suitable for performance-sensitive scenes such as network equipment. In addition, in a scenario where transaction transactions are very frequent, a large amount of logs generated by the debugging method also affect the efficiency of problem debugging and positioning.
Therefore, the embodiment of the present application provides a trace debugging method, a trace debugging system, and a computer readable storage medium, which can specify a target trace point to output debug log information, thereby reducing the generation of other log information, ensuring that sufficient information can be obtained while being not interfered by a large amount of log information, improving program performance, and improving the efficiency of program debugging problem location.
Referring to fig. 1, fig. 1 is a flowchart illustrating steps of a trace debugging method according to an embodiment of the present application, including:
step 101, configuring tracking point variables in a program; the tracking point variable is used for outputting debugging log information at a target tracking point;
step 102, running a program; in the program operation, tracking point variables sequentially pass through each tracking point in a tracking point set;
103, acquiring a debugging command, wherein the debugging command is used for indicating a target tracking point and turning on a debugging switch corresponding to the target tracking point;
and 104, outputting debugging log information at the target tracking point.
In the embodiment of the application, each trace point in a trace point set is predefined, a program sequentially passes through each trace point and then configures trace point variables for outputting debugging log information at a target trace point, a debugging switch corresponding to the target trace point is turned on through a debugging command, and the log output function of each trace point is controlled through the switch, so that the target trace point can be appointed to output the debugging log information, thereby reducing the generation of other log information, ensuring that enough information can be obtained and not interfered by a large amount of log information. Therefore, the variable counting and tracking method and device can quickly locate abnormal information in the program running process, improve the efficiency of locating program debugging problems, and reduce the influence of the recorded log files on the program performance.
In some optional embodiments, before configuring the tracking point variable in the program, further comprising: by macro definition, a tracking point variable is introduced. In the embodiment of the application, the definition of the tracking point variable is automatically completed through macro definition, so that the development efficiency is improved, and the maintenance difficulty is reduced.
In some optional embodiments, the tracking point variable is introduced by macro definition, including: and carrying out aggregation operation on the variables and the target tracking points and the debugging switches corresponding to the variables to obtain tracking point variables.
Correspondingly, the tracking point variable in the configuration program comprises the following steps: initializing variables of the tracking point variables, the target tracking point and a debugging switch.
In the embodiment of the application, the process of obtaining the tracking point variable by carrying out aggregation operation on the target tracking point and the debugging switch corresponding to the variable is automatically completed through macro definition, so that the development efficiency is improved, and the maintenance difficulty is reduced.
In some optional embodiments, before running the program, the method further comprises: and generating a tracking point set according to all variables, and placing the tracking point set in a tracking section of the program by using a compiler.
In some optional embodiments, the debug command is further configured to: and traversing the tracking section of the program, and matching a target tracking point by using a pcre matching mode.
In some optional embodiments, running the program, the tracking point variable sequentially passing through each tracking point in the tracking point set includes: through macro definition, when a tracking point variable passes through each tracking point, the corresponding position count of a tracking point count array is added with 1; and each thread is distributed with an array of N tracking point counts, wherein N is the total number of the tracking points in the tracking point set.
In the embodiment of the application, macro definition is adopted, and the subscript of the tracking point can be calculated by subtracting the address of the first tracking point from the address of the current tracking point, so that the position of the tracking point is obtained, and the counting rule of the tracking point is automatically formed.
In some optional embodiments, further comprising: and judging the turning-on or turning-off of the debugging switch by utilizing the macro definition, and outputting debugging log information when the debugging switch corresponding to the target tracking point is turned on.
In some alternative embodiments, the program is a C/C + + program, the compiler is a gcc compiler, and the macro definition is a macro definition in C/C + +. In the embodiment of the application, aiming at the C/C + + program, the trace debugging method capable of being integrated into the program is realized by utilizing the macro definition and the gcc compiler of the C/C + + program and some preset control command logics, so that the high performance of variable counting trace debugging can be achieved, the detailed output of log information is realized, the development efficiency is improved, and the maintenance difficulty is reduced.
Referring to fig. 2, fig. 2 is a flowchart of a trace debugging method according to an embodiment of the present application, and a specific implementation process includes two main stages, i.e., trace point resource initialization, trace point counting statistics, and output.
Step 201-:
step 201, program initialization, and acquiring the total number N of tracking points in the tracking point set.
Calling a trace (x, fmt …) macro definition interface at a program tracking point to automatically complete variable definition, aggregation and program tracking code addition; traversing in program initialization, and calculating the total number N of tracking points;
the pseudo code of the macro definition interface comprises the following steps:
Figure BDA0003410100250000091
step 202, thread initialization, and an array with the size of N is distributed as a tracking point counting array.
And when the threads are initialized, distributing an array of N counting variables for each thread set to serve as a tracking point counting set.
Step 203-:
and step 203, counting the position corresponding to the tracking point variable by +1, and acquiring the position of the tracking point variable.
When the program runs, calculating the position of the tracking point variable corresponding to the counting variable according to the appearance position of the tracking point variable in the tracking point set, and adding one to the counting;
meanwhile, the location of the trace point variable is obtained because all trace point names are located in the trace segment (i.e., trace segment), and the trace point index can be calculated by subtracting the address of the first trace point from the address of the current trace point.
And step 204, turning on a debugging switch according to the target tracking point and outputting debugging information.
And opening the corresponding debugging switch according to the target tracking point, wherein all the tracking point names are positioned in the trace section, and traversing the trace section through a cli command to perform pcre matching on the target tracking point. The debug switches for all trace points that meet the condition will be opened. And (3) starting a debugging switch according to a target through a cli command, accurately outputting printing information corresponding to debugging points, and automatically carrying out multithreading counting variable merging and displaying operation by a program when the debugging information is output.
In the embodiment of the application, the logic of the definition, the use, the statistics and the output of the variable is directly converted into automatic completion by utilizing the variable aggregation function of the C/C + + compiler and the macro definition grammar and designing the data storage. The invention can count and output all the tracking point counting variables and quickly position most problems. By providing a unified cli log output switch command, a user can open the debugging switch according to the name of the target tracking point as required, so that the log output of each tracking point is accurately controlled, the information interference is reduced, and the debugging efficiency is improved. Therefore, the trace debugging method of the embodiment of the application outputs the debugging log according to needs, improves development and debugging efficiency, and has the advantages of high performance and easiness in expansion and maintenance.
Referring to fig. 3, fig. 3 is a functional block diagram of a trace debugging system according to an embodiment of the present disclosure, including a configuration module 1, a running module 2, a command obtaining module 3, and an output module 4.
The configuration module 1 is used for configuring tracking point variables in a program; and the tracking point variable is used for outputting debugging log information at the target tracking point. The running module 2 is used for running the program; during program operation, the tracking point variable passes through each tracking point in the tracking point set in sequence. And the command acquisition module 3 is used for acquiring a debugging command, wherein the debugging command is used for indicating the target tracking point and opening a debugging switch corresponding to the target tracking point. And the output module 4 is used for outputting the debugging log information at the target tracking point.
In the embodiment of the application, the configuration module 1, the operation module 2, the command acquisition module 3 and the output module 4 are utilized to realize the log output function of controlling each tracking point through a switch, and target tracking points can be appointed to output debugging log information, so that the generation of other log information is reduced, sufficient information can be acquired while the debugging log information is not interfered by a large amount of log information, the program performance is improved, and the efficiency of program debugging problem positioning is improved.
In some optional embodiments, the configuration module 1 is further configured to: by macro definition, a tracking point variable is introduced.
In the embodiment of the application, the configuration module 1 is used for adopting macro definition, and the definition of the tracking point variable is converted into automatic completion, so that the development efficiency is improved, and the maintenance difficulty is reduced.
In some optional embodiments, the configuration module 1 is further configured to: carrying out aggregation operation on the variables and target tracking points and debugging switches corresponding to the variables to obtain tracking point variables; and initializing variables of the tracking point variables, the target tracking point and the debugging switch.
In the embodiment of the application, the configuration module 1 is used for adopting macro definition, and the process of obtaining the tracking point variable by carrying out aggregation operation on the target tracking point and the debugging switch corresponding to the variable is converted into automatic completion, so that the development efficiency is improved, and the maintenance difficulty is reduced.
In some optional embodiments, the configuration module 1 is further configured to: and generating a tracking point set according to all variables, and placing the tracking point set in a tracking section of the program by using a compiler.
In some optional embodiments, the operation module 2 is further configured to: and traversing the tracking section of the program, and matching a target tracking point by using a pcre (Perl Compatible Regular Expressions) matching mode.
In some optional embodiments, the operation module 2 is further configured to: through macro definition, when a tracking point variable passes through each tracking point, the corresponding position count of a tracking point count array is added with 1; and each thread is distributed with an array of N tracking point counts, wherein N is the total number of the tracking points in the tracking point set.
In the embodiment of the application, the operation module 2 is used for calculating the subscript of the tracking point by adopting macro definition and subtracting the address of the first tracking point from the address of the current tracking point, so that the position of the tracking point is obtained, and the counting rule of the tracking point is automatically formed.
In some optional embodiments, the command acquiring module 3 is further configured to: and judging the turning-on or turning-off of the debugging switch by utilizing the macro definition, and outputting debugging log information when the debugging switch corresponding to the target tracking point is turned on.
In some alternative embodiments, the program is a C/C + + program, the compiler is a gcc compiler, and the macro definition is a macro definition in C/C + +.
In the embodiment of the application, aiming at the C/C + + program, the trace debugging method capable of being integrated into the program is realized by utilizing the macro definition and the gcc compiler of the C/C + + program and some preset control command logics, so that the high performance of variable counting trace debugging can be achieved, the detailed output of log information is realized, the development efficiency is improved, and the maintenance difficulty is reduced.
Fig. 4 shows a possible structure of an electronic device provided in an embodiment of the present application. Referring to fig. 3, the electronic device includes: a processor 51, a memory 52, and a communication interface 53, which are interconnected and in communication with each other via a communication bus 54 and/or other form of connection mechanism (not shown).
The Memory 52 includes one or more (Only one is shown in the figure), which may be, but not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an electrically Erasable Programmable Read-Only Memory (EEPROM), and the like. The processor 51, and possibly other components, may access, read and/or write data from the memory 52.
The processor 51 includes one or more (only one shown) which may be an integrated circuit chip having signal processing capabilities. The Processor 51 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Micro Control Unit (MCU), a Network Processor (NP), or other conventional processors; the Processor may also be a dedicated Processor, including a Neural-Network Processing Unit (NPU), a Graphics Processing Unit (GPU), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, and a discrete hardware component. When the processor 51 is plural, some of them may be general-purpose processors, and the other may be special-purpose processors.
The communication interface 53 includes one or more (only one shown) that can be used to communicate directly or indirectly with other devices for data interaction. The communication interface 53 may include an interface that performs wired and/or wireless communication.
One or more computer program instructions may be stored in the memory 52, and may be read and executed by the processor 51 to implement the methods provided by the embodiments of the present application.
It will be appreciated that the configuration shown in fig. 4 is merely illustrative and that the electronic device may include more or fewer components than shown in fig. 3 or have a different configuration than shown in fig. 4. The components shown in fig. 4 may be implemented in hardware, software, or a combination thereof. The electronic device may be a physical device, such as a PC, a laptop, a tablet, a cell phone, a server, an embedded device, etc., or may be a virtual device, such as a virtual machine, a virtualized container, etc. The electronic device is not limited to a single device, and may be a combination of a plurality of devices or a cluster including a large number of devices.
The embodiment of the present application further provides a computer-readable storage medium, where computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are read and executed by a processor of a computer, the computer-readable storage medium executes the method provided by the embodiment of the present application. For example, a computer-readable storage medium may implement: configuring a tracking point variable in a program; the tracking point variable is used for outputting debugging log information at a target tracking point; running a program; in the program operation, tracking point variables sequentially pass through each tracking point in a tracking point set; acquiring a debugging command, wherein the debugging command is used for indicating a target tracking point and opening a debugging switch corresponding to the target tracking point; and outputting the debugging log information at the target tracking point. The computer readable storage medium may also be embodied as the memory 52 in the electronic device of fig. 4.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (10)

1. A trace debug method, comprising:
configuring a tracking point variable in a program; the trace point variable is used for outputting debugging log information at a target trace point;
running the program; in the program operation, the tracking point variable sequentially passes through each tracking point in a tracking point set;
acquiring a debugging command, wherein the debugging command is used for indicating the target tracking point and turning on a debugging switch corresponding to the target tracking point;
outputting the debug log information at the target trace point.
2. The method of claim 1, prior to tracking point variables in the configuration program, further comprising:
introducing the tracking point variable through macro definition.
3. The method of claim 2, wherein said introducing the tracking point variable by macro definition comprises:
carrying out aggregation operation on the variables and target tracking points and debugging switches corresponding to the variables to obtain tracking point variables;
the tracking point variable in the configuration program comprises:
and initializing variables of the tracking point variables, a target tracking point and a debugging switch.
4. The method of claim 3, prior to said running said program, further comprising:
and generating a tracking point set according to all variables, and placing the tracking point set in a tracking section of the program by using a compiler.
5. The method of claim 4, wherein the debug command is further to:
and traversing the tracking section of the program, and matching the target tracking point by utilizing a pcre matching mode.
6. The method of claim 4, wherein running the program, the tracking point variable sequentially passing through each tracking point in a set of tracking points comprises:
through macro definition, when a tracking point variable passes through each tracking point, the corresponding position count of a tracking point count array is added with 1; and each thread is distributed with an array of N tracking point counts, wherein N is the total number of the tracking points in the tracking point set.
7. The method of claim 4, further comprising:
and judging the turning-on or turning-off of the debugging switch by using the macro definition, and outputting the debugging log information when the debugging switch corresponding to the target tracking point is turned on.
8. The method of any one of claims 4 to 7, wherein the program is a C/C + + program, the compiler is a gcc compiler, and the macro definition is a macro definition in C/C + +.
9. A trace debug system, comprising:
the configuration module is used for configuring tracking point variables in the program; the trace point variable is used for outputting debugging log information at a target trace point;
an operation module for operating the program; in the program operation, the tracking point variable sequentially passes through each tracking point in a tracking point set;
the command acquisition module is used for acquiring a debugging command, wherein the debugging command is used for indicating the target tracking point and opening a debugging switch corresponding to the target tracking point;
and the output module is used for outputting the debugging log information at the target tracking point.
10. A computer-readable storage medium having computer program instructions stored thereon, which when read and executed by a processor, perform the method of any one of claims 1-8.
CN202111529106.7A 2021-12-14 2021-12-14 Tracking debugging method, system and computer readable storage medium Pending CN114238107A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111529106.7A CN114238107A (en) 2021-12-14 2021-12-14 Tracking debugging method, system and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111529106.7A CN114238107A (en) 2021-12-14 2021-12-14 Tracking debugging method, system and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114238107A true CN114238107A (en) 2022-03-25

Family

ID=80755979

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111529106.7A Pending CN114238107A (en) 2021-12-14 2021-12-14 Tracking debugging method, system and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114238107A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117370214A (en) * 2023-12-01 2024-01-09 珠海格力电器股份有限公司 Program debugging method and device of controller and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117370214A (en) * 2023-12-01 2024-01-09 珠海格力电器股份有限公司 Program debugging method and device of controller and storage medium
CN117370214B (en) * 2023-12-01 2024-04-19 珠海格力电器股份有限公司 Program debugging method and device of controller and storage medium

Similar Documents

Publication Publication Date Title
US20210064512A1 (en) Selective memory tracing of program execution
US9176848B2 (en) Program debugger and program debugging
CN110741354A (en) Presenting differences between code entity invocations
US20120131559A1 (en) Automatic Program Partition For Targeted Replay
US20150006961A1 (en) Capturing trace information using annotated trace output
US8930923B2 (en) Generating debugging extension source code utilizing debugging information
JP6363152B2 (en) Apparatus, method, computer program, and storage medium for data flow analysis
CN104750603A (en) Multi-core DSP (Digital Signal Processor) software emulator and physical layer software testing method thereof
WO2016095570A1 (en) Debugging method and apparatus for embedded system, and storage medium
CN111813672B (en) Non-invasive coverage rate statistical method for various processor architectures
CN115061837B (en) Method and device for scheduling, tracking and acquiring user space call stack
CN102722438B (en) Kernel debugging method and equipment
EP3921734B1 (en) Using historic execution data to visualize tracepoints
CN109542444B (en) JAVA application monitoring method, device, server and storage medium
CN105824750B (en) A kind of soft breakpoint analogy method in the debugging of the NorFlash program spaces
CN106502695A (en) One kind is based on embedded software development method
CN112230904A (en) Code generation method and device based on interface document, storage medium and server
CN102331961B (en) Method, system and dispatcher for simulating multiple processors in parallel
CN114238107A (en) Tracking debugging method, system and computer readable storage medium
EP3915018A1 (en) Dynamic diagnostic code instrumentation over a historic program execution
US10289219B2 (en) Communicating with an unsupported input device
US20180260305A1 (en) Unexpected Path Debugging
CN112445855A (en) Visual analysis method and visual analysis device for graphic processor chip
CN112861138A (en) Software security analysis method and analysis device, electronic device, and storage medium
CN116662134A (en) Linux kernel performance tracking tool based on eBPF

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