Solved

Tracing an interrupt-based program

Posted on 1998-03-19
6
349 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 200 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Sorry, for "Intel process" please read "Intel processors"

0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 1

Expert Comment

by:Nexial
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now