Sunday, 26 December 2010

Developer Journal 23

CHANGES
* Fixed segmentation fault
* Changed pointer to btRigidBody in data object to a smart pointer.

REMINDERS
* Simplify process of setting and synchronizing positions and orientations.

NOTES

Working on fixing segmentation fault.

Program received signal SIGSEGV, Segmentation fault.
0x004b8c1f in operator* (v1=..., v2=...) at E:/agi/dep/bullet/src/LinearMath/btVector3.h:366
(gdb) bt
#0  0x004b8c1f in operator* (v1=..., v2=...) at E:/agi/dep/bullet/src/LinearMath/btVector3.h:366
#1  0x00485fbd in btRigidBody::applyCentralForce (this=0xbaadf00d, force=...) at E:/agi/dep/bullet/src/BulletDynamics/Dynamics/btRigidBody.h:270
#2  0x00485ef0 in btRigidBody::applyForce (this=0xbaadf00d, force=..., rel_pos=...) at E:/agi/dep/bullet/src/BulletDynamics/Dynamics/btRigidBody.h:306
#3  0x004295cd in PhysicsBullet::Update (this=0xefc510) at E:\agi\polyworld\physics\PhysicsBullet.cpp:206
#4  0x004283bf in Physics::Update (this=0xf1b288) at E:\agi\polyworld\physics\Physics.cpp:25
#5  0x00408c61 in TSimulation::Update (this=0x22fe20) at E:\agi\polyworld\app\Simulation.cpp:1159
#6  0x0040ef6c in TSimulation::Run (this=0x22fe20) at E:\agi\polyworld\app\Simulation.cpp:2888
#7  0x004102a8 in WinMain@16 (hInst=0x400000, strCmdLine=0x241f06 "") at E:\agi\polyworld\app\main.cpp:24
#8  0x00484df6 in main ()
(gdb)

Drilled down into btVector3 operator*.

btRigidBody::applyCentralForce() calls btVector3 operator* but I can't see one of the vectors, m_linearFactor.

When I print m_linerFactor in GDB, I get the message, error reading variable.

Could be because I did not build Bullet with debug symbols.

btRigidBody::applyForce() calls
btRigidBody::applyCentralForce() calls
operator*

btRigidBody::setupRigidBody() is responsible for initialising m_linearFactor.

btRigidBody::btRigidBody() calls
btRigidBody::setupRigidBody()

Eureka!

My data object has a pointer to a btRigidBody object but I did not initialize it.

I figured out the error when I used the pointer to a btRigidBody object in my data object to get the linear factor.

One of the things I find challenging about development is having to wait until I get a moment to fix an error.

Changing pointer to btRigidBody in data object to a smart pointer.

No comments:

Post a Comment