gdb: care for dynamic objfiles in build_id_bfd_get ()
authorJan Vrany <jan.vrany@labware.com>
Wed, 18 Jan 2023 11:34:37 +0000 (11:34 +0000)
committerJan Vrany <jan.vrany@labware.com>
Wed, 18 Jan 2023 11:34:37 +0000 (11:34 +0000)
commit722e0dd9e4f03d66666c5b62e162da31cafe6d9f
treec9520fd8df787228bb7f21ea6dc5e6ac3dc5522c
parent94e76498c3790d90c383621b88268abf9acdd5bf
gdb: care for dynamic objfiles in build_id_bfd_get ()

Accessing gdb.Objfile.build_id caused GDB to crash when objfile is
dynamic, that is created by JIT reader API.

The issue was NULL-pointer dereferencing in build_id_bfd_get () because
dynamic objfiles have no underlaying BFD structure. This commit fixes
the problem by a NULL-check in build_id_bfd_get ().
gdb/build-id.c
gdb/testsuite/gdb.base/jit-reader.exp