This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb: New maint info line-table command.
- From: Andrew Burgess <andrew dot burgess at embecosm dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 11 Mar 2016 22:54:50 +0000
- Subject: Re: [PATCH] gdb: New maint info line-table command.
- Authentication-results: sourceware.org; auth=none
- References: <ca54477642135f97eda104b54da83ae21f483914 dot 1454796848 dot git dot andrew dot burgess at embecosm dot com> <56C4572A dot 9090300 at redhat dot com> <20160221000652 dot GA15799 at embecosm dot com> <56D5F439 dot 3040708 at redhat dot com>
* 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