CN115391232B - Program data stream diagnosis method, device and equipment - Google Patents

Program data stream diagnosis method, device and equipment Download PDF

Info

Publication number
CN115391232B
CN115391232B CN202211330722.4A CN202211330722A CN115391232B CN 115391232 B CN115391232 B CN 115391232B CN 202211330722 A CN202211330722 A CN 202211330722A CN 115391232 B CN115391232 B CN 115391232B
Authority
CN
China
Prior art keywords
diagnosis
data
program
request
result
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.)
Active
Application number
CN202211330722.4A
Other languages
Chinese (zh)
Other versions
CN115391232A (en
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 Carpura Technology Co ltd
Original Assignee
Beijing Carpura 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 Beijing Carpura Technology Co ltd filed Critical Beijing Carpura Technology Co ltd
Priority to CN202211330722.4A priority Critical patent/CN115391232B/en
Publication of CN115391232A publication Critical patent/CN115391232A/en
Application granted granted Critical
Publication of CN115391232B publication Critical patent/CN115391232B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics
    • 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)
  • Test And Diagnosis Of Digital Computers (AREA)

Abstract

The embodiment of the invention provides a program data stream diagnosis method, a device and equipment, wherein the method comprises the following steps: responding to a diagnosis request in an application program, and acquiring a diagnosis modality, a diagnosis target data area, a data diagnosis mode and a program positioning mark of the diagnosis request from the diagnosis request; performing diagnosis calculation on data in the diagnosis target data area according to the data diagnosis mode; combining the result of the diagnosis calculation of the data in the diagnosis target data area with the program positioning mark to obtain a diagnosis result; and outputting a diagnosis result according to the diagnosis mode. The diagnosis of the application program is realized, and the errors hidden in the application program can be accurately positioned according to the output diagnosis result.

Description

