CN120578574A - Code debugging method and related equipment - Google Patents

Code debugging method and related equipment

Info

Publication number
CN120578574A
CN120578574A CN202510542656.4A CN202510542656A CN120578574A CN 120578574 A CN120578574 A CN 120578574A CN 202510542656 A CN202510542656 A CN 202510542656A CN 120578574 A CN120578574 A CN 120578574A
Authority
CN
China
Prior art keywords
debugging
code
target
scheme
preset
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
CN202510542656.4A
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.)
Voyah Automobile Technology Co Ltd
Original Assignee
Voyah Automobile 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 Voyah Automobile Technology Co Ltd filed Critical Voyah Automobile Technology Co Ltd
Priority to CN202510542656.4A priority Critical patent/CN120578574A/en
Publication of CN120578574A publication Critical patent/CN120578574A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/362Debugging of software
    • G06F11/3628Debugging of software of optimised code
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Biomedical Technology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Biophysics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a code debugging method and related equipment, and relates to the technical field of software and hardware testing, wherein the method comprises the steps of carrying out vectorization decomposition processing on project code packages to obtain a code vector database; the method comprises the steps of obtaining a code vector database, obtaining a code vector text, obtaining a code context matched with the code context by searching based on the debug requirement text input by a user, analyzing the debug requirement text and the code context through a preset large language model to obtain a target debug scheme, and obtaining debug process data aiming at a project code package by executing debug operation through a preset debug interface based on the target debug scheme. According to the application, by constructing the code vector database and combining the large language model analysis and automatic debugging interface, the code debugging process with high efficiency, accuracy and systemization can be realized, and the debugging efficiency and the intelligent level are remarkably improved.

Description

