void mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc) { struct symtab_and_line st; struct ui_out *uiout = current_uiout; if (!mi_valid_noargs ("-file-list-exec-source-file", argc, argv)) error (_("-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. Apparently, filename does not need to be tested for NULL. The documentation in symtab.h suggests it will always be correct. */ if (!st.symtab) error (_("-file-list-exec-source-file: No symtab")); /* Print to the user the line, filename and fullname. */ ui_out_field_int (uiout, "line", st.line); ui_out_field_string (uiout, "file", symtab_to_filename_for_display (st.symtab)); ui_out_field_string (uiout, "fullname", symtab_to_fullname (st.symtab)); ui_out_field_int (uiout, "macro-info", COMPUNIT_MACRO_TABLE (SYMTAB_COMPUNIT (st.symtab)) != NULL); }
enum mi_cmd_result mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc) { struct symtab_and_line st; int optind = 0; char *optarg; if (!mi_valid_noargs ("mi_cmd_file_list_exec_source_file", argc, argv)) 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. Apparently, filename does not need to be tested for NULL. The documentation in symtab.h suggests it will always be correct */ if (!st.symtab) error (_("mi_cmd_file_list_exec_source_file: No symtab")); /* Extract the fullname if it is not known yet */ symtab_to_fullname (st.symtab); /* Print to the user the line, filename and fullname */ ui_out_field_int (uiout, "line", st.line); ui_out_field_string (uiout, "file", st.symtab->filename); /* We may not be able to open the file (not available). */ if (st.symtab->fullname) ui_out_field_string (uiout, "fullname", st.symtab->fullname); ui_out_field_int (uiout, "macro-info", st.symtab->macro_table ? 1 : 0); return MI_CMD_DONE; }