/* Handle HP SOM shared libraries for GDB, the GNU Debugger.
Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
- 2003 Free Software Foundation, Inc.
+ 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
#include "gdbcmd.h"
#include "language.h"
#include "regcache.h"
+#include "gdb_assert.h"
+#include "exec.h"
+#include "hppa-tdep.h"
#include <fcntl.h>
#define O_BINARY 0
#endif
+#ifndef SHL_LOAD
+#define SHL_LOAD 4
+#endif
+
+#ifndef SHL_UNLOAD
+#define SHL_UNLOAD 8
+#endif
+
/* Uncomment this to turn on some debugging output.
*/
/* #define SOLIB_DEBUG
*/
-/* Defined in exec.c; used to prevent dangling pointer bug.
- */
-extern struct target_ops exec_ops;
-
/* This lives in hppa-tdep.c. */
extern struct unwind_table_entry *find_unwind_entry (CORE_ADDR pc);
/* TODO:
- * Most of this code should work for hp300 shared libraries. Does
- anyone care enough to weed out any SOM-isms.
-
* Support for hpux8 dynamic linker. */
/* The basic structure which describes a dynamically loaded object. This
/* We believe that filename was handed to us by the dynamic linker, and
is therefore always an absolute path.
*/
- desc = openp (getenv ("PATH"), 1, filename, O_RDONLY | O_BINARY, 0, &absolute_name);
+ desc = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
+ O_RDONLY | O_BINARY, 0, &absolute_name);
if (desc < 0)
{
perror_with_name (filename);
som_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
CORE_ADDR text_addr)
{
- obj_private_data_t *obj_private;
+ struct hppa_objfile_private *obj_private;
struct obj_section *s;
so->objfile = symbol_file_add (name, from_tty, NULL, 0, OBJF_SHARED);
*/
so->objfile->flags |= OBJF_SHARED;
- if (so->objfile->obj_private == NULL)
+ obj_private = (struct hppa_objfile_private *)
+ objfile_data (so->objfile, hppa_objfile_priv_data);
+ if (obj_private == NULL)
{
- obj_private = (obj_private_data_t *)
- obstack_alloc (&so->objfile->psymbol_obstack,
- sizeof (obj_private_data_t));
+ obj_private = (struct hppa_objfile_private *)
+ obstack_alloc (&so->objfile->objfile_obstack,
+ sizeof (struct hppa_objfile_private));
+ set_objfile_data (so->objfile, hppa_objfile_priv_data, obj_private);
obj_private->unwind_info = NULL;
obj_private->so_info = NULL;
- so->objfile->obj_private = obj_private;
}
- obj_private = (obj_private_data_t *) so->objfile->obj_private;
obj_private->so_info = so;
if (!bfd_check_format (so->abfd, bfd_object))
}
name = obsavestring (name, name_len - 1,
- &symfile_objfile->symbol_obstack);
+ &symfile_objfile->objfile_obstack);
status = target_read_memory (addr + 8, buf, 4);
if (status != 0)
/* What a crock. */
msymbol2 = lookup_minimal_symbol_solib_trampoline (DEPRECATED_SYMBOL_NAME (msymbol),
- NULL, objfile);
+ objfile);
/* Found a symbol with the right name. */
if (msymbol2)
{
CORE_ADDR addr;
struct minimal_symbol *msymbol;
int status;
- char dld_flags_buffer[TARGET_INT_BIT / TARGET_CHAR_BIT];
+ char dld_flags_buffer[4];
unsigned int dld_flags_value;
struct cleanup *old_cleanups = save_inferior_ptid ();
msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL);
addr = SYMBOL_VALUE_ADDRESS (msymbol);
- status = target_read_memory (addr, dld_flags_buffer, TARGET_INT_BIT / TARGET_CHAR_BIT);
+ status = target_read_memory (addr, dld_flags_buffer, 4);
- dld_flags_value = extract_unsigned_integer (dld_flags_buffer,
- sizeof (dld_flags_value));
+ dld_flags_value = extract_unsigned_integer (dld_flags_buffer, 4);
dld_flags_value &= ~DLD_FLAGS_HOOKVALID;
- store_unsigned_integer (dld_flags_buffer,
- sizeof (dld_flags_value),
- dld_flags_value);
- status = target_write_memory (addr, dld_flags_buffer, TARGET_INT_BIT / TARGET_CHAR_BIT);
+ store_unsigned_integer (dld_flags_buffer, 4, dld_flags_value);
+ status = target_write_memory (addr, dld_flags_buffer, 4);
do_cleanups (old_cleanups);
}
{
CORE_ADDR event_kind;
- event_kind = read_register (ARG0_REGNUM);
+ event_kind = read_register (HPPA_ARG0_REGNUM);
return (event_kind == SHL_LOAD);
}
{
CORE_ADDR event_kind;
- event_kind = read_register (ARG0_REGNUM);
+ event_kind = read_register (HPPA_ARG0_REGNUM);
return (event_kind == SHL_UNLOAD);
}
static char dll_pathname[1024];
/* Read the descriptor of this newly-loaded library. */
- dll_handle_address = read_register (ARG1_REGNUM);
+ dll_handle_address = read_register (HPPA_ARG1_REGNUM);
read_memory (dll_handle_address, (char *) &dll_descriptor, sizeof (dll_descriptor));
/* We can find a pointer to the dll's pathname within the descriptor. */
}
dld_msymbol = lookup_minimal_symbol_solib_trampoline ("shl_load",
- NULL,
objfile);
if (dld_msymbol != NULL)
{
}
dld_msymbol = lookup_minimal_symbol_solib_trampoline ("shl_unload",
- NULL,
objfile);
if (dld_msymbol != NULL)
{
if (so_list->objfile == NULL)
printf_unfiltered (" (symbols not loaded)");
printf_unfiltered ("\n");
- printf_unfiltered (" %-12s", local_hex_string_custom (flags, "08l"));
+ printf_unfiltered (" %-12s", hex_string_custom (flags, 8));
printf_unfiltered ("%-12s",
- local_hex_string_custom (so_list->som_solib.text_addr, "08l"));
+ hex_string_custom (so_list->som_solib.text_addr, 8));
printf_unfiltered ("%-12s",
- local_hex_string_custom (so_list->som_solib.text_end, "08l"));
+ hex_string_custom (so_list->som_solib.text_end, 8));
printf_unfiltered ("%-12s",
- local_hex_string_custom (so_list->som_solib.data_start, "08l"));
+ hex_string_custom (so_list->som_solib.data_start, 8));
printf_unfiltered ("%-12s",
- local_hex_string_custom (so_list->som_solib.data_end, "08l"));
+ hex_string_custom (so_list->som_solib.data_end, 8));
printf_unfiltered ("%-12s\n",
- local_hex_string_custom (so_list->som_solib.got_value, "08l"));
+ hex_string_custom (so_list->som_solib.got_value, 8));
so_list = so_list->next;
}
}
}
-/* LOCAL FUNCTION
-
- no_shared_libraries -- handle command to explicitly discard symbols
- from shared libraries.
-
- DESCRIPTION
-
- Implements the command "nosharedlibrary", which discards symbols
- that have been auto-loaded from shared libraries. Symbols from
- shared libraries that were added by explicit request of the user
- are not discarded. Also called from remote.c. */
-
-void
-no_shared_libraries (char *ignored, int from_tty)
-{
- /* FIXME */
-}
-
-
void
_initialize_som_solib (void)
{
add_info ("sharedlibrary", som_sharedlibrary_info_command,
"Status of loaded shared object libraries.");
- add_show_from_set
+ deprecated_add_show_from_set
(add_set_cmd ("auto-solib-add", class_support, var_boolean,
(char *) &auto_solib_add,
"Set autoloading of shared library symbols.\n\
&setlist),
&showlist);
- add_show_from_set
+ deprecated_add_show_from_set
(add_set_cmd ("auto-solib-limit", class_support, var_zinteger,
(char *) &auto_solib_limit,
"Set threshold (in Mb) for autoloading shared library symbols.\n\
/* Get some HPUX-specific data from a shared lib.
*/
CORE_ADDR
-so_lib_thread_start_addr (struct so_list *so)
+som_solib_thread_start_addr (struct so_list *so)
{
return so->som_solib.tsd_start_addr;
}