/* Handle HP SOM shared libraries for GDB, the GNU Debugger.
- Copyright 1993, 1996, 1999 Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GDB.
#include "gdbcmd.h"
#include "assert.h"
#include "language.h"
+#include "regcache.h"
#include <fcntl.h>
if (!abfd)
{
close (desc);
- make_cleanup (free, filename);
+ make_cleanup (xfree, filename);
error ("\"%s\": can't open to read symbols: %s.", filename,
bfd_errmsg (bfd_get_error ()));
}
if (!bfd_check_format (abfd, bfd_object)) /* Reads in section info */
{
bfd_close (abfd); /* This also closes desc */
- make_cleanup (free, filename);
+ make_cleanup (xfree, filename);
error ("\"%s\": can't read symbols: %s.", filename,
bfd_errmsg (bfd_get_error ()));
}
st_size += (LONGEST) bfd_section_size (abfd, sect);
bfd_close (abfd); /* This also closes desc */
- free (filename);
+ xfree (filename);
/* Unfortunately, just summing the sizes of various debug info
sections isn't a very accurate measurement of how much heap
CORE_ADDR text_addr)
{
obj_private_data_t *obj_private;
- struct section_addr_info section_addrs;
+ struct obj_section *s;
- memset (§ion_addrs, 0, sizeof (section_addrs));
- section_addrs.other[0].name = ".text";
- section_addrs.other[0].addr = text_addr;
- so->objfile = symbol_file_add (name, from_tty, §ion_addrs, 0, OBJF_SHARED);
+ so->objfile = symbol_file_add (name, from_tty, NULL, 0, OBJF_SHARED);
so->abfd = so->objfile->obfd;
+ /* syms_from_objfile has bizarre section offset code,
+ so I do my own right here. */
+ for (s = so->objfile->sections; s < so->objfile->sections_end; s++)
+ {
+ flagword aflag = bfd_get_section_flags(so->abfd, s->the_bfd_section);
+ if (aflag & SEC_CODE)
+ {
+ s->addr += so->som_solib.text_addr - so->som_solib.text_link_addr;
+ s->endaddr += so->som_solib.text_addr - so->som_solib.text_link_addr;
+ }
+ else if (aflag & SEC_DATA)
+ {
+ s->addr += so->som_solib.data_start;
+ s->endaddr += so->som_solib.data_start;
+ }
+ else
+ ;
+ }
+
/* Mark this as a shared library and save private data.
*/
so->objfile->flags |= OBJF_SHARED;
}
anaddr = SYMBOL_VALUE_ADDRESS (msymbol);
- store_unsigned_integer (buf, 4, inferior_pid);
+ store_unsigned_integer (buf, 4, PIDGET (inferior_ptid));
status = target_write_memory (anaddr, buf, 4);
if (status != 0)
{
struct so_list *temp;
temp = so_list_head;
- free (so_list_head);
+ xfree (so_list_head);
so_list_head = temp->next;
}
clear_symtab_users ();
}
-
-static void
-reset_inferior_pid (int saved_inferior_pid)
-{
- inferior_pid = saved_inferior_pid;
-}
-
-
/* This operation removes the "hook" between GDB and the dynamic linker,
which causes the dld to notify GDB of shared library events.
int status;
char dld_flags_buffer[TARGET_INT_BIT / TARGET_CHAR_BIT];
unsigned int dld_flags_value;
- int saved_inferior_pid = inferior_pid;
- struct cleanup *old_cleanups = make_cleanup (reset_inferior_pid, saved_inferior_pid);
+ struct cleanup *old_cleanups = save_inferior_ptid ();
/* Ensure that we're really operating on the specified process. */
- inferior_pid = pid;
+ inferior_ptid = pid_to_ptid (pid);
/* We won't bother to remove the solib breakpoints from this process.
while (sl)
{
struct so_list *next_sl = sl->next;
- free (sl);
+ xfree (sl);
sl = next_sl;
}
so_list_head = NULL;