X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fsolib-frv.c;h=bce33a3e4d61f287b05a98c755695b73425ed0e0;hb=5b860c93e3c659625d92a2d2247712a84eac1041;hp=08fa5768676bedabf9216ddc45194ab5ba952873;hpb=fd3619828e94a24a92cddec42cbc0ab33352eeb4;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 08fa576867..bce33a3e4d 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -1,5 +1,5 @@ /* Handle FR-V (FDPIC) shared libraries for GDB, the GNU Debugger. - Copyright (C) 2004-2019 Free Software Foundation, Inc. + Copyright (C) 2004-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -376,8 +376,6 @@ frv_current_sos (void) this in the list of shared objects. */ if (got_addr != mgot) { - int errcode; - gdb::unique_xmalloc_ptr name_buf; struct int_elf32_fdpic_loadmap *loadmap; struct so_list *sop; CORE_ADDR addr; @@ -404,16 +402,15 @@ frv_current_sos (void) addr = extract_unsigned_integer (lm_buf.l_name, sizeof (lm_buf.l_name), byte_order); - target_read_string (addr, &name_buf, SO_NAME_MAX_PATH_SIZE - 1, - &errcode); + gdb::unique_xmalloc_ptr name_buf + = target_read_string (addr, SO_NAME_MAX_PATH_SIZE - 1); if (solib_frv_debug) fprintf_unfiltered (gdb_stdlog, "current_sos: name = %s\n", name_buf.get ()); - if (errcode != 0) - warning (_("Can't read pathname for link map entry: %s."), - safe_strerror (errcode)); + if (name_buf == nullptr) + warning (_("Can't read pathname for link map entry.")); else { strncpy (sop->so_name, name_buf.get (), @@ -785,8 +782,7 @@ frv_relocate_main_executable (void) main_executable_lm_info = new lm_info_frv; main_executable_lm_info->map = ldm; - gdb::unique_xmalloc_ptr new_offsets - (XCNEWVEC (struct section_offsets, symfile_objfile->num_sections)); + section_offsets new_offsets (symfile_objfile->section_offsets.size ()); changed = 0; ALL_OBJFILE_OSECTIONS (symfile_objfile, osect) @@ -800,7 +796,7 @@ frv_relocate_main_executable (void) /* Current address of section. */ addr = obj_section_addr (osect); /* Offset from where this section started. */ - offset = ANOFFSET (symfile_objfile->section_offsets, osect_idx); + offset = symfile_objfile->section_offsets[osect_idx]; /* Original address prior to any past relocations. */ orig_addr = addr - offset; @@ -809,10 +805,10 @@ frv_relocate_main_executable (void) if (ldm->segs[seg].p_vaddr <= orig_addr && orig_addr < ldm->segs[seg].p_vaddr + ldm->segs[seg].p_memsz) { - new_offsets->offsets[osect_idx] + new_offsets[osect_idx] = ldm->segs[seg].addr - ldm->segs[seg].p_vaddr; - if (new_offsets->offsets[osect_idx] != offset) + if (new_offsets[osect_idx] != offset) changed = 1; break; } @@ -820,7 +816,7 @@ frv_relocate_main_executable (void) } if (changed) - objfile_relocate (symfile_objfile, new_offsets.get ()); + objfile_relocate (symfile_objfile, new_offsets); /* Now that symfile_objfile has been relocated, we can compute the GOT value and stash it away. */ @@ -909,10 +905,7 @@ main_got (void) CORE_ADDR frv_fdpic_find_global_pointer (CORE_ADDR addr) { - struct so_list *so; - - so = master_so_list (); - while (so) + for (struct so_list *so : current_program_space->solibs ()) { int seg; lm_info_frv *li = (lm_info_frv *) so->lm_info; @@ -924,8 +917,6 @@ frv_fdpic_find_global_pointer (CORE_ADDR addr) && addr < map->segs[seg].addr + map->segs[seg].p_memsz) return li->got_value; } - - so = so->next; } /* Didn't find it in any of the shared objects. So assume it's in the @@ -959,7 +950,7 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point) if (sym == 0) name = 0; else - name = SYMBOL_LINKAGE_NAME (sym); + name = sym->linkage_name (); /* Check the main executable. */ addr = find_canonical_descriptor_in_load_object @@ -970,10 +961,7 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point) in list of shared objects. */ if (addr == 0) { - struct so_list *so; - - so = master_so_list (); - while (so) + for (struct so_list *so : current_program_space->solibs ()) { lm_info_frv *li = (lm_info_frv *) so->lm_info; @@ -982,8 +970,6 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point) if (addr != 0) break; - - so = so->next; } } @@ -1117,8 +1103,6 @@ find_canonical_descriptor_in_load_object CORE_ADDR frv_fetch_objfile_link_map (struct objfile *objfile) { - struct so_list *so; - /* Cause frv_current_sos() to be run if it hasn't been already. */ if (main_lm_addr == 0) solib_add (0, 0, 1); @@ -1129,7 +1113,7 @@ frv_fetch_objfile_link_map (struct objfile *objfile) /* The other link map addresses may be found by examining the list of shared libraries. */ - for (so = master_so_list (); so; so = so->next) + for (struct so_list *so : current_program_space->solibs ()) { lm_info_frv *li = (lm_info_frv *) so->lm_info; @@ -1143,8 +1127,9 @@ frv_fetch_objfile_link_map (struct objfile *objfile) struct target_so_ops frv_so_ops; +void _initialize_frv_solib (); void -_initialize_frv_solib (void) +_initialize_frv_solib () { frv_so_ops.relocate_section_addresses = frv_relocate_section_addresses; frv_so_ops.free_so = frv_free_so;