Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [PATCH] implements MI "-file-list-exec-sections" (updated)
@ 2004-04-22 21:56 Stefan Weyergraf
  2004-04-22 22:22 ` Bob Rossi
  2004-05-07  1:20 ` Andrew Cagney
  0 siblings, 2 replies; 12+ messages in thread
From: Stefan Weyergraf @ 2004-04-22 21:56 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: Text/Plain, Size: 546 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Resubmitting updated (against current CVS) patch. Includes changes to GDB/MI 
and docs. No test case yet.
Maybe it's worth mentioning, that GDB/CLI output for "info file" changes with 
this patch which will probably break programs that parse this. (I don't think 
such programs exist)

Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAiD+UEP9tKMRlxN8RAtW2AJ9QYKMq/tVJjF+NjdE+xCpPJERqcwCeNgS/
IVntw4sYLYa1mSMVzGQGAnw=
=+1Q+
-----END PGP SIGNATURE-----

[-- Attachment #2: .sw1c.patch --]
[-- Type: text/x-diff, Size: 32869 bytes --]

Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.38
diff -u -3 -p -r1.38 corelow.c
--- corelow.c	21 Apr 2004 17:47:10 -0000	1.38
+++ corelow.c	22 Apr 2004 21:43:59 -0000
@@ -66,7 +66,7 @@ static struct core_fns *core_vec = NULL;
 
 struct gdbarch *core_gdbarch = NULL;
 
-static void core_files_info (struct target_ops *);
+static void core_files_info (struct target_ops *, struct ui_out *);
 
 #ifdef SOLIB_ADD
 static int solib_add_stub (void *);
@@ -511,9 +511,9 @@ get_core_registers (int regno)
 }
 
 static void
-core_files_info (struct target_ops *t)
+core_files_info (struct target_ops *t, struct ui_out *uiout)
 {
-  print_section_info (t, core_bfd);
+  print_section_info (t, core_bfd, uiout);
 }
 \f
 static LONGEST
Index: exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.37
diff -u -3 -p -r1.37 exec.c
--- exec.c	21 Apr 2004 23:52:20 -0000	1.37
+++ exec.c	22 Apr 2004 21:43:59 -0000
@@ -63,7 +63,7 @@ static void file_command (char *, int);
 
 static void set_section_command (char *, int);
 
-static void exec_files_info (struct target_ops *);
+static void exec_files_info (struct target_ops *, struct ui_out *);
 
 static int ignore (CORE_ADDR, char *);
 
