On 01/09/2021 17:47, Alex Lelievre via wsjt-devel wrote:
Hi there,

I was wondering if anyone can give me some context in how the FT8 decoder works.

I’m seeing a crash inside of the jt9 module on Apple M1 because it is trying to call a callback with an unmapped address (at least that’s what I’m seeing).

I can’t seem to figure out where or who sets this callback address (mainly because I’m still learning how to read Fortran).

If someone knows the answer, it might help me understand what’s actually wrong.

Here’s what I’ve traced so far:

When jt9 is executed, it finds the shared memory and attaches to it.

Next it does:
*call* multimode_decoder(shared_data%ss,shared_data%id2,local_params,12000) [in jt9a.f90:74]

Which subsequently calls:
*call* my_ft8%decode(ft8_decoded,id2,params%nQSOProgress,params%nfqso, … [in decoder.f90:147]

As far as I can tell, id2 is passed in for callback arg.
*subroutine* decode(this,callback,iwave,nQSOProgress,nfqso,nftx,newdat, …

Then is assigned: (this%callback => callback)

But from what I gathered, id2 is a pointer to sample data and not a ft8_decode_callback.  As a result this line crashes: *call* this%callback(sync,nsnr,xdt,f1,msg37,iaptype,qual) [in ft8_decode.f90:200]

I can’t imagine a pointer in shared memory being valid so I feel like I’m not understanding this code.  Is anyone familiar with this code to give me some context in how it should work?

Thanks for the help,
alex K6LOT

HI Alex,

the procedure 'decode' is a type bound procedure, the first argument is a pointer to the object that it was called on. The key declaration is:

    class(ft8_decoder), intent(inout) :: this

so 'this' is a bit like the hidden 'this' pointer in a C++ member function call, except it is not hidden in the procedure declaration ;) It is passed as the address of the object to the left of the '%' character at the call site, i.e. my_ft8:

     call my_ft8%decode(ft8_decoded,id2,params%nQSOProgress,params%nfqso,    &
          params%nftx,newdat,params%nutc,params%nfa,params%nfb,              &
          params%nzhsym,params%ndepth,params%emedelay,ncontest,              &
          logical(params%nagain),logical(params%lft8apon),                   &
          logical(params%lapcqonly),params%napwid,mycall,hiscall,            &
          params%ndiskdat)

The callback dummy argument is passed ft8_decoded which the decoder invokes to pass back the decode details.

73
Bill
G4WJS.

_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel

Reply via email to