point d'arrêt non-atteint sûrement à cause de pointeurs de fonction
Bonjour,
j'essaye d'atteindre un point d'arrêt situé assez tôt dans mon code, mais je n'y arrive pas. Je pensais que gdb ne se débrouillait pas avec les templates C++ mais ça a l'air d'aller, je pense donc que c'est un problème de pointeurs de fonction. En effet le nom de la fonction à exécuter (ici "doit") est déterminée à l'exécution. Extraits de code :
Code:
1 2 3 4 5 6
| int main(int argc,const char **argv)
{
ABM proc(params...);
proc.execute(fileinr);
return EXIT_SUCCESS;
} |
Ici l'endroit où j'ai mon point d'arrêt :
Code:
1 2 3 4 5 6
| template <class T>
bool doit( Process & process, const string & fileinr, Finder & )
{
//stuff
return(1);
} |
Le lien entre les deux : ABM est un fils de Process, et son unique constructeur comporte :
Code:
1 2 3 4 5 6 7 8 9 10
| registerProcessType( "Volume", "S8", &doit<int8_t> );
registerProcessType( "Volume", "U8", &doit<uint8_t> );
registerProcessType( "Volume", "S16", &doit<int16_t> );
registerProcessType( "Volume", "U16", &doit<uint16_t> );
registerProcessType( "Volume", "S32", &doit<int32_t> );
registerProcessType( "Volume", "U32", &doit<uint32_t> );
registerProcessType( "Volume", "FLOAT", &doit<float> );
registerProcessType( "Volume", "DOUBLE", &doit<double> );
registerProcessType( "Volume", "RGB", &doit<int16_t> );
registerProcessType( "Volume", "RGBA", &doit<int16_t> ); |
"" de Process est défini comme suit :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| bool Process::execute( const string & filename )
{
Finder f;
if( !f.check( filename ) )
{
f.launchException();
throw format_error( filename );
return( false );
}
return( execute( f, filename ) );
}
bool Process::execute( Finder & f, const string & filename )
{
string otype = f.objectType();
string dtype = f.dataType();
map<string, map<string, ProcFunc> >::const_iterator
ip = _execs.find( otype );
if( ip == _execs.end() )
{
throw datatype_format_error( string( "unsupported data type " ) + otype + " / " + dtype, filename );
return( false );
}
map<string, ProcFunc>::const_iterator ip2 = (*ip).second.find( dtype );
if( ip2 == (*ip).second.end() )
{
// Try alternate data types
vector<string> posstypes = f.possibleDataTypes();
unsigned i, n = posstypes.size();
for( i=0; i<n; ++i )
if( posstypes[i] != dtype )
{
ip2 = (*ip).second.find( posstypes[i] );
if( ip2 != (*ip).second.end() )
{
// force new datatype into finder
f.setDataType( posstypes[i] );
break;
}
}
if( i == n )
{
throw datatype_format_error( string( "unsupported data type " ) + otype + " / " + dtype, filename );
return( false );
}
}
// execute process function
return( (*ip2).second( *this, filename, f ) );
} |
Donc enfin la question : comment placer correctement mon point d'arrêt, puissque la méthode "breakpoint cheminSource/nomSource.extensionSource:numeroDeLigne" ne marche pas dans ce cas-ci. Je suis pour l'instant obligé de faire du pas à pas, ce qui combiné à du parallélisme est très très vite lassant... problème assez classique mais je n'ai rien trouvé sur le net!
D'avance merci,
AM