CN103077112A - Software debugging method and system - Google Patents
Software debugging method and system Download PDFInfo
- Publication number
- CN103077112A CN103077112A CN2012103938522A CN201210393852A CN103077112A CN 103077112 A CN103077112 A CN 103077112A CN 2012103938522 A CN2012103938522 A CN 2012103938522A CN 201210393852 A CN201210393852 A CN 201210393852A CN 103077112 A CN103077112 A CN 103077112A
- Authority
- CN
- China
- Prior art keywords
- debugging
- file
- code
- breakpoint
- description document
- 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
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a software debugging method and a software debugging system. The method comprises the following steps of: setting key debugging information by using an embedded system descriptive language; storing the key debugging information as a description file in the format of embedded system software debugging information; parsing the description file and modifying an executable file generated by debugging codes according to the parsed description file; and running the debugging codes according to the modified executable file and recording a debugging result. Through the method and the system provided by the invention, the workload of system porting can be reduced during debugging, and the characteristics of light weight, high scalability, strong operability, platform independence and the like are obtained.
Description
Technical field
The present invention relates to the debugging technique of embedded software, relate in particular to a kind of method and system of software debugging.
Background technology
Debugger is being brought into play very important effect as a kind of important software debugging means in software development, for example, when software defect was carried out trace debug, debugger provided very many functions, comprising: operation, time-out, process of stepping; Breakpoint is set; Operation note and internal memory; Catch internal abnormality etc.Debugger mainly comprises hardware debugger and software running device, hardware debugger powerful, but expensive, use cost and learning cost are all very high; Software running device is normally debugged for the code that operates on the operating system layer, and this debugging does not possess portability, especially supports limited to the debugging of the bottom layer driving code of the software systems such as linux, ucos, ecos.
The principle of work of software debugging in the correlation technique is normally moved one section code, checks its output by display, judges whether that according to its Output rusults operation is correct.Yet, for the bottom layer driving code debugging of system, the situations such as code debugging of system initialisation phase, this moment is because the also loading of the driver of display, display is not output also, yet there are not the interactive meanses such as serial ports, network interface, therefore, traditional software debugging method and be not suitable for the code debugging of above situation.For the bottom layer driving code of system, the debugging demands such as code of system initialisation phase, correlation technique adopts a kind of mode of lighting a lamp to debug the tracking code.But this debud mode of lighting a lamp can not be checked the call stack of program, also needs some configuration efforts basic to processor even light a lamp, and is visual poor, complicated operation.
Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of method and system of software debugging, with the method and system of software debugging, with the solution problems such as the visuality of debud mode is poor, complicated operation of lighting a lamp.
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of method of software debugging, the method comprises: use the embedded system descriptive language that key Debugging message is set; Storing described key Debugging message according to the form of built-in system software Debugging message is description document; Resolve described description document, and revise the executable file that debugging code generates according to the description document of resolving; According to amended executable file operation debugging code, and the record debug results.
Described key Debugging message comprises: the breakpoint mode of choosing, the physical memory addresses that produces breakpoint, the register that need to check when breakpoint arrives, the memory address of recording exceptional information.
It is description document that described form according to the built-in system software Debugging message is stored described key Debugging message, comprising: described key Debugging message is stored as the description document that suffix is .cfg according to predefined form.
Described description document according to resolving is revised the executable file that debugging code generates, comprise: the threaded file the carried out form ELF file that generates according to the form modifying debugging code of cfg file, according to processor instruction set, debugging code is inserted in the amended ELF file the amended ELF file of the new url of laying equal stress on.
The amended executable file operation of described foundation debugging code, and record debug results, comprise: when running to breakpoint generation place, resolve stack register and generate the text root function and call, and the content of the information of record function call stack and the register that will check is to the memory address of recording exceptional information.
A kind of system of software debugging, this system comprises:
User's expansion connection module is used for using the embedded system descriptive language that key Debugging message is set;
Extended debugging routine processes engine, being used for storing described key Debugging message according to the form of built-in system software Debugging message is description document;
Routine library is processed in debugging, is used for resolving the description document that described extended debugging routine processes engine is stored, and revises the executable file that debugging code generates according to the description document of resolving;
The operating system processing module is used for according to the amended executable file operation of extended debugging routine processes engine debugging code, and the record debug results.
Described key Debugging message comprises: the breakpoint mode of choosing, the physical memory addresses that produces breakpoint, the register that need to check when breakpoint arrives, the memory address of recording exceptional information.
Described extended debugging routine processes engine also is used for described key Debugging message is stored as the description document that suffix is .cfg according to predefined form.
Routine library is processed in described debugging, the threaded file the carried out form ELF file that also generates for the form modifying debugging code according to the cfg file, according to processor instruction set, debugging code is inserted in the amended ELF file the amended ELF file of the new url of laying equal stress on.
Described operating system processing module also is used for when run to breakpoint generation place, resolve stack register and generate the text root function and call, and the content of the information of record function call stack and the register that will check arrives the memory address of recording exceptional information.
The method and system of a kind of software debugging provided by the present invention uses the embedded system descriptive language that key Debugging message is set; Storing described key Debugging message according to the form of built-in system software Debugging message is description document; Resolve described description document, and revise the executable file that debugging code generates according to the description document of resolving; According to amended executable file operation debugging code, and the record debug results.This mode by direct modification executable file is carried out code debugging, can reduce the workload of implant system, is specially adapted to just have after the polycaryon processor, system initialization the system of serial ports.The characteristics such as debud mode of the present invention has lightweight, can expand, workable, platform independence.
Description of drawings
Fig. 1 is the method flow diagram of a kind of software debugging of the embodiment of the invention;
Fig. 2 is the synoptic diagram of a kind of register in the embodiment of the invention;
Fig. 3 is that the system of a kind of software debugging of the embodiment of the invention forms structural representation.
Embodiment
The technical solution of the present invention is further elaborated below in conjunction with the drawings and specific embodiments.
The method of a kind of software debugging that the embodiment of the invention provides as shown in Figure 1, mainly comprises:
Key Debugging message comprises: the breakpoint mode of choosing, the physical memory addresses that produces breakpoint, the register that need to check when breakpoint arrives and the memory address of recording exceptional information etc.
The major function of debugger comprises debugging breakpoints, storehouse analysis etc.For debugging breakpoints, the debugging breakpoints means that the debugging acid of main flow provides mainly are software breakpoint and Hardware Breakpoint.Software breakpoint is exactly to make its time-out when CPU carries out the code of ad-hoc location.Software breakpoint is maximum breakpoint of using in the debug process.The essence of software breakpoint is exactly the instruction of a byte, is used for suspending the program that is performed, and control is transferred to the breakpoint processing function of debugger.
Take the PowerPC processor as example, the PowerPC processor is the central processing unit (CPU) of a kind of Reduced Instruction Set Computer (RISC, Reduced Instruction Set Computer) framework.Be illustrated in figure 2 as the synoptic diagram of Hardware Breakpoint register in the PowerPC processor.
The mtcr r5 that gives an order, this instruction is not understood by CPU, need to be converted into a kind of operational code, and this instruction transformation becomes operational code to be 8BC3, if this instruction occurs in this address of 0x4433221, then is shown as:
0x44332211:8BC3 mtcr r5
In order in this address breakpoint to be set, suspend CPU, the 8BC3 operational code of 2 bytes need to be converted to the operational code of a byte, the operational code after the conversion is 0xCC, is shown as:
0x44332211:CCC3 mtcr r5
The function of Hardware Breakpoint is very powerful, and the PowerPC processor carries the Hardware Breakpoint register, to realize following basic interrupt function:
A, interruption when having instruction to carry out on the specific address;
B, on specific address, there are data can write fashionable interruption;
C, on specific address, there are data to read or write, but interrupt when not carrying out.
Described key Debugging message is stored as the description document that suffix is .cfg according to predefined form.
Debugging is processed routine library and is resolved this description document, and revises the threaded file carried out form (ELF, the Executable and Linkable Format) file that debugging code generates according to the form of cfg file.The ELF file is the executable file under the linux system.Subsequently, according to processor instruction set, in the amended ELF file of code insertion, the amended ELF file of the new url of laying equal stress on.
The above-mentioned ELF file that debugging code is generated make amendment in have: select storehouse to call and resolve form, the register title that will record, data segment content .data.bss etc., these information are recorded to the reserved memory address of system.
The operation debugging code, when running to breakpoint generation place, pressure jumps to inserts the code place, scale-of-two import deal according to the PowerPC processor, the record breakpoint requires the information of record when occurring, and automatically resolve stack register generation text root function and call, the content of the information of record function call stack and the register that will check is to the memory address of recording exceptional information.
The below is take ucos code and PowerPC processor as example, and the software debugging method of the embodiment of the invention is further elaborated.
1, at first in configuration file, selects breakpoint type, the degree of depth of choice function call stack, the register that selection will be checked, the memory address of definition record abnormal information when breakpoint arrives.
If the selection software breakpoint then by resolving the symbol table that will move the ELF file, is listed the function that will locate, example is as follows:
c0000000<_start>:
c0000000: 60 00 00 00 nop
c0000004: 7c 7f 1b 78 mr r31,r3
c0000008: 7c 9e 23 78 mr r30,r4
c000000c: 7c bd 2b 78 mr r29,r5
c0000010: 7c dc 33 78 mr r28,r6
c0000014: 7c fb 3b 78 mr r27,r7
c0000018: 3b 20 00 00 li r25,0
c000001c: 3b 00 00 00 li r24,0
c0000020: 3a e0 00 00 li r23,0
c0000024: 48 00 00 05 bl c0000028<invstr>
c0000028<invstr>:
c0000028: 7c c8 02 a6 mflr r6
c000002c: 7c e0 00 a6 mfmsr r7
c0000030: 54 e4 df fe rlwinm r4,r7,27,31,31
If need to locate to increase breakpoint, the address of then recording this software interruption by configuration file at " c0000014:7c fb 3b 78mr r27, the r7 " of start function.
2, resolve this configuration file, debugging is processed routine library the ELF file that the ucos code generates is made amendment the amended ELF file of the new url of laying equal stress on.
3, at processor operation ucos code, when running to breakpoint generation place, the information of function call stack, the content of registers that check can be automatically recorded on the user-defined memory address.
4, the automatic power-off restarting not of equipment after restarting, is preserved address information by checking self-defining abnormal information, checks the information when obtaining breakpoint occurs.
The embodiment of the invention is carried out code debugging by the mode of direct modification executable file, by the interface, can reduce the workload of implant system, is specially adapted to just have after the polycaryon processor, system initialization the system of serial ports.The characteristics such as debud mode of the present invention has lightweight, can expand, workable, platform independence.
As shown in Figure 3, the present invention also provides a kind of system of software debugging, comprising:
User's expansion connection module is used for using the embedded system descriptive language that key Debugging message is set;
Extended debugging routine processes engine, being used for storing key Debugging message according to the form of built-in system software Debugging message is description document;
Routine library is processed in debugging, is used for resolving the description document that extended debugging routine processes engine is stored, and revises the executable file that debugging code generates according to the description document of resolving;
The operating system processing module is used for according to the amended executable file operation of extended debugging routine processes engine debugging code, and the record debug results.
Preferably, key Debugging message comprises: the breakpoint mode of choosing, the physical memory addresses that produces breakpoint, the register that need to check when breakpoint arrives, the memory address of recording exceptional information.
Extended debugging routine processes engine also is used for key Debugging message is stored as the description document that suffix is .cfg according to predefined form.
Routine library is processed in debugging, the threaded file the carried out form ELF file that also generates for the form modifying debugging code according to the cfg file, according to processor instruction set, debugging code is inserted in the amended ELF file the amended ELF file of the new url of laying equal stress on.
The operating system processing module also is used for when run to breakpoint generation place, resolve stack register and generate the text root function and call, and the content of the information of record function call stack and the register that will check arrives the memory address of recording exceptional information.
The above is preferred embodiment of the present invention only, is not for limiting protection scope of the present invention.
Claims (10)
1. the method for a software debugging is characterized in that, the method comprises:
Use the embedded system descriptive language that key Debugging message is set;
Storing described key Debugging message according to the form of built-in system software Debugging message is description document;
Resolve described description document, and revise the executable file that debugging code generates according to the description document of resolving;
According to amended executable file operation debugging code, and the record debug results.
2. the method for described software debugging according to claim 1, it is characterized in that described key Debugging message comprises: the breakpoint mode of choosing, the physical memory addresses that produces breakpoint, the register that need to check when breakpoint arrives, the memory address of recording exceptional information.
3. the method for described software debugging according to claim 2 is characterized in that it is description document that described form according to the built-in system software Debugging message is stored described key Debugging message, comprising:
Described key Debugging message is stored as the description document that suffix is .cfg according to predefined form.
4. the method for described software debugging according to claim 3 is characterized in that, described description document according to resolving is revised the executable file that debugging code generates, and comprising:
The threaded file carried out form ELF file according to the form modifying debugging code of cfg file generates, inserts debugging code in the amended ELF file the amended ELF file of the new url of laying equal stress on according to processor instruction set.
5. the method for described software debugging according to claim 4 is characterized in that, the amended executable file operation of described foundation debugging code, and record debug results comprise:
When running to breakpoint generation place, resolve stack register and generate the text root function and call, and the content of the information of record function call stack and the register that will check is to the memory address of recording exceptional information.
6. the system of a software debugging is characterized in that, this system comprises:
User's expansion connection module is used for using the embedded system descriptive language that key Debugging message is set;
Extended debugging routine processes engine, being used for storing described key Debugging message according to the form of built-in system software Debugging message is description document;
Routine library is processed in debugging, is used for resolving the description document that described extended debugging routine processes engine is stored, and revises the executable file that debugging code generates according to the description document of resolving;
The operating system processing module is used for according to the amended executable file operation of extended debugging routine processes engine debugging code, and the record debug results.
7. the system of described software debugging according to claim 6, it is characterized in that described key Debugging message comprises: the breakpoint mode of choosing, the physical memory addresses that produces breakpoint, the register that need to check when breakpoint arrives, the memory address of recording exceptional information.
8. the system of described software debugging according to claim 7 is characterized in that,
Described extended debugging routine processes engine also is used for described key Debugging message is stored as the description document that suffix is .cfg according to predefined form.
9. the system of described software debugging according to claim 8 is characterized in that,
Routine library is processed in described debugging, the threaded file the carried out form ELF file that also generates for the form modifying debugging code according to the cfg file, according to processor instruction set, debugging code is inserted in the amended ELF file the amended ELF file of the new url of laying equal stress on.
10. the system of described software debugging according to claim 9 is characterized in that,
Described operating system processing module also is used for when run to breakpoint generation place, resolve stack register and generate the text root function and call, and the content of the information of record function call stack and the register that will check arrives the memory address of recording exceptional information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2012103938522A CN103077112A (en) | 2012-10-16 | 2012-10-16 | Software debugging method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2012103938522A CN103077112A (en) | 2012-10-16 | 2012-10-16 | Software debugging method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103077112A true CN103077112A (en) | 2013-05-01 |
Family
ID=48153645
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2012103938522A Pending CN103077112A (en) | 2012-10-16 | 2012-10-16 | Software debugging method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103077112A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103699481A (en) * | 2013-12-03 | 2014-04-02 | 华为技术有限公司 | Code debugging method and code debugging system |
CN103729288A (en) * | 2013-11-01 | 2014-04-16 | 华中科技大学 | Application program debugging method under embedded multi-core environment |
CN104503738A (en) * | 2014-11-28 | 2015-04-08 | 华为技术有限公司 | Parameter transferring method, single-broad loader, single broad and single-broad simulator |
CN105138453A (en) * | 2015-08-12 | 2015-12-09 | 杭州数梦工场科技有限公司 | Program debugging method and apparatus |
CN106250312A (en) * | 2016-07-29 | 2016-12-21 | 腾讯科技(深圳)有限公司 | Data test method and device |
CN106598830A (en) * | 2015-10-16 | 2017-04-26 | 阿里巴巴集团控股有限公司 | Mobile terminal webpage script debugging method and system |
CN107451045A (en) * | 2016-05-31 | 2017-12-08 | 北京信威通信技术股份有限公司 | A kind of method and device of abnormal information positioning |
CN109344083A (en) * | 2018-11-05 | 2019-02-15 | 郑州云海信息技术有限公司 | A kind of program debugging method, device, equipment and readable storage medium storing program for executing |
CN110088736A (en) * | 2016-12-05 | 2019-08-02 | 耐瑞唯信有限公司 | Self-debugging |
CN110347610A (en) * | 2019-07-23 | 2019-10-18 | 中电智能科技有限公司 | A kind of embedded code debugging system and method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1627254A (en) * | 2003-12-10 | 2005-06-15 | 华为技术有限公司 | Method for debuging embedded system and equipment |
CN101609429A (en) * | 2009-07-22 | 2009-12-23 | 大唐微电子技术有限公司 | A kind of method and apparatus of debugging embedded operating system |
CN102279789A (en) * | 2010-06-13 | 2011-12-14 | 三星电子(中国)研发中心 | Debugging system and debugging method for embedded system of production phase |
-
2012
- 2012-10-16 CN CN2012103938522A patent/CN103077112A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1627254A (en) * | 2003-12-10 | 2005-06-15 | 华为技术有限公司 | Method for debuging embedded system and equipment |
CN101609429A (en) * | 2009-07-22 | 2009-12-23 | 大唐微电子技术有限公司 | A kind of method and apparatus of debugging embedded operating system |
CN102279789A (en) * | 2010-06-13 | 2011-12-14 | 三星电子(中国)研发中心 | Debugging system and debugging method for embedded system of production phase |
Non-Patent Citations (1)
Title |
---|
李宝丹: "《嵌入式系统辅助调试环境的开发》", 《中国优秀硕士学位论文全文数据库》, 15 March 2010 (2010-03-15) * |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103729288B (en) * | 2013-11-01 | 2016-02-24 | 华中科技大学 | The adjustment method of application program under a kind of embedded multi-core environment |
CN103729288A (en) * | 2013-11-01 | 2014-04-16 | 华中科技大学 | Application program debugging method under embedded multi-core environment |
CN103699481A (en) * | 2013-12-03 | 2014-04-02 | 华为技术有限公司 | Code debugging method and code debugging system |
CN104503738B (en) * | 2014-11-28 | 2018-03-06 | 华为技术有限公司 | Parameter transfer method, veneer loader, veneer and veneer emulator |
CN104503738A (en) * | 2014-11-28 | 2015-04-08 | 华为技术有限公司 | Parameter transferring method, single-broad loader, single broad and single-broad simulator |
CN105138453A (en) * | 2015-08-12 | 2015-12-09 | 杭州数梦工场科技有限公司 | Program debugging method and apparatus |
CN105138453B (en) * | 2015-08-12 | 2018-08-14 | 杭州数梦工场科技有限公司 | A kind of program debugging method and device |
CN106598830B (en) * | 2015-10-16 | 2019-06-07 | 阿里巴巴集团控股有限公司 | The page script adjustment method and system of mobile terminal |
CN106598830A (en) * | 2015-10-16 | 2017-04-26 | 阿里巴巴集团控股有限公司 | Mobile terminal webpage script debugging method and system |
CN107451045A (en) * | 2016-05-31 | 2017-12-08 | 北京信威通信技术股份有限公司 | A kind of method and device of abnormal information positioning |
CN106250312B (en) * | 2016-07-29 | 2019-01-08 | 腾讯科技(深圳)有限公司 | Data test method and device |
CN106250312A (en) * | 2016-07-29 | 2016-12-21 | 腾讯科技(深圳)有限公司 | Data test method and device |
CN110088736A (en) * | 2016-12-05 | 2019-08-02 | 耐瑞唯信有限公司 | Self-debugging |
CN110088736B (en) * | 2016-12-05 | 2023-05-23 | 耐瑞唯信有限公司 | Self-tuning method and system |
CN109344083A (en) * | 2018-11-05 | 2019-02-15 | 郑州云海信息技术有限公司 | A kind of program debugging method, device, equipment and readable storage medium storing program for executing |
CN110347610A (en) * | 2019-07-23 | 2019-10-18 | 中电智能科技有限公司 | A kind of embedded code debugging system and method |
CN110347610B (en) * | 2019-07-23 | 2023-10-27 | 中电智能科技有限公司 | Embedded code debugging system and method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103077112A (en) | Software debugging method and system | |
EP2359247B1 (en) | Transforming user script code for debugging | |
EP2368189B1 (en) | Debugging pipeline | |
RU2668973C2 (en) | Debugging native code by transitioning from execution in native mode to execution in interpreted mode | |
US20080127113A1 (en) | Method and system for implementing watchpoints | |
US6397382B1 (en) | Dynamic software code instrumentation with cache disabling feature | |
CN103106132B (en) | During linux system collapse, adjustment method analyzed by kernel function call stack | |
KR20210002701A (en) | Execution control through cross-level trace mapping | |
CN102117241A (en) | Multi-core system debugging method and multi-core system | |
TW201337755A (en) | Multiple national language supporting system and method of applications | |
WO2013007068A1 (en) | Automatic test system and method oriented to functions of hardware apparatus | |
US20130132063A1 (en) | Systems and methods for debugging just-in-time static translation in an emulated system | |
CN105843590B (en) | A kind of parallel instruction set pre-decode method and system running on CUDA platform | |
US10853224B2 (en) | Indexing and searching a time-travel trace for arbitrary length/arbitrary alignment values | |
CN113342654A (en) | Script language code debugging method and device, readable storage medium and electronic equipment | |
US8943480B2 (en) | Setting breakpoints in optimized instructions | |
CN102722438B (en) | Kernel debugging method and equipment | |
US20120110383A1 (en) | Method and apparatus for off-line analyzing crashed programs | |
CN111475150A (en) | Cross-language binding method, device, equipment and storage medium | |
CN102541727B (en) | Program debugging method and system | |
CN105824750A (en) | Soft breakpoint simulation method during NorFlash program space debugging | |
US9405739B1 (en) | Source code format for IDE code development with embedded objects | |
CN114036047A (en) | Method for realizing firmware instant debugger based on serial port | |
CN110096888B (en) | Method and system for accelerating verification and analyzing SMM potential safety hazard | |
CN114510429A (en) | Debugging method, system and medium based on dynamic symbol execution |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20130501 |