old-cross-binutils/gdb/solib-osf.c

640 lines
18 KiB
C
Raw Normal View History

/* Handle OSF/1, Digital UNIX, and Tru64 shared libraries
for GDB, the GNU Debugger.
Copyright (C) 1993-2013 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* When handling shared libraries, GDB has to find out the pathnames
of all shared libraries that are currently loaded (to read in their
symbols) and where the shared libraries are loaded in memory
(to relocate them properly from their prelinked addresses to the
current load address).
Under OSF/1 there are two possibilities to get at this information:
1) Peek around in the runtime loader structures.
These are not documented, and they are not defined in the system
header files. The definitions below were obtained by experimentation,
but they seem stable enough.
2) Use the libxproc.a library, which contains the equivalent ldr_*
routines. The library is documented in Tru64 5.x, but as of 5.1, it
only allows a process to examine itself. On earlier versions, it
may require that the GDB executable be dynamically linked and that
NAT_CLIBS include -lxproc -Wl,-expect_unresolved,ldr_process_context
for GDB and all applications that are using libgdb.
We will use the peeking approach until libxproc.a works for other
processes. */
#include "defs.h"
#include <sys/types.h>
#include <signal.h>
#include "gdb_string.h"
#include "bfd.h"
#include "symtab.h"
#include "symfile.h"
#include "objfiles.h"
#include "target.h"
#include "inferior.h"
Remove the global stop_signal in favour of a per-thread stop_signal. * inferior.h (stop_signal): Delete. * gdbthread.h (save_infrun_state, load_infrun_state): Remove stop_signal argument. * thread.c (load_infrun_state, save_infrun_state): Remove stop_signal argument. Don't reference it. * infcmd.c (stop_signal): Delete. (program_info): Adjust. * infrun.c (resume): Clear stop_signal. (proceed): Adjust. Pass the last stop_signal to the thread we're resuming. (context_switch): Don't context-switch stop_signal. (handle_inferior_event, keep_going): Adjust. (save_inferior_status, restore_inferior_status): Adjust. * fbsd-nat.c: Include "gdbthread.h". (find_signalled_thread, find_stop_signal): New. (fbsd_make_corefile_notes): Use it. * fork-child.c (startup_inferior): Adjust. * linux-nat.c (get_pending_status): Adjust. (linux_nat_do_thread_registers): Adjust. (find_signalled_thread, find_stop_signal): New. (linux_nat_do_thread_registers): Add stop_signal parameter. (struct linux_nat_corefile_thread_data): Add stop_signal member. (linux_nat_corefile_thread_callback): Pass stop_signal. (linux_nat_do_registers): Delete. (linux_nat_make_corefile_notes): Use find_stop_signal. Assume there's always a thread. * procfs.c (find_signalled_thread, find_stop_signal): New. (find_stop_signal): New. (procfs_do_thread_registers): Add stop_signal parameter. (struct procfs_corefile_thread_data): Add stop_signal member. (procfs_corefile_thread_callback): Pass args->stop_signal. (procfs_make_note_section): Find the last stop_signal. * solib-irix.c: Include gdbthread.h. (irix_solib_create_inferior_hook): Adjust. * solib-osf.c: Include gdbthread.h. (osf_solib_create_inferior_hook): Adjust. * solib-sunos.c: Include gdbthread.h. (sunos_solib_create_inferior_hook): Adjust. * solib-svr4.c: Include gdbthread.h. (svr4_solib_create_inferior_hook): Adjust. * win32-nat.c (do_initial_win32_stuff): Adjust.
2008-09-08 21:51:18 +00:00
#include "gdbthread.h"
#include "solist.h"
2008-10-03 16:38:01 +00:00
#include "solib.h"
#ifdef USE_LDR_ROUTINES
# include <loader.h>
#endif
#ifndef USE_LDR_ROUTINES
/* Definition of runtime loader structures, found by experimentation. */
#define RLD_CONTEXT_ADDRESS 0x3ffc0000000
/* Per-module information structure referenced by ldr_context_t.head. */
typedef struct
{
CORE_ADDR next;
CORE_ADDR previous;
CORE_ADDR unknown1;
CORE_ADDR module_name;
CORE_ADDR modinfo_addr; /* Used by next_link_map_member() to detect
the end of the shared module list. */
long module_id;
CORE_ADDR unknown2;
CORE_ADDR unknown3;
long region_count;
CORE_ADDR regioninfo_addr;
}
ldr_module_info_t;
/* Per-region structure referenced by ldr_module_info_t.regioninfo_addr. */
typedef struct
{
long unknown1;
CORE_ADDR regionname_addr;
long protection;
CORE_ADDR vaddr;
CORE_ADDR mapaddr;
long size;
long unknown2[5];
}
ldr_region_info_t;
/* Structure at RLD_CONTEXT_ADDRESS specifying the start and finish addresses
of the shared module list. */
typedef struct
{
CORE_ADDR unknown1;
CORE_ADDR unknown2;
CORE_ADDR head;
CORE_ADDR tail;
}
ldr_context_t;
#endif /* !USE_LDR_ROUTINES */
/* Per-section information, stored in struct lm_info.secs. */
struct lm_sec
{
CORE_ADDR offset; /* difference between default and actual
virtual addresses of section .name */
CORE_ADDR nameaddr; /* address in inferior of section name */
const char *name; /* name of section, null if not fetched */
};
/* Per-module information, stored in struct so_list.lm_info. */
struct lm_info
{
int isloader; /* whether the module is /sbin/loader */
int nsecs; /* length of .secs */
struct lm_sec secs[1]; /* variable-length array of sections, sorted
by name */
};
/* Context for iterating through the inferior's shared module list. */
struct read_map_ctxt
{
#ifdef USE_LDR_ROUTINES
ldr_process_t proc;
ldr_module_t next;
#else
CORE_ADDR next; /* next element in module list */
CORE_ADDR tail; /* last element in module list */
#endif
};
/* Forward declaration for this module's autoinit function. */
extern void _initialize_osf_solib (void);
#ifdef USE_LDR_ROUTINES
# if 0
/* This routine is intended to be called by ldr_* routines to read memory from
the current target. Usage:
ldr_process = ldr_core_process ();
ldr_set_core_reader (ldr_read_memory);
ldr_xdetach (ldr_process);
ldr_xattach (ldr_process);
ldr_core_process() and ldr_read_memory() are neither documented nor
declared in system header files. They work with OSF/1 2.x, and they might
work with later versions as well. */
static int
ldr_read_memory (CORE_ADDR memaddr, char *myaddr, int len, int readstring)
{
int result;
char *buffer;
if (readstring)
{
target_read_string (memaddr, &buffer, len, &result);
if (result == 0)
strcpy (myaddr, buffer);
xfree (buffer);
}
else
result = target_read_memory (memaddr, myaddr, len);
if (result != 0)
result = -result;
return result;
}
# endif /* 0 */
#endif /* USE_LDR_ROUTINES */
/* Comparison for qsort() and bsearch(): return -1, 0, or 1 according to
whether lm_sec *P1's name is lexically less than, equal to, or greater
than that of *P2. */
static int
lm_sec_cmp (const void *p1, const void *p2)
{
const struct lm_sec *lms1 = p1, *lms2 = p2;
return strcmp (lms1->name, lms2->name);
}
/* Sort LMI->secs so that osf_relocate_section_addresses() can binary-search
it. */
static void
lm_secs_sort (struct lm_info *lmi)
{
qsort (lmi->secs, lmi->nsecs, sizeof *lmi->secs, lm_sec_cmp);
}
/* Populate name fields of LMI->secs. */
static void
fetch_sec_names (struct lm_info *lmi)
{
#ifndef USE_LDR_ROUTINES
int i, errcode;
struct lm_sec *lms;
char *name;
for (i = 0; i < lmi->nsecs; i++)
{
lms = lmi->secs + i;
target_read_string (lms->nameaddr, &name, PATH_MAX, &errcode);
if (errcode != 0)
{
2011-01-05 Michael Snyder <msnyder@vmware.com> * addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
2011-01-05 22:22:53 +00:00
warning (_("unable to read shared sec name at 0x%lx"),
lms->nameaddr);
name = xstrdup ("");
}
lms->name = name;
}
lm_secs_sort (lmi);
#endif
}
/* target_so_ops callback. Adjust SEC's addresses after it's been mapped into
the process. */
static void
osf_relocate_section_addresses (struct so_list *so,
struct target_section *sec)
{
struct lm_info *lmi;
struct lm_sec lms_key, *lms;
/* Fetch SO's section names if we haven't done so already. */
lmi = so->lm_info;
if (lmi->nsecs && !lmi->secs[0].name)
fetch_sec_names (lmi);
/* Binary-search for offset information corresponding to SEC. */
lms_key.name = sec->the_bfd_section->name;
lms = bsearch (&lms_key, lmi->secs, lmi->nsecs, sizeof *lms, lm_sec_cmp);
if (lms)
{
sec->addr += lms->offset;
sec->endaddr += lms->offset;
}
}
/* target_so_ops callback. Free parts of SO allocated by this file. */
static void
osf_free_so (struct so_list *so)
{
int i;
const char *name;
for (i = 0; i < so->lm_info->nsecs; i++)
{
name = so->lm_info->secs[i].name;
if (name)
xfree ((void *) name);
}
xfree (so->lm_info);
}
/* target_so_ops callback. Discard information accumulated by this file and
not freed by osf_free_so(). */
static void
osf_clear_solib (void)
{
return;
}
/* target_so_ops callback. Prepare to handle shared libraries after the
inferior process has been created but before it's executed any
instructions.
For a statically bound executable, the inferior's first instruction is the
one at "_start", or a similar text label. No further processing is needed
in that case.
For a dynamically bound executable, this first instruction is somewhere
in the rld, and the actual user executable is not yet mapped in.
We continue the inferior again, rld then maps in the actual user
executable and any needed shared libraries and then sends
itself a SIGTRAP.
At that point we discover the names of all shared libraries and
read their symbols in.
FIXME
This code does not properly handle hitting breakpoints which the
user might have set in the rld itself. Proper handling would have
to check if the SIGTRAP happened due to a kill call.
Also, what if child has exit()ed? Must exit loop somehow. */
static void
gdb/ Add from_tty to solib_create_inferior_hook. * infcmd.c (post_create_inferior): Move solib_add after solib_create_inferior_hook. Pass from_tty to solib_create_inferior_hook. Call solib_add and SOLIB_ADD with 0 from_tty and comment why. * infrun.c (follow_exec): Pass from_tty solib_create_inferior_hook as 0. * linux-nat.c (linux_child_follow_fork): Likewise. * nto-procfs.c (procfs_post_attach, procfs_create_inferior): Likewise. * solib-darwin.c (darwin_solib_create_inferior_hook): New parameter from_tty. * solib-frv.c (frv_solib_create_inferior_hook): Likewise. * solib-irix.c (irix_solib_create_inferior_hook): Likewise. * solib-null.c (null_solib_create_inferior_hook): Likewise. * solib-osf.c (osf_solib_create_inferior_hook): Likewise. * solib-pa64.c (pa64_solib_create_inferior_hook): Likewise. * solib-som.c (som_solib_create_inferior_hook): Likewise. * solib-spu.c (spu_solib_create_inferior_hook): New parameter from_tty. Pass it to svr4_so_ops.solib_create_inferior_hook. * solib-sunos.c (sunos_solib_create_inferior_hook): New parameter from_tty. * solib-svr4.c (enable_break): New parameter from_tty. Pass it to solib_add. (svr4_solib_create_inferior_hook): New parameter from_tty. Pass it to enable_break. * solib-target.c (solib_target_solib_create_inferior_hook): New parameter from_tty. * solib.c (solib_create_inferior_hook): New parameter from_tty. Pass it to ops->solib_create_inferior_hook. (reload_shared_libraries): Pass from_tty to solib_create_inferior_hook. Move solib_add after solib_create_inferior_hook, call it now with from_tty as 0. New comment there. * solib.h (solib_create_inferior_hook): New parameter from_tty. * solist.h (struct target_so_ops <solib_create_inferior_hook>): Likewise.
2010-01-08 22:52:04 +00:00
osf_solib_create_inferior_hook (int from_tty)
{
struct inferior *inf;
Remove the global stop_signal in favour of a per-thread stop_signal. * inferior.h (stop_signal): Delete. * gdbthread.h (save_infrun_state, load_infrun_state): Remove stop_signal argument. * thread.c (load_infrun_state, save_infrun_state): Remove stop_signal argument. Don't reference it. * infcmd.c (stop_signal): Delete. (program_info): Adjust. * infrun.c (resume): Clear stop_signal. (proceed): Adjust. Pass the last stop_signal to the thread we're resuming. (context_switch): Don't context-switch stop_signal. (handle_inferior_event, keep_going): Adjust. (save_inferior_status, restore_inferior_status): Adjust. * fbsd-nat.c: Include "gdbthread.h". (find_signalled_thread, find_stop_signal): New. (fbsd_make_corefile_notes): Use it. * fork-child.c (startup_inferior): Adjust. * linux-nat.c (get_pending_status): Adjust. (linux_nat_do_thread_registers): Adjust. (find_signalled_thread, find_stop_signal): New. (linux_nat_do_thread_registers): Add stop_signal parameter. (struct linux_nat_corefile_thread_data): Add stop_signal member. (linux_nat_corefile_thread_callback): Pass stop_signal. (linux_nat_do_registers): Delete. (linux_nat_make_corefile_notes): Use find_stop_signal. Assume there's always a thread. * procfs.c (find_signalled_thread, find_stop_signal): New. (find_stop_signal): New. (procfs_do_thread_registers): Add stop_signal parameter. (struct procfs_corefile_thread_data): Add stop_signal member. (procfs_corefile_thread_callback): Pass args->stop_signal. (procfs_make_note_section): Find the last stop_signal. * solib-irix.c: Include gdbthread.h. (irix_solib_create_inferior_hook): Adjust. * solib-osf.c: Include gdbthread.h. (osf_solib_create_inferior_hook): Adjust. * solib-sunos.c: Include gdbthread.h. (sunos_solib_create_inferior_hook): Adjust. * solib-svr4.c: Include gdbthread.h. (svr4_solib_create_inferior_hook): Adjust. * win32-nat.c (do_initial_win32_stuff): Adjust.
2008-09-08 21:51:18 +00:00
struct thread_info *tp;
Remove the attach_flag global, and make it per-inferior. * inferior.h (attach_flag): Delete. (inferior_process): Declare. * solib.c (update_solib_list): Adjust. * gnu-nat.c (gnu_create_inferior, gnu_attach): Adjust. * inf-ptrace.c (inf_ptrace_detach): Adjust. (inf_ptrace_files_info): Get it from the current inferior. * inf-ttrace.c (inf_ttrace_attach): Adjust. (inf_ttrace_files_info): Get it from the current inferior. * inflow.c (terminal_inferior, terminal_ours_1, set_sigint_trap) (clear_sigint_trap): Get it from the current process. * remote.c (extended_remote_attach_1) (extended_remote_create_inferior_1): Adjust. * top.c (quit_confirm, quit_target): Get it from the current inferior. * procfs.c (do_detach): Adjust. (procfs_wait): Get it from the event inferior. (procfs_files_info): Get it from the current inferior. * nto-procfs.c (procfs_files_info): Likewise. (procfs_attach): Adjust. Set the attach_flag here. (do_attach): Don't set it here. (procfs_detach): Don't clear it. (procfs_mourn_inferior): Don't clear it. * solib-osf.c (osf_solib_create_inferior_hook): Adjust. * target.c (attach_flag): Delete. (generic_mourn_inferior): Don't clear it. * win32-nat.c (get_win32_debug_event): Get it from the event process. (do_initial_win32_stuff): Add attaching argument. Set attach_flag in the inferior accordingly. (win32_attach): Don't set the attach_flag here. Pass 1 to do_intial_win32_stuff. (win32_files_info): Get it from the current inferior. (win32_create_inferior): Dont clear attach_flag here. Pass 0 to do_intial_win32_stuff.
2008-09-22 15:21:30 +00:00
inf = current_inferior ();
/* If we are attaching to the inferior, the shared libraries
have already been mapped, so nothing more to do. */
Remove the attach_flag global, and make it per-inferior. * inferior.h (attach_flag): Delete. (inferior_process): Declare. * solib.c (update_solib_list): Adjust. * gnu-nat.c (gnu_create_inferior, gnu_attach): Adjust. * inf-ptrace.c (inf_ptrace_detach): Adjust. (inf_ptrace_files_info): Get it from the current inferior. * inf-ttrace.c (inf_ttrace_attach): Adjust. (inf_ttrace_files_info): Get it from the current inferior. * inflow.c (terminal_inferior, terminal_ours_1, set_sigint_trap) (clear_sigint_trap): Get it from the current process. * remote.c (extended_remote_attach_1) (extended_remote_create_inferior_1): Adjust. * top.c (quit_confirm, quit_target): Get it from the current inferior. * procfs.c (do_detach): Adjust. (procfs_wait): Get it from the event inferior. (procfs_files_info): Get it from the current inferior. * nto-procfs.c (procfs_files_info): Likewise. (procfs_attach): Adjust. Set the attach_flag here. (do_attach): Don't set it here. (procfs_detach): Don't clear it. (procfs_mourn_inferior): Don't clear it. * solib-osf.c (osf_solib_create_inferior_hook): Adjust. * target.c (attach_flag): Delete. (generic_mourn_inferior): Don't clear it. * win32-nat.c (get_win32_debug_event): Get it from the event process. (do_initial_win32_stuff): Add attaching argument. Set attach_flag in the inferior accordingly. (win32_attach): Don't set the attach_flag here. Pass 1 to do_intial_win32_stuff. (win32_files_info): Get it from the current inferior. (win32_create_inferior): Dont clear attach_flag here. Pass 0 to do_intial_win32_stuff.
2008-09-22 15:21:30 +00:00
if (inf->attach_flag)
return;
/* Nothing to do for statically bound executables. */
if (symfile_objfile == NULL
|| symfile_objfile->obfd == NULL
|| ((bfd_get_file_flags (symfile_objfile->obfd) & DYNAMIC) == 0))
return;
/* Now run the target. It will eventually get a SIGTRAP, at
which point all of the libraries will have been mapped in and we
can go groveling around in the rld structures to find
out what we need to know about them.
If debugging from a core file, we cannot resume the execution
of the inferior. But this is actually not an issue, because
shared libraries have already been mapped anyways, which means
we have nothing more to do. */
if (!target_can_run (&current_target))
return;
Remove the global stop_signal in favour of a per-thread stop_signal. * inferior.h (stop_signal): Delete. * gdbthread.h (save_infrun_state, load_infrun_state): Remove stop_signal argument. * thread.c (load_infrun_state, save_infrun_state): Remove stop_signal argument. Don't reference it. * infcmd.c (stop_signal): Delete. (program_info): Adjust. * infrun.c (resume): Clear stop_signal. (proceed): Adjust. Pass the last stop_signal to the thread we're resuming. (context_switch): Don't context-switch stop_signal. (handle_inferior_event, keep_going): Adjust. (save_inferior_status, restore_inferior_status): Adjust. * fbsd-nat.c: Include "gdbthread.h". (find_signalled_thread, find_stop_signal): New. (fbsd_make_corefile_notes): Use it. * fork-child.c (startup_inferior): Adjust. * linux-nat.c (get_pending_status): Adjust. (linux_nat_do_thread_registers): Adjust. (find_signalled_thread, find_stop_signal): New. (linux_nat_do_thread_registers): Add stop_signal parameter. (struct linux_nat_corefile_thread_data): Add stop_signal member. (linux_nat_corefile_thread_callback): Pass stop_signal. (linux_nat_do_registers): Delete. (linux_nat_make_corefile_notes): Use find_stop_signal. Assume there's always a thread. * procfs.c (find_signalled_thread, find_stop_signal): New. (find_stop_signal): New. (procfs_do_thread_registers): Add stop_signal parameter. (struct procfs_corefile_thread_data): Add stop_signal member. (procfs_corefile_thread_callback): Pass args->stop_signal. (procfs_make_note_section): Find the last stop_signal. * solib-irix.c: Include gdbthread.h. (irix_solib_create_inferior_hook): Adjust. * solib-osf.c: Include gdbthread.h. (osf_solib_create_inferior_hook): Adjust. * solib-sunos.c: Include gdbthread.h. (sunos_solib_create_inferior_hook): Adjust. * solib-svr4.c: Include gdbthread.h. (svr4_solib_create_inferior_hook): Adjust. * win32-nat.c (do_initial_win32_stuff): Adjust.
2008-09-08 21:51:18 +00:00
tp = inferior_thread ();
clear_proceed_status ();
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 04:31:25 +00:00
inf->control.stop_soon = STOP_QUIETLY;
gdb/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. gdb/gdbserver/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. include/gdb/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 * gdb/signals.def: Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/arm/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/avr/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/common/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/cr16/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/d10v/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/erc32/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/m32c/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/ppc/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/rl78/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/rx/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.
2012-05-24 16:51:47 +00:00
tp->suspend.stop_signal = GDB_SIGNAL_0;
do
{
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 04:31:25 +00:00
target_resume (minus_one_ptid, 0, tp->suspend.stop_signal);
wait_for_inferior ();
}
gdb/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. gdb/gdbserver/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. include/gdb/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 * gdb/signals.def: Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/arm/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/avr/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/common/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/cr16/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/d10v/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/erc32/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/m32c/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/ppc/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/rl78/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout. sim/rx/ 2012-05-24 Pedro Alves <palves@redhat.com> PR gdb/7205 Replace TARGET_SIGNAL_ with GDB_SIGNAL_ throughout.
2012-05-24 16:51:47 +00:00
while (tp->suspend.stop_signal != GDB_SIGNAL_TRAP);
/* solib_add will call reinit_frame_cache.
But we are stopped in the runtime loader and we do not have symbols
for the runtime loader. So heuristic_proc_start will be called
and will put out an annoying warning.
Delaying the resetting of stop_soon until after symbol loading
suppresses the warning. */
Approved by kev@cygnus.com ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * coff-solib.c (coff_solib_add): Add new readsyms arg. * irix5-nat.c (solib_add): Ditto. * osfsolib.c (solib_add): Ditto. * pa64solib.c (pa64_solib_add): Ditto. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * solib.c (solib_add): Ditto. * somsolib.c (som_solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * coff-solib.h (coff_solib_add): Add new readsyms arg to prototype. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * pa64solib.h (pa64_solib_add): Ditto. * solib.h (solib_add): Ditto. * somsolib.h (som_solib_add): Ditto. * config/i386/tm-cygwin.h (child_solib_add): Ditto. * coff-solib.c (coff_solib_add): If readsyms is zero don't read symbols but do any other needed work for shared libs. * irix5-nat.c: Ditto. * osfsolib.c (solib_add): Ditto. * solib.c (solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * irix5-nat.c (sharedlibrary_command): Pass 1 as readsyms to solib_add to force reading of shared library symbols. * osfsolib.c (sharedlibrary_command;): Ditto. * pa64solib.c (pa64_solib_sharedlibrary_command): Ditto. * solib.c (sharedlibrary_command): Ditto. * somsolib.c (som_solib_sharedlibrary_command): Ditto. * xcoffsolib.c (sharedlibrary_command): Ditto. * coff-solib.c (coff_solib_create_inferior_hook): Call solib_add unconditionally with auto_solib_add. * irix5-nat.c (solib_create_inferior_hook): Ditto. * osfsolib.c (solib_create_inferior_hook): Ditto. * solib.c (solib_create_inferior_hook): Ditto. * solib-osf.c (osf_solib_create_inferior_hook): Ditto. * solib-svr4.c (enable_break): Ditto. * solib-sunos.c (sunos_solib_create_inferior_hook): Ditto. * corelow.c (solib_add_stub): Add auto_solib_add to args passed via SOLIB_ADD. * sol-thread.c (sol_thread_attach): Ditto. * config/rs6000/nm-rs6000.h (SOLIB_ADD): Ditto. * infcmd.c (attach_command): Remove auto_solib_add decl. Call SOLIB_ADD directly with auto_solib_add. * infrun.c (handle_inferior_event): Ditto. * coff-solib.h (SOLIB_ADD): Add readsyms arg. * pa64solib.h (SOLIB_ADD): Ditto. * solib.h (SOLIB_ADD): Ditto. * somsolib.h (SOLIB_ADD): Ditto. * config/i386/tm-cygwin.h (SOLIB_ADD): Ditto. * fork-child.c (clone_and_follow_inferior): Remove unused auto_solib_add decl. * pa64solib.c (pa64_solib_add): Call add_to_solist with readsyms. (read_dld_descriptor): Ditto. (pa64_solib_add): Call read_dld_descriptor with readsyms. (pa64_solib_in_dynamic_linker): Ditto. * corelow.c (symfile.h): Need this for auto_solib_add declaration. * sol-thread.c (symfile.h): Ditto. Approved by eliz@is.elta.co.il doc/ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * gdbint.texinfo (SOLIB_ADD): Document additional new "readsyms" arg.
2001-11-01 16:17:08 +00:00
solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
gdb/ Rename and move inferior_thread_state and inferior_status. * gdbthread.h (struct thread_control_state): New struct, move fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step and stop_bpstat here from struct thread_info. (struct thread_suspend_state): New struct, move field stop_signal here from struct thread_info. (struct thread_info): Move the fields above from this struct. * inferior.h: Move the inferior_thread_state and inferior_status declarations comment to their definitions at infrun.c. (struct inferior_control_state): New struct, move field stop_soon from struct inferior here. (struct inferior_suspend_state): New empty struct. (struct inferior): New fields control and suspend. Move out field stop_soon. * infrun.c (struct inferior_thread_state): Rename to ... (infcall_suspend_state): ... here. Replace field stop_signal by fields thread_suspend and inferior_suspend. (save_inferior_thread_state): Rename to ... (save_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (restore_inferior_thread_state): Rename to ... (restore_infcall_suspend_state): ... here. New variable inf. Update the code for new fields. (do_restore_inferior_thread_state_cleanup): Rename to ... (do_restore_infcall_suspend_state_cleanup): ... here. (make_cleanup_restore_inferior_thread_state): Rename to ... (make_cleanup_restore_infcall_suspend_state): ... here. (discard_inferior_thread_state): Rename to ... (discard_infcall_suspend_state): ... here. (get_inferior_thread_state_regcache): Rename to ... (get_infcall_suspend_state_regcache): ... here. (struct inferior_status): Rename to ... (struct infcall_control_state): ... here. Replace fields step_range_start, step_range_end, step_frame_id, step_stack_frame_id, trap_expected, proceed_to_finish, in_infcall, step_over_calls, stop_step, stop_bpstat and stop_soon by fields thread_control and inferior_control. (save_inferior_status): Rename to ... (save_infcall_control_state): ... here. Update the code for new fields. (restore_inferior_status): Rename to ... (restore_infcall_control_state): ... here. Update the code for new fields. (do_restore_inferior_status_cleanup): Rename to ... (do_restore_infcall_control_state_cleanup): ... here. (make_cleanup_restore_inferior_status): Rename to ... (make_cleanup_restore_infcall_control_state): ... here. (discard_inferior_status): Rename to ... (discard_infcall_control_state): ... here. * alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h, exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c, inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c, mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c, solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the references to the moved fields and renamed functions.
2010-11-28 04:31:25 +00:00
inf->control.stop_soon = NO_STOP_QUIETLY;
}
/* target_so_ops callback. Do additional symbol handling, lookup, etc. after
symbols for a shared object have been loaded. */
static void
osf_special_symbol_handling (void)
{
return;
}
/* Initialize CTXT in preparation for iterating through the inferior's module
list using read_map(). Return success. */
static int
open_map (struct read_map_ctxt *ctxt)
{
#ifdef USE_LDR_ROUTINES
/* Note: As originally written, ldr_my_process() was used to obtain
the value for ctxt->proc. This is incorrect, however, since
ldr_my_process() retrieves the "unique identifier" associated
with the current process (i.e. GDB) and not the one being
debugged. Presumably, the pid of the process being debugged is
compatible with the "unique identifier" used by the ldr_
routines, so we use that. */
ctxt->proc = ptid_get_pid (inferior_ptid);
if (ldr_xattach (ctxt->proc) != 0)
return 0;
ctxt->next = LDR_NULL_MODULE;
#else
CORE_ADDR ldr_context_addr, prev, next;
ldr_context_t ldr_context;
if (target_read_memory ((CORE_ADDR) RLD_CONTEXT_ADDRESS,
(char *) &ldr_context_addr,
sizeof (CORE_ADDR)) != 0)
return 0;
if (target_read_memory (ldr_context_addr,
(char *) &ldr_context,
sizeof (ldr_context_t)) != 0)
return 0;
ctxt->next = ldr_context.head;
ctxt->tail = ldr_context.tail;
#endif
return 1;
}
/* Initialize SO to have module NAME, /sbin/loader indicator ISLOADR, and
space for NSECS sections. */
static void
init_so (struct so_list *so, char *name, int isloader, int nsecs)
{
int namelen, i;
/* solib.c requires various fields to be initialized to 0. */
memset (so, 0, sizeof *so);
/* Copy the name. */
namelen = strlen (name);
if (namelen >= SO_NAME_MAX_PATH_SIZE)
namelen = SO_NAME_MAX_PATH_SIZE - 1;
memcpy (so->so_original_name, name, namelen);
so->so_original_name[namelen] = '\0';
memcpy (so->so_name, so->so_original_name, namelen + 1);
/* Allocate section space. */
so->lm_info = xmalloc (sizeof (struct lm_info)
+ (nsecs - 1) * sizeof (struct lm_sec));
so->lm_info->isloader = isloader;
so->lm_info->nsecs = nsecs;
for (i = 0; i < nsecs; i++)
so->lm_info->secs[i].name = NULL;
}
/* Initialize SO's section SECIDX with name address NAMEADDR, name string
NAME, default virtual address VADDR, and actual virtual address
MAPADDR. */
static void
init_sec (struct so_list *so, int secidx, CORE_ADDR nameaddr,
const char *name, CORE_ADDR vaddr, CORE_ADDR mapaddr)
{
struct lm_sec *lms;
lms = so->lm_info->secs + secidx;
lms->nameaddr = nameaddr;
lms->name = name;
lms->offset = mapaddr - vaddr;
}
/* If there are more elements starting at CTXT in inferior's module list,
store the next element in SO, advance CTXT to the next element, and return
1, else return 0. */
static int
read_map (struct read_map_ctxt *ctxt, struct so_list *so)
{
ldr_module_info_t minf;
ldr_region_info_t rinf;
#ifdef USE_LDR_ROUTINES
size_t size;
ldr_region_t i;
/* Retrieve the next element. */
if (ldr_next_module (ctxt->proc, &ctxt->next) != 0)
return 0;
if (ctxt->next == LDR_NULL_MODULE)
return 0;
if (ldr_inq_module (ctxt->proc, ctxt->next, &minf, sizeof minf, &size) != 0)
return 0;
/* Initialize the module name and section count. */
init_so (so, minf.lmi_name, 0, minf.lmi_nregion);
/* Retrieve section names and offsets. */
for (i = 0; i < minf.lmi_nregion; i++)
{
if (ldr_inq_region (ctxt->proc, ctxt->next, i, &rinf,
sizeof rinf, &size) != 0)
goto err;
init_sec (so, (int) i, 0, xstrdup (rinf.lri_name),
(CORE_ADDR) rinf.lri_vaddr, (CORE_ADDR) rinf.lri_mapaddr);
}
lm_secs_sort (so->lm_info);
#else
char *name;
int errcode, i;
/* Retrieve the next element. */
if (!ctxt->next)
return 0;
if (target_read_memory (ctxt->next, (char *) &minf, sizeof minf) != 0)
return 0;
if (ctxt->next == ctxt->tail)
ctxt->next = 0;
else
ctxt->next = minf.next;
/* Initialize the module name and section count. */
target_read_string (minf.module_name, &name, PATH_MAX, &errcode);
if (errcode != 0)
return 0;
init_so (so, name, !minf.modinfo_addr, minf.region_count);
xfree (name);
/* Retrieve section names and offsets. */
for (i = 0; i < minf.region_count; i++)
{
if (target_read_memory (minf.regioninfo_addr + i * sizeof rinf,
(char *) &rinf, sizeof rinf) != 0)
goto err;
init_sec (so, i, rinf.regionname_addr, NULL, rinf.vaddr, rinf.mapaddr);
}
#endif /* !USE_LDR_ROUTINES */
return 1;
err:
osf_free_so (so);
return 0;
}
/* Free resources allocated by open_map (CTXT). */
static void
close_map (struct read_map_ctxt *ctxt)
{
#ifdef USE_LDR_ROUTINES
ldr_xdetach (ctxt->proc);
#endif
}
/* target_so_ops callback. Return a list of shared objects currently loaded
in the inferior. */
static struct so_list *
osf_current_sos (void)
{
struct so_list *head = NULL, *tail = NULL, *newtail, so;
struct read_map_ctxt ctxt;
int skipped_main;
if (!open_map (&ctxt))
return NULL;
/* Read subsequent elements. */
for (skipped_main = 0;;)
{
if (!read_map (&ctxt, &so))
break;
/* Skip the main program module, which is first in the list after
/sbin/loader. */
if (!so.lm_info->isloader && !skipped_main)
{
osf_free_so (&so);
skipped_main = 1;
continue;
}
newtail = xmalloc (sizeof *newtail);
if (!head)
head = newtail;
else
tail->next = newtail;
tail = newtail;
memcpy (tail, &so, sizeof so);
tail->next = NULL;
}
close_map (&ctxt);
return head;
}
/* target_so_ops callback. Attempt to locate and open the main symbol
file. */
static int
osf_open_symbol_file_object (void *from_ttyp)
{
struct read_map_ctxt ctxt;
struct so_list so;
int found;
if (symfile_objfile)
if (!query (_("Attempt to reload symbols from process? ")))
return 0;
/* The first module after /sbin/loader is the main program. */
if (!open_map (&ctxt))
return 0;
for (found = 0; !found;)
{
if (!read_map (&ctxt, &so))
break;
found = !so.lm_info->isloader;
osf_free_so (&so);
}
close_map (&ctxt);
if (found)
symbol_file_add_main (so.so_name, *(int *) from_ttyp);
return found;
}
/* target_so_ops callback. Return whether PC is in the dynamic linker. */
static int
osf_in_dynsym_resolve_code (CORE_ADDR pc)
{
/* This function currently always return False. This is a temporary
solution which only consequence is to introduce a minor incovenience
for the user: When stepping inside a subprogram located in a shared
library, gdb might stop inside the dynamic loader code instead of
inside the subprogram itself. See the explanations in infrun.c about
the in_solib_dynsym_resolve_code() function for more details. */
return 0;
}
static struct target_so_ops osf_so_ops;
void
_initialize_osf_solib (void)
{
osf_so_ops.relocate_section_addresses = osf_relocate_section_addresses;
osf_so_ops.free_so = osf_free_so;
osf_so_ops.clear_solib = osf_clear_solib;
osf_so_ops.solib_create_inferior_hook = osf_solib_create_inferior_hook;
osf_so_ops.special_symbol_handling = osf_special_symbol_handling;
osf_so_ops.current_sos = osf_current_sos;
osf_so_ops.open_symbol_file_object = osf_open_symbol_file_object;
osf_so_ops.in_dynsym_resolve_code = osf_in_dynsym_resolve_code;
osf_so_ops.bfd_open = solib_bfd_open;
/* FIXME: Don't do this here. *_gdbarch_init() should set so_ops. */
current_target_so_ops = &osf_so_ops;
}