Does anyone know how to tell if a given variable is valid when its pretty printer is invoked from gdb.

For example one of my pretty printers uses gdb.parse_and_eval which causes gdb to crash unless the variable has been initialised.

TestPrettyPrint::TestPrettyPrint(QWidget *parent)
    : QMainWindow(parent)
	QFile f("C:/Log.txt");
If i put a break point on the first line and try to examine 'f' gdb crashes. If I put a break point after when 'f' has been created everything is fine.

Any information would be extremely helpful