VOGONS

Common searches


First post, by efry

User metadata
Rank Newbie
Rank
Newbie

Hi Guys,

Just a quick question regarding the dosbox debugger. I'm new to asm programing so please bare with me if my question isn't 100% dosbox related.

I'm trying to debug Ultima 6 using IDA Pro 4.3 for DOS and the internal Dosbox debugger.

I seem to have a problem setting the break points in dosbox. The start code is at F7:000 in dosbox which is fine but everything in IDA Pro is referenced from an address starting at 0x10000 or by its own segments (exe blocks?)

It looks like Dosbox doesn't break when I specify a different segment:offset pair for the same address.

Heres an example

bp f7:a works fine the debugger breaks out when it hits the address and the line is marked red

But if I reference the same address as 0:f7a it seems to miss the breakpoint altogether. It still registers the breakpoint and marks it red. 🙁

Do I need to specify the break point in notation that dosbox understands? Does dosbox just go by the contents of the code segment register? If so could you tell me how to properly reference code based on my disassembly in IDA Pro?

Any thoughts would be greatly appreciated?

Eric

Reply 1 of 6, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Suppose they use protected mode, so the first part isn't the segment
but a selector (so you can't write 0x678 instead of 0x60:0x78).
Not sure if that helps with your problem though.

Reply 2 of 6, by efry

User metadata
Rank Newbie
Rank
Newbie

Ok I've worked out what is happening. Dosbox is only matching breakpoints based on seg and offset not on the actual address. I made a small change to

bool CBreakpoint::CheckBreakpoint(Bitu seg, Bitu off)
in src/debug/debug.cpp

to check break points based on their flat address and it seems to work fine.

if ((bp->GetType()==BKPNT_PHYSICAL) && bp->IsActive() && bp->GetLocation() == GetAddress(seg,off)) {

instead of

if ((bp->GetType()==BKPNT_PHYSICAL) && bp->IsActive() && (bp->GetSegment()==seg) && (bp->GetOffset()==off)) {

Is there any reason why the debugger would be checking seg and offset instead of the location address?

Eric

Reply 3 of 6, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

With the current implementation you can add breakpoints in a
game-specific way, thus place some BPs, exit the game, run
something else (this won't trigger the breakpoints as the segment
is different (most of the time at least)).

Reply 4 of 6, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I can live with the suggestion of efry though.

I doubt a breakpoint in non heavy mode will survive the loading of an executable

Water flows down the stream
How to ask questions the smart way!