This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] Fix warning: Invalid entry in .debug_gdb_scripts section
- From: Jan Kratochvil <jkratoch at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 16 Mar 2017 16:41:10 +0100
- Subject: [patch] Fix warning: Invalid entry in .debug_gdb_scripts section
- Authentication-results: sourceware.org; auth=none
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.
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 56914c8..63b54b8 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -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))