Hi,

I'm a developer in the Robotics Research Group at URJC [1]. We are currently using gearbox in our software.
I think I've found a bug in exceptions.cpp:

const char *
Exception::basename( const char *s ) const
{
#ifndef WIN32
    return strrchr( s, '/' )+1;
#else
    return strrchr( s, '\\' )+1;
#endif
};

std::string
Exception::toMessageString( const char *file, const char *line, const std::string &message ) const
{
    std::string msg = "\n *** ERROR(";
    // not to confuse our local basename() with gbxutilacfr::basename()
    msg += this->basename(file);
    msg += ":";
    msg += line;
    msg += "): " + message;
    return msg;
}


In basename it is supposed that s contains a "/" or "\\" for WIN32, but this is not true always so strrchr returns NULL+1 in this cases.
In our system gcc compiles files with absolute paths, so __FILE__ is substituted with a file name without any slash, making my programs SEGFAULT whenever an exception is thrown.

The bug could be solved easily checking the return of strrchr.

Thanks,
David.


[1] http://jderobot.org/index.php/Main_Page