@@ -521,47 +521,50 @@ xfer_memory (CORE_ADDR memaddr, char *my
 \f
 
 void
-print_section_info (struct target_ops *t, bfd *abfd)
+print_section_info (struct target_ops *t, bfd *abfd, struct ui_out *uiout)
 {
   struct section_table *p;
-  /* FIXME: "016l" is not wide enough when TARGET_ADDR_BIT > 64.  */
-  char *fmt = TARGET_ADDR_BIT <= 32 ? "08l" : "016l";
+  ui_out_text (uiout, "\t`");
+  ui_out_field_string (uiout, "filename", bfd_get_filename (abfd));
+  ui_out_text (uiout, "', ");
+
+  ui_out_wrap_hint (uiout, "        ");
+
+  ui_out_text (uiout, "file type ");
+  ui_out_field_string (uiout, "file-type", bfd_get_target (abfd));
+  ui_out_text (uiout, ".\n");
 
-  printf_filtered ("\t`%s', ", bfd_get_filename (abfd));
-  wrap_here ("        ");
-  printf_filtered ("file type %s.\n", bfd_get_target (abfd));
   if (abfd == exec_bfd)
     {
-      printf_filtered ("\tEntry point: ");
-      print_address_numeric (bfd_get_start_address (abfd), 1, gdb_stdout);
-      printf_filtered ("\n");
+      ui_out_text (uiout, "\tEntry point: ");
+      ui_out_field_core_addr (uiout, "target-entrypoint", bfd_get_start_address (abfd));
+      ui_out_text (uiout, "\n");
     }
+  ui_out_begin (uiout, ui_out_type_list, "sections");
   for (p = t->to_sections; p < t->to_sections_end; p++)
     {
-      printf_filtered ("\t%s", local_hex_string_custom (p->addr, fmt));
-      printf_filtered (" - %s", local_hex_string_custom (p->endaddr, fmt));
-
-      /* FIXME: A format of "08l" is not wide enough for file offsets
-	 larger than 4GB.  OTOH, making it "016l" isn't desirable either
-	 since most output will then be much wider than necessary.  It
-	 may make sense to test the size of the file and choose the
-	 format string accordingly.  */
-      if (info_verbose)
-	printf_filtered (" @ %s",
-			 local_hex_string_custom (p->the_bfd_section->filepos, "08l"));
-      printf_filtered (" is %s", bfd_section_name (p->bfd, p->the_bfd_section));
+      ui_out_begin (uiout, ui_out_type_tuple, NULL);
+      ui_out_text (uiout, "\t");
+      ui_out_field_core_addr (uiout, "start-address", p->addr);
+      ui_out_text (uiout, " - ");
+      ui_out_field_core_addr (uiout, "end-address", p->endaddr);
+      ui_out_text (uiout, " is ");
+      ui_out_field_string (uiout, "section-name", bfd_section_name (p->bfd, p->the_bfd_section));
       if (p->bfd != abfd)
 	{
-	  printf_filtered (" in %s", bfd_get_filename (p->bfd));
+          ui_out_text (uiout, " in ");
+          ui_out_field_string (uiout, "section-filename", bfd_get_filename (p->bfd));
 	}
-      printf_filtered ("\n");
+      ui_out_text (uiout, "\n");
+      ui_out_end (uiout, ui_out_type_tuple);
     }
+  ui_out_end (uiout, ui_out_type_list);
 }
 
 static void
-exec_files_info (struct target_ops *t)
+exec_files_info (struct target_ops *t, struct ui_out *uiout)
 {
-  print_section_info (t, exec_bfd);
+  print_section_info (t, exec_bfd, uiout);
 
   if (vmap)
     {
@@ -653,7 +656,7 @@ set_section_command (char *args, int fro
 	  p->addr += offset;
 	  p->endaddr += offset;
 	  if (from_tty)
-	    exec_files_info (&exec_ops);
+	    exec_files_info (&exec_ops, uiout);
 	  return;
 	}
     }
Index: go32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/go32-nat.c,v
retrieving revision 1.37
diff -u -3 -p -r1.37 go32-nat.c
--- go32-nat.c	29 Dec 2003 07:42:43 -0000	1.37
+++ go32-nat.c	22 Apr 2004 21:43:59 -0000
@@ -180,7 +180,7 @@ static int go32_xfer_memory (CORE_ADDR m
 			     int write,
 			     struct mem_attrib *attrib,
 			     struct target_ops *target);
-static void go32_files_info (struct target_ops *target);
+static void go32_files_info (struct target_ops *target, struct ui_out *);
 static void go32_stop (void);
 static void go32_kill_inferior (void);
 static void go32_create_inferior (char *exec_file, char *args, char **env);
@@ -550,7 +550,7 @@ go32_xfer_memory (CORE_ADDR memaddr, cha
 static cmdline_t child_cmd;	/* parsed child's command line kept here */
 
 static void
-go32_files_info (struct target_ops *target)
+go32_files_info (struct target_ops *target, struct ui_out *uiout)
 {
   printf_unfiltered ("You are running a DJGPP V2 program.\n");
 }
Index: hpux-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpux-thread.c,v
retrieving revision 1.22
diff -u -3 -p -r1.22 hpux-thread.c
--- hpux-thread.c	21 Apr 2004 23:52:20 -0000	1.22
+++ hpux-thread.c	22 Apr 2004 21:43:59 -0000
@@ -411,9 +411,9 @@ hpux_thread_xfer_memory (CORE_ADDR memad
 /* Print status information about what we're accessing.  */
 
 static void
-hpux_thread_files_info (struct target_ops *ignore)
+hpux_thread_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
-  child_ops.to_files_info (ignore);
+  child_ops.to_files_info (ignore, uiout);
 }
 
 static void
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.107
diff -u -3 -p -r1.107 infcmd.c
--- infcmd.c	21 Apr 2004 23:52:20 -0000	1.107
+++ infcmd.c	22 Apr 2004 21:43:59 -0000
@@ -1308,7 +1308,7 @@ program_info (char *args, int from_tty)
       return;
     }
 
-  target_files_info ();
+  target_files_info (uiout);
   printf_filtered ("Program stopped at %s.\n",
 		   local_hex_string ((unsigned long) stop_pc));
   if (stop_step)
Index: inftarg.c
===================================================================
RCS file: /cvs/src/src/gdb/inftarg.c,v
retrieving revision 1.23
diff -u -3 -p -r1.23 inftarg.c
--- inftarg.c	4 Feb 2004 21:49:55 -0000	1.23
+++ inftarg.c	22 Apr 2004 21:43:59 -0000
@@ -59,7 +59,7 @@ void child_post_wait (ptid_t, int);
 
 static void child_open (char *, int);
 
-static void child_files_info (struct target_ops *);
+static void child_files_info (struct target_ops *, struct ui_out *);
 
 static void child_detach (char *, int);
 
@@ -300,7 +300,7 @@ child_prepare_to_store (void)
 /* Print status information about what we're accessing.  */
 
 static void
-child_files_info (struct target_ops *ignore)
+child_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   printf_unfiltered ("\tUsing the running image of %s %s.\n",
       attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid));
Index: monitor.c
===================================================================
RCS file: /cvs/src/src/gdb/monitor.c,v
retrieving revision 1.46
diff -u -3 -p -r1.46 monitor.c
--- monitor.c	21 Jan 2004 15:37:11 -0000	1.46
+++ monitor.c	22 Apr 2004 21:44:00 -0000
@@ -83,7 +83,7 @@ static int monitor_xfer_memory (CORE_ADD
 				int write, 
 				struct mem_attrib *attrib,
 				struct target_ops *target);
-static void monitor_files_info (struct target_ops *ops);
+static void monitor_files_info (struct target_ops *ops, struct ui_out *uiout);
 static int monitor_insert_breakpoint (CORE_ADDR addr, char *shadow);
 static int monitor_remove_breakpoint (CORE_ADDR addr, char *shadow);
 static void monitor_kill (void);
@@ -1408,7 +1408,7 @@ monitor_prepare_to_store (void)
 }
 
 static void
