Is it a Bug?

Chris R. Miller lordSaurontheGreat at gmail.com
Tue Aug 5 22:29:44 PDT 2008


I have code which runs when built by GDC on OS X, but fails 
spectacularly on DMD 1.030 and 1.033 on Windows.  I'm not sure what to 
think, since DDBG isn't working well enough to import the rest of the 
source files to unroll the stack far enough for me to find the offending 
line and work around it.

It's also a really big and scary "it doesn't work" situation.  I know so 
little about what's failing that I cannot make an effective test case to 
find the exact behavior that's not working.  I'd think it was my code if 
it weren't that
a) It compiles fine.
b) When built by GDC it runs fine.

The issue is with a funky data structure I wrote to store parts of a 
video game map with many different actors on each tile, with actors that 
can exist on more than one tile at a time.  So knowing that it should be 
easier for you to follow what the program is trying to do.

It's a test-case I wrote to ensure my data structure works as intended. 
  The test case starts here:

http://www.fsdev.net/repositories/entry/tick/trunk/tick/test/AMapSectionTest.d?rev=13

And is built to test the functionality of this type:


http://www.fsdev.net/repositories/entry/tick/trunk/tick/common/AMapSection.d?rev=13

And it uses two types defined here:

http://www.fsdev.net/repositories/entry/tick/trunk/tick/common/MapArea.d?rev=13
http://www.fsdev.net/repositories/entry/tick/trunk/tick/common/MapCoord.d?rev=13

DDBG tells me this:

Lord Sauron at PRIMARY-COMPUTA:C:\Users\Lord Sauron\Desktop\tick\tick> ddbg 
bin\Tes
tAMapSection.exe
Ddbg 0.11.3 beta - D Debugger
Copyright (c) 2007 Jascha Wetzel
see http://ddbg.mainia.de/doc.html for documentation

Loading symbols from bin\TestAMapSection.exe
->r
No symbols available from ntdll.dll
ntdll.dll loaded at 0x772a0000
No symbols available from KERNEL32.dll
KERNEL32.dll loaded at 0x76e30000
No symbols available from SHELL32.dll
SHELL32.dll loaded at 0x760d0000
No symbols available from msvcrt.dll
msvcrt.dll loaded at 0x77050000
No symbols available from GDI32.dll
GDI32.dll loaded at 0x75d30000
No symbols available from USER32.dll
USER32.dll loaded at 0x76030000
No symbols available from ADVAPI32.dll
ADVAPI32.dll loaded at 0x77100000
No symbols available from RPCRT4.dll
RPCRT4.dll loaded at 0x771d0000
No symbols available from SHLWAPI.dll
SHLWAPI.dll loaded at 0x75b70000
Unknown breakpoint hit at ntdll.dll (0x772e7dfe) thread(2284)
No symbols available from IMM32.dll
IMM32.dll loaded at 0x75b20000
No symbols available from MSCTF.dll
MSCTF.dll loaded at 0x75f60000
No symbols available from LPK.dll
LPK.dll loaded at 0x75ed0000
No symbols available from USP10.dll
USP10.dll loaded at 0x75ee0000
No symbols available from GoogleDesktopNetwork3.DLL
GoogleDesktopNetwork3.DLL loaded at 0x48000000
No symbols available from WS2_32.dll
WS2_32.dll loaded at 0x76c70000
No symbols available from NSI.dll
NSI.dll loaded at 0x77040000
No symbols available from NTMARTA.dll
NTMARTA.dll loaded at 0x75980000
No symbols available from WLDAP32.dll
WLDAP32.dll loaded at 0x77420000
No symbols available from PSAPI.DLL
PSAPI.DLL loaded at 0x75a80000
No symbols available from SAMLIB.dll
SAMLIB.dll loaded at 0x75960000
No symbols available from ole32.dll
ole32.dll loaded at 0x75bd0000
No symbols available from COMCTL32.dll
COMCTL32.dll loaded at 0x74a70000
Testing common.AMapSection
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at 
typeinfo.ti_C.Typ
eInfo_C.getHash (0x0040c2b0) thread(2284)
->us
#0 uint typeinfo.ti_C.TypeInfo_C.getHash(void*, void*) () at 
test\AMapSectionTes
t.d:38 from ti_C
#1 0x0040218a in _Dmain () at test\AMapSectionTest.d:38
#2 0x004096d4 in extern (C) int dmain2.main(int, char**) . void 
runMain(void*) (
) from dmain2
#3 0x0040970b in extern (C) int dmain2.main(int, char**) . void 
runAll(void*) ()
  from dmain2
#4 0x0040944c in _main () from dmain2
#5 0x0041283d in _mainCRTStartup () from constart
#6 0x76e74911 in ?? () from KERNEL32.dll
#7 0x772de4b6 in ?? () from ntdll.dll
#8 0x772de489 in ?? () from ntdll.dll
->

It appears to be choking on some odd "getHash" function call, which is 
interesting because the only hashing function I know of is toHash in 
MapCoord:

http://www.fsdev.net/repositories/entry/tick/trunk/tick/common/MapCoord.d?rev=13#L32

I know that it's trying to use toHash correctly because GDC does it just 
fine (puts the right actors into the right place based on their unique 
hash value, or their almost unique value, anyways...  Never mind, the 
maps don't get big enough for too many collisions, anyways).

So if anyone knows how to coax a little more info from DDBG, knows a 
workaround, or even know what's going wrong, I'd really appreciate it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20080805/c450726d/attachment.pgp>


More information about the Digitalmars-d mailing list