This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC 4/7] Share code in initialize_tdesc_ functions


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 (齐尧)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]