Program data stream diagnosis method, device and equipment
Technical Field
The embodiment of the invention relates to the technical field of software testing, in particular to a program data flow diagnosis method, device and equipment.
Background
The software program is inevitably provided with errors (bugs), and the software program with the errors is easy to have the following error phenomena: 1) The program operation is interrupted due to the occurrence of a segment error or the like; 2) Although the program run ends normally, unreasonable partial output results are produced. Errors in a software program can cause unexpected adverse effects, and software testing with a core target of positioning and solving the errors in the software program is an indispensable key step in software engineering and has important significance for improving the quality and reliability of software.
At present, great importance is attached to software testing by large companies, and a testing standard system is established, a compiler is improved, and a large number of testing tools are developed to detect errors in a software program. Although modern compilers and some testing tools (such as Valgrind, etc.) can provide a certain detection function, with the continuous increase of complexity and the rapid increase of program code amount of software programs, the number of errors implicit in the software programs increases, the difficulty and the workload of accurately positioning the errors increase, and thus a great number of errors in the software programs are difficult to position by the existing means.
Disclosure of Invention
The embodiment of the invention provides a program data stream diagnosis method, a device and equipment, which are used for diagnosing a software program so as to accurately position the hidden errors in the software program.
In a first aspect, an embodiment of the present invention provides a program data flow diagnosis method, including:
responding to a diagnosis request in an application program, and acquiring a diagnosis mode, a diagnosis target data area, a data diagnosis mode and a program positioning mark of the diagnosis request from the diagnosis request;
performing diagnosis calculation on the data in the diagnosis target data area according to the data diagnosis mode;
combining the result of the diagnosis calculation of the data in the diagnosis target data area with the program positioning mark to obtain a diagnosis result;
and outputting a diagnosis result according to the diagnosis mode.
In one embodiment, the diagnostic modality includes a reference data stream generation modality and a data stream consistency detection modality, wherein, in the reference data stream generation modality, the diagnostic result is output to a reference diagnostic log file; and under the data stream consistency detection mode, acquiring a reference diagnosis result from the corresponding reference diagnosis log file, and outputting a program error warning if the current diagnosis result is different from the reference diagnosis result.
In one embodiment, the data diagnosis means includes at least one of: key position data value tracking, area data value tracking, data value valid range diagnosis and abnormal value discrimination.
In one embodiment, when the application program is a parallel program, the diagnosis modality of the diagnosis request is a reference data stream generation modality, and the data diagnosis manner of the diagnosis request is key location data value tracking, the method includes:
responding to a current diagnosis request when the application program is operated under the first parallel setting, acquiring array indexes of a plurality of specific positions from the current diagnosis request, acquiring data values corresponding to the array indexes of the specific positions from a diagnosis target data area of the current diagnosis request, performing diagnosis calculation, combining program positioning marks to obtain a diagnosis result, and writing the diagnosis result into a diagnosis log file corresponding to each process or thread to obtain a first group of diagnosis log files;
responding to a current diagnosis request when the application program is operated under the second parallel setting, acquiring array indexes of a plurality of specific positions from the current diagnosis request, acquiring data values corresponding to the array indexes of the specific positions from a diagnosis target data area of the current diagnosis request, performing diagnosis calculation, obtaining a diagnosis result by combining with a program positioning mark, and writing the diagnosis result into a diagnosis log file corresponding to each process or thread to obtain a second group of diagnosis log files;
and determining the program positions with different operation results under the first parallel setting and the second parallel setting according to the first group of diagnostic log files and the second group of diagnostic log files.
In one embodiment, when the data diagnosis mode of the diagnosis request is region data value tracking, the method comprises the following steps:
responding to a diagnosis request of which the diagnosis mode is a reference data stream generation mode in an application program, calculating a characteristic value of data in a diagnosis target data area of the diagnosis request, and writing a combination of the characteristic value corresponding to each diagnosis request and a program positioning mark as a diagnosis result into a diagnosis log file to obtain a reference diagnosis log file;
responding to a diagnosis request of which the diagnosis mode in the application program is a data stream consistency detection mode, calculating a characteristic value of data in a diagnosis target data area of the current diagnosis request, and obtaining a current diagnosis result according to a combination of the characteristic value corresponding to the current diagnosis request and a program positioning mark;
and obtaining a reference diagnosis result corresponding to the current diagnosis result from the reference diagnosis log file, and determining the program position causing the difference of the two operation results according to the program positioning mark of the current diagnosis result when the reference diagnosis result is different from the current diagnosis result.
In one embodiment, the characteristic value of the data in the diagnosis target data area is a binary checksum of the data in the diagnosis target data area.
In one embodiment, when the data diagnosis mode of the diagnosis request is abnormal value screening, performing diagnosis calculation on the data in the diagnosis target data region according to the data diagnosis mode includes:
judging whether an abnormal data value exists in the diagnosis target data area or not;
when an abnormal data value exists in the diagnosis target data region, a diagnosis result of a program error warning is generated.
In one embodiment, when the data diagnosis mode of the diagnosis request is data value valid range diagnosis, the method further comprises: obtaining a valid data range of the diagnosis request from the diagnosis request;
the performing diagnosis calculation on the data in the diagnosis target data region according to the data diagnosis manner includes:
judging whether each data in the diagnosis target data area is located in an effective data range or not;
when data outside the valid data range exists in the diagnosis target data region, a diagnosis result of a program error warning is generated.
In a second aspect, an embodiment of the present invention provides a program data flow diagnostic apparatus, including:
the response module is used for responding to a diagnosis request in the application program and acquiring a diagnosis mode, a diagnosis target data area, a data diagnosis mode and a program positioning mark of the diagnosis request from the diagnosis request;
the diagnosis module is used for carrying out diagnosis calculation on the data in the diagnosis target data area according to the data diagnosis mode;
the combination module is used for combining the result of the diagnosis calculation of the data in the diagnosis target data area with the program positioning mark to obtain a diagnosis result;
and the output module is used for outputting the diagnosis result according to the diagnosis mode.
In a third aspect, an embodiment of the present invention provides a program data stream diagnostic apparatus, including:
at least one processor and memory;
the memory stores computer-executable instructions;
execution of the computer-executable instructions stored by the memory by the at least one processor causes the at least one processor to perform the program data stream diagnostic method of any one of the first aspects.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the computer-readable storage medium is configured to implement the program data stream diagnosis method according to any one of the first aspect.
According to the program data stream diagnosis method, device and equipment provided by the embodiment of the invention, the diagnosis modality of the diagnosis request, the diagnosis target data area, the data diagnosis mode and the program positioning mark are obtained from the diagnosis request by responding to the diagnosis request in the application program; performing diagnosis calculation on data in the diagnosis target data area according to the data diagnosis mode; combining the result of the diagnosis calculation of the data in the diagnosis target data area with the program positioning mark to obtain a diagnosis result; and outputting a diagnosis result according to the diagnosis mode. The diagnosis of the application program is realized, and the errors hidden in the application program can be accurately positioned according to the output diagnosis result.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a flow chart of a method for diagnosing program data streams according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a program data flow diagnostic apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a program data flow diagnostic apparatus according to an embodiment of the present invention.
With the above figures, certain embodiments of the invention have been illustrated and described in more detail below. The drawings and the description are not intended to limit the scope of the inventive concept in any way, but rather to illustrate it by those skilled in the art with reference to specific embodiments.
Detailed Description
The present invention will be described in further detail with reference to the following detailed description and accompanying drawings. Wherein like elements in different embodiments are numbered with like associated elements. In the following description, numerous details are set forth in order to provide a better understanding of the present application. However, those skilled in the art will readily recognize that some of the features may be omitted or replaced with other elements, materials, methods in different instances. In some instances, certain operations related to the present application have not been shown or described in detail in order to avoid obscuring the core of the present application from excessive description, and it is not necessary for those skilled in the art to describe these operations in detail, so that they may be fully understood from the description in the specification and the general knowledge in the art.
Furthermore, the features, operations, or characteristics described in the specification may be combined in any suitable manner to form various embodiments. Also, the various steps or actions in the description of the methods may be transposed or transposed in order, as will be apparent to a person skilled in the art. Thus, the various sequences in the specification and drawings are for the purpose of describing certain embodiments only and are not intended to imply a required sequence unless otherwise indicated where such sequence must be followed.
The numbering of the components as such, e.g., "first", "second", etc., is used herein only to distinguish the objects as described, and does not have any sequential or technical meaning. The term "connected" and "coupled" when used in this application, unless otherwise indicated, includes both direct and indirect connections (couplings).
Fig. 1 is a flowchart of a program data flow diagnosis method according to an embodiment of the present invention. As shown in fig. 1, the program data flow diagnosis method provided in this embodiment may include:
s101, responding to a diagnosis request in an application program, and acquiring a diagnosis mode, a diagnosis target data area, a data diagnosis mode and a program positioning mark of the diagnosis request from the diagnosis request.
It is understood that, for an application program requiring diagnosis, before step S101, inserting a diagnosis request into the application program and running the application program is further included. Each diagnostic request includes: a diagnostic modality, a diagnostic target data region, a data diagnostic mode, and a procedure positioning marker. The program positioning mark is used for uniquely identifying the position of the diagnosis request in the application program, and the program positioning marks corresponding to different diagnosis requests are different; the diagnosis target data area is used to indicate data to be diagnosed, and is composed of a plurality of data in one memory area, and is usually organized as a multidimensional array. The data type is determined by the application and may be, for example, an integer, a single precision floating point number, a double precision floating point number, and the like. The data diagnosis means is used to instruct what kind of diagnosis calculation is performed on the data in the diagnosis target data region.
The program location marker is typically a string given by the application program when initiating a diagnostic request. The program location flag is written to the diagnostic log file. When the method detects an error warning, a programmer can find out a corresponding diagnosis request and a program position according to the program positioning marks in the diagnosis log file so as to conveniently position the bug. The application program may initiate different diagnostic requests at different program locations, and the program location markers of the different diagnostic requests should be different.
And S102, performing diagnosis calculation on the data in the diagnosis target data area according to the data diagnosis mode.
The data diagnosis means may include one or more of the following four: abnormal value discrimination, data value valid range diagnosis, key position data value tracking and region data value tracking.
The abnormal value discrimination is used to detect whether an abnormal data value exists in the diagnosis target data region, such as a Not a Number (NaN) in a floating point Number, infinity (infite, inf), and the like. When the data diagnosis mode of the diagnosis request is abnormal value screening, performing diagnosis calculation on the data in the diagnosis target data area according to the data diagnosis mode comprises the following steps: judging whether an abnormal data value exists in the diagnosis target data area or not; when an abnormal data value exists in the diagnosis target data region, a diagnosis result of a program error warning is generated. Outlier screening can be used to diagnose outliers in both serial and parallel programs. When an abnormal value is found in the diagnosis target data area, a program error warning is sent out, and the error position in the application program can be accurately positioned according to the program positioning mark corresponding to the program error warning.
The data value valid range diagnosis is used to detect whether or not a value outside the specified range exists in the diagnosis target data region. When the data diagnosis mode of the diagnosis request is data value valid range diagnosis, the diagnosis request also comprises a valid data range. When the data diagnosis mode of the diagnosis request is data value effective range diagnosis, firstly, obtaining the effective data range of the diagnosis request from the diagnosis request, and then judging whether each data in the diagnosis target data area is located in the effective data range; when data outside the valid data range exists in the diagnosis target data region, a diagnosis result of a program error warning is generated. Data value valid range diagnostics may be used to diagnose data ranges in both serial and parallel programs. When the numerical value outside the specified range is found, a program error warning is sent out, and the error position in the application program can be accurately positioned according to the program positioning mark corresponding to the program error warning.
The key position data values trace data for tracing, recording, several specific positions in the diagnosis target data area, and these data are used as the diagnosis result. When the data diagnosis mode of the diagnosis request is the key position data value tracking, the array index of the specific position is also included in the diagnosis request. This approach requires obtaining an array index for a specific location from the diagnostic request of the application, while the diagnostic target data area usually appears as a multidimensional array; this diagnostic approach can be used to determine the reason why parallel programs do not perform exactly the same under different parallel settings. When the data diagnosis mode of the diagnosis request is the key position data value tracking, the diagnosis calculation of the data in the diagnosis target data area according to the data diagnosis mode comprises the following steps: and determining the data corresponding to the array index as the result of the diagnosis calculation.
The region data value tracking is used to track data in the diagnosis target data region. When the data diagnosis mode of the diagnosis request is the region data value tracking, the diagnosis calculation of the data in the diagnosis target data region according to the data diagnosis mode comprises the following steps: and calculating the characteristic value of the data in the diagnosis target data area, and taking the characteristic value of the data as the result of diagnosis calculation. Usually a checksum of the target data area can be calculated and used as a diagnostic result. This approach may be used to detect the cause of inconsistent results from multiple runs of an application. By adopting the characteristic value of the data, on one hand, the efficiency of diagnosis calculation can be improved, and on the other hand, a large amount of contents can be prevented from being written into a diagnosis log file, namely, the storage efficiency is improved. The checksum functions to avoid writing large amounts of content into the diagnostic log file.
S103, combining the result of the diagnosis calculation of the data in the diagnosis target data area with the program positioning mark to obtain a diagnosis result.
A diagnostic result may be obtained in response to a diagnostic request in the application. For positioning, program positioning marks for indicating position information should be included in the diagnosis result. The result of the diagnostic calculation can therefore be combined with the program location marker as a diagnostic result in this embodiment.
It should be noted that the diagnostic calculation result is usually only a part of the diagnostic result. In an alternative embodiment, the diagnosis result may also be a combination of the diagnosis calculation result, the program positioning mark and the diagnosis serial number.
And S104, outputting a diagnosis result according to the diagnosis mode.
The diagnostic modalities include a reference data stream generation modality and a data stream consistency detection modality. Under a reference data stream generation mode, outputting a diagnosis result to a reference diagnosis log file; in the data stream consistency detection mode, obtaining a reference diagnosis result from a corresponding reference diagnosis log file (previously running program generation in the reference data stream generation mode), comparing the current diagnosis result with the reference diagnosis result, and outputting a program error warning if the current diagnosis result is different from the reference diagnosis result.
In this embodiment, the diagnostic result is written to a diagnostic log file. For parallel programs, each process or thread of an application has a separate diagnostic log file, i.e., different processes or threads use different diagnostic log files. In response to a diagnosis request of an application program, after a diagnosis result is obtained, a combination of the diagnosis result, a program positioning mark, and a diagnosis sequence number may be written into a corresponding diagnosis log file. The setting of the diagnostic number is generally: the serial number of the current diagnosis result is 1 greater than that of the last diagnosis result. When the key position data value tracking mode is adopted, key position information is required to be written into a corresponding diagnosis log file.
In an alternative embodiment, when the diagnosis modality is the reference data stream generation modality, outputting a diagnosis result according to the diagnosis modality includes: the diagnostic result is output to the reference diagnostic log file.
In another optional embodiment, when the diagnosis modality is a data flow consistency detection modality, outputting a diagnosis result according to the diagnosis modality includes: a reference diagnostic result is obtained from the corresponding reference diagnostic log file, and a program error warning is output when the reference diagnostic result is different from the current diagnostic result.
And judging whether the data flow is correct or not, namely comparing the reference diagnosis result with the current diagnosis result in the data flow consistency detection mode. And responding to a diagnosis request of the application program, acquiring a serial number of the current diagnosis result when the diagnosis result is not a program error warning after the diagnosis result is acquired, and finding out a corresponding reference diagnosis result from the reference diagnosis log file according to the serial number. When the corresponding reference diagnosis result is found not to be found (the situation may occur when the operation time is not long enough in the previous reference data stream generation mode or the program is mistakenly exited), or the corresponding reference diagnosis result is different from the current diagnosis result, the judgment that the data stream is incorrect is given, and a program error warning is given.
In the program data stream diagnostic method provided by this embodiment, a diagnostic modality, a diagnostic target data area, a data diagnostic mode, and a program positioning flag of a diagnostic request are obtained from the diagnostic request by responding to the diagnostic request in an application program; performing diagnosis calculation on data in the diagnosis target data area according to the data diagnosis mode; combining the result of the diagnosis calculation of the data in the diagnosis target data area with the program positioning mark to obtain a diagnosis result; and outputting a diagnosis result according to the diagnosis mode. The diagnosis of the application program is realized, and the errors hidden in the application program can be accurately positioned according to the output diagnosis result.
In an optional embodiment, when the data diagnosis mode of the diagnosis request is abnormal value discrimination, performing diagnosis calculation on the data in the diagnosis target data region according to the data diagnosis mode includes: judging whether an abnormal data value exists in the diagnosis target data area or not; when an abnormal data value exists in the diagnosis target data area, a diagnosis result of program error warning is generated, and the program position where the abnormal value is located can be located according to a program positioning mark corresponding to the diagnosis result.
The following describes how to locate the program position where the abnormal value is calculated, by a specific embodiment. The specific operation steps are as follows:
1) The method comprises the steps of inserting diagnosis request calls at a plurality of positions in a program, setting diagnosis modes of all the diagnosis request calls as reference data stream generation modes, setting diagnosis modes as abnormal values for discrimination, and enabling program positioning marks of different request calls to be different.
2) Running the program, and finding the first program error warning and the last diagnosis result thereof from the corresponding diagnosis log file when the diagnosis result of the program error warning appears; and positioning two corresponding program positions according to the program positioning marks of the two diagnosis results. When a large amount of data is calculated between the time when the program exits or runs in error and the time when the bug is generated, the bug of the program is difficult to reversely deduce and locate according to the error phenomenon or the error diagnosis result. In order to solve the problem, when a lot of codes exist between two program positions and an error program cannot be accurately positioned, the program is operated again after a plurality of diagnosis request calls are added between the two program positions.
3) If the diagnosis result of the program error warning does not appear when the program operation is finished, the program positioning mark corresponding to the last diagnosis result can be found from the corresponding diagnosis log file, the program position of the mark is positioned, a plurality of diagnosis request calls are added in the program behind the position, and then the program is operated again.
In an optional implementation manner, when the data diagnosis manner of the diagnosis request is data value valid range diagnosis, the valid data range of the diagnosis request may also be obtained from the diagnosis request; the performing diagnosis calculation on the data in the diagnosis target data region according to the data diagnosis manner includes: judging whether each data in the diagnosis target data area is located in an effective data range; when data outside the valid data range exists in the diagnosis target data area, a diagnosis result of program error warning is generated, and the program position where the data value outside the valid data range is located can be located according to the program positioning mark corresponding to the diagnosis result.
In the following, a specific embodiment is used to describe how to locate the program position of the data value outside the valid range, specifically, the diagnostic modality of all diagnostic request calls may be set as the reference data stream generation modality, the diagnostic mode is set as the data value valid range diagnosis, each diagnostic request call provides the valid data range of the data value, and the program location flag of different request calls is different. Then, the program is run, and the diagnostic log file is generated by referring to the operation steps in the above embodiment.
With the rapid increase of the computation amount of the application program, the development of a parallel program is required to accelerate the running of the application program by utilizing the parallel computing capability of a high-performance computer based on a plurality of processor cores. The essence of parallel programs is that multiple processes and multiple threads are used to cooperatively complete program computation. Compared with a serial program, the parallel program is more complex, the number of the implicit bugs is more, and the difficulty and the workload for accurately finding the bugs in the parallel program are necessarily greater. It is of great significance to accurately locate errors in parallel programs.
An error in the parallel program may cause the running results of the parallel program under different parallel settings to be not completely the same, and for this error, the error may be caused by a difference in data flow or an abnormal value in the calculation process of the program under different parallel settings. Thus, bugs in a parallel program can be located by tracking and comparing data streams of the parallel program at different parallel settings or examining outliers in the data streams.
In an alternative embodiment, when the application program is a parallel program, the diagnosis modality of the diagnosis request is a reference data stream generation modality, and the data diagnosis modality of the diagnosis request is key location data value tracking, the method includes:
responding to a current diagnosis request when an application program is operated under a first parallel setting, acquiring array indexes of a plurality of specific positions from the current diagnosis request, acquiring data values corresponding to the array indexes of the specific positions from a diagnosis target data area of the current diagnosis request, performing diagnosis calculation, obtaining a diagnosis result by combining with a program positioning mark, and writing the diagnosis result into a diagnosis log file corresponding to each process or thread to obtain a first group of diagnosis log files;
responding to a current diagnosis request when the application program is operated under the second parallel setting, acquiring array indexes of a plurality of specific positions from the current diagnosis request, acquiring data values corresponding to the array indexes of the specific positions from a diagnosis target data area of the current diagnosis request, performing diagnosis calculation, obtaining a diagnosis result by combining with a program positioning mark, and writing the diagnosis result into a diagnosis log file corresponding to each process or thread to obtain a second group of diagnosis log files;
and determining the program positions with different operation results under the first parallel setting and the second parallel setting according to the first group of diagnostic log files and the second group of diagnostic log files.
How to locate a program position that causes the parallel program to run with different results in different parallel settings is described below by a specific embodiment. The specific operation steps are as follows:
1) Determining two different parallel settings which are respectively used for running the program, and determining array indexes of a plurality of key positions according to the difference of two running results;
2) The diagnosis request calls are inserted at a plurality of positions in the program, the diagnosis modes of all the request calls are set as reference data stream generation modes, the diagnosis mode is set as key position data value tracking, the program positioning marks of different request calls are different, and array indexes of a plurality of key positions are provided in each diagnosis request call.
3) And adopting the first parallel setting to run the program to obtain a diagnosis log file group 1.
4) And adopting a second parallel arrangement, and running the program to obtain a diagnosis log file group 2.
5) And comparing the diagnosis results of the diagnosis log file group 1 and the diagnosis log file group 2 about the key positions, and confirming the program position with different running results of the program under different parallel settings through analysis, or needing to add diagnosis request calls. When the diagnosis request call needs to be added, the 2~5 step is repeated.
Errors in a program may also lead to situations where the results of multiple runs of the program are not exactly the same. This error may be caused by a difference in data flow or an abnormal value in the calculation process of the program under multiple runs. Thus, bugs in a program may be located by tracking and comparing data streams of the program over multiple runs or examining outliers in the data streams.
In an alternative embodiment, when the data diagnosis mode of the diagnosis request is the region data value tracking, the method includes:
responding to a diagnosis request of which the diagnosis mode is a reference data stream generation mode in an application program, calculating a characteristic value of data in a diagnosis target data area of the diagnosis request, and writing a combination of the characteristic value corresponding to each diagnosis request and a program positioning mark as a diagnosis result into a diagnosis log file to obtain a reference diagnosis log file;
responding to a diagnosis request of which the diagnosis mode in the application program is a data stream consistency detection mode, calculating a characteristic value of data in a diagnosis target data area of the current diagnosis request, and obtaining a current diagnosis result according to a combination of the characteristic value corresponding to the current diagnosis request and a program positioning mark;
and obtaining a reference diagnosis result corresponding to the current diagnosis result from the reference diagnosis log file, and determining the program position causing the difference of the two operation results according to the program positioning mark of the current diagnosis result when the reference diagnosis result is different from the current diagnosis result.
In one embodiment, the characteristic value of the data in the diagnosis target data area is a binary checksum of the data in the diagnosis target data area.
The following describes how to locate a program position that causes a difference in the results of multiple runs of the program by a specific embodiment. The specific operation steps are as follows:
1) And (3) inserting diagnosis request calls at a plurality of positions in the program, setting the diagnosis modes of all the request calls as region data value tracking, and enabling the program positioning marks of different request calls to be different.
2) And setting all diagnosis modes requested to be called as reference data stream generation modes, and then operating the program to obtain a reference diagnosis log file.
3) And setting all diagnosis modalities called by the requests as data flow consistency detection modalities, and then running the program. Through analysis, the successful positioning is confirmed to lead to the program position with different results of multiple running of the program, or the diagnosis request calling is also required to be added. When the diagnosis request call needs to be added, the 1~3 step is repeated.
Fig. 2 is a schematic structural diagram of a program data flow diagnostic apparatus according to an embodiment of the present invention. As shown in fig. 2, the program data flow diagnosis apparatus 20 provided in the present embodiment may include: a response module 201, a diagnostic module 202, a combination module 203, and an output module 204.
A response module 201, configured to respond to a diagnosis request in an application program, and obtain a diagnosis modality, a diagnosis target data area, a data diagnosis manner, and a program location flag of the diagnosis request from the diagnosis request;
the diagnosis module 202 is used for performing diagnosis calculation on data in the diagnosis target data area according to the data diagnosis mode;
the combination module 203 is used for combining the result of the diagnosis calculation of the data in the diagnosis target data area with the program positioning mark to obtain a diagnosis result;
and the output module 204 is configured to output a diagnosis result according to the diagnosis modality.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 1, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 3 is a schematic diagram of a program data stream diagnostic apparatus according to an embodiment of the present invention, which is only illustrated in fig. 3, and the embodiment of the present invention is not limited thereto. Fig. 3 is a schematic structural diagram of a program data flow diagnostic apparatus according to an embodiment of the present invention. As shown in fig. 3, the present embodiment provides a program data stream diagnostic apparatus 30 including: memory 301, processor 302, and bus 303. The bus 303 is used to realize connection between the elements.
The memory 301 stores a computer program, and when executed by the processor 302, the computer program can implement the technical solutions of any of the above method embodiments.
Wherein, the memory 301 and the processor 302 are electrically connected directly or indirectly to realize data transmission or interaction. For example, these components may be electrically connected to each other via one or more communication buses or signal lines, such as bus 303. The memory 301 stores a computer program for implementing the method of the program data stream diagnosis apparatus, which includes at least one software functional module that can be stored in the memory 301 in the form of software or firmware, and the processor 302 executes various functional applications and data processing by running the software program and the module stored in the memory 301.
The Memory 301 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 301 is used for storing programs, and the processor 302 executes the programs after receiving the execution instructions. Further, the software programs and modules within the memory 301 may also include an operating system, which may include various software components and/or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide an operating environment for other software components.
The processor 302 may be an integrated circuit chip having signal processing capabilities. The Processor 302 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. It will be appreciated that the configuration of fig. 3 is merely illustrative and may include more or fewer components than shown in fig. 3 or have a different configuration than shown in fig. 3. The components shown in fig. 3 may be implemented in hardware and/or software.
The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the technical solution of any one of the above-mentioned method embodiments.
The embodiments in the disclosure are described in a progressive manner, and the same and similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from the other embodiments.
The scope of the present disclosure is not limited to the above-described embodiments, and it is apparent that various modifications and variations can be made to the present disclosure by those skilled in the art without departing from the scope and spirit of the present disclosure. It is intended that the present disclosure also cover the modifications and variations of this invention provided they come within the scope of the appended claims and their equivalents.

