gdb/ctf: check return value of ctf_type_align

I tried to build the Linux kernel with -gctf.  I am not sure if the
result is good, because I got plenty of warnings like:

    ld: warning: orphan section `.ctf' from `vmlinux.o' being placed in section `.ctf'

Nevertheless, I tried to load it in GDB, and it didn't complain.
However, when doing "maint expand-symtabs", I did hit this assert:

    /home/simark/src/binutils-gdb/gdb/gdbtypes.c:3640: internal-error: set_type_align: Assertion `(align & (align - 1)) == 0' failed.

This is because ctf_type_align returns -1 for some types, which is an
indication of an error.  Update the code to check the return value of
ctf_type_align for errors, and emit complaints if it happens.

With this patch, if I enable the complaints, I see a bunch of messages
like this:

    During symbol reading: ctf_type_align read_structure_type failed - Type is not a complete type.

Change-Id: Ibed23e7f1490d9163b8dde1318b9e45dec2906d6
Approved-By: Tom Tromey <tom@tromey.com>
1 file changed