From: Yao Qi <qiyaoltc@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC 2/7] Add unit test to builtin tdesc generated by xml
Date: Thu, 18 May 2017 09:54:00 -0000 [thread overview]
Message-ID: <86bmqq8p8h.fsf@gmail.com> (raw)
In-Reply-To: <692db623-3694-b809-4075-293c0d70cf5e@redhat.com> (Pedro Alves's message of "Wed, 17 May 2017 16:41:27 +0100")
Pedro Alves <palves@redhat.com> writes:
>> +{
>> + std::string feature_dir (ldirname (__FILE__));
>> + struct stat st;
>
> Ugh. Obviously this can't work if gdb is installed / copied elsewhere,
> remote host testing, etc.
>
I thought about this, but I can't figure out one better than __FILE__.
What I want to do is to find srcdir, and open these xml files during
unit tests. Since it is a unit test, I expect gdb is executed in either
builddir/gdb or builddir/gdb/testsuite. I don't see a case that people
build gdb in one place, and run unit/self tests somewhere else.
>> +
>> + /* 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, "..");
>> +
>> + /* If still can't find the path, something is wrong. */
>> + SELF_CHECK (stat (feature_dir.data (), &st) == 0);
>
> Do we want to flag this as an error / unit test failure?
> Maybe it should be a warning instead?
>
We can skip this test if it can't find "features" directory in source, but
something wrong can be easily ignored if we do so.
>> --- a/gdb/target-descriptions.h
>> +++ b/gdb/target-descriptions.h
>> @@ -162,6 +162,12 @@ enum gdb_osabi tdesc_osabi (const struct target_desc *);
>> int tdesc_compatible_p (const struct target_desc *,
>> const struct bfd_arch_info *);
>>
>> +/* Compare target descriptions TDESC1 and TDESC2, return true if they
>> + are identical. */
>> +
>> +bool tdesc_equals (const struct target_desc *tdesc1,
>> + const struct target_desc *tdesc2);
>
> Any reason this and the other equals functions aren't operator==
> implementations?
tdesc_reg, tdesc_type, tdesc_feature and target_desc should be
class-fied first, including adding proper ctor, dtor, etc. I thought it
must be a lot of work, so I don't do that. I can do that if it doesn't
take me much time.
> It's not obvious since the comments say "identical", which would maybe
> suggest that
> there may be some property that is not being compared and thus this is not
> strict value equality, but then function name says "equals".
I think "identical" implies "strict value equality". The information I
want to deliver is that this function compares all properties, return
true if they are exactly the same. Is it this better,
/* Return true if target description TDESC1 and TDESC2 are equal. */
--
Yao (齐尧)
next prev parent reply other threads:[~2017-05-18 9:54 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 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 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 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
2017-06-01 17:53 ` Philipp Rudo
2017-05-17 15:41 ` Pedro Alves
2017-05-18 9:54 ` Yao Qi [this message]
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 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 6/7] Lazily and dynamically create i386-linux target descriptions 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 15:55 ` [RFC 5/7] Centralize i386 linux " 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=86bmqq8p8h.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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).