This is the mail archive of the gdb-patches@sourceware.org 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]

Re: [PATCH] gdb: New maint info line-table command.


* Pedro Alves <palves@redhat.com> [2016-03-01 19:57:45 +0000]:

> On 02/21/2016 12:06 AM, Andrew Burgess wrote:
> 
> 
> >+  if (linetable == NULL)
> >+    printf_filtered (_("No line table.\n"));
> >+  else if (linetable->nitems <= 0)
> >+    printf_filtered (_("Line table has no lines.\n"));
> >+  else
> >+    {
> >+      int i;
> >+
> >+      /* Leave space for 6 digits of index and line number.  After that the
> >+	 tables will just not format as well.  */
> >+      printf_filtered ("%-6s %6s %s\n",
> 
> Wrap these in an extra (), otherwise I think the ARI will complain.
> 
> 
> >+		       _("INDEX"), _("LINE"), _("ADDRESS"));
> >+
> >+      for (i = 0; i < linetable->nitems; ++i)
> >+	{
> >+	  struct linetable_entry *item;
> >+	  struct cleanup *row_cleanup;
> >+
> >+	  item = &linetable->item [i];
> >+	  printf_filtered ("%-6d %6d %s\n", i, item->line,
> 
> Ditto.
> 
> >+			   core_addr_to_string (item->pc));
> >+	}
> >+    }
> >+
> >+  return 0;
> >+}
> >+
> >+/* Implement the 'maint info line-table' command.  */
> >+
> >+static void
> >+maintenance_info_line_tables (char *regexp, int from_tty)
> >+{
> >+  struct program_space *pspace;
> >+  struct objfile *objfile;
> >+
> >+  dont_repeat ();
> >+
> >+  if (regexp)
> 
> regexp != NULL.
> 
> >+    re_comp (regexp);
> >+
> >+  ALL_PSPACES (pspace)
> >+    ALL_PSPACE_OBJFILES (pspace, objfile)
> >+    {
> >+      struct compunit_symtab *cust;
> >+      struct symtab *symtab;
> >+
> >+      ALL_OBJFILE_COMPUNITS (objfile, cust)
> >+	{
> >+	  ALL_COMPUNIT_FILETABS (cust, symtab)
> >+	    {
> >+	      QUIT;
> >+
> >+	      if (! regexp
> 
> regexp == NULL.
> 
> >  void
> >@@ -982,6 +1066,12 @@ linetables --- just the symbol table structures themselves.\n\
> >  With an argument REGEXP, list the symbol tables with matching names."),
> >  	   &maintenanceinfolist);
> >
> >+  add_cmd ("line-table", class_maintenance, maintenance_info_line_tables, _("\
> >+List line tables contents for specified symtab.\n\
> >+Given the filename of a symtab, list the contents of the\n\
> >+associated line table."),
> 
> Shouldn't the last sentence be updated to mention REGEXP, like the
> maint info symtabs entry above?
> 
> > +maint info line-table FILENAME
> > +  Display the contents of GDB's internal line table data struture.
> 
> Ditto.
> 
> > +List the @code{struct linetable} from each @code{struct symtab} whose
> > +name matches @var{regexp}.  If @var{regexp} is not given, list the
> > +@code{struct linetable} from all @code{struct symtab}.
> 
> Either "from all @code{struct symtab} instances", or "from all symtabs", I
> think.
> 
> Otherwise LGTM.  Thanks for doing this.

Thanks for the review.  Sorry for the delay in moving this on.  I've
pushed this patch with the fixes that you pointed out above.

Thanks again,
Andrew


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