Comments (8)
Compiling with option "-gdb" can sometimes be useful too.
from brl.mod.
Maybe you should add this option to MaxIDE then (Debug, Debug GDB). Recompiled the whole project with "-gdb" (recompile enforced as it else reused the normal debugbuild which existed already)
./bmk makeapp -t console -d -a -gdb "/path/to/my/project.bmx"
... happily recompiled the project ...
when running the project via "gdb" the crash details are the same (same for backtrace).
Did I miss a step?
EDIT: ok, recompiled the modules too:
Program received signal SIGSEGV, Segmentation fault.
0x0859cad9 in brl_reflection_TTypeId_ForObject (bbt_obj=0xce05330)
at /home/ronny/Arbeit/Programmieren/BlitzMaxNG/mod/brl.mod/reflection.mod/reflection.bmx:1813
1813 EndIf
Right before that endif the source is this:
Function ForObject:TTypeId( obj:Object )
_Update
Local class:Byte Ptr=bbRefGetObjectClass( obj )
If class=ArrayTypeId._class
If Not bbRefArrayLength( obj ) Return ArrayTypeId
Return TypeIdForTag( bbRefArrayTypeTag( obj ) ).ArrayType()
Else
Return TTypeId( _classMap.ValueForKey( New TClass.SetClass( class ) ) )
EndIf
So something there is not working as intended ?
from brl.mod.
Ok, So I appended some "debug print" right before that Return TTypeId(...)
if not _classMap then Print "ForObject: _classMap Missing"
'
if not class then Print "ForObject: class is null"
'
if not New TClass.SetClass( class ) then print "ForObject: SetClass failed"
'
if not _classMap.ValueForKey( New TClass.SetClass( class ) ) then Print "ForObject: _classMap.ValueForKey NULL"
Return TTypeId( _classMap.ValueForKey( New TClass.SetClass( class ) ) )
It fails at the first '
which I assume means, it failed the line before (like with that "endif"). Which means _classMap
is null
in that call. But this _classMap
is a global one ...so I assume this cannot be the case. Why is it failing at odd lines (like EndIf
or '
) ...
Ok ... so I expanded the first if to be:
If _classMap
Print "ForObject: _classMap exists"
Else
print "ForObject: _classMap Missing"
EndIf
Recompiled modules, recompiled (of course then) my project ... and it prints some "_classMap exists" when cloning objects ... but as soon as it has to clone the type with "cast:TProgrammePersonJob[]" it fails at the line: Print "ForObject: _classMap exists"
(which I think means it fails on If _classMap
) ... but how could such a thing fail?
from brl.mod.
I tried more and more things - I even created a new file only importing things used in the specific situation - and it does not crash there (cloning the basic objects by hand) but it fails as soon as it is done via the more complicated routines in the db-xml-loader.
I assume that there is something borked in reflection.mod and it needs a rare situation to make it break.
Feel free to download the most current version from: https://github.com/GWRon/TVTower and compile on your own.
As compilation is a bit slow, I prepared a smaller example (still using much of the game objects) - this sample also segfaults. Place it next to "TVTower.bmx":
SuperStrict
Framework Brl.StandardIO
Import "source/game.database.bmx"
Global l:TDatabaseLoader = New TDatabaseLoader
l.Load("res/database/Default/database.xml")
The problematic line is in source/game.database.bmx
:
Method LoadV3ProgrammeLicenceFromNode:TProgrammeLicence(node:TxmlNode, xml:TXmlHelper, parentLicence:TProgrammeLicence = Null)
...
'try to clone the parent's data - if that fails, create
'a new instance
if parentLicence then programmeData = TProgrammeData(THelper.CloneObject(parentLicence.data))
"data" is valid (checked that before).
But it only fails if the "TProgrammeData" contains something in the field "cast:TProgrammePersonJob[]" (leave it empty be commenting out the "AddCast")
Edit: it is not important if the "cast" is of type "TProgrammePersonJob" - it segfaults in that type as soon as I append a "complex" type:
Type TProgrammeData extends TGameObject {_exposeToLua}
Field objectArray:TMap[] = [new TMap,new TMap]
will fail at "objectArray" then...
from brl.mod.
Ok, I shrinked my example to this one:
SuperStrict
Framework Brl.StandardIO
Import "source/game.programme.programmedata.bmx"
Import "source/game.programme.programmeperson.bmx"
'create a base person so the cast of the data block can get filled
Local person:TProgrammePerson = New TProgrammePerson
'create an entry
Local programmeData:TProgrammeData = New TProgrammeData
'add sample cast - only fails with something set in the cast (else it is not "cloned")
programmeData.AddCast(New TProgrammePersonJob.Init(person, TVTProgrammePersonJob.ACTOR))
'this fails (when "cast"-field is the thing to clone)
THelper.CloneObject(programmeData)
Print "cloned..."
Any hints to narrow it down even further?
from brl.mod.
Ok ... next try, this time I removed every external source, so the following code is a "single file" example:
EDIT: made the code even shorter:
SuperStrict
Framework Brl.StandardIO
Import Brl.Reflection
Type TDataBlock
Field cast:TSubData[]
End Type
Type TSubData
Field bla:Int
End Type
Local data:TDataBlock = New TDataBlock
'add sample entry - only works with this
data.cast :+ [New TSubData]
Print "Fetching objTypeIDs: "
Local objTypeID:TTypeId = TTypeId.ForObject(data)
For Local fld:TField = EachIn objTypeID.EnumFields()
Print " Field: "+fld.name
If fld.Get(data)
Print " Field: not empty!"
'this fails for our array
Local subObjTypeID:TTypeId = TTypeId.ForObject(fld.Get(data))
EndIf
Next
Print "Fetched."
It fails as soon as it has to get the "ForObject" of the array.
from brl.mod.
The latest bcc commit should hopefully resolve this issue.
from brl.mod.
BTW: If you want to close an issue in another repo: "Closes/Fixes #14" in your bcc-ng-commit would close this issue.
Sample of course compiles now...
ATM recompiling my game (takes a while) ... finished, failing in another situation now ... so prepare for new issues 😆
from brl.mod.
Related Issues (20)
- [brl.graphics] Duplicate use of Graphics() flag IDs
- [Brl.Socket] AF_UNSPEC_ usage in docs is wrong
- Some undefined behavior found in bbMilliSecs()
- brl.TStringbuilder; extended startsWith() HOT 1
- [graphics.mod] TGraphics.Resize() and .Position() only stubs HOT 2
- [blitz.mod] Expose MemSet() or extend MemClear() to allow specific values
- [gnet.mod] Handle invalid peer events and disconnect timeout
- io.mod/common.bmx identifier FromEpoch not found HOT 2
- Unhandled Exception:GNet error, ENET_EVENT_TYPE_RECEIVE with invalid peer HOT 6
- [glGraphics.mod] MacOS: Carbon API deprecated / not supported
- Issues with 'library callbacks' with a potential solution HOT 2
- [platform.mod] PhysicalProcessorCount() not working properly on Win32 HOT 3
- StackTrace path issue HOT 1
- add FileExists function or use FileSize =-1? also, one other thing HOT 2
- Memory leaks (bbMemAlloc & bbMemFree) HOT 10
- [brl.pixmap] Handling "noDebug" - with still catching "null objects"
- [blitz.mod] Debug builds: GCSuspend/GCResume for each "local block"
- [blitz.mod] Debug builds secretly reactivate the GC even once GCSuspend()-ed HOT 7
- [random.mod] Add Rand() overloads to support "float/double" too? HOT 2
- [map.mod] Single method to retrieve value and existence of passed key HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brl.mod.