Claims (10)

1. A program data flow diagnostic method, comprising:
responding to a diagnosis request in an application program, and acquiring a diagnosis modality, a diagnosis target data area, a data diagnosis mode and a program positioning mark of the diagnosis request from the diagnosis request, wherein the diagnosis modality comprises a reference data stream generation modality and a data stream consistency detection modality;
performing diagnosis calculation on the data in the diagnosis target data area according to the data diagnosis mode;
combining the result of the diagnosis calculation of the data in the diagnosis target data area with the program positioning mark to obtain a diagnosis result;
outputting the diagnosis result according to the diagnosis modality;
the outputting the diagnostic result according to the diagnostic modality includes: under a reference data stream generation mode, outputting a diagnosis result to a reference diagnosis log file; and under the data stream consistency detection mode, acquiring a reference diagnosis result from a corresponding reference diagnosis log file, and outputting a program error warning if the current diagnosis result is different from the reference diagnosis result.
2. The method of claim 1, wherein the data diagnostic modality includes at least one of: and tracking key position data values, tracking area data values, diagnosing effective ranges of the data values and screening abnormal values.
3. The method according to claim 1 or 2, wherein when the application program is a parallel program, the diagnosis modality of the diagnosis request is a reference data stream generation modality, and the data diagnosis manner of the diagnosis request is key location data value tracking, the method comprises:
responding to a current diagnosis request when the application program is operated under a first parallel setting, acquiring array indexes of a plurality of specific positions from the current diagnosis request, acquiring data values corresponding to the array indexes of the specific positions from a diagnosis target data area of the current diagnosis request, performing diagnosis calculation, obtaining a diagnosis result by combining program positioning marks, and writing the diagnosis result into a diagnosis log file corresponding to each process or thread to obtain a first group of diagnosis log files;
responding to a current diagnosis request when the application program is operated under a second parallel setting, acquiring array indexes of a plurality of specific positions from the current diagnosis request, acquiring data values corresponding to the array indexes of the specific positions from a diagnosis target data area of the current diagnosis request, performing diagnosis calculation, obtaining a diagnosis result by combining program positioning marks, and writing the diagnosis result into a diagnosis log file corresponding to each process or thread to obtain a second group of diagnosis log files;
and determining program positions with different running results under the first parallel setting and the second parallel setting according to the first group of diagnostic log files and the second group of diagnostic log files.
4. The method according to claim 1 or 2, wherein when the data diagnosis mode of the diagnosis request is region data value tracking, the method comprises:
responding to a diagnosis request of which the diagnosis mode in the application program is a reference data stream generation mode, calculating a characteristic value of data in a diagnosis target data area of the diagnosis request, and writing a combination of the characteristic value corresponding to each diagnosis request and a program positioning mark as a diagnosis result into a diagnosis log file to obtain a reference diagnosis log file;
responding to a diagnosis request of which the diagnosis mode in the application program is a data stream consistency detection mode, calculating a characteristic value of data in a diagnosis target data area of the current diagnosis request, and obtaining a current diagnosis result according to a combination of the characteristic value corresponding to the current diagnosis request and a program positioning mark;
and acquiring a reference diagnosis result corresponding to the current diagnosis result from the reference diagnosis log file, and determining the program position causing different operation results according to the program positioning mark of the current diagnosis result when the reference diagnosis result is different from the current diagnosis result.
5. The method according to claim 4, wherein the characteristic value of the data in the diagnosis target data area is a binary checksum of the data in the diagnosis target data area.
6. The method according to claim 1 or 2, wherein when the data diagnosis manner of the diagnosis request is abnormal value discrimination, the performing the diagnosis calculation on the data in the diagnosis target data region according to the data diagnosis manner includes:
judging whether an abnormal data value exists in the diagnosis target data area or not;
when an abnormal data value exists in the diagnosis target data region, a diagnosis result of a program error warning is generated.
7. The method according to claim 1 or 2, wherein when the data diagnosis manner of the diagnosis request is data value valid range diagnosis, the method further comprises: obtaining a valid data range of the diagnosis request from the diagnosis request;
the performing diagnosis calculation on the data in the diagnosis target data area according to the data diagnosis mode comprises:
judging whether each data in the diagnosis target data area is located in the valid data range or not;
when data outside the valid data range exists in the diagnosis target data region, a diagnosis result of a program error warning is generated.
8. A program data flow diagnostic device, comprising:
the response module is used for responding to a diagnosis request in an application program, and acquiring a diagnosis modality, a diagnosis target data area, a data diagnosis mode and a program positioning mark of the diagnosis request from the diagnosis request, wherein the diagnosis modality comprises a reference data stream generation modality and a data stream consistency detection modality;
the diagnosis module is used for carrying out diagnosis calculation on the data in the diagnosis target data area according to the data diagnosis mode;
the combination module is used for combining the result of the diagnosis calculation of the data in the diagnosis target data area with the program positioning mark to obtain a diagnosis result;
the output module is used for outputting the diagnosis result according to the diagnosis modality;
the output module is specifically used for outputting the diagnosis result to a reference diagnosis log file under a reference data stream generation mode; and under the data stream consistency detection mode, acquiring a reference diagnosis result from a corresponding reference diagnosis log file, and outputting a program error warning if the current diagnosis result is different from the reference diagnosis result.
9. A program data flow diagnostic apparatus, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the program data stream diagnostic method of any of claims 1-7.
10. A computer-readable storage medium having computer-executable instructions stored thereon, which when executed by a processor, implement the program data stream diagnostic method of any one of claims 1-7.
CN202211330722.4A 2022-10-28 2022-10-28 Program data stream diagnosis method, device and equipment Active CN115391232B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211330722.4A CN115391232B (en) 2022-10-28 2022-10-28 Program data stream diagnosis method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211330722.4A CN115391232B (en) 2022-10-28 2022-10-28 Program data stream diagnosis method, device and equipment

