This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-file-list-exec-source-file


I'm not quite sure what value to return when the symbol table is not
loaded. Other than that, I think that patch is in good working
condition.

Are the MI functions supposed to return a particular value to the front
end when an error occurs? Does the function "error" return some data
that the front end can parse and determine that there is an error? Or
does it just print out some debug info that a human can interpret?


2004-02-06  Bob Rossi  <bob_rossi@cox.net>

	* mi-cmd-file.c: Added -file-list-exec-source-files function.
	* mi-cmds.c (mi_cmds): Added -file-list-exec-source-file command.
	* mi-cmds.h (mi_cmd_file_list_exec_source_file): Declare.

Index: mi-cmd-file.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-file.c,v
retrieving revision 1.1
diff -w -u -r1.1 mi-cmd-file.c
--- mi-cmd-file.c	2 Apr 2003 22:10:35 -0000	1.1
+++ mi-cmd-file.c	7 Feb 2004 02:09:40 -0000
@@ -25,6 +25,8 @@
 #include "ui-out.h"
 #include "symtab.h"
 #include "source.h"
+#include "objfiles.h"
+#include "defs.h"
 
 /* Return to the client the absolute path and line number of the 
    current file being executed. */
@@ -63,5 +65,47 @@
   ui_out_field_string (uiout, "file", st.symtab->filename);
   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;
+  int first;
+
+  if ( !mi_valid_noargs("mi_cmd_file_list_exec_source_files", argc, argv) )
+    error ("mi_cmd_file_list_exec_source_files: Usage: No args");
+
+  /* What should this error be? */
+  if (!have_full_symbols () && !have_partial_symbols ())
+    error ("No symbol table is loaded.  Use the \"file\" command.");
+
+  /* Look at all of the symtabs */
+  first = 1;
+  ALL_SYMTABS (objfile, s)
+  {
+    ui_out_field_string (uiout, "symtab_file", s->filename);
+
+	/* Use the fullname or attempt to extract it if it is not yet known */
+    if (s->fullname || source_full_path_of (s->filename, &s->fullname))
+      ui_out_field_string (uiout, "symtab_fullname", s->fullname);
+  }
+
+  /* Look at all of the psymtabs */
+  first = 1;
+  ALL_PSYMTABS (objfile, ps)
+  {
+    if (!ps->readin) {
+      ui_out_field_string (uiout, "psymtab_file", ps->filename);
+
+	  /* Use the fullname or attempt to extract it if it is not yet known */
+      if (ps->fullname || source_full_path_of (ps->filename, &ps->fullname))
+        ui_out_field_string (uiout, "psymtab_fullname", ps->fullname);
+    }
+  }
+  
   return MI_CMD_DONE;
 }
Index: mi-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.14
diff -w -u -r1.14 mi-cmds.c
--- mi-cmds.c	4 Aug 2003 23:18:50 -0000	1.14
+++ mi-cmds.c	7 Feb 2004 02:09:41 -0000
@@ -81,7 +81,7 @@
   { "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 },
Index: mi-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
retrieving revision 1.12
diff -w -u -r1.12 mi-cmds.h
--- mi-cmds.h	24 Jan 2004 04:21:43 -0000	1.12
+++ mi-cmds.h	7 Feb 2004 02:09:41 -0000
@@ -87,6 +87,7 @@
 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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]