public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Philipp Rudo <prudo@linux.vnet.ibm.com>
To: Pedro Alves <palves@redhat.com>
Cc: Yao Qi <qiyaoltc@gmail.com>, gdb-patches@sourceware.org
Subject: Re: [RFC 2/7] Add unit test to builtin tdesc generated by xml
Date: Tue, 30 May 2017 08:00:00 -0000	[thread overview]
Message-ID: <20170530100007.309c5669@ThinkPad> (raw)
In-Reply-To: <4c6f2f5a-e2c2-df09-0440-0f9431e7594a@redhat.com>

Hi Pedro,

sorry for the late answer but I was sick the last 10 days and just returned
yesterday...

On Wed, 17 May 2017 17:06:13 +0100
Pedro Alves <palves@redhat.com> wrote:

> On 05/16/2017 01:00 PM, Philipp Rudo wrote:
> 
> >> +  /* Look for the features directory.  If the directory of __FILE__ can't
> >> +     be found, __FILE__ is a file name with relative path.  Guess that
> >> +     GDB is executed in testsuite directory like ../gdb, because I don't
> >> +     expect that GDB is invoked somewhere else and run self tests.  */
> >> +  if (stat (feature_dir.data (), &st) < 0)
> >> +    {
> >> +      feature_dir.insert (0, SLASH_STRING);
> >> +      feature_dir.insert (0, "..");  
> > 
> > This would be a perfect spot for concat_path (patch 2 from my lk series
> > https://sourceware.org/ml/gdb-patches/2017-03/msg00272.html).
> > Then it would read
> > 
> > feature_dir = concat_path ("..", feature_dir);
> > 
> > I actually want to bring some of my patches upstream (mostly the
> > s390-linux-tdep split up patch) to reduce maintenance cost of my
> > series.  This would be a good time for this patch, too.  
> 
> Could that patch be split out of the series, and justified on its
> own grounds?  Is there some representative place in the codebase
> that you could cleanup a bit using the new API, just to show it
> working nicely?  Also, a unit test would be nice.

The patch can be split from my series without problem.  I already pulled it
right to the beginning of the series, as it is independent of all other changes
in the set.

There are quite some places you can simplify by using the function.  Just grep
for SLASH_STRING to find most of them.  I also had a patch once where I
eliminated all use of SLASH_STRING using the concat_path.  Unfortunately it had
some problems with the mixture of C and C++ strings causing memory leaks and
read after free's.  I never had the time to clean that up and thus didn't send
it to the mailing list ...
 
> Also, and most importantly, seems to me that patch still has
> a lot inefficiency related to std::string copying, e.g.:
> 
>  +static inline unsigned long
>  +approx_path_length (std::initializer_list<std::string> args,
>  +		   std::string dir_separator)
> 
> This is passing in the strings by value / copy.  That looks like
> an aweful lot of malloc/free/strdup behind the scenes.

True, this can be optimized.

> I still think that if we're adding some utility for building
> paths from dir components, that it'd be preferred to model
> the API on (a small subset of) std::experimental::filesystem::path,
> since in a few years that's the API that everyone learning C++ will
> be learning.

Also true, let me see if I can hack something today.  Currently I don't like to
do what I should do and there are many meeting today anyway.  So this looks like
a perfect task for today ;)

Philipp
 
> Thanks,
> Pedro Alves
> 

  reply	other threads:[~2017-05-30  8:00 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 15:55 [RFC 0/7] Make GDB builtin target descriptions more flexible Yao Qi
2017-05-11 15:55 ` [RFC 3/7] Adjust the order of 32bit-linux.xml and 32bit-sse.xml in i386/i386-linux.xml Yao Qi
2017-05-11 15:55 ` [RFC 2/7] Add unit test to builtin tdesc generated by xml Yao Qi
2017-05-16 12:00   ` Philipp Rudo
2017-05-16 15:46     ` Yao Qi
2017-05-17  9:09       ` Philipp Rudo
2017-05-17 16:06     ` Pedro Alves
2017-05-30  8:00       ` Philipp Rudo [this message]
2017-06-01 17:53         ` Philipp Rudo
2017-05-17 15:41   ` Pedro Alves
2017-05-18  9:54     ` Yao Qi
2017-05-18 11:34       ` Pedro Alves
2017-05-19 15:47         ` Yao Qi
2017-05-22  8:51           ` Yao Qi
2017-05-11 15:55 ` [RFC 1/7] Move initialize_tdesc_mips* calls from mips-linux-nat.c to mips-linux-tdep.c Yao Qi
2017-05-11 15:55 ` [RFC 7/7] Remove builtin tdesc_i386_*_linux Yao Qi
2017-05-16 12:02   ` Philipp Rudo
2017-05-17 15:46   ` Pedro Alves
2017-05-11 15:55 ` [RFC 5/7] Centralize i386 linux target descriptions Yao Qi
2017-05-11 15:55 ` [RFC 6/7] Lazily and dynamically create i386-linux " Yao Qi
2017-05-11 18:14   ` John Baldwin
2017-05-11 21:03     ` Yao Qi
2017-05-17 15:43   ` Pedro Alves
2017-05-18 15:12     ` Yao Qi
2017-05-19 10:15       ` Pedro Alves
2017-05-19 14:27         ` Yao Qi
2017-05-11 16:06 ` [RFC 0/7] Make GDB builtin target descriptions more flexible Eli Zaretskii
2017-05-11 20:56   ` Yao Qi
2017-05-11 20:55 ` [RFC 4/7] Share code in initialize_tdesc_ functions Yao Qi
2017-05-16 12:02   ` Philipp Rudo
2017-05-17 15:43     ` Pedro Alves
2017-05-18 11:21       ` Yao Qi

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=20170530100007.309c5669@ThinkPad \
    --to=prudo@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=qiyaoltc@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).