Publications (2)

Publication Number Publication Date
CN115391232A CN115391232A (en) 2022-11-25
CN115391232B true CN115391232B (en) 2023-04-11

Family

ID=84115124

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211330722.4A Active CN115391232B (en) 2022-10-28 2022-10-28 Program data stream diagnosis method, device and equipment

Country Status (1)

Country Link
CN (1) CN115391232B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110888756A (en) * 2019-11-19 2020-03-17 支付宝(杭州)信息技术有限公司 Diagnostic log generation method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222016B (en) * 2010-04-16 2013-12-04 国际商业机器公司 Program deadlock detection method and system
CN103473172A (en) * 2013-09-05 2013-12-25 无敌科技(西安)有限公司 System and method for checking leak of background program memories and positioning leak memory points
CN106528372B (en) * 2016-10-26 2020-03-24 珠海许继芝电网自动化有限公司 Program operation monitoring system and method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110888756A (en) * 2019-11-19 2020-03-17 支付宝(杭州)信息技术有限公司 Diagnostic log generation method and device

Also Published As

Publication number Publication date
CN115391232A (en) 2022-11-25

Similar Documents

Publication Publication Date Title
US7469362B2 (en) Using a call stack hash to record the state of a process
US20080313602A1 (en) Bounded program failure analysis and correction
JP2000305809A (en) Memory access analyzing method, memory access tracing device, and computer-readable recording medium
JPS5851292B2 (en) Diagnosis/debug calculation system
US5712972A (en) Identification of faults in data paths and functional units of a central processing unit by a systematic execution of test instructions
CN103049373B (en) A kind of localization method of collapse and device
CN113225232B (en) Hardware testing method and device, computer equipment and storage medium
CN112256507A (en) Chip fault diagnosis method and device, readable storage medium and electronic equipment
CN115659335A (en) Block chain intelligent contract vulnerability detection method and device based on mixed fuzzy test
CN114201408A (en) Regression testing method, device, computer equipment and storage medium
CN109800152A (en) A kind of automated testing method and terminal device
CN111858290B (en) Method and apparatus for detecting memory leak path of object code
CN115391232B (en) Program data stream diagnosis method, device and equipment
CN104503908A (en) Predicate frequency statistics based software fault locating method
CN113360389A (en) Performance test method, device, equipment and storage medium
US7415560B2 (en) Method of automatically monitoring computer system debugging routine
CN114625106B (en) Method, device, electronic equipment and storage medium for vehicle diagnosis
CN109189671B (en) Layer-by-layer approximation type variable positioning method and system and terminal equipment
CN108304330B (en) Content extraction method and device and computer equipment
CN115756935A (en) Abnormal fault positioning method, device and equipment of embedded software system
CN112052165B (en) Method, system and storage medium for detecting target function debugged
JP2022124240A (en) Diagnostic pattern generation method and computer
CN111582347B (en) Fault diagnosis method and device
CN112069749B (en) Power supply connection verification method and device, electronic equipment and storage medium
CN114756217B (en) Plug-in based script generation system

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
GR01 Patent grant
GR01 Patent grant