#include "defs.h" #include "mi-cmds.h" #include "ui-out.h" #include "symtab.h" #include "source.h" /* Return to the client the absolute path and line number of the current file being executed. */ enum mi_cmd_result mi_cmd_file_list_exec_source_file(char *command, char **argv, int argc) { struct symtab_and_line st; if (argc != 0) error ("mi_cmd_file_list_exec_source_file: Usage: No args"); /* Set the default file and line, also get them */ set_default_source_symtab_and_line(); st = get_current_source_symtab_and_line(); /* We should always get a symtab. */ if (!st.symtab) error ("mi_cmd_file_list_exec_source_file: No symtab"); /* Extract the fullname if it is not known yet */ if (st.symtab->fullname == NULL) symtab_to_filename (st.symtab); /* We may not be able to open the file (not available). */ if (st.symtab->fullname == NULL) error ("mi_cmd_file_list_exec_source_file: File not found"); /* Print to the user the line and absolute file name */ ui_out_field_int (uiout, "line", st.line); ui_out_field_string (uiout, "file", st.symtab->fullname); return MI_CMD_DONE; }