Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH][gdb] Mention CU offset for <artifical> if verbose
Date: Fri, 07 Feb 2020 14:45:00 -0000	[thread overview]
Message-ID: <CAPTJ0XHj9PFCgnZNFGS-+RwGmLgyx-29xUZ+kUY3SBnSwTv=dg@mail.gmail.com> (raw)
In-Reply-To: <20200207113429.GA6532@delia>

On Fri, Feb 7, 2020 at 6:34 AM Tom de Vries <tdevries@suse.de> wrote:


> diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
> index dafe01d94a..28ade424fd 100644
> --- a/gdb/dwarf2read.c
> +++ b/gdb/dwarf2read.c
> @@ -8020,6 +8020,20 @@ create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name)
>    struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
>    dwarf2_psymtab *pst;
>
> +  const char *artificial = "<artificial>";

This may not matter but I'd use static const char artificial[] = "..."

> +  if (strcmp (name, artificial) == 0)
> +    {
> +      sect_offset cu_offset = per_cu->sect_off;
> +      const char *cu_offset_str = sect_offset_str (cu_offset);
> +      const char *sep = "@";
> +      char *new_name = (char *) xmalloc (strlen (artificial) + strlen (sep)
> +                                        + strlen (cu_offset_str) + 1);
> +      strcpy (new_name, artificial);
> +      strcat (new_name, sep);
> +      strcat (new_name, cu_offset_str);

Use concat() instead of malloc/strcpy/strcat?

> +      name = new_name;
> +    }
> +
>    pst = new dwarf2_psymtab (name, objfile, 0);
>
>    pst->psymtabs_addrmap_supported = true;


  reply	other threads:[~2020-02-07 14:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-07 11:34 Tom de Vries
2020-02-07 14:45 ` Christian Biesinger via gdb-patches [this message]
2020-02-08  9:16   ` Tom de Vries
2020-02-08 15:48     ` Simon Marchi
2020-02-09 11:48       ` Tom de Vries
2020-02-09 12:16         ` Simon Marchi
2020-02-09 13:35         ` Tom Tromey
2020-02-10 10:18           ` [PATCH][gdb] Fix -Wstrict-null-sentinel warnings Tom de Vries
2020-02-10 14:08             ` Simon Marchi
2020-02-10 14:19               ` Tom de Vries
2020-02-11 15:14               ` 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='CAPTJ0XHj9PFCgnZNFGS-+RwGmLgyx-29xUZ+kUY3SBnSwTv=dg@mail.gmail.com' \
    --to=gdb-patches@sourceware.org \
    --cc=cbiesinger@google.com \
    --cc=tdevries@suse.de \
    /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