bfd *tmp_bfd;
asection *sec;
obj_private_data_t *obj_private;
+ struct section_addr_info section_addrs;
+ memset (§ion_addrs, 0, sizeof (section_addrs));
/* We need the BFD so that we can look at its sections. We open up the
file temporarily, then close it when we are done. */
tmp_bfd = bfd_openr (name, gnutarget);
tmp_bfd = NULL;
/* Now let the generic code load up symbols for this library. */
- so->objfile = symbol_file_add (name, from_tty, text_addr, 0, 0, 0, 0, 1);
+ section_addrs.text_addr = text_addr;
+ so->objfile = symbol_file_add (name, from_tty, §ion_addrs, 0, OBJF_SHARED);
so->abfd = so->objfile->obfd;
/* Mark this as a shared library and save private data. */
status = target_read_memory (text_addr, buf, 4);
if (status != 0)
{
- int old, new;
- int update_coreops;
- int update_execops;
-
- /* We must update the to_sections field in the core_ops structure
- here, otherwise we dereference a potential dangling pointer
- for each call to target_read/write_memory within this routine. */
- update_coreops = core_ops.to_sections == target->to_sections;
-
- /* Ditto exec_ops (this was a bug). */
- update_execops = exec_ops.to_sections == target->to_sections;
-
+ int new, old;
+
new = so->sections_end - so->sections;
- /* Add sections from the shared library to the core target. */
- if (target->to_sections)
- {
- old = target->to_sections_end - target->to_sections;
- target->to_sections = (struct section_table *)
- xrealloc ((char *) target->to_sections,
- ((sizeof (struct section_table)) * (old + new)));
- }
- else
- {
- old = 0;
- target->to_sections = (struct section_table *)
- xmalloc ((sizeof (struct section_table)) * new);
- }
- target->to_sections_end = (target->to_sections + old + new);
-
- /* Update the to_sections field in the core_ops structure
- if needed, ditto exec_ops. */
- if (update_coreops)
- {
- core_ops.to_sections = target->to_sections;
- core_ops.to_sections_end = target->to_sections_end;
- }
-
- if (update_execops)
- {
- exec_ops.to_sections = target->to_sections;
- exec_ops.to_sections_end = target->to_sections_end;
- }
+ old = target_resize_to_sections (target, new);
+
/* Copy over the old data before it gets clobbered. */
memcpy ((char *) (target->to_sections + old),
so->sections,
if (bfd_section_size (symfile_objfile->obfd, shlib_info) == 0)
return;
- /* Slam the pid of the process into __d_pid; failing is only a warning! */
- msymbol = lookup_minimal_symbol ("__d_pid", NULL, symfile_objfile);
- if (msymbol == NULL)
- {
- warning ("Unable to find __d_pid symbol in object file.");
- warning ("Suggest linking with /opt/langtools/lib/end.o.");
- warning ("GDB will be unable to track explicit library load/unload calls");
- goto keep_going;
- }
-
- anaddr = SYMBOL_VALUE_ADDRESS (msymbol);
- store_unsigned_integer (buf, 4, inferior_pid);
- status = target_write_memory (anaddr, buf, 4);
- if (status != 0)
- {
- warning ("Unable to write __d_pid");
- warning ("Suggest linking with /opt/langtools/lib/end.o.");
- warning ("GDB will be unable to track explicit library load/unload calls");
- goto keep_going;
- }
-
-keep_going:
-
/* Read in the .dynamic section. */
if (! read_dynamic_info (shlib_info, &dld_cache))
error ("Unable to read the .dynamic section.");
/* Turn on the flags we care about. */
dld_cache.dld_flags |= DT_HP_DEBUG_PRIVATE;
- /* ?!? Right now GDB is not recognizing hitting the callback breakpoint
- as a shared library event. Fix that and remove the #if0 code. */
-#if 0
dld_cache.dld_flags |= DT_HP_DEBUG_CALLBACK;
-#endif
status = target_write_memory (dld_cache.dld_flags_addr,
(char *) &dld_cache.dld_flags,
sizeof (dld_cache.dld_flags));
sym_addr = load_addr + sym_addr + 4;
/* Create the shared library breakpoint. */
- create_solib_event_breakpoint (sym_addr);
+ {
+ struct breakpoint *b
+ = create_solib_event_breakpoint (sym_addr);
+
+ /* The breakpoint is actually hard-coded into the dynamic linker,
+ so we don't need to actually insert a breakpoint instruction
+ there. In fact, the dynamic linker's code is immutable, even to
+ ttrace, so we shouldn't even try to do that. For cases like
+ this, we have "permanent" breakpoints. */
+ make_breakpoint_permanent (b);
+ }
/* We're done with the temporary bfd. */
bfd_close (tmp_bfd);
if (exec_bfd == NULL)
{
- printf_unfiltered ("no exec file.\n");
+ printf_unfiltered ("No executable file.\n");
return;
}
}
printf_unfiltered ("Shared Object Libraries\n");
- printf_unfiltered (" %-19s%-19s%-19s%-19s\n",
- " tstart", " tend",
- " dstart", " dend");
+ printf_unfiltered (" %-19s%-19s%-19s%-19s\n",
+ " text start", " text end",
+ " data start", " data end");
while (so_list)
{
unsigned int flags;
local_hex_string_custom (so_list->pa64_solib_desc.text_base,
"016l"));
printf_unfiltered (" %-18s",
- local_hex_string_custom ((so_list->pa64_solib_desc.text_base,
+ local_hex_string_custom ((so_list->pa64_solib_desc.text_base
+ so_list->pa64_solib_desc.text_size),
"016l"));
printf_unfiltered (" %-18s",
local_hex_string_custom (so_list->pa64_solib_desc.data_base,
"016l"));
printf_unfiltered (" %-18s\n",
- local_hex_string_custom ((so_list->pa64_solib_desc.data_base,
+ local_hex_string_custom ((so_list->pa64_solib_desc.data_base
+ so_list->pa64_solib_desc.data_size),
"016l"));
so_list = so_list->next;