VOGONS


First post, by fearyourself

User metadata
Rank Newbie
Rank
Newbie

Dear all,

I'm currently working on my game project called backtoroots which is a port of the old Ultima engines.

Anyhow, part of the work is actually decoding the old formats used for these games and this is where the dosbox debugger comes in. It's already really good and my hat goes to whoever brought it there but I need more elements:

- To be able to search the memory space efficiently in the debugger and not go through a dump/search

- To stop the code when a file is opened (for the moment the debugger sees it when it is opened but I'd like to be able to stop it at that point)

- Logging the CPU cycles is good but it blocks the interaction with the code so that I can't play the game to see where the code goes to. This means all I get is the rendering code pretty much. So figuring out a way to do this in a much more light weight way.

Basically, this post is to know if:
- You are interested in following my changes, and potentially me giving you a patch for these changes
- If so:
- do you want me to follow certain coding standards and are certain things in a no-touch mode.
- what version do you want me to be working on?

Jc

Reply 1 of 8, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

- To stop the code when a file is opened (for the moment the debugger sees it when it is opened but I'd like to be able to stop it at that point)

I usually try a "bpint 21 3d" first as that catches most stuff. Otherwise place a DEBUG_EnableDebugger(); in the dosbox sources where file opening is cntralized.

- Logging the CPU cycles is good but it blocks the interaction with the code

The logging functions are very heavy and slow functions in general so don't know how you'd want to achieve interactivity there.

Reply 2 of 8, by fearyourself

User metadata
Rank Newbie
Rank
Newbie
wd wrote:

- To stop the code when a file is opened (for the moment the debugger sees it when it is opened but I'd like to be able to stop it at that point)

I usually try a "bpint 21 3d" first as that catches most stuff. Otherwise place a DEBUG_EnableDebugger(); in the dosbox sources where file opening is cntralized.

Yeah, I thought of doing that too. I'll try to see if that is enough, but I wanted something like:

FILEOPENHALT "DATA.OVL"

and it would stop if opening that file. That would simplify my life a lot.

- Logging the CPU cycles is good but it blocks the interaction with the code

The logging functions are very heavy and slow functions in general so don't know how you'd want to achieve interactivity there.

I don't care for the moment on the values of the registers, just what code is executed, so potentially just remembering the branches/calls that were taken and reconstructing the log post-process.

I've barely opened your code base so I haven't thought of it yet a lot. This was more a : if I do make changes, are you interested in seeing what I did. And if you are, probably if you wanted the changes, it would be best that I play around with your current working version.

If not, I'll just post my changes for whoever would want to do the same 😀
Jc

Reply 3 of 8, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

If you're changing dosbox sources, feel free to post them in this thread. So if somebody is looking for a similar feature,
it's already there, or if it looks nice/useful/usable somebody may commit it to the official sources.

About the "coding style": just browse a few source files, it's not much about rules but if it would be nice if
everything looks consistently the same. Also try to base changes on the current svn sources.

Reply 5 of 8, by fearyourself

User metadata
Rank Newbie
Rank
Newbie

I've playing around with your base code and this is what I've done:

- Memory search seems complete:

-> You can do the following :
MEMSEARCH seg:off len A B C D

where A B C D are hexadecimal values that are contained in a character each

MEMSEARCH seg:off len s Hey how are you doing?

Where with an extra 's', we have a string version that search for strings.

- It gives you all the positions where there is a match and sets the Data Overview to the first found.

-> I've added the file opening interrupt which allows you to stop the program if it opens a file you are watching:
- BPFILE, BPFILELIST, BPRMFILE : adds, shows, removes a file from the list.

The last add I wanted to do to really get back to my game was: call stacks. Now I looked around and I see CPU_CALL/CPU_RET and thought that's awesome if I can use that.

But after a bit of playing around, it seems that this is not the only entry point or you don't always go through here: I either have no stack when I pop/push there or there is only one function....

Any ideas on this last part?
Thanks,
Jc

Reply 8 of 8, by fearyourself

User metadata
Rank Newbie
Rank
Newbie

I undesrtand the abusing of the call stack. But I'm surprised that my system only got 1 call or none. I'll do some debugging to see if my target game abuses it to that point.

From what I saw in the assembly, we should have more calls than that though.\

Here is another VOGONs thread concerning DOSBox debugging: this post with some code from member ninjalj tha may be of interest.

Any reason what that member did not get into the main stream of the code? I just think that doing this could be useful (evidently) therefore, getting it in there once and for all is better than having to do it over and over again 😀
Jc