Code debugging method and related equipment
Technical Field
The application relates to the technical field of software and hardware testing, in particular to a code debugging method and related equipment.
Background
Along with the continuous improvement of the scale and complexity of a software system, code debugging is an important means for guaranteeing the correctness of programs and the stability of the system, and plays a vital role in the fields of embedded systems, operating system kernels, bottom layer drive development and the like. However, in modern projects, the code structure is huge and the modules are numerous, so that the traditional debugging mode which depends on manual analysis or static script increasingly exposes the defects in efficiency and accuracy, and particularly when facing complex situations such as nested functions, multithreading collaboration or related hardware calling, developers often need to spend a great deal of time to understand the code context, set breakpoints and repeatedly try to debug paths, so that the development cost and the error probability are obviously increased.
In the related technology, the prior method tries to introduce a large language model to realize automation of a debugging process, but generally faces two key challenges, namely, the lack of context fusion capability with a real project code, which leads to easy deviation of a debugging instruction generated by the model from actual demands, and the lack of an effective dynamic interaction mechanism, which cannot realize real-time connection and operation with a debugging tool, so that the application value of the model in a real development scene is limited, and the prior debugging auxiliary technology is difficult to meet the demands of high accuracy and high automation, especially in the stages of project selection, problem reproduction, performance diagnosis and the like. That is, there is a technical problem in the related art that the automation and the intelligentization degree of the debugging process are insufficient.
Disclosure of Invention
In the summary of the application, a series of concepts in a simplified form are introduced, which will be further described in detail in the detailed description section. The summary of the application is not intended to define the key features and essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subject matter.
The code debugging method and the related equipment provided by the application can realize efficient, accurate and systematic code debugging flow by constructing the code vector database and combining with the large language model analysis and the automatic debugging interface, and remarkably improve the debugging efficiency and the intelligent level.
The application provides a code debugging method, which comprises the steps of carrying out vectorization decomposition processing on a project code package to obtain a code vector database, retrieving code contexts matched with the code demand text from the code vector database based on debugging demand text input by a user, analyzing the debugging demand text and the code contexts through a preset large language model to obtain a target debugging scheme, wherein the target debugging scheme comprises debugging step priorities, debugging tool calling sequences and expected output formats, and executing debugging operation through a preset debugging interface based on the target debugging scheme to obtain debugging process data aiming at the project code package.
In some embodiments, the vectorizing decomposition processing is performed on the project code package to obtain a code vector database, which comprises the steps of carrying out structuring segmentation on the project code package through an abstract syntax tree parser to obtain a plurality of structure code units, and carrying out vector representation generation on the structure code units based on a preset embedding model to obtain the code vector database.
In some embodiments, the searching the code context matched with the debugging requirement text from the code vector database based on the debugging requirement text input by the user comprises extracting elements from the debugging requirement text to obtain search elements, wherein the search elements comprise target variables, target function names and target error types, and searching the code context from the code vector database based on the search elements.
In some embodiments, the element extraction of the debug requirement text to obtain a search element includes performing semantic rewriting on the debug requirement text through the preset large language model to obtain an intermediate requirement text conforming to a preset text structure, and performing information extraction from the intermediate requirement text according to a preset regular rule to obtain the search element.
In some embodiments, the analyzing the debug requirement text and the code context through the preset large language model to obtain a target debug scheme includes performing debug architecture generation processing on the debug requirement text through the preset large language model to obtain a debug scheme architecture, and inputting the code context into the preset large language model to enable the preset large language model to adjust the debug scheme architecture based on the code context to obtain the target debug scheme.
In some embodiments, the code debugging method further comprises generating a debug summary report based on the debug process data in response to a user confirmation instruction, wherein the debug summary report comprises a structured debug log, code coverage analysis results, and a list of potential defects.
In some embodiments, the step of executing the debugging operation through a preset debugging interface based on the target debugging scheme to obtain the debugging process data for the project code package comprises the steps of executing pre-execution on the target debugging scheme based on a sandbox verification rule to generate a simulation execution result, responding to a deviation signal of the simulation execution result and an expected execution result, adjusting the priority of a debugging step in the target debugging scheme, and executing the debugging operation through the preset debugging interface based on the optimized debugging scheme with the adjusted priority of the debugging step to obtain the debugging process data.
The application further provides a code debugging device, which comprises a code processing unit, a code retrieval unit, a debugging generation unit and a debugging execution unit, wherein the code processing unit is used for carrying out vectorization decomposition processing on a project code package to obtain a code vector database, the code retrieval unit is used for retrieving a code context matched with a debugging requirement text from the code vector database based on the debugging requirement text input by a user, the debugging generation unit is used for analyzing the debugging requirement text and the code context through a preset large language model to obtain a target debugging scheme, the target debugging scheme comprises a debugging step priority, a debugging tool calling sequence and an expected output format, and the debugging execution unit is used for executing debugging operation through a preset debugging interface based on the target debugging scheme to obtain debugging process data aiming at the project code package.
In a third aspect, the application also provides an electronic device comprising a memory and a processor for implementing the steps of the code debugging method of the first aspect when executing a computer program stored in the memory.
In a fourth aspect, the present application also provides a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the code debugging method of the first aspect.
In a fifth aspect, the present application further provides a computer program product, including a computer program or a computer executable instruction, where the computer program or the computer executable instruction implement the code debugging method provided by the embodiment of the present application when the computer program or the computer executable instruction is executed by a processor.
In summary, the project codes are vectorized and a code vector database is constructed, so that when facing a large project or multi-module code structure, context codes related to user debugging requirements can be efficiently positioned, compared with a traditional line-by-line searching or manual analysis mode, the preparation time before debugging can be greatly saved, the most relevant code contexts are automatically retrieved from the vector database through semantic matching based on the user input debugging requirements, the fact that a subsequently generated debugging scheme can be accurately combined with the current code actual situation is ensured, debugging instruction deviation problems and large model illusion problems are reduced, a large language model is used for generating a section of debugging codes and combining the debugging requirements and the code contexts, a structured target debugging scheme is generated, the whole debugging process is more systematic and procedural, the debugging process is convenient to reproduce and problem positioning, the debugging operation can be automatically executed according to the generated debugging scheme by utilizing a preset debugging interface, and errors and repeated labor brought by manual operation are avoided. In summary, the code debugging method provided by the application can realize a high-efficiency, accurate and systematic code debugging process by constructing the code vector database and combining with a large language model analysis and automatic debugging interface, thereby remarkably improving the debugging efficiency and the intelligent level.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the specification. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 is a schematic flow chart of a code debugging method according to an embodiment of the present application;
Fig. 2 is a schematic diagram of a composition structure of a code debugging device according to an embodiment of the present application;
Fig. 3 is a schematic diagram of a composition structure of an electronic device according to an embodiment of the present application.
Detailed Description
Terms such as "first," "second," "third," "fourth," and the like in the description, in the claims and in the drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is, therefore, to be understood that the terms so used are interchangeable under appropriate circumstances such that the described embodiments are capable of operation in other sequences than described of illustrated or otherwise described herein. Furthermore, the terms "a" and "an" and "the" and any variations thereof, are intended to cover all possible constituent elements without being exclusive. For example, a process, method, system, article, or apparatus that comprises a step or unit is not necessarily limited to only those steps or units explicitly listed and may include other steps or units not explicitly listed or inherent to such process, method, article, or apparatus.
In the present application, "module" or "unit" refers to a computer program or a part of a computer program having a specific function, and cooperates with other relevant parts to achieve a predetermined object. These modules or units may be implemented in software, hardware (e.g., processing circuitry or memory), or a combination of both. One or more processors or memories may implement one or more modules or units. Also, each module or unit may be part of a larger module or unit.
The technical scheme of the present application will be described in detail below with reference to the accompanying drawings in the embodiments. It should be noted that the described embodiments are only a part of the application, not all embodiments. In the following description, reference is made to "some embodiments" only being a subset of all possible embodiments, which may be the same or different, and the different embodiments may be combined with each other without conflict.
Fig. 1 is a flow chart of a code debugging method according to an embodiment of the present application. For example, referring to fig. 1, the code debugging method provided by the embodiment of the present application may include the following steps 101 to 104:
Step 101, carrying out vectorization decomposition processing on a project code packet to obtain a code vector database;
In some examples, the project code package refers to a plurality of source files, module files, configuration files, compiling scripts and the like contained in a complete code engineering catalog, is an actual project to be debugged, may have a multi-level catalog structure and complex dependency relationships, and can be obtained through a code warehouse, local folder uploading, remote FTP downloading and the like. The vectorization decomposition processing refers to firstly carrying out structural partitioning on source codes in a project code package, such as partitioning according to functions, classes, modules and the like, and then converting each partitioning into a high-dimensional vector representation by using code embedding models, such as CodeBERT, openAI embeddings, fastText and the like, so as to support retrieval and matching of semantic levels. The code vector database is a vector search database that stores vector representations generated from code blocks and supports fast semantic search by approximation vector search algorithms, such as FAISS, milvus, pinecone, etc.
By implementing the step 101, the project-level codes are vectorized and a vector database is constructed, so that the complex and huge code database can be effectively converted into a structured data format for semantic retrieval of a large language model, the content related to specific functions, variables and functions in the quick positioning codes can be supported, and a high-correlation context basis is provided for the subsequent debugging requirements, thereby remarkably improving the information retrieval efficiency and accuracy of a debugging preparation stage.
Step 102, based on the debugging requirement text input by the user, retrieving a code context matched with the debugging requirement text from a code vector database;
In some examples, the debug requirement text is a debug target, problem phenomena, or behavioral content desired to be analyzed, described in natural language or semi-structured manner, entered by a user, for driving a code debugging process. The code context refers to a source code segment and the content of a dependency relationship thereof which are associated with the debugging requirement and can comprise function definition, variable statement, module reference, macro definition and the like for supporting subsequent debugging analysis, and the code context matched with the debugging requirement text is obtained by converting the debugging requirement text into semantic vectors and then performing approximate matching search in a code vector database.
By implementing step 102, the code context most relevant to the debugging requirement is retrieved from the vector database, so that the problem points concerned by the user, such as variable states, function call paths or boundary conditions, can be captured more accurately, and a semantically rich and logically coherent context basis is provided for subsequent model analysis. The process can reduce the risk of disjointing the debugging instruction and the actual code, and effectively reduce the occurrence rate of the phenomenon of 'illusion' of the large model.
Step 103, analyzing the text of the debugging requirement and the context of the code through a preset large language model to obtain a target debugging scheme, wherein the target debugging scheme can comprise a debugging step priority, a debugging tool calling sequence and an expected output format;
In some examples, the preset large language model refers to a code debugging scene related to the embodiment of the application, and is based on a general large language model through special multi-stage training or fine tuning optimization natural language processing model, and is combined with a multi-task learning framework, and multi-source code debugging corpus including a debugging log, a program annotation, an error tracking record, a code submitting history, a fault reproduction case and the like is led to retrain, so that the model has debugging intention understanding capability (can be based on a natural language debugging requirement text, and can identify variables, functions, abnormal types and semantic relations in the text to form a structured intermediate expression), semantic context adaptation capability (can carry out semantic matching on the debugging requirement and the code context, generate a debugging strategy matched with a target code structure), debugging scheme generation capability (can generate an operable debugging step based on the adapted input, and comprises debugging tool selection, an execution sequence, output preset and dependency relation labeling) and task switching capability (can flexibly switch between understanding, searching, generating and the like by introducing a prompting word and an instruction scheduling mechanism, and the like), the model is not applicable to the general language model 4364, but has the general language model Qwen-specific large language model can be used for the general language model BERT (Bidirectional Encoder Representations from Transformers), and the model can be used for the general language model 4364. The target debugging scheme is a group of structured debugging processes generated by a preset large language model based on debugging requirements and context codes and comprises debugging step priorities, debugging tool calling sequences and expected output formats, wherein the debugging step priorities are execution sequences and importance degree sequences of different actions or checks in the debugging process, the debugging tool calling sequences can ensure that fault points with higher possibility of being firstly checked and solved or the maximum influence can be ensured, the debugging tool calling sequences refer to the calling sequences of specific operation instructions in an external debugging interface (such as TRACE 32) and comprise setting breakpoints, single step execution, checking registers and the like, the debugging tool interface can be generated and called by the preset large language model planning according to problem characteristics and target function logic, and the expected output formats are structural standards which are met by data output or returned by the debugging tool and comprise fields, formats, types and the like, so that the follow-up analysis and display are convenient.
By implementing step 103, a large language model is introduced to carry out intelligent analysis on the debugging task, so that the relation between the debugging requirement and related codes can be understood, a structured and executable debugging scheme can be automatically generated, the systematicness and standardability of the debugging process are greatly improved through clear debugging logic sequence, called debugging tools and output format, the debugging process is more planned and controllable, the problem reproduction and result tracking are facilitated, and the human experience dependence is reduced.
Step 104, executing debugging operation through a preset debugging interface based on a target debugging scheme to obtain debugging process data aiming at the project code package;
In some examples, the preset debug interface is a pre-integrated call interface capable of interfacing with a debug tool, and is used for automatically controlling the debug process, and can be implemented through a standard debug protocol (such as GDB Remote Protocol), a third party API, script bridging (such as a Python call command line tool) or an IDE plug-in interface, and the specific implementation of executing the debug operation through the preset debug interface is to automatically transfer steps and call sequences included in the target debug scheme to the debug tool to execute through the debug interface. The debugging process data refers to complete records of running results, variable value changes, exception logs, breakpoint hits and other information related to the project code package generated when the debugging operation is executed, and the state information, log output and other information returned by the debugging tool when each step is executed can be collected in real time and stored in a structured whole.
Through implementation of the step 104, the automatic docking is carried out with a preset debugging interface of the debugging tool, breakpoint setting, variable monitoring, single-step running and other operations are automatically executed according to a debugging strategy generated by a preset large language model, automatic execution and real-time feedback of debugging operation are realized, the efficiency and accuracy of a debugging execution stage are improved, debugging process data can be automatically collected for analysis, recording and tracking, the error probability of manual operation and repeated labor are greatly reduced, and the debugging intellectualization and datamation level is improved.
In summary, the embodiment of the application can efficiently locate the context code related to the debugging requirement of a user when facing a large-scale project or multi-module code structure by vectorizing project codes and constructing a code vector database, can greatly save the preparation time before debugging compared with the traditional mode of searching line by line or manually analyzing, automatically retrieve the most relevant code context from the vector database by semantic matching based on the debugging requirement input by the user, thereby ensuring that a subsequently generated debugging scheme can accurately combine the actual condition of the current code, reducing the deviation problem of debugging instructions and the illusion problem of a large model, generating a structured target debugging scheme by combining the debugging requirement and the code context instead of generating a large-scale debugging code, enabling the whole debugging process to be more systematic and procedural, facilitating the reproduction and problem location, and automatically executing the debugging operation according to the generated debugging scheme by utilizing a preset debugging interface, thereby avoiding errors and repeated labor brought by manual operation. In summary, the code debugging method provided by the embodiment of the application can realize an efficient, accurate and systematic code debugging process by constructing the code vector database and combining large language model analysis and automatic debugging interfaces, thereby remarkably improving the debugging efficiency and the intelligent level.
In some embodiments, the step 101 may include performing structural segmentation on the project code package by using an abstract syntax tree parser to obtain a plurality of structural code units, and performing vector representation generation on the structural code units based on a preset embedding model to obtain a code vector database.
In some examples, an abstract syntax tree (Abstract Syntax Tree, AST) parser is a tool that converts source code into a syntax tree structure for analyzing the syntax composition and structure level of the code, and project code packages can be divided into basic units that can be represented independently, such as classes, functions, code blocks, variable definitions, etc., based on the abstract syntax tree. The structural code units are the basic code segment units after being divided by structuring, and each unit can independently describe a certain function or logic block. The preset embedded model is a trained neural network model and is used for mapping the code units into vector representations with fixed dimensions and preserving semantic information of the code units, and after the structural code units are input into the preset embedded model, numerical value vectors capable of representing semantic features of the structural code units can be generated and stored in a code vector database.
Through the implementation of the embodiment, the abstract syntax tree is introduced to carry out structural segmentation, so that fine division is facilitated to codes according to logic units, vectorization processing is carried out by combining with an embedded model, the constructed vector database is closer to an actual code structure at a semantic level, the precision of code semantic retrieval and the context restoring capability can be enhanced, and high-quality data support is provided for debugging requirements.
In some embodiments, the step 102 may include extracting elements from the debug requirement text to obtain a search element, where the search element may include a target variable, a target function name, and a target error type, and retrieving a code context from a code vector database based on the search element.
In some examples, the element extraction is implemented by performing semantic analysis and structural analysis on the text of the debug requirement input by the user, extracting key information closely related to the debug target from the text, and implementing element extraction by a universal large language model, a named entity recognition model, or a rule-based parser. The search element is a structured information item extracted from the debugging requirement text and used for constructing a query request, the related code units in the matching code vector database can be generated through regular expression matching, template extraction or language model semantic analysis, the search element can comprise a target variable, a target function name and a target error type, the target variable is a variable name explicitly mentioned in the debugging requirement text, the target function name is a function name mentioned in the debugging requirement text, and the target error type is specific error type or abnormal information pointed out in the debugging requirement text and used for assisting in narrowing the search range. The realization process of retrieving the code context from the code vector database based on the retrieval elements is to construct a query vector or semantic query condition by using the extracted retrieval elements, search structural code units with similar semantics in the code vector database to form the code context for debugging, and construct the query by combining the retrieval elements, such as multi-mode matching and weight weighted matching, and perform efficient search by using a vector similarity retrieval tool.
Through implementation of the embodiment, key elements are extracted from the debugging requirement text and used for vectorization retrieval, so that pertinence and relativity of retrieval and matching are further improved, errors of a large language model in a context matching process are avoided, and a generated debugging scheme is closer to the actual problem.
In some embodiments, the extracting the elements from the debug requirement text to obtain the search elements may include performing semantic rewriting on the debug requirement text through a preset large language model to obtain an intermediate requirement text conforming to a preset text structure, and extracting information from the intermediate requirement text according to a preset regular rule to obtain the search elements.
In some examples, the preset text structure is a pre-defined text template or format for standardized debug requirements content expression, so that subsequent information extraction is more accurate and consistent. The intermediate requirement text is an intermediate expression result which is converted into a structure conforming to a preset text after the debugging requirement text is subjected to semantic rewriting of a large language model. The preset regular rule is a regular expression set for extracting specific elements from the intermediate demand text with structural or semantic clarity, and the regular expression for the target text format can be manually written or assisted to be generated by using an automatic rule generating tool.
Through implementation of the embodiment, the preset large language model is utilized to rewrite the debugging requirement semanteme and extract information by means of the regular rule, flexibility and structuring are considered, standardized debugging elements can be extracted from freely expressed natural language more accurately, resolving capability of fuzzy requirements is enhanced, and writing thresholds of users are reduced.
In some embodiments, the step 103 may include performing a debugging architecture generation process on the debugging requirement text through a preset large language model to obtain a debugging scheme architecture, and inputting the code context into the preset large language model to enable the preset large language model to adjust the debugging scheme architecture based on the code context to obtain the target debugging scheme.
In some examples, a preset large language model is used for carrying out understanding analysis on a debugging requirement text input by a user, and a preliminary debugging solution idea or scheme framework, namely a debugging scheme framework, is generated based on reasoning and a paradigm, wherein the debugging scheme framework refers to a general debugging step outline which is generated by the preset large language model based on the debugging requirement and does not contain specific code structures or context logic, then the initial debugging step can be combined with specific code contexts, and the debugging scheme framework can be further refined and localized through the preset large language model to enable the initial debugging step to be more fit with actual project logic, so that a target debugging scheme is obtained, and the target debugging scheme is a complete debugging step set which is finally generated and combines the debugging requirement with the actual code contexts and has execution sequence and operability.
Through implementation of the embodiment, the general debugging framework is generated firstly, and then the adaptation adjustment is carried out by combining with the specific context, so that the final debugging scheme has more customization and execution feasibility, the problem that the general strategy is not adapted to the actual code scene is solved, and the rationality and the execution success rate of the debugging process are improved.
In some embodiments, the foregoing code debugging method may further comprise generating a debug summary report based on the foregoing debug process data in response to a user confirmation instruction, wherein the debug summary report may include the structured debug log, the code coverage analysis result, and the potential defect list.
In some examples, the user confirmation instruction refers to an instruction that explicitly indicates to generate a debug summary report in a debugging process, after the completion of the debugging operation, the user confirms or commands the system to generate a final report through an interface, the user can input the instruction through a graphical interface, a command line or through some interactive interface, for example, click on a "generate debug report" button or input a "generate report" command, under the triggering of the user confirmation instruction, data in the debugging process, such as a debug log, a variable state, error information, and the like, can be used to generate a set of debug summary reports, summarize the debugging process and the result, the debug summary report is a summary document, a reference is provided for the subsequent development and problem solving, the complete process of debugging, the operation steps of execution, the debugging result, the potential problems found, and the like can be included, the structured debugging refers to a detailed log generated in the debugging process, the time, the execution step, the variable state, the error information, and the like are recorded, the subsequent coverage rate refers to the analysis is convenient, and the coverage rate refers to the analysis is covered by which paths of the execution paths are not evaluated, and the critical code is not analyzed, so that the critical code is not analyzed. The potential defect list refers to a logic error or performance bottleneck which is estimated according to the result in the debugging process and can mark a problem area which may need to be further checked based on a debugging log and code behaviors.
By implementing the embodiment, the structural debugging summary report is automatically generated after the debugging is finished, so that the system backtracking, test coverage analysis and defect tracking are facilitated, the subsequent analysis and project management are facilitated, and the visualization and documentation capabilities of the debugging result are remarkably improved.
In some embodiments, the step 104 may include pre-executing the target debugging scheme based on the sandbox verification rule to generate a simulation execution result, adjusting a priority of a debugging step in the target debugging scheme in response to a deviation signal of the simulation execution result and an expected execution result, and executing a debugging operation through a preset debugging interface based on the optimized debugging scheme with the adjusted priority of the debugging step to obtain the debugging process data.
In some examples, sandbox validation rules refer to simulation rules performed on a target debugging scheme in a controlled environment, ensuring that the debugging operations do not affect the actual production environment, and may be performed by a previously defined framework, tool, or environment constraints, e.g., utilizing a virtual machine, containerization technique (e.g., docker), or a specialized debugging environment, ensuring that operations are performed only within the virtual environment. Pre-executing the target debugging scheme refers to simulating the execution of the debugging step in the sandbox environment before actually executing the debugging operation so as to evaluate the effectiveness, the potential risk and the error of the debugging scheme. The simulation execution result refers to a result generated by a system after the simulation operation of the target debugging scheme is executed under the sandbox verification rule, and comprises a successful step, execution time, error prompt and the like, the expected execution result refers to an ideal result preset according to the debugging requirement and the target debugging scheme, and is usually set by a developer or a debugging expert according to experience and requirement, success standard and expected output of expected execution can be set through design documents, requirement description or past debugging experience of projects, a deviation signal refers to a difference between the simulation execution result and the expected execution result and can be used for indicating that a problem exists in the debugging scheme or a part needing improvement, and for example, if the expected output is an error code 5, but the simulation execution result outputs an error code 10, the deviation signal is an error code disagreement. After the deviation signal is found, the target debugging scheme can be optimized according to the adjusted debugging step priority, then the optimized debugging scheme is executed through a preset debugging interface, and finally data in the debugging process, such as logs, error information and the like, are collected. The optimized debugging scheme is generated by adjusting and optimizing the sequence, importance and the like of debugging steps after the execution deviation or potential problem of the original scheme is found relative to the original target debugging scheme.
By implementing the embodiment, the sandbox verification mechanism is introduced to simulate debugging execution in advance and dynamically adjust the debugging strategy according to deviation feedback, so that the debugging process is more robust and adaptive, erroneous judgment or resource waste caused by one-time execution is avoided, the reliability evaluation and adjustment capability before the execution of the debugging scheme is improved, and the debugging failure rate is reduced.
Furthermore, as an implementation of the foregoing method embodiment, the present application further provides a code debugging device, which is configured to implement the foregoing method embodiment. The embodiment of the device corresponds to the embodiment of the method, and for convenience of reading, the embodiment of the code debugging device does not describe the details of the embodiment of the method one by one, but it should be clear that the device in the embodiment of the application can correspondingly implement all the contents of the embodiment of the method. As shown in fig. 2, the code debugging device 20 comprises a code processing unit 201, a code retrieving unit 202, a debugging generating unit 203 and a debugging executing unit 204, wherein the code processing unit 201 is used for carrying out vectorization decomposition processing on a project code package to obtain a code vector database, the code retrieving unit 202 is used for retrieving a code context matched with a debugging requirement text from the code vector database based on the debugging requirement text input by a user, the debugging generating unit 203 is used for analyzing the debugging requirement text and the code context through a preset large language model to obtain a target debugging scheme, the target debugging scheme can comprise debugging step priority, debugging tool calling sequence and expected output format, and the debugging executing unit 204 is used for carrying out debugging operation through a preset debugging interface based on the target debugging scheme to obtain debugging process data for the project code package.
In some embodiments, the code processing unit 201 is further configured to perform structural segmentation on the project code package through an abstract syntax tree parser to obtain a plurality of structural code units, and perform vector representation generation on the structural code units based on a preset embedding model to obtain a code vector database.
In some embodiments, the code retrieval unit 202 is further configured to extract elements from the debug requirement text to obtain retrieval elements, where the retrieval elements include a target variable, a target function name, and a target error type, and retrieve a code context from the code vector database based on the retrieval elements.
In some embodiments, the code retrieving unit 202 is further configured to perform semantic rewriting on the debug requirement text through a preset large language model to obtain an intermediate requirement text conforming to a preset text structure, and perform information extraction from the intermediate requirement text according to a preset regular rule to obtain a retrieval element.
In some embodiments, the debug generating unit 203 is further configured to perform debug architecture generation processing on the debug requirement text through a preset large language model to obtain a debug scheme architecture, and input the code context into the preset large language model to enable the preset large language model to adjust the debug scheme architecture based on the code context to obtain the target debug scheme.
In some embodiments, debug execution unit 204 is further to generate a debug summary report based on the debug process data in response to the user validation instruction, wherein the debug summary report includes the structured debug log, the code coverage analysis results, and the list of potential defects.
In some embodiments, the debug execution unit 204 is further configured to pre-execute the target debug scheme based on the sandbox verification rule to generate a simulation execution result, adjust a priority of a debug step in the target debug scheme in response to a deviation signal of the simulation execution result and an expected execution result, and execute a debug operation through a preset debug interface based on the optimized debug scheme with the adjusted priority of the debug step to obtain debug process data.
The present application also provides a computer readable storage medium having stored therein computer executable instructions or a computer program which when executed by a processor will cause the processor to perform any of the steps of the code debugging method provided by the present application.
In some embodiments, the computer readable storage medium may be an access Memory (random access Memory, RAM), a Read-Only Memory (ROM), a flash Memory, a magnetic surface Memory, an optical disk, or a CD-ROM (Compact Disc Read-Only Memory), or various devices including one or any combination of the above.
In some embodiments, computer-executable instructions may be written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, in the form of programs, software modules, scripts, or code, and they may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
In some embodiments, the computer-executable instructions may, but need not, correspond to files in a file system, may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a hypertext markup language (Hyper Text Markup Language, HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files that store one or more modules, sub-programs, or portions of code).
In some embodiments, the computer-executable instructions may be deployed to be executed on one electronic device or on multiple electronic devices located at one site or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
As shown in fig. 3, the present application further provides an electronic device 30, including a memory 310, a processor 320, and a computer program 311 stored in the memory 310 and capable of running on the processor, where the processor 320 implements any step of the code debugging method when executing the computer program 311.
The present application also provides a computer program product comprising a computer program or computer executable instructions stored in a computer readable storage medium. The processor of the electronic device reads the computer program or computer-executable instructions from the computer-readable storage medium, and the processor executes the computer program or computer-executable instructions so that the electronic device performs any of the steps of the code debugging method of the present application described above.
The foregoing embodiments are merely for illustrating the technical solution of the present application, but not for limiting the same, and although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that modifications may be made to the technical solution described in the foregoing embodiments or equivalents may be substituted for parts of the technical features thereof, and that such modifications or substitutions do not depart from the spirit and scope of the technical solution of the embodiments of the present application in essence.

