[patch] Speed up dwarf2_frame_find_fde

Andreas Schwab schwab@redhat.com
Wed Jul 22 10:02:00 GMT 2009


ppluzhnikov@google.com (Paul Pluzhnikov) writes:

> +static int
> +bsearch_cie_cmp (const void *key, const void *element)
> +{
> +  ULONGEST cie_pointer = *(ULONGEST *) key;
> +  struct dwarf2_cie *cie = *(struct dwarf2_cie **) element;
> +  return cie_pointer - cie->cie_pointer;

This can overflow.

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

Likewise.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."



More information about the Gdb-patches mailing list