VOGONS


First post, by alex.123

User metadata
Rank Newbie
Rank
Newbie

Hello!

I am using dosbox debugger (heavydebug build) to test my patch of a dos program. I want to pause the program when a certain condition is met. How can I do it? I tried INT 3, but it does not work.

Reply 1 of 6, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You can't do it, and that is by design. No program running in the emulation should be aware of the debugger's presence or be able to influence it.

What you CAN do is identify a branch the program takes when the condition is met, or make the program take a branch, then set a breakpoint on that branch.

Reply 4 of 6, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

If you point the INT 3 vector at some address and set a breakpoint at that address, then you can also use the CC opcode. In any case the interrupt should only occur when the condition is met, and is just another form of the branch I referred to.

Reply 5 of 6, by alex.123

User metadata
Rank Newbie
Rank
Newbie

I am going to use it in my _die function, so longer opcode is no problem and easier setup with BPINT 3 is preferable to changing int 3 vector. Anyway thanks for your suggestion.

Also a stack trace would be handy. I assume dosbox debugger can't do it and i have to code it myself. Is this correct?

Reply 6 of 6, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

It might be easier to set up than you think: break into the debugger, use the INTHAND 3 command, set a breakpoint by pressing F9, resume execution with F5, then run your program. However, INT 3 initially points to the default interrupt handler that can also be triggered by other kinds of interrupts, so in some cases it might be necessary to point INT 3 to a unique address.

Yes, there is no built-in stack trace. The DOSBox debugger has no context for what a program does with the stack.