Claims (10)

1.A code debugging method, comprising:
Carrying out vectorization decomposition processing on the project code package to obtain a code vector database;
retrieving a code context matched with the debugging requirement text from the code vector database based on the debugging requirement text input by a user;
Analyzing the debugging requirement text and the code context through a preset large language model to obtain a target debugging scheme, wherein the target debugging scheme comprises a debugging step priority, a debugging tool calling sequence and an expected output format;
And executing debugging operation through a preset debugging interface based on the target debugging scheme to obtain debugging process data aiming at the project code package.
2. The code debugging method of claim 1, wherein the vectorizing decomposition of the project code package to obtain the code vector database comprises:
Carrying out structural segmentation on the project code package through an abstract syntax tree parser to obtain a plurality of structural code units;
And generating vector representation of the structural code unit based on a preset embedding model to obtain the code vector database.
3. The code debugging method of claim 1, wherein the retrieving code context from the code vector database that matches the debugging requirement text based on the user-entered debugging requirement text comprises:
Extracting elements from the debugging requirement text to obtain retrieval elements, wherein the retrieval elements comprise target variables, target function names and target error types;
and retrieving the code context from the code vector database based on the retrieval element.
4. A code debugging method according to claim 3, wherein said extracting elements from said debugging requirement text to obtain search elements comprises:
Performing semantic rewriting on the debugging requirement text through the preset large language model to obtain an intermediate requirement text conforming to a preset text structure;
and extracting information from the intermediate demand text according to a preset regular rule to obtain the retrieval element.
5. The code debugging method according to claim 1, wherein the analyzing the debugging requirement text and the code context by a preset large language model to obtain a target debugging scheme comprises:
performing debugging framework generation processing on the debugging requirement text through the preset large language model to obtain a debugging scheme framework;
Inputting the code context into the preset large language model so that the preset large language model adjusts the debugging scheme framework based on the code context to obtain the target debugging scheme.
6. The code debugging method of claim 1, wherein the code debugging method further comprises:
And generating a debugging summary report based on the debugging process data in response to a user confirmation instruction, wherein the debugging summary report comprises a structured debugging log, a code coverage rate analysis result and a potential defect list.
7. The code debugging method according to claim 1, wherein the executing a debugging operation through a preset debugging interface based on the target debugging scheme to obtain the debugging process data for the project code package comprises:
Pre-executing the target debugging scheme based on a sandbox verification rule to generate a simulation execution result;
Adjusting the priority of the debugging step in the target debugging scheme in response to a deviation signal of the simulation execution result and the expected execution result;
And executing debugging operation through a preset debugging interface based on the optimized debugging scheme with the adjusted priority of the debugging step to obtain the debugging process data.
8. A code debugging device, comprising:
the code processing unit is used for carrying out vectorization decomposition processing on the project code package to obtain a code vector database;
The code retrieval unit is used for retrieving a code context matched with the debugging requirement text from the code vector database based on the debugging requirement text input by a user;
The debugging generation unit is used for analyzing the debugging requirement text and the code context through a preset large language model to obtain a target debugging scheme, wherein the target debugging scheme comprises a debugging step priority, a debugging tool calling sequence and an expected output format;
And the debugging execution unit is used for executing debugging operation through a preset debugging interface based on the target debugging scheme to obtain the debugging process data aiming at the project code package.
9. An electronic device comprising a memory and a processor, characterized in that the processor is adapted to implement the steps of the code debugging method of any of claims 1-7 when executing a computer program stored in the memory.
10. A computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the steps of the code debugging method of any of claims 1-7.
CN202510542656.4A 2025-04-28 2025-04-28 Code debugging method and related equipment Pending CN120578574A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202510542656.4A CN120578574A (en) 2025-04-28 2025-04-28 Code debugging method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202510542656.4A CN120578574A (en) 2025-04-28 2025-04-28 Code debugging method and related equipment

