Intel 8086/8088 mikroişlemcileri için debugger tasarımı

thumbnail.default.alt
Tarih
1992
Yazarlar
Şanal, Ali Sabri
Süreli Yayın başlığı
Süreli Yayın ISSN
Cilt Başlığı
Yayınevi
Fen Bilimleri Enstitüsü
Institute of Science and Technology
Özet
Bu tez çalışmasında, günümüz kişisel bilgisayarlannda kullanılan İntel 8086 ve 8088 mikroişlemcileri için DOS ortamında yazılmış programların, makina komutlan düzeyinde test edilmeleri gösterilmiştir. Bu doğrultuda işlemci kontrol özelliklerinden yararlanılarak bir 'Hata bulucu program' (Debugger) hazırlanmıştır. Amaç işlemcinin sahip olduğu, düşük seviyeli kullanımdaki, 'single-step', 'breakpoint' test mekanizmalarının işleyişini açıklayarak, geliştirilecek yazılımlarda bu stratejilerin kullanımını göstermektir. Programın genel rutinleri Turbo C programlama dili ile, işlemcinin teknik özelliklerini kullanan daha spesifik rutinler ise Assembly programlama dili ile yazılmıştır. Daha sonra bu ayn modüller object kod halinde derlenerek ana programla birleştirilmişlerdir. Çalışmada aynca, disk işletim sistemi DOS'un program yönetimi ve icra edilebilir programlann yapısı incelenerek ayrıntılı bilgi verilmiştir. Hazırlanan program, mevcut hata bulucu programlarla kıyaslandığında eksiksiz olduğu söylenemez. Ancak yazılım geliştirme araçlarından biri olan hata bulucu programların tüm temel özelliklerini taşıyan bir örneğini teşkil etmektedir.
A debugger design for Intel 8086/8088 Debuggers A debugger Is a program designed to facilitate the final debugging of a user program. The debugger offers facilities such as: "Stop at instruction X ", "Execute instruction one at a time", "Display the contents of registers", "Display the contents of memory (in hexadecimal or symbolic form)", "Fill the memory with the desired values", using a debugger, the contents of the registers can be changed and the program can be restarted with new data. The advantages of the debugger may not be obvious at first but on a hardware microprocessor it's imposible that to examine the contents of registers once execution is stopped. The only way to examine them would be to connect microprobes to the actual flip-flops of the registers inside the chip. Once the microprocessor is sealed, only the contents of its buses are visible. An essential feature of a debugger is that it allows examination of the contents of registers and changes to the contents. This is accomplished by the debugger, either by executing under the control of a simulator or an emulator, which stores a copy of the value of the registers in the memory Debugging and testing are among the most time-consuming stages of software development. Even though such methods as modular programing, structured programing and top-down design can siplify programs and reduce the frequency of errors, debugging and testing are still difficult. Because they are so poorly defined. Debugging tools have two major functions. One is to pin the error down to a short section of the program ; the other is to provide more detailed information about what the computer is doing than is provided by normal runs, and so make the source of the error obvious. Current debugging tools do not find and correct errors by themselves ; user must know enough about what is happening to recognize and correct the error when the debugging tools zero in on it and show its effects in detail. Debugging and testing are the stepchildren of the software development process. Most projects leave far too little time for them and most textbooks neglect them. But designers and software developers often find that these stages are the most expensive and time consuming. Progress may be difficult to measure or produce. Debugging and testing microprocessor software is particularly difficult because the powerful hardware and software tools can be used on larger computers are seldom available for microcomputers. Simple Debugging Tools The most common simple debugging tools are:. Breakpoint facility. Single step facility. Trace facility. Register and memory dump programs Breakpoint : An essential facility of a debugger is that it provides breakpoints. Breakpoints are addresses, specified by user, at which the program will stop automaticaly. using breakpoints, the user can examine the value of variables in the memory, or the contents of registers. The program execution is said to be suspended. While the user program is being debugged under the control of the debugger, diagnostics are generated. They will normaly be displayed on the screen. Limited corrections are then possible if the user is willing to modify memory locations directly. Breakpoints allow the user either to check or pass over an entire section of a program. To see if an initialization routine is correct the user can place a breakpoint on the end of it and run the program. In 8086-8088 type 3 interrupt is dedicated to the breakpoint interrupt. A breakpoint is generaly any place in a program where normal execution is arrested so that some sort of special processing may be performed. Breakpoints typicaly are inserted into programs during debugging as a way of displaying registers, memory locations, etc., at crucial points in the program. The INT 3 (breakpoint) instruction is one byte long. This makes it easy to "Plant" a breakpoint any where in a program. The simplest and best way to insert a breakpoint in a program is to replace the firs word of an instruction. When the trap instruction is executed, program control is transfered to a breakpoint routine specified via a trap vector, the processor is forced into supervisor mode, and the program counter and register contents are saved. vi Single-step: A single-step facility allows the user to execute a program on instruction or one memory cycle at a time. After each step the user might display register or memory contents. When TF (the trap flag) is set, the 8086-8088 is said to be in single-step mode. In this mode the processor automatically generates a type 1 interrupt after each instruction. As a part of its interrupt processing, the CPU automatically pushes the flags onto the stack and then clears TF and IF. Thus the processor is not in single-step mode when the single-step interrupt procedure Is entered; it runs normaly. When the single-step procedure terminates, the old flag image is restored from the stack, placing the CPU back into single-step mode. Single-stepping is a valuable debugging tool. It allows the single-step procedure to act as a "window" into the system trough wihich operation can be observed instruction-by-instruction. A single-step procedure, for example, can print or display register contents, the value of the instruction pointer (it is on the stack), key memory variables as they change after each instruction. In this way the exact flow of a program can be traced in detail, and the point at which discrepancies occur can be determined. The 8086 and 8088 do not have instructions for setting or clearing TF directly. Rather, TF can be changed by modifying the flag-image on the stack. The PCISHF and POPF instructions are available for pushing and poping the flags directly (TF can be set by ORing the flag image with 0100H and cleared by ANDing it with FEFFH). After TF is set in this manner, the first single-step interrupt occurs after the first instruction following the IRET from the single- step procedure. Trace Facility: The trace facility allows the user to see intermediate results since the user can determine the status of the processor's registers after each instruction is executed. A simple trace usualy lets the user step trough the program instruction by instruction and prints all the registers after each instruction is executed. A more useful trace facility might allow the user to execute several instruction before stopping and print the contents of specified memory locations. Simple instruction tracing may provide the user very detailed information about what happens inside the processor. This information should be sufficient to identify such errors as jump and branch instructions with incorrect conditions and/or destinations, omitted or incorrect addresses, incorrect operation codes, and improper data values. The user keep in mind that a single-step trace slows the processor far below its normal speed. Thus, the user cannot check delay loops or I/O operations in real time. Nor a single-step trace can help the user to find timing errors or errors in the interrupt or DMA system. In fact, the single-step mode typically operates at less than one millionth of normal processor speed. To single-step through one second of real processor time would require more than one day. The single-step trace mode, therefore, is useful to check the logic of short sequences of instructions. vii Register and memory dump programs: Register and memory dump programs are facilities that list the contents of all, or some selected subset, of the processor's registers and the contents of memory on the screen in hexadecimal format. This is an efficient way of examining data arrays and processor status. These routines are very often parts of a breakpoint handling routine and the debug program that controls the trace facility, useful register and memory dump routines will let the user specify which register and even which portion of selected registers to display and change the contents of the specified memory locations and registers. The project's main goal is to describe the debugging features and strategies for 8086-8088 microprocessors in DOS environment and to make clear the usage of breakpoint and single-step routines. The debugging program which is written in Turbo C programing language is an example of the kind of software development tool. It can be used to debug executable programs which is written for 8086-8088 microprocessors. The program is not meant to be the complete debugging tool but is an example of what can be put together to utilize the breakpoint and single-step routines and instruction encoding. The program provides following debugging facilities. Loading executable program modules into the memory.. Breakpoint facility. Single-stepping. Trace facility. Dump of the memory locations. Dump of register contents and stack. Encoding the instruction at a given memory location. Riling the memory with desired values.
Açıklama
Tez (Yüksek Lisans) -- İstanbul Teknik Üniversitesi, Fen Bilimleri Enstitüsü, 1992
Thesis (M.Sc.) -- İstanbul Technical University, Institute of Science and Technology, 1992
Anahtar kelimeler
Bilgisayar programları, Hata ayıklayıcı, Mikroişlemciler, Computer programs, Debugger, Microprocessors
Alıntı