From 30e8ee25e375c3ef5de195643a2de1d3f47bf1b9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 18 Feb 2013 23:50:32 +0000 Subject: include/ * bfdlink.h (struct bfd_link_info): Delete emit_note_gnu_build_id. bfd/ * configure.in: Bump version to 2.23.52. * elf-bfd.h (struct elf_build_id_info): New. (struct elf_obj_tdata): Delete after_write_object_contents, after_write_object_contents_info and build_id_size. Make build_id a pointer to struct elf_build_id_info. * elf.c (_bfd_elf_write_object_contents): Style. Update after_write_ibject_contents invocation. (elfobj_grok_gnu_build_id): Update for new build_id struct. Don't allow zero size notes. * configure: Regenerate. gdb/ * elfread.c (struct build_id): Delete. Use struct elf_build_id throughout file instead. (build_id_bfd_get): Update to use new elf_tdata build_id field. Don't xmalloc return value. (build_id_verify): Similarly. Don't xfree. (build_id_to_debug_filename): Update. (find_separate_debug_file_by_buildid): Update, don't xfree. ld/ * emultempl/elf32.em (emit_note_gnu_build_id): New static var. Replace all info->emit_note_gnu_build_id refs. (id_note_section_size): Rename from gld${EMULATION_NAME}_id_note_section_size. (struct build_id_info): Delete. (write_build_id): Rename from gld${EMULATION_NAME}_write_build_id_section. Update elf_tdata usage. Style, formatting. (setup_build_id): New function. (gld${EMULATION_NAME}_after_open): Use setup_build_id. --- gdb/ChangeLog | 12 +++++++++++- gdb/elfread.c | 30 ++++++++---------------------- 2 files changed, 19 insertions(+), 23 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d6e879f..1c511ff 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2013-02-19 Alan Modra + + * elfread.c (struct build_id): Delete. Use struct elf_build_id + throughout file instead. + (build_id_bfd_get): Update to use new elf_tdata build_id field. + Don't xmalloc return value. + (build_id_verify): Similarly. Don't xfree. + (build_id_to_debug_filename): Update. + (find_separate_debug_file_by_buildid): Update, don't xfree. + 2013-02-18 Tom Tromey PR gdb/15102: @@ -1151,7 +1161,7 @@ 2013-01-24 Tiago Stürmer Daitx  - * MAINTAINERS (Write After Approval): Add myself to the list. + * MAINTAINERS (Write After Approval): Add myself to the list. 2013-01-24 Tom Tromey diff --git a/gdb/elfread.c b/gdb/elfread.c index 6ca659f9..85e408f 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1074,38 +1074,27 @@ elf_gnu_ifunc_resolver_return_stop (struct breakpoint *b) update_breakpoint_locations (b, sals, sals_end); } -struct build_id - { - size_t size; - gdb_byte data[1]; - }; - /* Locate NT_GNU_BUILD_ID from ABFD and return its content. */ -static struct build_id * +static struct elf_build_id * build_id_bfd_get (bfd *abfd) { - struct build_id *retval; - if (!bfd_check_format (abfd, bfd_object) || bfd_get_flavour (abfd) != bfd_target_elf_flavour - || elf_tdata (abfd)->build_id == NULL) + || elf_tdata (abfd)->build_id == NULL + || elf_tdata (abfd)->build_id->u.i.size == 0) return NULL; - retval = xmalloc (sizeof *retval - 1 + elf_tdata (abfd)->build_id_size); - retval->size = elf_tdata (abfd)->build_id_size; - memcpy (retval->data, elf_tdata (abfd)->build_id, retval->size); - - return retval; + return &elf_tdata (abfd)->build_id->u.i; } /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */ static int -build_id_verify (const char *filename, struct build_id *check) +build_id_verify (const char *filename, struct elf_build_id *check) { bfd *abfd; - struct build_id *found = NULL; + struct elf_build_id *found; int retval = 0; /* We expect to be silent on the non-existing files. */ @@ -1126,13 +1115,11 @@ build_id_verify (const char *filename, struct build_id *check) gdb_bfd_unref (abfd); - xfree (found); - return retval; } static char * -build_id_to_debug_filename (struct build_id *build_id) +build_id_to_debug_filename (struct elf_build_id *build_id) { char *link, *debugdir, *retval = NULL; VEC (char_ptr) *debugdir_vec; @@ -1191,7 +1178,7 @@ build_id_to_debug_filename (struct build_id *build_id) static char * find_separate_debug_file_by_buildid (struct objfile *objfile) { - struct build_id *build_id; + struct elf_build_id *build_id; build_id = build_id_bfd_get (objfile->obfd); if (build_id != NULL) @@ -1199,7 +1186,6 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) char *build_id_name; build_id_name = build_id_to_debug_filename (build_id); - xfree (build_id); /* Prevent looping on a stripped .debug file. */ if (build_id_name != NULL && filename_cmp (build_id_name, objfile->name) == 0) -- cgit v1.1