TWI761917B - Program debugging method, device and storage media - Google Patents
Program debugging method, device and storage media Download PDFInfo
- Publication number
- TWI761917B TWI761917B TW109128322A TW109128322A TWI761917B TW I761917 B TWI761917 B TW I761917B TW 109128322 A TW109128322 A TW 109128322A TW 109128322 A TW109128322 A TW 109128322A TW I761917 B TWI761917 B TW I761917B
- Authority
- TW
- Taiwan
- Prior art keywords
- program
- debugged
- debugging method
- trigger point
- error
- Prior art date
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
本發明涉及軟體調試技術領域,具體涉及一種程式調試方法、裝置及電腦可讀存儲介質。 The present invention relates to the technical field of software debugging, in particular to a program debugging method, a device and a computer-readable storage medium.
當系統應用程式產生錯誤(Bug)時,通常是在現場可程式設計閘陣列(field-programmable gate array,FPGA)驗證時產生的問題,進行系統應用程式模擬時,這些問題容易被忽略或者本身不易產生。目前,一般通過兩種方式查找此類錯誤,其中,第一種方式為設置調試埠連接內部邏輯電路,並且利用邏輯分析儀獲取信號並找到錯誤,但是調試埠的設置不一定就在錯誤發生的位置上,可能需要多次重複和分析才能正確設置調試埠,並找到錯誤發生的原因,查找錯誤的過程比較費時。第二種方式為利用模擬的設備搭配軟體代碼找到錯誤,這種方式雖然查找錯誤的效率比較高,但是模擬的設備和環境成本較高。 When bugs are generated in the system application, it is usually a problem in the field-programmable gate array (FPGA) verification. When the system application is simulated, these problems are easy to be ignored or not easy by themselves. produce. At present, there are generally two ways to find such errors. The first way is to set the debug port to connect the internal logic circuit, and use the logic analyzer to obtain the signal and find the error, but the setting of the debug port is not necessarily the same as when the error occurs. In terms of location, it may take many repetitions and analysis to correctly set the debug port and find the cause of the error, and the process of finding the error is time-consuming. The second method is to use simulated equipment and software codes to find errors. Although this method is more efficient to find errors, the simulated equipment and environment costs are high.
有鑒於此,有必要提出一種可快速查找程式錯誤,且成本較低的程式調試方法、裝置及可讀存儲介質。 In view of this, it is necessary to provide a program debugging method, device and readable storage medium that can quickly find program errors and have low cost.
本申請的第一方面提供一種程式調試方法,用於識別並修復待調試程式中的錯誤,所述方法包括:建立待調試程式對應的模擬運行環境;將所述待調試程式中的指令和與所述指令對應的理論波形進行映射;在所述待調試程式內設置觸發點;從所述觸發點運行所述待調試程式,並存儲對應的模擬波形;以及將所述模擬波形與所述理論波形進行對比,當所述模擬波形與所述理論波形比對不一致時,識別所述錯誤,並對所述錯誤進行修復。 A first aspect of the present application provides a program debugging method for identifying and repairing errors in a program to be debugged, the method comprising: establishing a simulation running environment corresponding to the program to be debugged; mapping the theoretical waveform corresponding to the instruction; setting a trigger point in the program to be debugged; running the program to be debugged from the trigger point, and storing the corresponding analog waveform; and comparing the analog waveform with the theoretical waveform The waveforms are compared, and when the analog waveform is inconsistent with the theoretical waveform, the error is identified and the error is repaired.
優選地,所述“建立待調試程式對應的類比運行環境”的步驟包括:讀取所述待調試程式對應的程式檔;以及運行所述的程式檔,以類比所述待調試程式執行的過程。 Preferably, the step of "establishing an analog running environment corresponding to the program to be debugged" includes: reading a program file corresponding to the program to be debugged; and running the program file to analogize the process executed by the program to be debugged .
優選地,所述“在所述待調試程式內設置觸發點”的步驟包括:類比執行所述待調試程式,並根據執行結果確定產生所述錯誤的指令;以及在產生所述錯誤的指令執行之前設置所述觸發點。 Preferably, the step of "setting a trigger point in the program to be debugged" comprises: executing the program to be debugged by analogy, and determining the instruction that generates the error according to the execution result; and executing the instruction that generates the error Set the trigger point before.
優選地,所述“在所述待調試程式內設置觸發點”的步驟包括:在所述待調試程式的中間位置設置觸發點。 Preferably, the step of "setting a trigger point in the program to be debugged" comprises: setting a trigger point in the middle of the program to be debugged.
優選地,所述程式調試方法還包括:判斷所述錯誤是否修復完畢;以及如果所述錯誤沒有修復完畢,則返回至所述“在所述待調試程式內設置觸發點”的步驟,直至所述錯誤修復完畢結束。 Preferably, the program debugging method further includes: judging whether the error has been repaired; and if the error has not been repaired, returning to the step of "setting a trigger point in the program to be debugged" until all the The above error has been fixed.
優選地,所述“將所述待調試程式中的指令和與所述指令對應的理論波形進行映射”的步驟包括:獲取所述指令與機器代碼編譯器的列表檔;以及根據所述列表檔將所述指令與所述理論波形進行對應。 Preferably, the step of "mapping the instruction in the program to be debugged and the theoretical waveform corresponding to the instruction" comprises: acquiring a list file between the instruction and the machine code compiler; and according to the list file The command is associated with the theoretical waveform.
優選地,所述程式檔為bin格式或者hex格式檔。 Preferably, the program file is a bin format or a hex format file.
優選地,所述觸發點為基本輸入輸出信號。 Preferably, the trigger point is a basic input and output signal.
本申請的第二方面提供一種程式調試裝置,所述程式調試裝置包括處理器,所述處理器用於執行記憶體中存儲的電腦程式時實現上述程式調試方法。 A second aspect of the present application provides a program debugging device, the program debugging device includes a processor, and the processor is configured to implement the above program debugging method when executing a computer program stored in a memory.
本申請的第三方面提供一種電腦可讀存儲介質,其上存儲有電腦程式,所述電腦程式被處理器執行時實現上述的程式調試方法。 A third aspect of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned program debugging method is implemented.
本發明所述程式調試方法、裝置及電腦可讀存儲介質通過設置觸發點,並從所述觸發點對待調試程式進行模擬及模擬波形資料的存儲,可減少調試過程中重複的次數,減少調試時間,加快模擬速度,同時,可減少存儲模擬波形資料所佔用的硬碟空間。此外,調試過程無需配置模擬設備,因此,成本較低。 The program debugging method, device and computer-readable storage medium of the present invention can reduce the number of repetitions in the debugging process and reduce debugging time by setting a trigger point, and simulating the program to be debugged and storing the simulated waveform data from the trigger point. , to speed up the simulation speed, and at the same time, it can reduce the hard disk space occupied by storing the analog waveform data. In addition, the commissioning process does not require the configuration of analog equipment, therefore, the cost is low.
1:程式調試裝置 1: Program debugging device
10:記憶體 10: Memory
20:處理器 20: Processor
30:顯示器 30: Display
40:輸入裝置 40: Input device
100:程式調試系統 100: Program debugging system
101:建立模組 101: Building Mods
102:映射模組 102: Mapping Modules
103:設置模組 103: Setting up modules
104:模擬模組 104: Simulation Mods
105:判斷模組 105: Judgment Module
圖1是本發明一實施方式的程式調試裝置的功能模組圖。 FIG. 1 is a functional block diagram of a program debugging device according to an embodiment of the present invention.
圖2是本發明一實施方式的程式調試系統的功能模組圖。 FIG. 2 is a functional module diagram of a program debugging system according to an embodiment of the present invention.
圖3是本發明一實施方式的程式調試方法的流程圖。 FIG. 3 is a flowchart of a program debugging method according to an embodiment of the present invention.
為了使本發明的目的、技術方案及優點更加清楚明白,以下結合附圖及實施例,對本發明進行進一步詳細說明。應當理解,此處所描述的具體實施例僅用以解釋本發明,並不用於限定本發明。基於本發明中的實施例,本領域普通技術人員在沒有做出創造性勞動前提下所獲得的所有其他實施例,都屬於本發明保護的範圍。 In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
進一步需要說明的是,在本文中,術語“包括”、“包含”或者其任何其他變體意在涵蓋非排他性的包含,從而使得包括一系列要素的過程、方法、物品或者裝置不僅包括那些要素,而且還包括沒有明確列出的其他要素,或者是還包括為這種過程、方法、物品或者裝置所固有的要素。在沒有更多限制的情況下,由語句“包括一個……”限定的要素,並不排除在包括該要素的過程、方法、物品或者裝置中還存在另外的相同要素。 It should be further noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements , but also other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
圖1為本發明程式調試裝置較佳實施例的功能模組圖。 FIG. 1 is a functional module diagram of a preferred embodiment of the program debugging device of the present invention.
請參閱圖1,本實施例中,程式調試裝置1可為電腦裝置。所述程式調試裝置1包括電性連接的記憶體10、至少一個處理器20、顯示器30、輸入裝置40以及存儲在所述記憶體10中並可在所述處理器20上運行的程式調試系統100。
Please refer to FIG. 1 . In this embodiment, the
所述處理器20執行所述統程式調試系統100時實現程式調試方法實施例中的步驟,例如,圖3所示的步驟S301~S306。或者,所述處理器20執行所述程式調試系統100時實現程式調試系統100實施例中各模組的功能,例如圖2中的模組101~105。
When the
所述程式調試系統100可以被分割成一個或多個模組,所述一個或者多個模組被存儲在所述記憶體10中,並由所述處理器20執行,以完成本發明。所述一個或多個模組可以是能夠完成特定功能的一系列電腦程式指令段,所述指令段用於描述所述程式調試系統100在所述程式調試裝置1中的執行過程。例如,所述程式調試系統100可以被分割成圖2中的建立模組101、映射模組102、設置模組103、模擬模組104、及判斷模組105。各模組具體功能參見下圖2中各模組的功能。
The
本領域技術人員可以理解,所述示意圖僅是程式調試裝置1的示例,並不構成對程式調試裝置1的限定,可以包括比圖示更多或更少的部件,或者組合某些部件,或者不同的部件,例如所述程式調試裝置1還可以包括網路接入設備、匯流排等。
Those skilled in the art can understand that the schematic diagram is only an example of the
所稱處理器20可以是中央處理單元(Central Processing Unit,CPU),還可以是其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用積體電路(Application Specific Integrated Circuit,ASIC)、現場可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯器件、分立門或者電晶體邏輯器件、分立硬體元件等。通用處理器可以是微處理器或者所述處理器20也可以是任何常規的處理器等,所述處理器20可以利用各種介面和匯流排連接程式調試裝置1的各個部分。
The so-called
所述記憶體10可用於存儲所述程式調試系統100和/或模組,所述處理器20通過運行或執行存儲在所述記憶體10內的電腦程式和/或模組,以及調用存儲在記憶體10內的資料,實現所述程式調試裝置1的各種功能。所述記憶體10可以包括高速隨機存取記憶體,還可以包括非易失性記憶體,例如硬碟、記憶體、插接式硬碟,智慧存儲卡(Smart Media Card,SMC),安全數位(Secure Digital,SD)卡,快閃記憶體卡(Flash Card)、至少一個磁碟記憶體件、快閃記憶體器件、或其他非易失性固態記憶體件。
The
所述顯示器30用於顯示進行程式調試過程中的各種資料,例如,所述程式運行指令的理論波形以及模擬波形。
The
所述輸入裝置40可包括滑鼠、鍵盤等輸入裝置,用於接收調試人員輸入的資料。
The
圖2為本發明程式調試系統較佳實施例的功能模組圖。 FIG. 2 is a functional module diagram of a preferred embodiment of the program debugging system of the present invention.
參閱圖2所示,程式調試系統100可以包括建立模組101、映射模組102、設置模組103、模擬模組104以及判斷模組105。在一實施方式中,上述模組可以為存儲於所述記憶體10中且可被所述處理器20調用執行的可程式化軟體指令。可以理解的是,在其他實施方式中,上述模組也可為固化於所述處理器20中的程式指令或固件(firmware)。
Referring to FIG. 2 , the
所述建立模組101用於建立待調試程式對應的模擬運行環境。所述映射模組102用於將所述待調試程式中的指令和與所述指令對應的理論波形進行映射。所述設置模組103用於在所述待調試程式內設置觸發點。所述模擬模組104用於從所述觸發點運行所述待調試程式,並存儲對應的模擬波形。所述判斷模組105用於將所述模擬波形與所述理論波形進行對比,當所述模擬波形與所述理論波形比對不一致時,識別所述錯誤,並對所述錯誤進行修復。
The
圖3為本發明一實施方式中程式調試方法的流程圖。根據不同的需求,所述流程圖中步驟的順序可以改變,某些步驟可以省略。 FIG. 3 is a flowchart of a program debugging method in an embodiment of the present invention. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
步驟S301,所述建立模組101建立待調試程式對應的模擬運行環境。
Step S301, the
在本較佳實施例中,所述“建立待調試程式對應的類比運行環境”的步驟包括: In this preferred embodiment, the step of "establishing an analog running environment corresponding to the program to be debugged" includes:
步驟a1,讀取所述待調試程式對應的程式檔。所述程式檔為bin格式或者hex格式檔,預存於所述記憶體10內。
Step a1, read the program file corresponding to the program to be debugged. The program file is a bin format or hex format file, and is pre-stored in the
步驟a2,運行所述的程式檔,以類比所述待調試程式執行的過程。 Step a2, run the program file to simulate the execution process of the program to be debugged.
步驟S302,所述映射模組102將所述待調試程式中的指令和與所述指令對應的理論波形進行映射。所述理論波形是指所述指令中不存在錯誤時,執行所述指令生成的波形。
Step S302, the
在本較佳實施例中,所述“將所述待調試程式中的指令和與所述指令對應的理論波形進行映射”的步驟包括: In this preferred embodiment, the step of "mapping the instruction in the program to be debugged and the theoretical waveform corresponding to the instruction" includes:
步驟b1,獲取所述指令與機器代碼編譯器的列表檔。所述列表文件可預存於所述記憶體10內。
Step b1, obtaining the list file of the instruction and the machine code compiler. The list file can be pre-stored in the
步驟b2,根據所述列表檔將所述指令與所述理論波形進行對應。 Step b2: Corresponding the instruction with the theoretical waveform according to the list file.
步驟S303,所述設置模組103在所述待調試程式內設置觸發點。通過所述觸發點,在後續模擬過程中,可方便查找對應的位置。
Step S303, the
在本發明第一較佳實施例中,所述“在所述待調試程式內設置觸發點”的步驟包括: In the first preferred embodiment of the present invention, the step of "setting a trigger point in the program to be debugged" includes:
步驟c1,類比執行所述待調試程式,並根據執行結果確定產生所述錯誤的指令。 Step c1 , execute the program to be debugged by analogy, and determine the instruction generating the error according to the execution result.
步驟c2,在產生所述錯誤的指令執行之前設置所述觸發點。 Step c2, setting the trigger point before executing the instruction that generates the error.
在本發明第二較佳實施例中,所述“在所述待調試程式內設置觸發點”的步驟包括:在所述待調試程式的中間位置設置觸發點。 In the second preferred embodiment of the present invention, the step of "setting a trigger point in the program to be debugged" includes: setting a trigger point in the middle of the program to be debugged.
步驟S304,所述模擬模組104從所述觸發點運行所述待調試程式,並存儲對應的模擬波形。
Step S304, the
步驟S305,所述判斷模組105將所述模擬波形與所述理論波形進行對比,當所述模擬波形與所述理論波形比對不一致時,識別所述錯誤,並對所述錯誤進行修復。可以理解,所述判斷模組105可利用所述顯示器30顯示所述模擬波形與所述理論波形,方便調試人員查看。
Step S305, the
步驟S306,所述判斷模組105還進一步判斷所述錯誤是否修復完畢,具體地,可由調試人員判斷錯誤是否修復完畢,所述判斷模組105利用所述輸入裝置40獲取所述判斷結果,如果沒有修復完畢,則返回至所述步驟S303,再次重複步驟S303至S305,直至所述錯誤修復完畢結束。如果已經修復完畢,則結束流程。
Step S306, the judging
上述程式調試方法、裝置1及電腦可讀存儲介質通過設置觸發點,並從所述觸發點對待調試程式進行模擬及模擬波形資料的存儲,可減少調試過程中重複的次數,減少調試時間,加快模擬速度,同時,可減少存儲模擬波形資料所佔用的硬碟空間。此外,調試過程無需配置模擬設備,因此,成本較低。
The above-mentioned program debugging method,
對本領域的技術人員來說,可以根據本發明的發明方案和發明構思結合生產的實際需要做出其他相應的改變或調整,而這些改變和調整都應屬於本發明所公開的範圍。 For those skilled in the art, other corresponding changes or adjustments can be made according to the inventive solution and inventive concept of the present invention combined with the actual needs of production, and these changes and adjustments should all belong to the scope disclosed by the present invention.
除非另有定義,本文所使用的所有的技術和科學術語與屬於本發明的技術領域的技術人員通常理解的含義相同。本文中在本發明的說明書中所使用的術語只是為了描述具體的實施例的目的,不是旨在於限制本發明。 Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terms used herein in the description of the present invention are for the purpose of describing specific embodiments only, and are not intended to limit the present invention.
1:程式調試裝置 1: Program debugging device
10:記憶體 10: Memory
20:處理器 20: Processor
30:顯示器 30: Display
40:輸入裝置 40: Input device
100:程式調試系統 100: Program debugging system
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW109128322A TWI761917B (en) | 2020-08-19 | 2020-08-19 | Program debugging method, device and storage media |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW109128322A TWI761917B (en) | 2020-08-19 | 2020-08-19 | Program debugging method, device and storage media |
Publications (2)
Publication Number | Publication Date |
---|---|
TW202209107A TW202209107A (en) | 2022-03-01 |
TWI761917B true TWI761917B (en) | 2022-04-21 |
Family
ID=81747139
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW109128322A TWI761917B (en) | 2020-08-19 | 2020-08-19 | Program debugging method, device and storage media |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI761917B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI322351B (en) * | 2006-12-22 | 2010-03-21 | Inventec Besta Co Ltd | |
US8516309B1 (en) * | 2010-03-29 | 2013-08-20 | Emc Corporation | Method of debugging a software system |
US20160266996A1 (en) * | 2011-05-05 | 2016-09-15 | International Business Machines Corporation | Program subset execution and debug |
TWI554875B (en) * | 2010-12-27 | 2016-10-21 | 微軟技術授權有限責任公司 | Predicting, diagnosing, and recovering from application failures based on resource access patterns |
TWI599906B (en) * | 2015-04-23 | 2017-09-21 | Mitsubishi Electric Corp | Program update device, complex cell device, update decision program product and program update method |
CN107844412A (en) * | 2016-09-19 | 2018-03-27 | 东华软件股份公司 | Method and apparatus for program debugging |
TWI709907B (en) * | 2019-12-31 | 2020-11-11 | 新唐科技股份有限公司 | Micro-controller |
-
2020
- 2020-08-19 TW TW109128322A patent/TWI761917B/en active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI322351B (en) * | 2006-12-22 | 2010-03-21 | Inventec Besta Co Ltd | |
US8516309B1 (en) * | 2010-03-29 | 2013-08-20 | Emc Corporation | Method of debugging a software system |
TWI554875B (en) * | 2010-12-27 | 2016-10-21 | 微軟技術授權有限責任公司 | Predicting, diagnosing, and recovering from application failures based on resource access patterns |
US20160266996A1 (en) * | 2011-05-05 | 2016-09-15 | International Business Machines Corporation | Program subset execution and debug |
TWI599906B (en) * | 2015-04-23 | 2017-09-21 | Mitsubishi Electric Corp | Program update device, complex cell device, update decision program product and program update method |
CN107844412A (en) * | 2016-09-19 | 2018-03-27 | 东华软件股份公司 | Method and apparatus for program debugging |
TWI709907B (en) * | 2019-12-31 | 2020-11-11 | 新唐科技股份有限公司 | Micro-controller |
Also Published As
Publication number | Publication date |
---|---|
TW202209107A (en) | 2022-03-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8417998B2 (en) | Targeted black box fuzzing of input data | |
US7293204B2 (en) | Computer peripheral connecting interface system configuration debugging method and system | |
CN111722990A (en) | Method and device for checking cable connection between main back boards | |
TWI620061B (en) | Error detecting apparatus of server and error detecting method thereof | |
US11302412B2 (en) | Systems and methods for simulated device testing using a memory-based communication protocol | |
CN105320553A (en) | Method and system for updating network card firmware based on domestic processor platform | |
JP2017084082A (en) | Simulation device, test scenario file creation method, and test method using test scenario file | |
US8122293B2 (en) | Method for automatically simulating manual testing of a computer, and testing system for performing the method | |
CN111400992A (en) | Test method and system for automatically verifying boxing layout and wiring | |
CN110516447A (en) | A kind of method and apparatus of identification terminal simulator | |
CN112286750A (en) | GPIO (general purpose input/output) verification method and device, electronic equipment and medium | |
US8589734B2 (en) | Verifying correctness of processor transactions | |
CA2811617A1 (en) | Commit sensitive tests | |
CN101131663B (en) | Method for detecting installation correctness of computer PCI/PCI Express devices | |
TWI761917B (en) | Program debugging method, device and storage media | |
US11397662B2 (en) | Method for debugging computer program, device employing method, and storage medium | |
TW202411872A (en) | Verification system, verification method, electronic device and storage medium | |
TWI668566B (en) | Memory inspecting system, memory inspecting method, and error mapping table building method for memory inspecting | |
CN115732025A (en) | Method and device for verifying access conflict of RAM (random Access memory) | |
CN113360402B (en) | Test method, electronic equipment, chip and storage medium | |
US10803219B1 (en) | Method and system for combined formal static analysis of a design code | |
CN116861829B (en) | Method for locating errors in logic system design and electronic equipment | |
CN113407394B (en) | Method, device, equipment and medium for server RAS function test | |
US20210173989A1 (en) | Simulation signal viewing method and system for digital product | |
CN117332733A (en) | Method, equipment and storage medium for positioning errors of logic system design |