1. Field of the Invention
The present invention relates to a method for program It is therefore a primary objective of the claimed invention
debugging, and more particularly, to a method for program to provide a method which can immediately debug error
debugging which can debug program codes. handlers of an implementation under test (IUT).
2. Description of the Prior Art 10 The method for program debugging in the claimed invenIn the programming field, the development tools are low tion comprises: setting a plurality of breakpoints correspondlevel program languages and high level program languages. lm? to a Plurallty of events ln an implementation under test, The text of program codes written in low level languages (e.g. executing the implementation under test for outputting a diagassembly language) is more similar to machine language, but nosls code of a breakpoint, resetting a parameter of the event the programming and debugging are not easy. Due to better 15 corresponding to the diagnosis code, and executing the event executing efficiency, low level languages are usually used in according to the reset parameter for making the event undergo basic input/output systems (BIOS) or driver programs. an error handler.
Take a BIOS for example. After a computer turns on, the These ^ other objectives of the present invention will no main function of the BIOS is to a execute power on self test 20 doubt become obvlous to those of ordinary skill in the art after (POST) to detect whether the settings of peripheral devices readlng the following detailed description of the preferred are correct, peripheral devices being controlled by the oper- embodiment that is illustrated in the various figures and drawating system. With the complexity of computers, types of mgsperipheral devices are gradually increasing, such as keyboards, disc units, disc controllers, hard disks, video disc 25 BRIEF DESCRIPTION OF DRAWINGS players and so on. Therefore the operation of BIOS becomes
more complex. Suppose that the operation of a device on the FIG. 1 is an ICE debug system.
motherboard is improper or that the programming of BIOS FIG. 2 shows steps of the method for program debugging of
program code contains an error. Since the operating system is the present invention.
not loaded yet, errors are debugged by source codes instead of 30 FIG. 3 shows addresses of breakpoints in an implementa
debug software. This requires more time and a lot of work. tion under test.
To speed up the debug process, there are two general meth- FIG. 4 shows steps of the script file of the present invention,
ods. One method is to insert a debug interface card into the FIG. 5 shows steps of the implementation under test of the
motherboard and to add several diagnosis codes to the BIOS 35 present invention, program code. When the BIOS program code is executed at
different sections, a diagnosis code would be sent from port DETAILED DESCRIPTION 80/z to the debug interface card for locking the section. Therefore sections at which errors occur can be found by trapping xhe above-mentioned and other techniques and advandiagnosis codes. 40 tages of the present invention are clearly disclosed in the
Please refer to FIG. 1. The other method is called in circuit following embodiment of the present invention, emulator (ICE). Take a host 7 as the program start, and con- Before describing the present invention, it should be noted nect the host 7 and an emulator 8 by the connection port of the that the present invention is still executed by an ICE. Develhost 7 (RS232 or printer parallel port). Also, take a mother- opment tools for programming script files and emulators conboard 9 as the program target, and connect the motherboard 9 45 nected to the host can be selected from ITP products such as and the emulator 8. The host includes assemblers, script files, those of American Arium or Cisco Systems, which are known and so on. The emulator 8 is utilized to simulate a CPU and to one of ordinary skill in the art.
the emulator 8 is inserted into the CPU slot. Therefore the Please refer to FIG. 2. Step 21 recites setting a plurality of
software of the host 7 can be utilized to control the emulator 5Q breakpoints corresponding to a plurality of events in an IUT.
8 for remote debugging. In the embodiment of the present invention, take a BIOS for
Although the remote debugging provides a good environ- example. Of course, the IUT can be a driver program or other
ment for software and hardware, the debug process is still similar program.
executed by technicians, who execute the script file to BIOS Please refer to FIG. 3. Since the BIOS program code
and observe if BIOS is executed as expected. A technician 55 executes BIOS for peripheral devices, the BIOS program
needs to set many breakpoints in places where bugs might code can be divided into many test modules. Since there are
occur, and when running into a breakpoint, stop executing the many modules in BIOS, consider a CMOS test module, a
program and determine if the result of the execution is memory test module, and a hardware test module for
expected. If not, this means that there are bugs in the program example. Events are defined as tests executed to each periph
codes and the technician must narrow the range to execute the 60 eral device. In each event, there are two processing states: one
same steps to search for program errors. is a general processing state when the device is working well
However, in the debug of BIOS, besides errors of the pro- and the other is an error processing state when the device is
gram codes, the most important thing is how error handlers of out of order.
BIOS deal with errors of peripheral devices. For instance, A breakpoint is set corresponding to an event, as shown in
when BIOS detects hardware errors, the motherboard typi- 65 Table 1. Diagnosis codes are defined by designers. Note that
cally provides an alert such as a beep. Due to a large number addresses of each breakpoint can be set ahead of each event,
of peripheral devices, the debug method mentioned above Also, addresses of each breakpoint can be set after each event.