public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
	 Simon Marchi <simon.marchi@efficios.com>
Subject: Re: [PATCH] gdb/dwarf: dump cooked index contents in cooked_index_functions::dump
Date: Fri, 27 Jan 2023 07:24:22 -0700	[thread overview]
Message-ID: <87mt64qcmh.fsf@tromey.com> (raw)
In-Reply-To: <20230127051317.700077-1-simon.marchi@polymtl.ca> (Simon Marchi via Gdb-patches's message of "Fri, 27 Jan 2023 00:13:17 -0500")

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> The cooked_index_functions::dump function is called as part of the
Simon> "maintenance print objfiles" command.  I tried to make the output
Simon> well structured and indented to help readability, as this prints a lot
Simon> of text.

Thanks for doing this.

Simon> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
Simon> index cd937f24ee74..73aafbed80b4 100644
Simon> --- a/gdb/dwarf2/read.c
Simon> +++ b/gdb/dwarf2/read.c
Simon> @@ -93,6 +93,7 @@
Simon>  #include "split-name.h"
Simon>  #include "gdbsupport/parallel-for.h"
Simon>  #include "gdbsupport/thread-pool.h"
Simon> +#include "inferior.h"
 
Simon>  /* When == 1, print basic high level tracing messages.
Simon>     When > 1, be more verbose.
Simon> @@ -18588,7 +18589,78 @@ struct cooked_index_functions : public dwarf2_base_index_functions
 
Simon>    void dump (struct objfile *objfile) override
Simon>    {
Simon> -    gdb_printf ("Cooked index in use\n");
Simon> +    gdb_printf ("Cooked index in use:\n");
Simon> +    gdb_printf ("\n");

I think I'd rather have the bulk of the dumping in the cooked-index code
instead of here.

Simon> +
Simon> +    dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile);
Simon> +
Simon> +    cooked_index_vector *table
Simon> +      = (gdb::checked_static_cast<cooked_index_vector *>
Simon> +         (per_objfile->per_bfd->index_table.get ()));

Like right here could be a method call.

The cooked index dumper should probably start with a call to 'wait' to
ensure that no background work is being done.

Simon> +	    const char *start_addr_str
Simon> +	      = paddress (current_inferior ()->gdbarch, start_addr);

I was curious why the inferior.h include was needed.
I suspect the objfile's arch is preferred here.

Tom

  parent reply	other threads:[~2023-01-27 14:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27  5:13 Simon Marchi
2023-01-27 10:34 ` Andrew Burgess
2023-01-27 14:24 ` Tom Tromey [this message]
2023-01-27 16:03   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mt64qcmh.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).