1 /* MI Command Set - breakpoint and watchpoint commands.
2 Copyright (C) 2000, 2001, 2002, 2007, 2008, 2009, 2010, 2011
3 Free Software Foundation, Inc.
4 Contributed by Cygnus Solutions (a Red Hat company).
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "mi-getopt.h"
30 /* Return to the client the absolute path and line number of the
31 current file being executed. */
34 mi_cmd_file_list_exec_source_file (char *command
, char **argv
, int argc
)
36 struct symtab_and_line st
;
37 struct ui_out
*uiout
= current_uiout
;
39 if (!mi_valid_noargs ("-file-list-exec-source-file", argc
, argv
))
40 error (_("-file-list-exec-source-file: Usage: No args"));
42 /* Set the default file and line, also get them */
43 set_default_source_symtab_and_line ();
44 st
= get_current_source_symtab_and_line ();
46 /* We should always get a symtab.
47 Apparently, filename does not need to be tested for NULL.
48 The documentation in symtab.h suggests it will always be correct */
50 error (_("-file-list-exec-source-file: No symtab"));
52 /* Extract the fullname if it is not known yet */
53 symtab_to_fullname (st
.symtab
);
55 /* Print to the user the line, filename and fullname */
56 ui_out_field_int (uiout
, "line", st
.line
);
57 ui_out_field_string (uiout
, "file", st
.symtab
->filename
);
59 /* We may not be able to open the file (not available). */
60 if (st
.symtab
->fullname
)
61 ui_out_field_string (uiout
, "fullname", st
.symtab
->fullname
);
63 ui_out_field_int (uiout
, "macro-info", st
.symtab
->macro_table
? 1 : 0);
66 /* A callback for map_partial_symbol_filenames. */
68 print_partial_file_name (const char *filename
, const char *fullname
,
71 struct ui_out
*uiout
= current_uiout
;
73 ui_out_begin (uiout
, ui_out_type_tuple
, NULL
);
75 ui_out_field_string (uiout
, "file", filename
);
78 ui_out_field_string (uiout
, "fullname", fullname
);
80 ui_out_end (uiout
, ui_out_type_tuple
);
84 mi_cmd_file_list_exec_source_files (char *command
, char **argv
, int argc
)
86 struct ui_out
*uiout
= current_uiout
;
88 struct objfile
*objfile
;
90 if (!mi_valid_noargs ("-file-list-exec-source-files", argc
, argv
))
91 error (_("-file-list-exec-source-files: Usage: No args"));
93 /* Print the table header */
94 ui_out_begin (uiout
, ui_out_type_list
, "files");
96 /* Look at all of the symtabs */
97 ALL_SYMTABS (objfile
, s
)
99 ui_out_begin (uiout
, ui_out_type_tuple
, NULL
);
101 ui_out_field_string (uiout
, "file", s
->filename
);
103 /* Extract the fullname if it is not known yet */
104 symtab_to_fullname (s
);
107 ui_out_field_string (uiout
, "fullname", s
->fullname
);
109 ui_out_end (uiout
, ui_out_type_tuple
);
112 map_partial_symbol_filenames (print_partial_file_name
, NULL
,
113 1 /*need_fullname*/);
115 ui_out_end (uiout
, ui_out_type_list
);
This page took 0.030577 seconds and 4 git commands to generate.