public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <xdje42@gmail.com>
To: Patrick Palka <patrick@parcs.ath.cx>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Use gdbarch obstack to allocate the TYPE_NAME string in arch_type
Date: Sat, 29 Aug 2015 18:20:00 -0000	[thread overview]
Message-ID: <m3io7ydkjq.fsf@sspiff.org> (raw)
In-Reply-To: <1435631281-31970-2-git-send-email-patrick@parcs.ath.cx> (Patrick	Palka's message of "Mon, 29 Jun 2015 22:28:01 -0400")

Patrick Palka <patrick@parcs.ath.cx> writes:
> Since the type whose name is being set is now being allocated on the
> gdbarch obstack, we should allocate its TYPE_NAME on the obstack too.
> This reduces the number of individual valgrind warnings for the command
> "gdb gdb" from ~300 to ~150.
>
> Tested on x86_64-unknown-linux-gnu.
>
> [ I have a few more patches on top of these that together bring the total
>   number of valgrind warnings for the command "gdb gdb" down to ~30
>   but they are more controversial than these two, and if these aren't OK
>   then the rest definitely aren't OK.  ]
>
> gdb/ChangeLog:
>
> 	* gdbarch.h (gdbarch_obstack_strdup): Declare.
> 	* gdbarch.c (gdbarch_obstack_strdup): Define.
> 	* gdbtypes.c (arch_type): Use it.

Hi.
A couple of comments.

1) gdbarch.[ch] are machine generated.
IIUC, you have to edit gdbarch.sh and then run it to regenerate gdbarch.[ch].

2) I would have done this slightly differently.
If the obstack API doesn't provide a strdup functionality,
I wouldn't insist on trying to add it there. But I would like
to see it added to gdb in an application-independent way.
(make it non-gdbarch specific). obstack_strdup sounds sufficiently
useful and generic enough. If one wants to add a
gdbarch_obstack_strdup wrapper on top of that, fine by me.
IOW, add obstack_strdup to gdb_obstack.[ch].

  parent reply	other threads:[~2015-08-29 18:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30  2:28 [PATCH 1/2] Use gdbarch obstack to allocate types in alloc_type_arch Patrick Palka
2015-06-30  2:28 ` [PATCH 2/2] Use gdbarch obstack to allocate the TYPE_NAME string in arch_type Patrick Palka
2015-06-30  9:36   ` Pedro Alves
2015-06-30 20:05     ` Patrick Palka
2015-08-29 12:59       ` Patrick Palka
2015-08-29 18:20   ` Doug Evans [this message]
2015-08-29 21:29     ` Patrick Palka
2015-08-29 22:33       ` Patrick Palka
2015-09-02  5:12         ` Doug Evans
2015-08-29 18:06 ` [PATCH 1/2] Use gdbarch obstack to allocate types in alloc_type_arch Doug Evans
2015-08-29 21:26   ` Patrick Palka
2015-08-29 21:35     ` Doug Evans
2015-08-29 22:30       ` Patrick Palka
2015-08-29 22:31         ` Patrick Palka

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=m3io7ydkjq.fsf@sspiff.org \
    --to=xdje42@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=patrick@parcs.ath.cx \
    /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).