gdb/mi/mi-cmd-file.c - gdb
Functions defined
Source code
- #include "defs.h"
- #include "mi-cmds.h"
- #include "mi-getopt.h"
- #include "ui-out.h"
- #include "symtab.h"
- #include "source.h"
- #include "objfiles.h"
- #include "psymtab.h"
- 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_default_source_symtab_and_line ();
- st = get_current_source_symtab_and_line ();
-
- if (!st.symtab)
- error (_("-file-list-exec-source-file: No symtab"));
-
- 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);
- }
- static void
- print_partial_file_name (const char *filename, const char *fullname,
- void *ignore)
- {
- struct ui_out *uiout = current_uiout;
- ui_out_begin (uiout, ui_out_type_tuple, NULL);
- ui_out_field_string (uiout, "file", filename);
- if (fullname)
- ui_out_field_string (uiout, "fullname", fullname);
- ui_out_end (uiout, ui_out_type_tuple);
- }
- void
- mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
- {
- struct ui_out *uiout = current_uiout;
- struct compunit_symtab *cu;
- struct symtab *s;
- struct objfile *objfile;
- if (!mi_valid_noargs ("-file-list-exec-source-files", argc, argv))
- error (_("-file-list-exec-source-files: Usage: No args"));
-
- ui_out_begin (uiout, ui_out_type_list, "files");
-
- ALL_FILETABS (objfile, cu, s)
- {
- ui_out_begin (uiout, ui_out_type_tuple, NULL);
- ui_out_field_string (uiout, "file", symtab_to_filename_for_display (s));
- ui_out_field_string (uiout, "fullname", symtab_to_fullname (s));
- ui_out_end (uiout, ui_out_type_tuple);
- }
- map_symbol_filenames (print_partial_file_name, NULL,
- 1 );
- ui_out_end (uiout, ui_out_type_list);
- }