This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC 4/7] Share code in initialize_tdesc_ functions
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: Philipp Rudo <prudo at linux dot vnet dot ibm dot com>, gdb-patches at sourceware dot org
- Date: Thu, 18 May 2017 12:21:18 +0100
- Subject: Re: [RFC 4/7] Share code in initialize_tdesc_ functions
- Authentication-results: sourceware.org; auth=none
- References: <1494518105-15412-1-git-send-email-yao.qi@linaro.org> <20170511205504.cnufjdz6ehnml5wv@localhost> <20170516140217.1f2d3c64@ThinkPad> <148caa86-619a-9941-071b-7f38c817db33@redhat.com>
Pedro Alves <palves@redhat.com> writes:
Hi Philipp and Pedro,
Thanks for your comments.
>> This function is actually the part I like least of your implementation. Its
>> way to long and barely readable. The way I understand, it is needed to create
>> unique macro and function names. So why don't you simply use the filename of
>> the XML file where the feature is defined? It already is unique. Or use an
>> gdbarch hook so every architecture can decide for itself how to name them?
>
> Agreed. I was reading the patch and thinking how there must be a better
> way to handle this.
I dislike my implementation either. I thought about using xml feature
file name to distinguish features with the same name. However it
doesn't work because the file name is lost after processing xi:include.
GDB processes XML target descriptions in two steps,
1) process xi:include, copy feature xml files into a buffer,
2) parse the buffer with gdb-target.dtd then,
All tdesc_features are created in step 2, and GDB doesn't know what file
is this feature from. For example, there is an XML target description,
<target>
<xi:include href="32bit-core.xml"/>
</target>
after step 1, the buffer contains XML contents from 32bit-core.xml,
<target>
<feature name="org.gnu.gdb.i386.core">
...
</feature>
</target>
GDB starts parse it in buffer, but doesn't know where is this feature
from. I'll think about gdbarch hook you suggested.
--
Yao (齐尧)