Publications (1)

Publication Number Publication Date
CN120578574A true CN120578574A (en) 2025-09-02

Family

ID=96853534

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202510542656.4A Pending CN120578574A (en) 2025-04-28 2025-04-28 Code debugging method and related equipment

Country Status (1)

Country Link
CN (1) CN120578574A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120950373A (en) * 2025-10-15 2025-11-14 阿里巴巴(中国)有限公司 Code processing method, code repairing method and model request processing method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120950373A (en) * 2025-10-15 2025-11-14 阿里巴巴(中国)有限公司 Code processing method, code repairing method and model request processing method

Similar Documents

Publication Publication Date Title
CN117806980B (en) Automatic test case generating device based on large language model
US11907107B2 (en) Auto test generator
US11579856B2 (en) Multi-chip compatible compiling method and device
CN106227654B (en) A kind of test platform
US20240345808A1 (en) Intelligent and predictive modules for software development and coding using artificial intelligence and machine learning
Agarwal et al. Copilot evaluation harness: Evaluating llm-guided software programming
Brownlee Machine learning mastery with R: Get started, build accurate models and work through projects step-by-step
CN119201059A (en) A PLC code generation and verification method based on large language model
CN117724390A (en) A program editor and integration method for integrating AI into PLC
CN119939004A (en) Web page process automation method, device, equipment, storage medium and program product
CN114064157A (en) Method, system, device and medium for realizing automatic flow based on page element identification
CN120578574A (en) Code debugging method and related equipment
CN119576363A (en) Adaptive code annotation updating method, system, terminal and storage medium
Kilic et al. Source Code Summarization & Comment Generation with NLP: A New Index Proposal
CN119179467B (en) Artificial intelligence aided programming construction method
CN120315692A (en) AI-based code generation method, device, computer equipment and storage medium
US20180253287A1 (en) Method for translation of assembler computer language to validated object-oriented programming language
CN119597342A (en) Driver program cross-platform transplantation method, device, storage medium and electronic device
Somogyi et al. Software modernization using machine learning techniques
CN119807019B (en) Abnormal data generation method and abnormal code generation method
CN119806538B (en) A dual-layer debugging-driven API arrangement method and system based on LLM
Alshehri et al. AST2CVCode: A New Benchmark Dataset for Source Code Generation on Computer Vision Applications
EP4625178A1 (en) A method for generating a simulation code to test a control logic code
FOLHA et al. Editor de código para objetos de negócio
Wen et al. LLM-Assisted Collaborative Change Specification of Industrial Control Software

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
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: 430109 Hubei Province, Wuhan City, Yunfeng Avenue 8, Wuhan Economic and Technological Development Zone

Applicant after: Lantu Automotive Technology Co.,Ltd.

Address before: 430050Hubei Province, Wuhan Economic and Technological Development Zone, Artificial Intelligence Science and Technology Park, Building N, 3rd Floor, Room N3010

Applicant before: Lantu Automobile Technology Co.,Ltd.

Country or region before: China