Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Aleksandar Ristovski <aristovski@qnx.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Do not add partial_symbol again and again to the list
Date: Mon, 11 Feb 2008 20:38:00 -0000	[thread overview]
Message-ID: <20080211203809.GA29560@caradoc.them.org> (raw)
In-Reply-To: <47B0AEC7.3070400@qnx.com>

On Mon, Feb 11, 2008 at 03:23:35PM -0500, Aleksandar Ristovski wrote:
> The attached patch checks if partial_symbol has already been added to the 
> list instead of adding duplicate records.

How does this ever happen?  It seems very wrong.  Also, I am worried
that the linear search will be a bottleneck (this is quadratic as each
psymtab grows).

> @@ -3102,15 +3103,20 @@ add_psymbol_to_list (char *name, int nam
>  		     enum language language, struct objfile *objfile)
>  {
>    struct partial_symbol *psym;
> -  char *buf = alloca (namelength + 1);
> +  struct partial_symbol **ps;
> +  char *buf = name;  
>    /* psymbol is static so that there will be no uninitialized gaps in the
>       structure which might contain random data, causing cache misses in
>       bcache. */
>    static struct partial_symbol psymbol;
> -
> -  /* Create local copy of the partial symbol */
> -  memcpy (buf, name, namelength);
> -  buf[namelength] = '\0';
> +  
> +  if (name[namelength] != '\0')
> +    {
> +      buf = alloca (namelength + 1);
> +      /* Create local copy of the partial symbol */
> +      memcpy (buf, name, namelength);
> +      buf[namelength] = '\0';
> +    }
>    /* val and coreaddr are mutually exclusive, one of them *will* be zero */
>    if (val != 0)
>      {

Even easier: eliminate the copy entirely.  SYMBOL_SET_NAMES -> symbol_set_names
already does this and it never modifies its argument.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2008-02-11 20:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-11 20:23 Aleksandar Ristovski
2008-02-11 20:38 ` Daniel Jacobowitz [this message]
2008-02-11 20:52   ` Aleksandar Ristovski
2008-02-11 21:09     ` Daniel Jacobowitz
2008-02-11 21:41       ` Aleksandar Ristovski
2008-02-11 21:48         ` Daniel Jacobowitz
2008-02-11 22:10           ` Aleksandar Ristovski
2008-02-11 22:31             ` Daniel Jacobowitz
2008-02-11 22:43               ` Aleksandar Ristovski
2008-02-11 22:53                 ` Daniel Jacobowitz
2008-02-12  1:08                   ` Aleksandar Ristovski
2008-02-12  2:12                     ` Daniel Jacobowitz
2008-02-12  5:35                       ` Aleksandar Ristovski
2008-02-12 13:26                         ` Daniel Jacobowitz
2008-02-12 15:54                           ` Aleksandar Ristovski
2008-02-13  5:23                   ` Aleksandar Ristovski
2008-02-14  1:31                     ` Aleksandar Ristovski
2008-05-02 18:11                       ` Aleksandar Ristovski
2008-05-03 21:32                     ` Daniel Jacobowitz
2008-05-05 19:41                       ` Aleksandar Ristovski
2008-05-05 19:38                         ` Aleksandar Ristovski
2008-05-06 15:47                         ` Daniel Jacobowitz
2008-05-06 18:45                           ` Aleksandar Ristovski
2008-05-06 18:39                             ` Aleksandar Ristovski
2008-05-06 18:50                             ` Daniel Jacobowitz
2008-05-07  8:22                               ` Aleksandar Ristovski
2008-05-07  9:01                                 ` Aleksandar Ristovski
2008-06-05 18:17                                 ` Daniel Jacobowitz
2008-06-05 19:26                                   ` Aleksandar Ristovski

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=20080211203809.GA29560@caradoc.them.org \
    --to=drow@false.org \
    --cc=aristovski@qnx.com \
    --cc=gdb-patches@sourceware.org \
    /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