-monitor_files_info (struct target_ops *ops)
+monitor_files_info (struct target_ops *ops, struct ui_out *uiout)
 {
   printf_unfiltered ("\tAttached to %s at %d baud.\n", dev_name, baud_rate);
 }
Index: nto-procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/nto-procfs.c,v
retrieving revision 1.3
diff -u -3 -p -r1.3 nto-procfs.c
--- nto-procfs.c	18 Jul 2003 17:15:33 -0000	1.3
+++ nto-procfs.c	22 Apr 2004 21:44:00 -0000
@@ -485,7 +485,7 @@ procfs_meminfo (char *args, int from_tty
 
 /* Print status information about what we're accessing.  */
 static void
-procfs_files_info (struct target_ops *ignore)
+procfs_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   printf_unfiltered ("\tUsing the running image of %s %s via %s.\n",
 		     attach_flag ? "attached" : "child",
Index: ocd.c
===================================================================
RCS file: /cvs/src/src/gdb/ocd.c,v
retrieving revision 1.28
diff -u -3 -p -r1.28 ocd.c
--- ocd.c	18 Jan 2004 19:26:51 -0000	1.28
+++ ocd.c	22 Apr 2004 21:44:00 -0000
@@ -723,7 +723,7 @@ ocd_xfer_memory (CORE_ADDR memaddr, char
 }
 \f
 void
-ocd_files_info (struct target_ops *ignore)
+ocd_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   puts_filtered ("Debugging a target over a serial line.\n");
 }
Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.53
diff -u -3 -p -r1.53 procfs.c
--- procfs.c	15 Feb 2004 22:38:40 -0000	1.53
+++ procfs.c	22 Apr 2004 21:44:01 -0000
@@ -117,7 +117,7 @@ static void procfs_detach (char *, int);
 static void procfs_resume (ptid_t, int, enum target_signal);
 static int procfs_can_run (void);
 static void procfs_stop (void);
-static void procfs_files_info (struct target_ops *);
+static void procfs_files_info (struct target_ops *, struct ui_out *);
 static void procfs_fetch_registers (int);
 static void procfs_store_registers (int);
 static void procfs_notice_signals (ptid_t);
@@ -4587,13 +4587,13 @@ procfs_notice_signals (ptid_t ptid)
 }
 
 /*
- * Function: target_files_info
+ * Function: procfs_files_info
  *
  * Print status information about the child process.
  */
 
 static void
-procfs_files_info (struct target_ops *ignore)
+procfs_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   printf_filtered ("\tUsing the running image of %s %s via /proc.\n",
 		   attach_flag? "attached": "child",
Index: remote-e7000.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-e7000.c,v
retrieving revision 1.39
diff -u -3 -p -r1.39 remote-e7000.c
--- remote-e7000.c	11 Dec 2003 06:21:12 -0000	1.39
+++ remote-e7000.c	22 Apr 2004 21:44:01 -0000
@@ -1051,7 +1051,7 @@ e7000_prepare_to_store (void)
 }
 
 static void
-e7000_files_info (struct target_ops *ops)
+e7000_files_info (struct target_ops *ops, struct ui_out *uiout)
 {
   printf_unfiltered ("\tAttached to %s at %d baud.\n", dev_name, baudrate);
 }
Index: remote-m32r-sdi.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-m32r-sdi.c,v
retrieving revision 1.2
diff -u -3 -p -r1.2 remote-m32r-sdi.c
--- remote-m32r-sdi.c	10 Mar 2004 00:18:44 -0000	1.2
+++ remote-m32r-sdi.c	22 Apr 2004 21:44:01 -0000
@@ -1058,7 +1058,7 @@ m32r_prepare_to_store (void)
 }
 
 static void
