Re: _initialize_arch_tdep() not getting called

Simon Marchi
2019-08-12T00:34:32Z

On 2019-08-10 22:49, William Tambe wrote:
> I have narrowed down the issue to the function _initialize_arch_tdep()
> not being generated in gdb/init.c by gdb/Makefile.in during the build
> process.
>
> Any idea what could be the issue ?
>
> On Sat, Aug 10, 2019 at 9:16 AM William Tambe <tambewilliam@gmail.com>
> wrote:
>>
>> I am running into an issue where my GDB port is not calling
>> _initialize_arch_tdep() which is responsible for calling
>> register_gdbarch_init().
>>
>> The files arch-tdep.c has been properly created and contain the
>> function _initialize_arch_tdep().
>>
>> During GDB initialization, the function gdbarch_find_by_info() fail
>> causing the following error to occur:
>> arch-utils.c:693: internal-error: initialize_current_architecture:
>> Selection of initial architecture failed
>>
>> Any idea what I could have missed causing _initialize_arch_tdep() not
>> to be called ?

Hi William,

I can't find _initialize_arch_tdep in the GDB code base, so I presume it
is the init function in your private -tdep.c file that you want GDB to
call.

The only reason I see for your function not ending up in init.c is that
doesn't respect the regex that looks for init functions:

1855 @-for f in $(INIT_FILES); do \
1856 sed -n -e 's/^_initialize_\([a-z_0-9A-Z]*\).*/\1/p' \
1857 $(srcdir)/$$f 2>/dev/null; \

The function name but start at the beginning of the line and start with
"_initialize_". That's the only guess I can make with the provided
information.

Simon