diff options
author | Bob Rossi <bob@brasko.net> | 2004-06-10 20:05:45 +0000 |
---|---|---|
committer | Bob Rossi <bob@brasko.net> | 2004-06-10 20:05:45 +0000 |
commit | 57c22c6ce1e294fcec9653c0cf2c37eb77225fe6 (patch) | |
tree | 1cf1db59680a0f24ebb22438fa5ef981bf8d8c74 /gdb/mi | |
parent | 239ae8c7556347fead17ce5caef2e9a441e89e05 (diff) | |
download | gdb-57c22c6ce1e294fcec9653c0cf2c37eb77225fe6.zip gdb-57c22c6ce1e294fcec9653c0cf2c37eb77225fe6.tar.gz gdb-57c22c6ce1e294fcec9653c0cf2c37eb77225fe6.tar.bz2 |
Add the -file-list-exec-source-files command to MI.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-file.c | 65 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.c | 2 | ||||
-rw-r--r-- | gdb/mi/mi-cmds.h | 1 |
3 files changed, 60 insertions, 8 deletions
diff --git a/gdb/mi/mi-cmd-file.c b/gdb/mi/mi-cmd-file.c index eb1d67a..aa20a79 100644 --- a/gdb/mi/mi-cmd-file.c +++ b/gdb/mi/mi-cmd-file.c @@ -25,6 +25,7 @@ #include "ui-out.h" #include "symtab.h" #include "source.h" +#include "objfiles.h" /* Return to the client the absolute path and line number of the current file being executed. */ @@ -39,7 +40,6 @@ mi_cmd_file_list_exec_source_file(char *command, char **argv, int argc) 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(); @@ -51,17 +51,68 @@ mi_cmd_file_list_exec_source_file(char *command, char **argv, int argc) 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"); + 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); return MI_CMD_DONE; } + +enum mi_cmd_result +mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc) +{ + struct symtab *s; + struct partial_symtab *ps; + struct objfile *objfile; + + if (!mi_valid_noargs ("mi_cmd_file_list_exec_source_files", argc, argv)) + error ("mi_cmd_file_list_exec_source_files: Usage: No args"); + + /* Print the table header */ + ui_out_begin (uiout, ui_out_type_list, "files"); + + /* Look at all of the symtabs */ + ALL_SYMTABS (objfile, s) + { + ui_out_begin (uiout, ui_out_type_tuple, NULL); + + ui_out_field_string (uiout, "file", s->filename); + + /* Extract the fullname if it is not known yet */ + symtab_to_fullname (s); + + if (s->fullname) + ui_out_field_string (uiout, "fullname", s->fullname); + + ui_out_end (uiout, ui_out_type_tuple); + } + + /* Look at all of the psymtabs */ + ALL_PSYMTABS (objfile, ps) + { + if (!ps->readin) + { + ui_out_begin (uiout, ui_out_type_tuple, NULL); + + ui_out_field_string (uiout, "file", ps->filename); + + /* Extract the fullname if it is not known yet */ + psymtab_to_fullname (ps); + + if (ps->fullname) + ui_out_field_string (uiout, "fullname", ps->fullname); + + ui_out_end (uiout, ui_out_type_tuple); + } + } + + ui_out_end (uiout, ui_out_type_list); + + return MI_CMD_DONE; +} diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index 0dfc217..918676d 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -81,7 +81,7 @@ struct mi_cmd mi_cmds[] = { "file-exec-file", { "exec-file", 1 }, NULL, NULL }, { "file-list-exec-sections", { NULL, 0 }, NULL, NULL }, { "file-list-exec-source-file", { NULL, 0 }, 0, mi_cmd_file_list_exec_source_file}, - { "file-list-exec-source-files", { NULL, 0 }, NULL, NULL }, + { "file-list-exec-source-files", { NULL, 0 }, NULL, mi_cmd_file_list_exec_source_files }, { "file-list-shared-libraries", { NULL, 0 }, NULL, NULL }, { "file-list-symbol-files", { NULL, 0 }, NULL, NULL }, { "file-symbol-file", { "symbol-file", 1 }, NULL, NULL }, diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h index 095f316..f9a08d9 100644 --- a/gdb/mi/mi-cmds.h +++ b/gdb/mi/mi-cmds.h @@ -87,6 +87,7 @@ extern mi_cmd_args_ftype mi_cmd_exec_step_instruction; extern mi_cmd_args_ftype mi_cmd_exec_until; extern mi_cmd_args_ftype mi_cmd_exec_interrupt; extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_file; +extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_files; extern mi_cmd_argv_ftype mi_cmd_gdb_exit; extern mi_cmd_argv_ftype mi_cmd_interpreter_exec; extern mi_cmd_argv_ftype mi_cmd_stack_info_depth; |