struct int_elf32_fdpic_loadmap *map;
/* The GOT address for this link map entry. */
CORE_ADDR got_value;
+ /* The link map address, needed for frv_fetch_objfile_link_map(). */
+ CORE_ADDR lm_addr;
/* Cached dynamic symbol table and dynamic relocs initialized and
used only by find_canonical_descriptor_in_load_object().
/* Cached value for lm_base(), below. */
static CORE_ADDR lm_base_cache = 0;
+/* Link map address for main module. */
+static CORE_ADDR main_lm_addr = 0;
+
/* Return the address from which the link map chain may be found. On
the FR-V, this may be found in a number of ways. Assuming that the
main executable has already been relocated, the easiest way to find
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
"lm_base: _GLOBAL_OFFSET_TABLE_ + 8 = %s\n",
- local_hex_string_custom (addr, "08l"));
+ hex_string_custom (addr, 8));
if (target_read_memory (addr, buf, sizeof buf) != 0)
return 0;
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
"lm_base: lm_base_cache = %s\n",
- local_hex_string_custom (lm_base_cache, "08l"));
+ hex_string_custom (lm_base_cache, 8));
return lm_base_cache;
}
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
"current_sos: reading link_map entry at %s\n",
- local_hex_string_custom (lm_addr, "08l"));
+ hex_string_custom (lm_addr, 8));
if (target_read_memory (lm_addr, (char *) &lm_buf, sizeof (lm_buf)) != 0)
{
- warning ("frv_current_sos: Unable to read link map entry. Shared object chain may be incomplete.");
+ warning (_("frv_current_sos: Unable to read link map entry. Shared object chain may be incomplete."));
break;
}
loadmap = fetch_loadmap (addr);
if (loadmap == NULL)
{
- warning ("frv_current_sos: Unable to fetch load map. Shared object chain may be incomplete.");
+ warning (_("frv_current_sos: Unable to fetch load map. Shared object chain may be incomplete."));
break;
}
sop->lm_info = xcalloc (1, sizeof (struct lm_info));
sop->lm_info->map = loadmap;
sop->lm_info->got_value = got_addr;
+ sop->lm_info->lm_addr = lm_addr;
/* Fetch the name. */
addr = extract_unsigned_integer (&lm_buf.l_name,
sizeof (lm_buf.l_name));
name_buf);
if (errcode != 0)
- {
- warning ("frv_current_sos: Can't read pathname for link map entry: %s\n",
- safe_strerror (errcode));
- }
+ warning (_("Can't read pathname for link map entry: %s."),
+ safe_strerror (errcode));
else
{
strncpy (sop->so_name, name_buf, SO_NAME_MAX_PATH_SIZE - 1);
*sos_next_ptr = sop;
sos_next_ptr = &sop->next;
}
+ else
+ {
+ main_lm_addr = lm_addr;
+ }
lm_addr = extract_unsigned_integer (&lm_buf.l_next, sizeof (lm_buf.l_next));
}
static void
enable_break_failure_warning (void)
{
- warning ("Unable to find dynamic linker breakpoint function.\n"
+ warning (_("Unable to find dynamic linker breakpoint function.\n"
"GDB will be unable to debug shared library initializers\n"
- "and track explicitly loaded dynamic code.");
+ "and track explicitly loaded dynamic code."));
}
/*
/* Make sure the dynamic linker is really a useful object. */
if (!bfd_check_format (tmp_bfd, bfd_object))
{
- warning ("Unable to grok dynamic linker %s as an object file", buf);
+ warning (_("Unable to grok dynamic linker %s as an object file"), buf);
enable_break_failure_warning ();
bfd_close (tmp_bfd);
return 0;
&interp_loadmap_addr, 0);
if (status < 0)
{
- warning ("Unable to determine dynamic linker loadmap address\n");
+ warning (_("Unable to determine dynamic linker loadmap address."));
enable_break_failure_warning ();
bfd_close (tmp_bfd);
return 0;
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
"enable_break: interp_loadmap_addr = %s\n",
- local_hex_string_custom (interp_loadmap_addr,
- "08l"));
+ hex_string_custom (interp_loadmap_addr, 8));
ldm = fetch_loadmap (interp_loadmap_addr);
if (ldm == NULL)
{
- warning ("Unable to load dynamic linker loadmap at address %s\n",
- local_hex_string_custom (interp_loadmap_addr, "08l"));
+ warning (_("Unable to load dynamic linker loadmap at address %s."),
+ hex_string_custom (interp_loadmap_addr, 8));
enable_break_failure_warning ();
bfd_close (tmp_bfd);
return 0;
addr = bfd_lookup_symbol (tmp_bfd, "_dl_debug_addr");
if (addr == 0)
{
- warning ("Could not find symbol _dl_debug_addr in dynamic linker");
+ warning (_("Could not find symbol _dl_debug_addr in dynamic linker"));
enable_break_failure_warning ();
bfd_close (tmp_bfd);
return 0;
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
"enable_break: _dl_debug_addr (prior to relocation) = %s\n",
- local_hex_string_custom (addr, "08l"));
+ hex_string_custom (addr, 8));
addr += displacement_from_map (ldm, addr);
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
"enable_break: _dl_debug_addr (after relocation) = %s\n",
- local_hex_string_custom (addr, "08l"));
+ hex_string_custom (addr, 8));
/* Fetch the address of the r_debug struct. */
if (target_read_memory (addr, addr_buf, sizeof addr_buf) != 0)
{
- warning ("Unable to fetch contents of _dl_debug_addr (at address %s) from dynamic linker",
- local_hex_string_custom (addr, "08l"));
+ warning (_("Unable to fetch contents of _dl_debug_addr (at address %s) from dynamic linker"),
+ hex_string_custom (addr, 8));
}
addr = extract_unsigned_integer (addr_buf, sizeof addr_buf);
_dl_debug_addr. */
if (target_read_memory (addr + 8, addr_buf, sizeof addr_buf) != 0)
{
- warning ("Unable to fetch _dl_debug_addr->r_brk (at address %s) from dynamic linker",
- local_hex_string_custom (addr + 8, "08l"));
+ warning (_("Unable to fetch _dl_debug_addr->r_brk (at address %s) from dynamic linker"),
+ hex_string_custom (addr + 8, 8));
enable_break_failure_warning ();
bfd_close (tmp_bfd);
return 0;
/* Now fetch the function entry point. */
if (target_read_memory (addr, addr_buf, sizeof addr_buf) != 0)
{
- warning ("Unable to fetch _dl_debug_addr->.r_brk entry point (at address %s) from dynamic linker",
- local_hex_string_custom (addr, "08l"));
+ warning (_("Unable to fetch _dl_debug_addr->.r_brk entry point (at address %s) from dynamic linker"),
+ hex_string_custom (addr, 8));
enable_break_failure_warning ();
bfd_close (tmp_bfd);
return 0;
if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog,
"enable_break: solib event breakpoint placed at entry point: %s\n",
- local_hex_string_custom
- (symfile_objfile->ei.entry_point, "08l"));
+ hex_string_custom
+ (symfile_objfile->ei.entry_point, 8));
}
else
{
/* Fetch the loadmap located at ``exec_addr''. */
ldm = fetch_loadmap (exec_addr);
if (ldm == NULL)
- error ("Unable to load the executable's loadmap.");
+ error (_("Unable to load the executable's loadmap."));
if (main_executable_lm_info)
xfree (main_executable_lm_info);
SYNOPSIS
- void frv_solib_create_inferior_hook()
+ void frv_solib_create_inferior_hook ()
DESCRIPTION
/* Enable shared library breakpoints. */
if (!enable_break ())
{
- warning ("shared library handler failed to enable breakpoint");
+ warning (_("shared library handler failed to enable breakpoint"));
return;
}
}
lm_base_cache = 0;
enable_break1_done = 0;
enable_break2_done = 0;
+ main_lm_addr = 0;
}
static void
if (abfd == 0)
return 0;
+ /* Nothing to do if no link map. */
+ if (lm == 0)
+ return 0;
+
/* We want to scan the dynamic relocs for R_FRV_FUNCDESC relocations.
(More about this later.) But in order to fetch the relocs, we
need to first fetch the dynamic symbols. These symbols need to
return addr;
}
+/* Given an objfile, return the address of its link map. This value is
+ needed for TLS support. */
+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, 0, 1);
+
+ /* frv_current_sos() will set main_lm_addr for the main executable. */
+ if (objfile == symfile_objfile)
+ return main_lm_addr;
+
+ /* The other link map addresses may be found by examining the list
+ of shared libraries. */
+ for (so = master_so_list (); so; so = so->next)
+ {
+ if (so->objfile == objfile)
+ return so->lm_info->lm_addr;
+ }
+
+ /* Not found! */
+ return 0;
+}
+
static struct target_so_ops frv_so_ops;
void
current_target_so_ops = &frv_so_ops;
/* Debug this file's internals. */
- deprecated_add_show_from_set
- (add_set_cmd ("solib-frv", class_maintenance, var_zinteger,
- &solib_frv_debug,
-"Set internal debugging of shared library code for FR-V.\n"
-"When non-zero, FR-V solib specific internal debugging is enabled.",
- &setdebuglist),
- &showdebuglist);
+ add_setshow_zinteger_cmd ("solib-frv", class_maintenance,
+ &solib_frv_debug, _("\
+Set internal debugging of shared library code for FR-V."), _("\
+Show internal debugging of shared library code for FR-V."), _("\
+When non-zero, FR-V solib specific internal debugging is enabled."),
+ NULL,
+ NULL, /* FIXME: i18n: */
+ &setdebuglist, &showdebuglist);
}