Re: [PATCH 3/6] : Update dat files with arch and osabi

Yao Qi
2018-01-22T15:28:29Z

Alan Hayward <Alan.Hayward@arm.com> writes:

> If you remove this patch, but keep all the rest of the series, then the ports
> using the new style target descriptions will segfault when printing the xml
> in print_xml_feature::visit_pre() because the -generated.c files do not
> contain an arch or osabi.

Can you elaborate how does that happen? New style target description
doesn't use anything from -generated.c files. Note that there is even no
-generated.c files in gdbserver build directory when gdb is in release mode
(bfd/development.sh:development is false).

>
> The segfault happens on gdbserver init because the -generated.c functions
> are calling tdesc_get_features_xml().

I still don't see why -generated.c functions call
tdesc_get_features_xml. For new style target description, it already
generate osabi and arch (see tdesc_get_features_xml path
tdesc->xmltarget == NULL). For old style target description, arch and
osabi is from xml file. Take i386-avx-linux-generated.c for example,

static const char *xmltarget_i386_avx_linux = "i386-avx-linux.xml";

#ifndef IN_PROCESS_AGENT
result->expedite_regs = expedite_regs_i386_avx_linux;
result->xmltarget = xmltarget_i386_avx_linux;
#endif

osabi and arch is specified in features/i386/i386-avx-linux.xml,

<architecture>i386</architecture>
<osabi>GNU/Linux</osabi>

> Thinking about it, I will remove this call from -generated.
> That fixes the bug.
>
> This leaves a question:
> Is it required that the generated target descriptions have the osabi and arch?
> If it does not need this information, then I will delete this patch.

If by "the generated target descriptions", you mean *-generated.c files
in gdbserver build directory, yes, they don't have osabi and arch. As I
said above, arch and osabi, if any, are specified in the xml files.

--
Yao (齐尧)