Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: tromey@redhat.com
Cc: Andreas Schwab <schwab@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [patch] Speed up dwarf2_frame_find_fde
Date: Tue, 04 Aug 2009 19:08:00 -0000	[thread overview]
Message-ID: <8ac60eac0908041208g477503e9n8079bd8df935b8b1@mail.gmail.com> (raw)
In-Reply-To: <m3tz0ne949.fsf@fleche.redhat.com>

On Tue, Aug 4, 2009 at 11:17 AM, Tom Tromey<tromey@redhat.com> wrote:

> Paul> +static int
> Paul> +qsort_fde_cmp (const void *a, const void *b)
> Paul> +{
> Paul> +  struct dwarf2_fde *aa = *(struct dwarf2_fde **)a;
> Paul> +  struct dwarf2_fde *bb = *(struct dwarf2_fde **)b;
> Paul> +  if (aa->initial_location == bb->initial_location)
> Paul> +    /* Put eh_frame entries after debug_frame ones. */
> Paul> +    return aa->eh_frame_p - bb->eh_frame_p;
>
> I don't understand this comment.

Before the patch:

-  /* First add the information from the .eh_frame section.  That way,
-     the FDEs from that section are searched last.  */

IOW, we prefer .debug_frame entries to .eh_frame ones.

After the patch, .eh_frame entries are sorted after .debug_frame ones in
the fde_table, and are then duplicate-eliminated when the final fde_table is
constructed here:

+      /* Since we'll be doing bsearch, squeeze out identical (except for
+         eh_frame_p) fde entries so bsearch result is predictable.  */
+      for (i = 0, j = 0; j < fde_table.num_entries; ++i)
+        {
+          const int k = j;
+
+          obstack_grow (&objfile->objfile_obstack, &fde_table.entries[j],
+                        sizeof (fde_table.entries[0]));
+          while (++j < fde_table.num_entries
+                 && (fde_table.entries[k]->initial_location ==
+                     fde_table.entries[j]->initial_location))
+            /* Skip.  */;
+        }


> I thought perhaps there would be some reason to do this -- but then it
> seems like the bsearch comparison function ought to have similar logic.
> Could you explain it?

Since the .eh_frame entries that were "pre-empted" by the .dwarf_frame
ones don't even appear in the final table, bsearch_fde_cmp doesn't need
special handling for them.

Thanks,
-- 
Paul Pluzhnikov


  reply	other threads:[~2009-08-04 19:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-22  5:37 Paul Pluzhnikov
2009-07-22 10:02 ` Andreas Schwab
2009-07-22 23:12   ` Paul Pluzhnikov
2009-07-30  3:13     ` Paul Pluzhnikov
2009-08-04 18:18     ` Tom Tromey
2009-08-04 19:08       ` Paul Pluzhnikov [this message]
2009-08-06 21:24         ` Tom Tromey

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=8ac60eac0908041208g477503e9n8079bd8df935b8b1@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=schwab@redhat.com \
    --cc=tromey@redhat.com \
    /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