Fix warning: Invalid entry in .debug_gdb_scripts section
Commit Message
Hi,
https://bugzilla.redhat.com/show_bug.cgi?id=1429598
there remains questionable whether bfd_get_section_by_name() should not return
an error for !SEC_LOAD but I haven't investigated that.
Also it could have a testcase.
OK for check-in?
Jan
gdb/ChangeLog
2017-03-16 Jan Kratochvil <jan.kratochvil@redhat.com>
* auto-load.c (auto_load_section_scripts): Check also SEC_LOAD.
Comments
On 03/16/2017 03:41 PM, Jan Kratochvil wrote:
> Hi,
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1429598
>
> there remains questionable whether bfd_get_section_by_name() should not return
> an error for !SEC_LOAD but I haven't investigated that.
>
> Also it could have a testcase.
>
> OK for check-in?
I don't think you've supplied enough rationale.
Why is this the right thing to do?
Shouldn't we be able to load scripts from debug-only sections?
A testcase would indeed be good to have.
Thanks,
Pedro Alves
@@ -1174,7 +1174,8 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name)
bfd_byte *data = NULL;
scripts_sect = bfd_get_section_by_name (abfd, section_name);
- if (scripts_sect == NULL)
+ if (scripts_sect == NULL
+ || (bfd_get_section_flags (abfd, scripts_sect) & SEC_LOAD) == 0)
return;
if (!bfd_get_full_section_contents (abfd, scripts_sect, &data))