Hi folks,
I’m facing a very hard problem to debug recently, which seems very random and can’t get (with the debugger I have, gdb on Windows) the full backtrace of what’s going on in the behind.
Basically, here’s a block of code section in the process():
ParamQuantity *pqPREParam9 = pTargetModule->paramQuantities[9];
if (pqPREParam9) {
if (pqPREParam9->getValue() != 0.4f) {
DEBUG("changed PRE");
}
}
pqParam11->setValue(newParamValue); // pqParam11 is pTargetModule->paramQuantities[11]
ParamQuantity *pqPOSTParam9 = pTargetModule->paramQuantities[9];
if (pqPOSTParam9) {
if (pqPOSTParam9->getValue() != 0.4f) {
DEBUG("changed POST");
}
}
Sometimes, the DEBUG will trig the line DEBUG(“changed POST”);
So it seems that between read param 9 pre/post and set a new value for param 11, it change the values of param 9 (and 99% of times it set the value of newParamValue, which is WEIRD.
Tried to breakpoint on widget/guy, and so on, but it seems all correct.
Maybe some other thread with some memory invasion that will replace data in the background? How would you debug this kind of stuff? Backtrace on gdb give to me only the stack of “main” function, basically:
#1 0x00007ffb9e747014 in derozer::mymodule::MyModule::process (this=0x52d1a50, args=...) at src/modules/MyModule.cpp:321
#2 0x00007ffba3d04d24 in rack::engine::Module::doProcess (this=0x52d1a50, args=...) at src/engine/Module.cpp:345
#3 0x00007ffba3d00f71 in rack::engine::Engine_stepWorker (that=0x51ac100, threadId=0) at src/engine/Engine.cpp:331
#4 rack::engine::Engine_stepFrame (that=<optimized out>) at src/engine/Engine.cpp:409
#5 rack::engine::Engine::stepBlock (this=<optimized out>, this@entry=0x4f97580, frames=<optimized out>, frames@entry=735) at src/engine/Engine.cpp:567
#6 0x00007ffba3d0173b in rack::engine::Engine_fallbackRun (that=0x4f97580) at src/engine/Engine.cpp:1349
#7 0x00007ffc3177387f in ?? () from C:\msys64\mingw64\bin\libstdc++-6.dll
#8 0x00007ffc3dd54dcb in ?? () from C:\msys64\mingw64\bin\libwinpthread-1.dll
#9 0x00007ffc517ae634 in msvcrt!_beginthreadex () from C:\Windows\System32\msvcrt.dll
#10 0x00007ffc517ae70c in msvcrt!_endthreadex () from C:\Windows\System32\msvcrt.dll
#11 0x00007ffc516b257d in KERNEL32!BaseThreadInitThunk () from C:\Windows\System32\kernel32.dll
#12 0x00007ffc52e8aa58 in ntdll!RtlUserThreadStart () from C:\Windows\SYSTEM32\ntdll.dll
#13 0x0000000000000000 in ?? ()
so I can’t see what’s happens in between pqParam11->setValue(newParamValue);. I think some other thread that will fill memory with garbage? Rack API seems stable.
Note: this doesn’t always happens after setValue, sometimes few lines later on the same function. So its not directly linked to setValue
This is making me crazy.
So I’m reasoing in some options:
- Which actions would you do for this kind of situation?
- Is there any tools that can list the last 100 functions call (for example) till reaching a breakpoint?
- which thread Rack use expect DSP and GUI ones? I don’t think on DSP thread somethings can happens in between a module’s process() function, and on GUI side all param value for that paramid=9 seems correct on step/draw/onX methods. Are there any other thread? Otherwise, it seems another process could insert garbage? (which would be even more weird).
Thanks for any useful tips you can give it to me.