VOGONS


First post, by realdepp

User metadata
Rank Newbie
Rank
Newbie

Hi,

I downloaded and compiled the new version 0.73 and tried to debug an application (Nuclear War).
But dosbox crashes (reproducible) when trying to do some kinds of action.
Without debugger, the game runs fine.

This is what I did:
./configure --prefix=/some/custom/location --enable-debug=heavy
make
make install

After that, I started dosbox, did a "debug NUKEWAR.EXE" and pressed F5 to let the game start normally.
After starting the game and trying to do sth - segfault.

What information would be useful for you?

edit:
OS is Ubuntu Linux 9.04

Reply 3 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

lovely all call parameters are optimized out. (not really your fault, but if you recompile dosbox could you change the -02 to -O0)

Could you before starting debug nukewar.exe
enter

core=normal
cycles=3000

to see if that gives us something more than just a null pointer

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

Reply 4 of 19, by realdepp

User metadata
Rank Newbie
Rank
Newbie

Changing the cycles to 3000 - does not change anything.

A new stack trace with -O0 is on it's way.

edit: There it is.

Last edited by realdepp on 2010-01-02, 21:53. Edited 1 time in total.

Reply 5 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

...changing the core being the important part.

Reply 6 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

btw try this as well.
Open src/hardware/pic.cpp
look for

(entry->pic_event)(entry->value);

This is line 463
Above that line add this

        if((entry == NULL) || (entry->pic_event == NULL)) E_Exit("This is really bad");

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

Reply 7 of 19, by realdepp

User metadata
Rank Newbie
Rank
Newbie

The core is and was set to normal.

I added the line but the message "This is really bad" did not appear.

edit: Stacktrace with -O0 see last posting

Reply 8 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Type "core" before starting the debugger to assure that the value is correctly set.

Reply 9 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

line 135 is:

     Bitu blah=(*CallBack_Handlers[ret])();

ret is/might be (according to log) 2332
so that will definetly result in a null pointer.

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

Reply 10 of 19, by realdepp

User metadata
Rank Newbie
Rank
Newbie
wd wrote:

Type "core" before starting the debugger to assure that the value is correctly set.

I did and it said "normal" so this options seems always to bet set to normal.

Qbix wrote:
line 135 is: […]
Show full quote

line 135 is:

     Bitu blah=(*CallBack_Handlers[ret])();

ret is/might be (according to log) 2332
so that will definetly result in a null pointer.

Tell me if I can help on that (debug messages or sth like that)

Reply 11 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Going to sleep now. But that should be trackable with some messages. (at least partially)

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

Reply 12 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Check out prefix_normal.h in the src/cpu/core_normal directory and add
a few LOG_MSG("here at xyz"); calls where return statements are
that don't return CBRET_NONE (that's the debug callbacks and the opcode
0xfe/7) to check which of those is causing it.

Reply 13 of 19, by realdepp

User metadata
Rank Newbie
Rank
Newbie

Did you mean src/cpu/core_normal/prefix_none.h?

If I do that i get many log lines per second of which are 95%
here at 792
(CASE_W(0xcf) / if (GETFLAG(IF) && PIC_IRQCheck) return CBRET_NONE;)
and 5%
here at 1109
(CASE_B(0xfe) / case 0x07)

The lines before segfault are:

here at 792
here at 792
here at 792
here at 792
here at 792
here at 792
here at 792
here at 792
here at 792
here at 792
here at 792
here at 1109
here at 792
here at 1109

Reply 14 of 19, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Remove all LOG_MSGs you added except for the callback one (0xfe/7).
Change it to print out the instruction pointer, like LOG_MSG("at %x:%x",SegValue(cs),reg_eip);
Run it again and check the cs:ip right before the crash, then start dosbox
again and break into the debugger, look at the code that's currently at
that location.

Reply 15 of 19, by realdepp

User metadata
Rank Newbie
Rank
Newbie

The last instructions are:

at f100:464
at f100:104
at f100:284
at f100:44a
at f100:464
at c7ff:1d
at c7ff:1d
at f100:205
at c7ff:1d
at c7ff:1d
at f100:104
at f100:284
at c7ff:1d
at 100e:1b06

I'm sorry, but I'm new to the dosbox-debugger. My problem is: I'm pressing F5 at program start because the game startup is of no interest for me (and the crash occurs later).
But in the game I found no way to return to the debugger.

According to this posting: Guide to the DOSBox debugger
the keys 1-5 would be helpful, but they don't seem to work in 0.73.

Can you give me a hint?

Reply 17 of 19, by realdepp

User metadata
Rank Newbie
Rank
Newbie

That doesn't work. Even if I step over the instructions from start, the game takes over control as soon as some files are loaded and I have no chance to return to the debugger again.

Besides, the crash occurs immediately after a mouse click, so I should be able to do some input and using the debugger.

Reply 18 of 19, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

there is f11 as well,
but
you could do in the debugger of dosbox:
bp 100e:1b06
f5
to see if it breaks before the crash and to see what kind of code is there. If there is real rubish there then we can as next step let dosbox create a (back) log of the instructions leading to there

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

Reply 19 of 19, by realdepp

User metadata
Rank Newbie
Rank
Newbie

It doesnt' break.

I tried with F11, but somehow it seems that I'm trapped in an infinite loop!?

I don't think that there are rubbish instructions, because the game runs fine without debugger.
What could be different for the program if run by the debugger?

edit: I also tried breakpoints at f100:284 and c7ff:1d. But since the crash occurs directly after a click and I can't properly do input while the debugger is active I had no luck to get to the right position.