?
Solved

Tracing an interrupt-based program

Posted on 1998-03-19
6
Medium Priority
?
360 Views
Last Modified: 2010-04-02
I don't know where I should put this question in. I chose here anyway....
Hi, everyone. I have a problem for you concerning a set of
interrupt-based programs.
Its particulars are as follows:
  1. it contains a driver (written in C) which alters a high
     interrupt vector (i.e. driver.exe) and the main code is in here.

  for example:
      int_60h_entry proc near
           :
           :
           call get_string

      int_60h_entry endp

      get_string proc near   <--- this part is where I want to know of.
          :
          :
          ret
      get_string endp
     
           

  2. A calling program (i.e 1.exe) calls the interrupt vector

  for example:
       mov ax, 0ah
       int 60h     <--- the debugger traces over this point
       add sp, 4
       ret

 p.s: there is an interrupt entry point in the driver, in which there are
      cores and guts that I want to know of.

What I would like to do with these programs is:

   Using Turbo Debugger 5.0 to trace into the interrupt, but debugger
   only traces up to the point where it calls the interrupt (e.g. int 60h).
   Then it steps over it.

Do you guys know how to trace into the interrupt?
,from the calling program to the driver?

0
Comment
Question by:whluk
6 Comments
 
LVL 16

Accepted Solution

by:
imladris earned 400 total points
ID: 1257771
Assuming that the interrupt routine is in RAM (as opposed to ROM) which you seem to indicate (the driver is written in C), it should be possible.
What I generally do in such circumstances is to find the entry point of the interrupt handler (by looking at the interrupt vector table if need be), then put a breakpoint early in the interrupt handling code. Depending on your debugger and system, the first one may be a poor choice. Try and look down until registers have been saved, and interrupts reenabled (so that the keyboard will work), and put a breakpoint there.

0
 
LVL 16

Expert Comment

by:imladris
ID: 1257772
P.S. the interrupt vector for int 60h on a PC will be at address:

0:180

Remember that the raw memory contents on Intel process is kind of backward. So if the contents at 0:180 is: DF D0 00 F0, the referenced address for the start of the interrupt routine will be: F000:D0DF

0
 
LVL 16

Expert Comment

by:imladris
ID: 1257773
Sorry, for "Intel process" please read "Intel processors"

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Expert Comment

by:Nexial
ID: 1257774
If you are running on a 386 or later, find a copy of PDVIM.EXE
which is available on the depositories.   This is a Public
Domain Virtual Machine which when run will execute your program in a protected mode Dos Box and allows full interrupt and hardware tracing.   You can also get a more powerful registered version, but from your description, the PD version should suffice.   (PDVIM is a command line oriented system, and the debug commands are very similar to DOS's debug.)

0
 
LVL 1

Expert Comment

by:focht
ID: 1257775
You can easily step into every software interrupt using Turbo Debugger. Use following procedure:
Step through the program until the cursor (blue line) is at Int 60h (next step would execute the int).
Now press ALT+F10 and you will see a menu popping up.
Choose "Follow" and press ENTER. You will see now the begin of the INT 60h Handler. Set a breakpoint at the beginning (F2) of the handler (same line).
Now simply let the program run and you will see it will stop at the breakpoint in the interrupt handler. You can now trace through the handler ;).


0
 
LVL 2

Expert Comment

by:tdubroff
ID: 1257776
You probably did this and it is unrelated to your question, but remember to put an 'iret' at the end of your interrupt handler (not just a 'ret').
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question