-m32r_files_info (struct target_ops *target)
+m32r_files_info (struct target_ops *target, struct ui_out *uiout)
 {
   char *file = "nothing";
 
Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.45
diff -u -3 -p -r1.45 remote-mips.c
--- remote-mips.c	21 Apr 2004 23:52:20 -0000	1.45
+++ remote-mips.c	22 Apr 2004 21:44:02 -0000
@@ -112,7 +112,7 @@ static int mips_xfer_memory (CORE_ADDR m
 			     struct mem_attrib *attrib,
 			     struct target_ops *target);
 
-static void mips_files_info (struct target_ops *ignore);
+static void mips_files_info (struct target_ops *ignore, struct ui_out *uiout);
 
 static void mips_create_inferior (char *execfile, char *args, char **env);
 
@@ -2114,7 +2114,7 @@ mips_xfer_memory (CORE_ADDR memaddr, cha
 /* Print info on this target.  */
 
 static void
-mips_files_info (struct target_ops *ignore)
+mips_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   printf_unfiltered ("Debugging a MIPS board over a serial line.\n");
 }
Index: remote-rdi.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-rdi.c,v
retrieving revision 1.31
diff -u -3 -p -r1.31 remote-rdi.c
--- remote-rdi.c	12 Feb 2004 18:43:09 -0000	1.31
+++ remote-rdi.c	22 Apr 2004 21:44:02 -0000
@@ -52,7 +52,7 @@ extern int isascii (int);
 
 /* Prototypes for local functions */
 
-static void arm_rdi_files_info (struct target_ops *ignore);
+static void arm_rdi_files_info (struct target_ops *ignore, struct ui_out *uiout);
 
 static int arm_rdi_xfer_memory (CORE_ADDR memaddr, char *myaddr,
 				int len, int should_write,
@@ -609,7 +609,7 @@ arm_rdi_xfer_memory (CORE_ADDR memaddr, 
 /* Display random info collected from the target.  */
 
 static void
-arm_rdi_files_info (struct target_ops *ignore)
+arm_rdi_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   char *file = "nothing";
   int rslt;
Index: remote-rdp.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-rdp.c,v
retrieving revision 1.36
diff -u -3 -p -r1.36 remote-rdp.c
--- remote-rdp.c	25 Mar 2004 16:52:42 -0000	1.36
+++ remote-rdp.c	22 Apr 2004 21:44:02 -0000
@@ -1341,7 +1341,7 @@ dump_bits (struct yn *t, int info)
 }
 
 static void
-remote_rdp_files_info (struct target_ops *target)
+remote_rdp_files_info (struct target_ops *target, struct ui_out *uiout)
 {
   printf_filtered ("Target capabilities:\n");
   dump_bits (stepinfo, ds.step_info);
Index: remote-sds.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sds.c,v
retrieving revision 1.28
diff -u -3 -p -r1.28 remote-sds.c
--- remote-sds.c	19 Jan 2004 01:20:11 -0000	1.28
+++ remote-sds.c	22 Apr 2004 21:44:02 -0000
@@ -55,7 +55,7 @@ static int sds_write_bytes (CORE_ADDR, c
 
 static int sds_read_bytes (CORE_ADDR, char *, int);
 
-static void sds_files_info (struct target_ops *ignore);
+static void sds_files_info (struct target_ops *ignore, struct ui_out *uiout);
 
 static int sds_xfer_memory (CORE_ADDR, char *, int, int, 
 			    struct mem_attrib *, struct target_ops *);
@@ -658,7 +658,7 @@ sds_xfer_memory (CORE_ADDR memaddr, char
 \f
 
 static void
-sds_files_info (struct target_ops *ignore)
+sds_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   puts_filtered ("Debugging over a serial connection, using SDS protocol.\n");
 }
Index: remote-sim.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-sim.c,v
retrieving revision 1.36
diff -u -3 -p -r1.36 remote-sim.c
--- remote-sim.c	21 Apr 2004 23:52:20 -0000	1.36
+++ remote-sim.c	22 Apr 2004 21:44:02 -0000
@@ -102,7 +102,7 @@ static int gdbsim_xfer_inferior_memory (
 					struct mem_attrib *attrib,
 					struct target_ops *target);
 
-static void gdbsim_files_info (struct target_ops *target);
+static void gdbsim_files_info (struct target_ops *target, struct ui_out *uiout);
 
 static void gdbsim_mourn_inferior (void);
 
@@ -778,7 +778,7 @@ gdbsim_xfer_inferior_memory (CORE_ADDR m
 }
 
 static void
-gdbsim_files_info (struct target_ops *target)
+gdbsim_files_info (struct target_ops *target, struct ui_out *uiout)
 {
   char *file = "nothing";
 
Index: remote-st.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-st.c,v
retrieving revision 1.19
diff -u -3 -p -r1.19 remote-st.c
--- remote-st.c	18 Sep 2003 22:39:21 -0000	1.19
+++ remote-st.c	22 Apr 2004 21:44:02 -0000
@@ -481,7 +481,7 @@ st2000_prepare_to_store (void)
 }
 
 static void
-st2000_files_info (void)
+st2000_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   printf ("\tAttached to %s at %d baud.\n",
 	  dev_name, baudrate);
Index: remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-utils.c,v
retrieving revision 1.13
diff -u -3 -p -r1.13 remote-utils.c
--- remote-utils.c	23 Mar 2002 17:38:12 -0000	1.13
+++ remote-utils.c	22 Apr 2004 21:44:02 -0000
@@ -430,7 +430,7 @@ gr_detach (char *args, int from_tty)
 }
 
 void
-gr_files_info (struct target_ops *ops)
+gr_files_info (struct target_ops *ops, struct ui_out *uiout)
 {
 #ifdef __GO32__
   printf_filtered ("\tAttached to DOS asynctsr\n");
Index: remote-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/remote-utils.h,v
retrieving revision 1.9
diff -u -3 -p -r1.9 remote-utils.h
--- remote-utils.h	12 Apr 2003 17:41:25 -0000	1.9
+++ remote-utils.h	22 Apr 2004 21:44:02 -0000
@@ -119,7 +119,7 @@ long sr_get_hex_word (void);
 void gr_close (int quitting);
 void gr_create_inferior (char *execfile, char *args, char **env);
 void gr_detach (char *args, int from_tty);
-void gr_files_info (struct target_ops *ops);
+void gr_files_info (struct target_ops *ops, struct ui_out *uiout);
 void gr_generic_checkin (void);
 void gr_kill (void);
 void gr_mourn (void);
Index: remote-vx.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-vx.c,v
retrieving revision 1.30
diff -u -3 -p -r1.30 remote-vx.c
--- remote-vx.c	21 Sep 2003 01:26:45 -0000	1.30
+++ remote-vx.c	22 Apr 2004 21:44:03 -0000
@@ -554,7 +554,7 @@ vx_xfer_memory (CORE_ADDR memaddr, char 
 }
 
 static void
-vx_files_info (void)
+vx_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   printf_unfiltered ("\tAttached to host `%s'", vx_host);
   printf_unfiltered (", which has %sfloating point", target_has_fp ? "" : "no ");
@@ -562,7 +562,7 @@ vx_files_info (void)
 }
 
 static void
-vx_run_files_info (void)
+vx_run_files_info (struct target_ops *ignore, struct ui_out *)
 {
   printf_unfiltered ("\tRunning %s VxWorks process %s",
 		     vx_running ? "child" : "attached",
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.133
diff -u -3 -p -r1.133 remote.c
--- remote.c	21 Apr 2004 23:52:20 -0000	1.133
+++ remote.c	22 Apr 2004 21:44:03 -0000
@@ -70,7 +70,7 @@ void async_remote_interrupt_twice (gdb_c
 
 static void build_remote_gdbarch_data (void);
 
-static void remote_files_info (struct target_ops *ignore);
+static void remote_files_info (struct target_ops *ignore, struct ui_out *uiout);
 
 static int remote_xfer_memory (CORE_ADDR memaddr, char *myaddr,
 			       int len, int should_write,
@@ -3835,7 +3835,7 @@ remote_xfer_memory (CORE_ADDR mem_addr, 
 }
 
 static void
-remote_files_info (struct target_ops *ignore)
+remote_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   puts_filtered ("Debugging a target over a serial line.\n");
 }
Index: sol-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/sol-thread.c,v
retrieving revision 1.40
diff -u -3 -p -r1.40 sol-thread.c
--- sol-thread.c	21 Apr 2004 23:52:21 -0000	1.40
+++ sol-thread.c	22 Apr 2004 21:44:04 -0000
@@ -784,9 +784,9 @@ sol_thread_xfer_partial (struct target_o
 /* Print status information about what we're accessing.  */
 
 static void
-sol_thread_files_info (struct target_ops *ignore)
+sol_thread_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
-  procfs_ops.to_files_info (ignore);
+  procfs_ops.to_files_info (ignore, uiout);
 }
 
 static void
@@ -1455,9 +1455,9 @@ sol_core_detach (char *args, int from_tt
 }
 
 static void
-sol_core_files_info (struct target_ops *t)
+sol_core_files_info (struct target_ops *t, struct ui_out *uiout)
 {
-  orig_core_ops.to_files_info (t);
+  orig_core_ops.to_files_info (t, uiout);
 }
 
 /* Worker bee for info sol-thread command.  This is a callback function that
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.72
diff -u -3 -p -r1.72 target.c
--- target.c	21 Apr 2004 23:52:21 -0000	1.72
+++ target.c	22 Apr 2004 21:44:04 -0000
@@ -39,7 +39,7 @@
 #include "gdb_assert.h"
 #include "gdbcore.h"
 
-static void target_info (char *, int);
+void target_info (char *, int);
 
 static void maybe_kill_then_create_inferior (char *, char *, char **);
 
@@ -111,7 +111,7 @@ static void debug_to_prepare_to_store (v
 static int debug_to_xfer_memory (CORE_ADDR, char *, int, int,
 				 struct mem_attrib *, struct target_ops *);
 
-static void debug_to_files_info (struct target_ops *);
+static void debug_to_files_info (struct target_ops *, struct ui_out *);
 
 static int debug_to_insert_breakpoint (CORE_ADDR, char *);
 
@@ -315,7 +315,7 @@ kill_or_be_killed (int from_tty)
   if (target_has_execution)
     {
       printf_unfiltered ("You are already running a program:\n");
-      target_files_info ();
+      target_files_info (uiout);
       if (query ("Kill it? "))
 	{
 	  target_kill ();
@@ -500,7 +500,7 @@ update_current_target (void)
 	    (int (*) (CORE_ADDR, char *, int, int, struct mem_attrib *, struct target_ops *)) 
 	    nomemory);
   de_fault (to_files_info, 
-	    (void (*) (struct target_ops *)) 
+	    (void (*) (struct target_ops *, struct ui_out *)) 
 	    target_ignore);
   de_fault (to_insert_breakpoint, 
 	    memory_insert_breakpoint);
@@ -1210,7 +1210,7 @@ get_target_memory_unsigned (struct targe
   return extract_unsigned_integer (buf, len);
 }
 
-static void
+void
 target_info (char *args, int from_tty)
 {
   struct target_ops *t;
@@ -1224,6 +1224,7 @@ target_info (char *args, int from_tty)
     return;
 #endif
 
+  ui_out_begin (uiout, ui_out_type_list, "targets");
   for (t = target_stack; t != NULL; t = t->beneath)
     {
       if (!t->to_has_memory)
@@ -1231,12 +1232,19 @@ target_info (char *args, int from_tty)
 
       if ((int) (t->to_stratum) <= (int) dummy_stratum)
 	continue;
+      ui_out_begin (uiout, ui_out_type_tuple, NULL);
       if (has_all_mem)
 	printf_unfiltered ("\tWhile running this, GDB does not access memory from...\n");
-      printf_unfiltered ("%s:\n", t->to_longname);
-      (t->to_files_info) (t);
+      ui_out_field_string (uiout, "target-type-long", t->to_longname);
+      ui_out_text (uiout, " (short: ");
+      ui_out_field_string (uiout, "target-type-short", t->to_shortname);
+      ui_out_text (uiout, "):\n");
+
+      (t->to_files_info) (t, uiout);
       has_all_mem = t->to_has_all_memory;
+      ui_out_end (uiout, ui_out_type_tuple);
     }
+  ui_out_end (uiout, ui_out_type_list);
 }
 
 /* This is to be called by the open routine before it does
@@ -1856,9 +1864,9 @@ debug_to_xfer_memory (CORE_ADDR memaddr,
 }
 
 static void
-debug_to_files_info (struct target_ops *target)
+debug_to_files_info (struct target_ops *target, struct ui_out *uiout)
 {
-  debug_target.to_files_info (target);
+  debug_target.to_files_info (target, uiout);
 
   fprintf_unfiltered (gdb_stdlog, "target_files_info (xxx)\n");
 }
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.58
diff -u -3 -p -r1.58 target.h
--- target.h	21 Apr 2004 23:52:21 -0000	1.58
+++ target.h	22 Apr 2004 21:44:04 -0000
@@ -332,7 +332,7 @@ struct target_ops
 			   struct mem_attrib *attrib,
 			   struct target_ops *target);
 
-    void (*to_files_info) (struct target_ops *);
+    void (*to_files_info) (struct target_ops *, struct ui_out *uiout);
     int (*to_insert_breakpoint) (CORE_ADDR, char *);
     int (*to_remove_breakpoint) (CORE_ADDR, char *);
     int (*to_can_use_hw_breakpoint) (int, int, int);
@@ -616,12 +616,12 @@ extern int inferior_has_execd (int pid, 
 
 /* From exec.c */
 
-extern void print_section_info (struct target_ops *, bfd *);
+extern void print_section_info (struct target_ops *, bfd *, struct ui_out *);
 
 /* Print a line about the current target.  */
 
-#define	target_files_info()	\
-     (*current_target.to_files_info) (&current_target)
+#define	target_files_info(uiout)	\
+     (*current_target.to_files_info) (&current_target, uiout)
 
 /* Insert a breakpoint at address ADDR in the target machine.  SAVE is
    a pointer to memory allocated for saving the target contents.  It
Index: v850ice.c
===================================================================
RCS file: /cvs/src/src/gdb/v850ice.c,v
retrieving revision 1.18
diff -u -3 -p -r1.18 v850ice.c
--- v850ice.c	2 Oct 2003 20:28:30 -0000	1.18
+++ v850ice.c	22 Apr 2004 21:44:04 -0000
@@ -57,7 +57,7 @@ static int init_hidden_window (void);
 
 static LRESULT CALLBACK v850ice_wndproc (HWND, UINT, WPARAM, LPARAM);
 
-static void v850ice_files_info (struct target_ops *ignore);
+static void v850ice_files_info (struct target_ops *ignore, struct ui_out *uiout);
 
 static int v850ice_xfer_memory (CORE_ADDR memaddr, char *myaddr,
 				int len, int should_write,
@@ -698,7 +698,7 @@ v850ice_xfer_memory (CORE_ADDR memaddr, 
 }
 
 static void
-v850ice_files_info (struct target_ops *ignore)
+v850ice_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   puts_filtered ("Debugging a target via the NEC V850 ICE.\n");
 }
Index: win32-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/win32-nat.c,v
retrieving revision 1.88
diff -u -3 -p -r1.88 win32-nat.c
--- win32-nat.c	21 Apr 2004 17:47:10 -0000	1.88
+++ win32-nat.c	22 Apr 2004 21:44:04 -0000
@@ -1662,7 +1662,7 @@ child_detach (char *args, int from_tty)
 /* Print status information about what we're accessing.  */
 
 static void
-child_files_info (struct target_ops *ignore)
+child_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   printf_unfiltered ("\tUsing the running image of %s %s.\n",
       attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid));
Index: wince.c
===================================================================
RCS file: /cvs/src/src/gdb/wince.c,v
retrieving revision 1.26
diff -u -3 -p -r1.26 wince.c
--- wince.c	6 Nov 2003 02:52:28 -0000	1.26
+++ wince.c	22 Apr 2004 21:44:05 -0000
@@ -1521,7 +1521,7 @@ child_wait (ptid_t ptid, struct target_w
 /* Print status information about what we're accessing.  */
 
 static void
-child_files_info (struct target_ops *ignore)
+child_files_info (struct target_ops *ignore, struct ui_out *uiout)
 {
   printf_unfiltered ("\tUsing the running image of child %s.\n",
 		     target_pid_to_str (inferior_ptid));
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.202
diff -u -3 -p -r1.202 gdb.texinfo
--- doc/gdb.texinfo	28 Mar 2004 12:22:55 -0000	1.202
+++ doc/gdb.texinfo	22 Apr 2004 21:44:09 -0000
@@ -14574,7 +14574,7 @@ Elena Zannoni.
 
 @item @var{mi-command} @expansion{}
 @code{[ @var{token} ] "-" @var{operation} ( " " @var{option} )*
-@code{[} " --" @code{]} ( " " @var{parameter} )* @var{nl}}
+[ " --" ] ( " " @var{parameter} )* @var{nl}}
 
 @item @var{token} @expansion{}
 "any sequence of digits"
@@ -14698,13 +14698,13 @@ depending on the needs---this is still i
 @code{@var{console-stream-output} | @var{target-stream-output} | @var{log-stream-output}}
 
 @item @var{console-stream-output} @expansion{}
-@code{"~" @var{c-string}}
+@code{"~" @var{c-string} @var{nl}}
 
 @item @var{target-stream-output} @expansion{}
-@code{"@@" @var{c-string}}
+@code{"@@" @var{c-string} @var{nl}}
 
 @item @var{log-stream-output} @expansion{}
-@code{"&" @var{c-string}}
+@code{"&" @var{c-string} @var{nl}}
 
 @item @var{nl} @expansion{}
 @code{CR | CR-LF}
@@ -16765,7 +16765,38 @@ information as this command.  @code{gdbt
 @samp{gdb_load_info}.
 
 @subsubheading Example
-N.A.
+@smallexample
+(@value{GDBP})
+123-file-list-exec-sections
+~"Symbols from \"/var/home/ouk/projects/ht20/testproject/test-g\".\n"
+123^done,targets=[{target-type-long="Local exec file",target-type-short="exec",
+filename="/var/home/ouk/projects/ht20/testproject/test-g",file-type="elf32-i386",
+target-entrypoint="0x08048380",sections=[
+{start-address="0x08048134",end-address="0x08048147",section-name=".interp"},
+{start-address="0x08048148",end-address="0x08048168",section-name=".note.ABI-tag"},
+{start-address="0x08048168",end-address="0x08048198",section-name=".hash"},
+{start-address="0x08048198",end-address="0x08048208",section-name=".dynsym"},
+{start-address="0x08048208",end-address="0x080482af",section-name=".dynstr"},
+{start-address="0x080482b0",end-address="0x080482be",section-name=".gnu.version"},
+{start-address="0x080482c0",end-address="0x08048300",section-name=".gnu.version_r"},
+{start-address="0x08048300",end-address="0x08048308",section-name=".rel.dyn"},
+{start-address="0x08048308",end-address="0x08048320",section-name=".rel.plt"},
+{start-address="0x08048320",end-address="0x08048337",section-name=".init"},
+{start-address="0x08048338",end-address="0x08048378",section-name=".plt"},
+{start-address="0x08048380",end-address="0x08048570",section-name=".text"},
+{start-address="0x08048570",end-address="0x0804858b",section-name=".fini"},
+{start-address="0x0804858c",end-address="0x080485a0",section-name=".rodata"},
+{start-address="0x080485a0",end-address="0x080485b4",section-name=".eh_frame_hdr"},
+{start-address="0x080485b4",end-address="0x080485f0",section-name=".eh_frame"},
+{start-address="0x080495f0",end-address="0x080495fc",section-name=".data"},
+{start-address="0x080495fc",end-address="0x080496dc",section-name=".dynamic"},
+{start-address="0x080496dc",end-address="0x080496e4",section-name=".ctors"},
+{start-address="0x080496e4",end-address="0x080496ec",section-name=".dtors"},
+{start-address="0x080496ec",end-address="0x080496f0",section-name=".jcr"},
+{start-address="0x080496f0",end-address="0x0804970c",section-name=".got"},
+{start-address="0x0804970c",end-address="0x08049710",section-name=".bss"}]}]
+(@value{GDBP})
+@end smallexample
 
 
 @subheading The @code{-file-list-exec-source-file} Command
Index: mi/mi-cmd-file.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-file.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 mi-cmd-file.c
--- mi/mi-cmd-file.c	2 Apr 2003 22:10:35 -0000	1.1
+++ mi/mi-cmd-file.c	22 Apr 2004 21:44:09 -0000
@@ -65,3 +65,12 @@ mi_cmd_file_list_exec_source_file(char *
 
   return MI_CMD_DONE;
 }
+
+extern void target_info (char *, int);
+
+enum mi_cmd_result
+mi_cmd_file_list_exec_sections(char *command, char **argv, int argc)
+{
+  target_info(NULL, 1);
+  return MI_CMD_DONE;
+}
Index: mi/mi-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.c,v
retrieving revision 1.14
diff -u -3 -p -r1.14 mi-cmds.c
--- mi/mi-cmds.c	4 Aug 2003 23:18:50 -0000	1.14
+++ mi/mi-cmds.c	22 Apr 2004 21:44:09 -0000
@@ -79,7 +79,7 @@ struct mi_cmd mi_cmds[] =
   { "file-clear", { NULL, 0 }, NULL, NULL },
   { "file-exec-and-symbols", { "file", 1 }, NULL, NULL },
   { "file-exec-file", { "exec-file", 1 }, NULL, NULL },
-  { "file-list-exec-sections", { NULL, 0 }, NULL, NULL },
+  { "file-list-exec-sections", { NULL, 0 }, 0, mi_cmd_file_list_exec_sections },
   { "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-shared-libraries", { NULL, 0 }, NULL, NULL },
Index: mi/mi-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmds.h,v
retrieving revision 1.12
diff -u -3 -p -r1.12 mi-cmds.h
--- mi/mi-cmds.h	24 Jan 2004 04:21:43 -0000	1.12
+++ mi/mi-cmds.h	22 Apr 2004 21:44:09 -0000
@@ -86,6 +86,7 @@ extern mi_cmd_args_ftype mi_cmd_exec_ste
 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_sections;
 extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_file;
 extern mi_cmd_argv_ftype mi_cmd_gdb_exit;
 extern mi_cmd_argv_ftype mi_cmd_interpreter_exec;

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [PATCH] implements MI "-file-list-exec-sections" (updated)
@ 2004-04-30 21:54 Nick Roberts
  2004-05-01  4:09 ` Bob Rossi
  0 siblings, 1 reply; 12+ messages in thread
From: Nick Roberts @ 2004-04-30 21:54 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: Bob Rossi, Stefan Weyergraf, gdb-patches


> > > Maybe it's worth mentioning, that GDB/CLI output for "info file" changes
> > > with this patch which will probably break programs that parse this. (I
> > > don't think such programs exist)

> > I get the feeling that changing the CLI output of "info file" is a bad
> > idea. My hunch is that some front ends to GDB are calling that function.

> One motivation of MI was to free us of this concern, we have to start
> somewhere. I should look at this in the morning.

For information only, please note that gdb-ui.el (CVS Emacs) currently uses
CLI output from the following commands:

info source
info breakpoints
where
info threads
info registers
info locals
disassemble
info frame

I plan to put a more basic version that uses GDB/MI into CVS as soon as Emacs
is released, whenever that might be. Andrew, if you are planning to change CLI
output could you please convey this to Richard Stallman, so that there can be
some co-ordination of schedule between GDB and Emacs.

Nick


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-05-12 20:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-22 21:56 [PATCH] implements MI "-file-list-exec-sections" (updated) Stefan Weyergraf
2004-04-22 22:22 ` Bob Rossi
2004-04-22 23:31   ` Stefan Weyergraf
2004-04-28 21:51   ` Andrew Cagney
2004-05-07  1:20 ` Andrew Cagney
2004-05-06 22:07   ` Stefan Weyergraf
2004-05-12 20:14     ` Andrew Cagney
2004-04-30 21:54 Nick Roberts
2004-05-01  4:09 ` Bob Rossi
2004-05-01 12:08   ` Nick Roberts
2004-05-02 13:25     ` Bob Rossi
2004-05-07  1:19       ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox