Custom Analyzer fails to load saved capture

Hello,
I wrote a custom analyzer about 3 years ago, and I am starting to see some issues when people save captures and try to reload them.

I am very surprised the code crashes, as this part of the code is identical to the I2C decoder code that is available on GitHub.

The interesting part is that my settings char array seems to contain all the relevant information; but once it’s passed to the SimpleArchive class it looks like it’s losing some information.

Could you please take a look at this, and tell me what I am doing wrong or what I can do to help you help me?

I am using SDK version SaleaeAnalyzerSdk-1.1.32.

The code crashes at the assert, because when try to extract name_string from the SimpleArchive it returns an empty string; the weirdness is that it looks like the serialized data that is passed to SimpleArchive::SetString has all the information that we need. I have no visibility in what the SimpleArchive class does though.

Here is the code section that crashes:

void MyAnalyzerSettings::LoadSettings( const char* settings )
{
	SimpleArchive text_archive;
	text_archive.SetString( settings );

    const char* name_string;
    
    text_archive >> &name_string;
    if( strcmp( name_string, MY_ANALYZER_NAME ) != 0 ) // This is to make sure we do not load rogue settings.
        AnalyzerHelpers::Assert( MY_ANALYZER_NAME ": Provided with a settings string that doesn't belong to us;" );
    
	text_archive >> mSCLKChannel;
    text_archive >> mDATAChannel;
    
    ClearChannels();
    AddChannel( mSCLKChannel, "SCLK", false );
    AddChannel( mDATAChannel, "DATA", false );

	UpdateInterfacesFromSettings();
}

Here is a screenshot of the memory of settings (I attached the raw dump at the bottom):

Here is my SaveSettings() function:

const char* MyAnalyzerSettings::SaveSettings()
{
	SimpleArchive text_archive;

text_archive << MY_ANALYZER_NAME;
	text_archive << mSCLKChannel;
text_archive << mDATAChannel;

	return SetReturnString( text_archive.GetString() );
}

The memory dump of settings:

32 32 20 73 65 72 69 61 6C 69 7A 61 74 69 6F 6E 3A 3A 61 72 63 68 69 76 65 20 31 30 20 34 20 53 50 4D 49 20 30 20 32 31 20 34 37 35 30 38 39 31 32 30 20 30 20 31 20 34 37 35 30 38 39 31 32 30 20 31 20 31 00 00 00 14 E3 0B 90 26 00 1C 74 10 00 00 00 00 00 00 10 01 CB 95 AB 28 00 50 34 2C 00 00 00 FF 00 00 00 FF 00 00 00 FF 00 00 00 FF 00 00 00 FA 00 00 00 BB 00 00 00 8C 00 00 00 9D 00 00 00 CF 00 00 00 FF 00 00 00 FF 00 00 00 FF 00 00 00 FF 00 00 00 FF 00 00 00 FF 00 00 00 FF 00 00 00 AD 00 00 00 21 00 00 00 0F 00 00 00 05 00 00 00 0A 00 00 00 13 00 00 00 3B 00 00 00 FB 00 00 00 FF 00 00 00 FF 00 00 00 FF 00 00 00 FF 00 00 00 AB 00 00 00 0D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 1D 00 00 00 F5 00 00 00 FF 00 00 00 FF 00 00 00 CB 00 00 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 00 00 00 FF 00 00 00 FF 00 00 00 3E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 A5 00 00 00 FF 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 64 00 00 00 D3 00 00 00 21 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4A 00 00 00 FF 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6B

Hi Mattia, thanks for submitting a support ticket in parallel. I’ll be in touch over email regarding next steps to debug this.