Linuxrocks123 Tree: https://github.com/linuxrocks123/vcmi

Comments, bugs, questions about github.com/linuxrocks123/vcmi here. Ultimate goal is to merge changes, of course; comments on how to go about that would be most helpful.

Is this another fork?

Ok, but is there any available debugger for MinGW32 or should I build VCMI in debud mode?
Edit: ok, I’ve found some interesting tricks, I’ll check them out now.

It’s a branch. “Fork” kind of implies taking it and creating a new product. My branch is just a place to put my changes until they get merged into the main tree.

You’re using MinGW32? Weird. That’s GCC for Windows. Most platform-specific bugs would be between MSVC and GCC, not GCC and GCC.

You should be using the debugger GDB if you’re using MinGW32.

Ok, I’ve built VCMI in debug mode, so what now? I tried to do something in GDB, but all attempts failed(I tried to create backtrace, but unsuccessfully). I’m open now to any clues :wink:

You run vcmiclient in gdb, type “gdb vcmiclient.exe”. When it crashes, type “backtrace” at the GDB command prompt. That should give you a stack trace.

I already tried that, but when VCMI crashes there is ‘SIGTRAP’ signal, which make me unable to check backtrace.

Here is the console output:

warning: HEAP[vcmi_client.exe]:
warning: Invalid Address specified to RtlFreeHeap( 08E40000, 1681FD9C )


Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 2792.0x868]
0x7c90120f in ntdll!DbgBreakPoint () from C:\WINDOWS\system32\ntdll.dll
(gdb) bException condition detected on fd 0
error detected on stdin
A debugging session is active.

        Inferior 1 [process 2792] will be killed.

Quit anyway? (y or n)

I typed then ‘n’, then ‘backtrace’ and actually it looks like:

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 2792.0x868]
0x7c90120f in ntdll!DbgBreakPoint () from C:\WINDOWS\system32\ntdll.dll
(gdb) bException condition detected on fd 0
error detected on stdin
A debugging session is active.

        Inferior 1 [process 2792] will be killed.

Quit anyway? (y or n) n
backtrace
Please answer y or n.
A debugging session is active.

        Inferior 1 [process 2792] will be killed.

Quit anyway? (y or n) n
Not confirmed.
(gdb)

but at this point I’m unable to type anything, VCMI simply freezes while waiting for termination.

I don’t know, Kantor. What VCMI is doing shouldn’t affect your ability to get a backtrace out of GDB. It’s designed to handle buggy programs. Maybe you can try recompiling with MSVC and use its debugger? That might make the problem go away, too. Then everyone would be happy. From that error message, it looks like it could be a use-after-free problem. I’ll run Valgrind against my tree when I get a chance to see if that makes any difference.

Thanks for advices :wink: I guess You probably noticed that I’m using Windows XP, so even if I really would like to install MSVC and run it, that would be impossible due to that VCMI requires MSVC 2013 to compile, and MSVC 2013 doesn’t support XP OS :frowning:
Two previous versions (MSVC 2010 and 2012) are both obsolete to VCMI source code (due to lack of support C++11).

I didn’t notice that, sorry.

If you can send me your build & all libraries, maybe I can use my copy of GDB on Windows to look into it. I don’t want to set up a Windows dev environment extensive enough to build VCMI – that sounds painful – but I do have GDB there and maybe can look into it if you send me the full build. Post it on a file locker like – I think VCMI recommends SendSpace?

Also, I forgot to mention: if you’re using any town mods other than Cove, it will crash, but I think this is because of VCMI in general and not my changes. Did you build normal VCMI with the same parameters and verify it’s only my version that crashes?

I was able to run the assembly from Kantor filedropper.com/vcmi096b

But I have a problem just in the first turns.
Logs.rar (81.1 KB)

Okay, well at least it’s somewhat consistently reproducible across Windows machines. Also, we know it’s OS-specific, because I’ve been able to play entire maps without crashing.

Your logs don’t show any hint of what might be wrong. Could you run his assembly in a debugger and produce a stack trace?

Also, Kantor, have you tried compiling the unaltered tree with MinGW and seeing if it fails as well? I think the official VCMI Windows builds are compiled with MSVC, so, if you haven’t done that, the issue may be unrelated to my changes.

Do these crashes happen during your turn or during the AI’s turn? Do they happen in battles or on the adventure map?

Unfortunately, no. I do not know how to compile and work with such things.

Failures occur exclusively on the turn AI.

Adventure map.
And

  1. sometimes when taken mine
  2. sometimes when rising resource
  3. sometimes not see why, but in the console simply write “disaster happened”
  4. Sometimes it just took off without an explanation of the reasons

This is what I saw through the eyes on the map with cheat. Perhaps it is misleading, and in fact there is something more. I do not know.
Saves.rar (403 KB)

Ok, I’ll do it, but do You want to have boost precompiled binaries too? You said that You don’t want to build VCMI so I guess boost binaries won’t be required. You want the VCMI package built in debug mode, right?

Ok, but I think SendSpace also deletes files after 30 days of non-downloading.

Yes, I’m aware of that, that’s why I’m using only “Adventure AI trace” mod. I regularly check if main develop branch changes and build it, so I’m sure I’m not overlooking any new updates. That’s why I know that Your changes cause crashes.

Crashes always occur during AI’s turn and I think most of them on adventure map.

Ok, Here is the link to VCMI package (with debug symbols): sendspace.com/file/fzopdp

And here is the link to VCMI 0.96b package from main dev branch: drive.google.com/file/d/0Bwj7Qc … sp=sharing

another save game
(From the old assembly filedropper.com/vcmi096b)
Saves1.rar (668 KB)
Crash.rar (590 KB)

New assembly
drive.google.com/file/d/0Bwj7Qc … sp=sharing

Freeze AI
FreezeAI2.rar (847 KB)
FreezeAI.rar (2.5 MB)

Very strange situation happened to me. I have a very very weak army, came to me the AI​​, it is stronger army to order. He completely ignores me! Walks collects resources for my spawn. Does not attack any heroes or city, although very easily kill me.

Just end turn and look
Not Kill me.rar (1.27 MB)

Kantor and Povelitel,

Thanks for the info. From what you say it does sound like it’s an issue with the changes. I will try to get a stack trace out of GDB on my Windows VM; please let me know if either of you manage to get a stack trace as well.

youtu.be/MposOSEDXTo
Monolit.rar (1020 KB)