Debugging Issues

En el CVS se pueden ver los siguientes proyectos Photran: debug.core, debug.ui, debug.mi.core y debug.mi.ui, sin embargo, en la documentación para contributors se comenta lo siguiente:

Currently, Photran re-uses the CDT debugger as-is and does not contribute any enhance-ments to it. Here is a brief summary of how the debugger works:
  • The so-called CDT debugger is actually just a graphical interface to gdb, or more specifically to gdb/mi. So, if something doesn’t appear to work, it is advisable to try it in gdb directly or to use another gdb-based tool such as DDD.
  • The debugger UI “contributes” breakpoint markers and actions to the editor. The “set breakpoint” action, and the breakpoint markers that appear in the ruler of the CDT (and Photran) editors are handled entirely by the CDT debug UI; there is no code for this in Photran. The “set breakpoint” action is enabled by calling setRulerContextMenuId(”#CEditorRulerContext”); in the AbstractFortranEditor constructor.
  • gdb reads debug symbols from the executable it is debugging. That is how it knows what line it’s on, what file to open, etc. Photran has nothing to do with this: These symbols are written entirely by the compiler. Moreover, the compiler determines what shows up in the Variables View. If the debugger views seem to be a mess, it is the compiler’s fault, not Photran’s.

Parece ser que CDT no introduce en la vista de variables las variables globales: Lo comentan en el FAQ (http://dev.eclipse.org/viewcvs/indextools.cgi/cdt-home/user/faq.html#debug_20). No dan razones, pero principalmente puede ser para evitar que aparezcan un montón de símbolos que son internos al programa. Sin embargo, lo que más me extraña es que incluso si intentamos añadir a mano las variables globales, éstas no aparecen en la lista (opción Add Global variables en la barra de herramientas de la vista). Sin embargo, se pueden añadir como Watch expressions, y desde gdb se pueden consultar sin problemas.

Errores que aparecen en la consola

mi_cmd_var_create: unable to create variable object

Debido a que el depurador no muestra las variables globales y éstas se añaden como Watch expressions, lo habitual es olvidarse de las Watch expressions y ponerse a depurar otro programa. El problema es que CDT trata de resolver esas expresiones a través de gdb, asumiendo que siguen siendo válidas para el programa que se está depurando actualmente. Basta con eliminar de la vista de Expressions las que no son válidas para que este tipo de errores desaparezca.