Looking for hints on DC import debugging

Dirk Hohndel dirk at hohndel.org
Mon Dec 30 08:12:54 UTC 2013


On Mon, 2013-12-30 at 11:57 +0100, Lutz Vieweg wrote:
> Hi,
> 
> since "just trying to find external conditions that trigger the import failure"
> did not get me anywhere, I intend to attach with gdb next time and find the
> place in the code where the decision is made to not use the data coming from the DC.
> 
> Can you hint me at which function I should start setting a break point?
> 
> Does subsurface process dive data while importing, one-dive-at-a-time, or
> is there more like a place in the code where the whole of one DC import
> (multiple dives) is passed back from libdivecomputer to the application?
> 

Look at this function in qt-ui/downloadfromdivecomputer.cpp:

void DownloadFromDCWidget::onDownloadThreadFinished()
{
	if (currentState == DOWNLOADING) {
		if (thread->error.isEmpty())
			updateState(DONE);
		else
			updateState(ERROR);

		// I'm not sure if we should really call process_dives even
		// if there's an error
		if (import_thread_cancelled) {
			// walk backwards so we don't keep moving the dives
			// down in the dive_table
			for (int i = dive_table.nr - 1; i >= previousLast; i--)
				delete_single_dive(i);
		} else {
			process_dives(TRUE, preferDownloaded());
		}
	} else {
		updateState(CANCELLED);
	}
}

When the download thread is done, this is where we figure out what to do
- whether to process the dives or whether to delete the ones that were
downloaded because the download was canceled.

This is where I'd start.



More information about the subsurface mailing list