Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
/* Core dump and executable file functions below target vector, for GDB.
|
1995-01-28 01:32:10 +00:00
|
|
|
|
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995
|
* README: Remove note about gcc warnings on alpha, these should be
gone now.
* c-exp.y, ch-exp.y, core.c, corelow.c, eval.c, fork-child.c,
m2-exp.y, minsyms.c, nlmread.c, parse.c, putenv.c, regex.c
remote-utils.c, stabsread.c: Include <string.h>.
* regex.c: Include "defs.h", change re_comp argument to const char *.
* infptrace.c (fetch_register, store_inferior_registers): Change
regaddr to type CORE_ADDR.
* config/alpha/alpha-nw.mt, config/alpha/alpha-osf1.mt (MT_CFLAGS):
Remove, no longer necessary now that we use bfd_vma for a CORE_ADDR.
1994-02-08 09:01:03 +00:00
|
|
|
|
Free Software Foundation, Inc.
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
|
|
|
|
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 2 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, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
* README: Remove note about gcc warnings on alpha, these should be
gone now.
* c-exp.y, ch-exp.y, core.c, corelow.c, eval.c, fork-child.c,
m2-exp.y, minsyms.c, nlmread.c, parse.c, putenv.c, regex.c
remote-utils.c, stabsread.c: Include <string.h>.
* regex.c: Include "defs.h", change re_comp argument to const char *.
* infptrace.c (fetch_register, store_inferior_registers): Change
regaddr to type CORE_ADDR.
* config/alpha/alpha-nw.mt, config/alpha/alpha-osf1.mt (MT_CFLAGS):
Remove, no longer necessary now that we use bfd_vma for a CORE_ADDR.
1994-02-08 09:01:03 +00:00
|
|
|
|
#include <string.h>
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include "frame.h" /* required by inferior.h */
|
|
|
|
|
#include "inferior.h"
|
|
|
|
|
#include "symtab.h"
|
|
|
|
|
#include "command.h"
|
|
|
|
|
#include "bfd.h"
|
|
|
|
|
#include "target.h"
|
|
|
|
|
#include "gdbcore.h"
|
* Makefile.in (c-exp.tab.o): Remove notice about shift/reduce conflicts
which no longer occur.
gcc -Wall lint:
* findvar.c (symbol_read_needs_frame), corelow.c (ignore),
inflow.c (gdb_has_a_terminal): Make sure to return a value.
* regex.h: Declare re_set_syntax.
* printcmd.c: Include valprint.h.
* infcmd.c, exec.c, maint.c, core.c: Include language.h.
* maint.c: Include expression.h.
* infrun.c, fork-child.c, corelow.c, inflow.c: Include thread.h.
* inftarg.c: Include command.h.
* coredep.c: Include value.h.
* c-exp.y, m2-exp.y, ch-exp.y: Include bfd.h, symfile.h and objfiles.h.
* ch-typeprint.c: Include typeprint.h.
* ch-valprint.c: Include c-lang.h.
* nlmread.c: Include buildsym.h.
* environ.c: Include gdbcore.h. Only include defs.h once.
(set_in_environ): Cast const char * to char * when passing to
set_gnutarget.
Remove unused variables:
* printcmd.c (printf_command): args_to_vprintf.
* coffread.c (coff_symfile_init): strsection.
Move variables to within the #ifdefs where they are used:
* symtab.c (gdb_mangle_name): opname.
* inftarg.c (child_attach): pid and exec_file.
* inftarg.c (child_detach): siggnal.
* objfiles.c (allocate_objfile): mapto, md, and fd.
* objfiles.c (free_objfile): mmfd.
* infrun.c (wait_for_inferior): Include BPSTAT_WHAT_LAST in switch.
* infrun.c (wait_for_inferior): Remove unused same_pid label.
* inferior.h: Declare set_sigint_trap and clear_sigint_trap.
* parser-defs.h: Declare write_exp_elt_block.
* stabsread.h: Declare elfstab_offset_sections and
coffstab_build_psymtabs.
1993-10-21 20:41:50 +00:00
|
|
|
|
#include "thread.h"
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
static void core_files_info PARAMS ((struct target_ops *));
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
|
|
|
|
#ifdef SOLIB_ADD
|
1994-10-16 00:19:02 +00:00
|
|
|
|
static int solib_add_stub PARAMS ((char *));
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1995-01-28 01:32:10 +00:00
|
|
|
|
static void core_open PARAMS ((char *, int));
|
|
|
|
|
|
|
|
|
|
static void core_detach PARAMS ((char *, int));
|
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
static void core_close PARAMS ((int));
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
static void get_core_registers PARAMS ((int));
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
/* Discard all vestiges of any previous core file and mark data and stack
|
|
|
|
|
spaces as empty. */
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
|
|
|
|
/* ARGSUSED */
|
|
|
|
|
static void
|
|
|
|
|
core_close (quitting)
|
|
|
|
|
int quitting;
|
|
|
|
|
{
|
* symfile.c (reread_symbols): Include bfd_errmsg string in error
message if bfd_close fails.
* exec.c (exec_close), solib.c (clear_solib), corelow.c
(core_close), objfiles.c (free_objfile), irix5-nat.c
(clear_solib), osfsolib.c (clear_solib), remote-utils.c
(gr_load_image): Check for errors from bfd_close.
* solib.c (look_for_base), remote-utils.c (gr_load_image),
remote-udi.c (download), corelow.c (core_open), symfile.c
(symfile_bfd_open), symfile.c (generic_load): Add comment
regarding error from bfd_close.
* remote-udi.c (download), remote-utils.c (gr_load_image): Add
comment about bogus handling of errors from bfd_openr.
* exec.c (exec_close): Add comment regarding memory leak and
dangling reference to vp->name.
1994-10-15 18:28:35 +00:00
|
|
|
|
char *name;
|
1994-10-16 00:19:02 +00:00
|
|
|
|
|
1993-09-25 00:40:20 +00:00
|
|
|
|
inferior_pid = 0; /* Avoid confusion from thread stuff */
|
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
if (core_bfd)
|
|
|
|
|
{
|
|
|
|
|
name = bfd_get_filename (core_bfd);
|
|
|
|
|
if (!bfd_close (core_bfd))
|
|
|
|
|
warning ("cannot close \"%s\": %s",
|
|
|
|
|
name, bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
free (name);
|
|
|
|
|
core_bfd = NULL;
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
#ifdef CLEAR_SOLIB
|
1994-10-16 00:19:02 +00:00
|
|
|
|
CLEAR_SOLIB ();
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
#endif
|
1994-10-16 00:19:02 +00:00
|
|
|
|
if (core_ops.to_sections)
|
|
|
|
|
{
|
|
|
|
|
free ((PTR)core_ops.to_sections);
|
|
|
|
|
core_ops.to_sections = NULL;
|
|
|
|
|
core_ops.to_sections_end = NULL;
|
|
|
|
|
}
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef SOLIB_ADD
|
1994-02-06 16:16:39 +00:00
|
|
|
|
/* Stub function for catch_errors around shared library hacking. FROM_TTYP
|
|
|
|
|
is really an int * which points to from_tty. */
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
|
|
|
|
static int
|
1994-02-06 16:16:39 +00:00
|
|
|
|
solib_add_stub (from_ttyp)
|
|
|
|
|
char *from_ttyp;
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
{
|
1994-09-24 09:00:50 +00:00
|
|
|
|
SOLIB_ADD (NULL, *(int *)from_ttyp, ¤t_target);
|
1994-09-10 08:50:10 +00:00
|
|
|
|
return 0;
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
#endif /* SOLIB_ADD */
|
|
|
|
|
|
1993-09-25 00:40:20 +00:00
|
|
|
|
/* Look for sections whose names start with `.reg/' so that we can extract the
|
|
|
|
|
list of threads in a core file. */
|
|
|
|
|
|
|
|
|
|
static void
|
1993-10-17 01:02:57 +00:00
|
|
|
|
add_to_thread_list (abfd, asect, reg_sect_arg)
|
1993-09-25 00:40:20 +00:00
|
|
|
|
bfd *abfd;
|
|
|
|
|
asection *asect;
|
1993-10-17 01:02:57 +00:00
|
|
|
|
PTR reg_sect_arg;
|
1993-09-25 00:40:20 +00:00
|
|
|
|
{
|
|
|
|
|
int thread_id;
|
1993-10-17 02:05:58 +00:00
|
|
|
|
asection *reg_sect = (asection *) reg_sect_arg;
|
1993-09-25 00:40:20 +00:00
|
|
|
|
|
|
|
|
|
if (strncmp (bfd_section_name (abfd, asect), ".reg/", 5) != 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
thread_id = atoi (bfd_section_name (abfd, asect) + 5);
|
|
|
|
|
|
|
|
|
|
add_thread (thread_id);
|
|
|
|
|
|
|
|
|
|
/* Warning, Will Robinson, looking at BFD private data! */
|
|
|
|
|
|
|
|
|
|
if (asect->filepos == reg_sect->filepos) /* Did we find .reg? */
|
|
|
|
|
inferior_pid = thread_id; /* Yes, make it current */
|
|
|
|
|
}
|
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
/* This routine opens and sets up the core file bfd. */
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
1995-01-28 01:32:10 +00:00
|
|
|
|
static void
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
core_open (filename, from_tty)
|
|
|
|
|
char *filename;
|
|
|
|
|
int from_tty;
|
|
|
|
|
{
|
|
|
|
|
const char *p;
|
|
|
|
|
int siggy;
|
|
|
|
|
struct cleanup *old_chain;
|
|
|
|
|
char *temp;
|
|
|
|
|
bfd *temp_bfd;
|
|
|
|
|
int ontop;
|
|
|
|
|
int scratch_chan;
|
|
|
|
|
|
|
|
|
|
target_preopen (from_tty);
|
|
|
|
|
if (!filename)
|
|
|
|
|
{
|
1994-10-16 00:19:02 +00:00
|
|
|
|
error (core_bfd ?
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
"No core file specified. (Use `detach' to stop debugging a core file.)"
|
|
|
|
|
: "No core file specified.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filename = tilde_expand (filename);
|
1994-10-16 00:19:02 +00:00
|
|
|
|
if (filename[0] != '/')
|
|
|
|
|
{
|
|
|
|
|
temp = concat (current_directory, "/", filename, NULL);
|
|
|
|
|
free (filename);
|
|
|
|
|
filename = temp;
|
|
|
|
|
}
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
|
|
|
|
old_chain = make_cleanup (free, filename);
|
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
scratch_chan = open (filename, write_files ? O_RDWR : O_RDONLY, 0);
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
if (scratch_chan < 0)
|
|
|
|
|
perror_with_name (filename);
|
|
|
|
|
|
1993-08-09 16:53:32 +00:00
|
|
|
|
temp_bfd = bfd_fdopenr (filename, gnutarget, scratch_chan);
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
if (temp_bfd == NULL)
|
1994-10-16 00:19:02 +00:00
|
|
|
|
perror_with_name (filename);
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
|
|
|
|
if (!bfd_check_format (temp_bfd, bfd_core))
|
|
|
|
|
{
|
|
|
|
|
/* Do it after the err msg */
|
* symfile.c (reread_symbols): Include bfd_errmsg string in error
message if bfd_close fails.
* exec.c (exec_close), solib.c (clear_solib), corelow.c
(core_close), objfiles.c (free_objfile), irix5-nat.c
(clear_solib), osfsolib.c (clear_solib), remote-utils.c
(gr_load_image): Check for errors from bfd_close.
* solib.c (look_for_base), remote-utils.c (gr_load_image),
remote-udi.c (download), corelow.c (core_open), symfile.c
(symfile_bfd_open), symfile.c (generic_load): Add comment
regarding error from bfd_close.
* remote-udi.c (download), remote-utils.c (gr_load_image): Add
comment about bogus handling of errors from bfd_openr.
* exec.c (exec_close): Add comment regarding memory leak and
dangling reference to vp->name.
1994-10-15 18:28:35 +00:00
|
|
|
|
/* FIXME: should be checking for errors from bfd_close (for one thing,
|
|
|
|
|
on error it does not free all the storage associated with the
|
|
|
|
|
bfd). */
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
make_cleanup (bfd_close, temp_bfd);
|
1994-10-16 00:19:02 +00:00
|
|
|
|
error ("\"%s\" is not a core dump: %s",
|
|
|
|
|
filename, bfd_errmsg (bfd_get_error ()));
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Looks semi-reasonable. Toss the old core file and work on the new. */
|
|
|
|
|
|
|
|
|
|
discard_cleanups (old_chain); /* Don't free filename any more */
|
|
|
|
|
unpush_target (&core_ops);
|
|
|
|
|
core_bfd = temp_bfd;
|
|
|
|
|
old_chain = make_cleanup (core_close, core_bfd);
|
|
|
|
|
|
|
|
|
|
validate_files ();
|
|
|
|
|
|
|
|
|
|
/* Find the data section */
|
|
|
|
|
if (build_section_table (core_bfd, &core_ops.to_sections,
|
|
|
|
|
&core_ops.to_sections_end))
|
1994-10-16 00:19:02 +00:00
|
|
|
|
error ("\"%s\": Can't find sections: %s",
|
|
|
|
|
bfd_get_filename (core_bfd), bfd_errmsg (bfd_get_error ()));
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
|
|
|
|
ontop = !push_target (&core_ops);
|
|
|
|
|
discard_cleanups (old_chain);
|
|
|
|
|
|
|
|
|
|
p = bfd_core_file_failing_command (core_bfd);
|
|
|
|
|
if (p)
|
|
|
|
|
printf_filtered ("Core was generated by `%s'.\n", p);
|
|
|
|
|
|
|
|
|
|
siggy = bfd_core_file_failing_signal (core_bfd);
|
|
|
|
|
if (siggy > 0)
|
|
|
|
|
printf_filtered ("Program terminated with signal %d, %s.\n", siggy,
|
1994-10-16 00:19:02 +00:00
|
|
|
|
safe_strsignal (siggy));
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
1993-09-25 00:40:20 +00:00
|
|
|
|
/* Build up thread list from BFD sections. */
|
|
|
|
|
|
|
|
|
|
init_thread_list ();
|
|
|
|
|
bfd_map_over_sections (core_bfd, add_to_thread_list,
|
|
|
|
|
bfd_get_section_by_name (core_bfd, ".reg"));
|
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
if (ontop)
|
|
|
|
|
{
|
|
|
|
|
/* Fetch all registers from core file. */
|
|
|
|
|
target_fetch_registers (-1);
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
/* Add symbols and section mappings for any shared libraries. */
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
#ifdef SOLIB_ADD
|
1994-10-16 00:19:02 +00:00
|
|
|
|
catch_errors (solib_add_stub, &from_tty, (char *)0,
|
|
|
|
|
RETURN_MASK_ALL);
|
|
|
|
|
|
|
|
|
|
/* solib_add_stub usually modifies current_target.to_sections, which
|
|
|
|
|
has to be reflected in core_ops to enable proper freeing of
|
|
|
|
|
the to_sections vector in core_close and correct section
|
|
|
|
|
mapping in xfer_memory and core_files_info. */
|
|
|
|
|
core_ops.to_sections = current_target.to_sections;
|
|
|
|
|
core_ops.to_sections_end = current_target.to_sections_end;
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1994-10-16 00:19:02 +00:00
|
|
|
|
/* Now, set up the frame cache, and print the top of stack. */
|
|
|
|
|
flush_cached_frames ();
|
|
|
|
|
select_frame (get_current_frame (), 0);
|
|
|
|
|
print_stack_frame (selected_frame, selected_frame_level, 1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
warning (
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
"you won't be able to access this core file until you terminate\n\
|
1994-07-23 00:53:28 +00:00
|
|
|
|
your %s; do ``info files''", target_longname);
|
1994-10-16 00:19:02 +00:00
|
|
|
|
}
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
1995-01-28 01:32:10 +00:00
|
|
|
|
static void
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
core_detach (args, from_tty)
|
|
|
|
|
char *args;
|
|
|
|
|
int from_tty;
|
|
|
|
|
{
|
|
|
|
|
if (args)
|
|
|
|
|
error ("Too many arguments");
|
|
|
|
|
unpush_target (&core_ops);
|
1993-09-30 21:27:16 +00:00
|
|
|
|
reinit_frame_cache ();
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
if (from_tty)
|
|
|
|
|
printf_filtered ("No core file now.\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the registers out of a core file. This is the machine-
|
|
|
|
|
independent part. Fetch_core_registers is the machine-dependent
|
|
|
|
|
part, typically implemented in the xm-file for each architecture. */
|
|
|
|
|
|
|
|
|
|
/* We just get all the registers, so we don't use regno. */
|
1994-10-16 00:19:02 +00:00
|
|
|
|
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
/* ARGSUSED */
|
|
|
|
|
static void
|
|
|
|
|
get_core_registers (regno)
|
|
|
|
|
int regno;
|
|
|
|
|
{
|
|
|
|
|
sec_ptr reg_sec;
|
|
|
|
|
unsigned size;
|
|
|
|
|
char *the_regs;
|
1993-09-25 00:40:20 +00:00
|
|
|
|
char secname[10];
|
|
|
|
|
|
|
|
|
|
/* Thread support. If inferior_pid is non-zero, then we have found a core
|
|
|
|
|
file with threads (or multiple processes). In that case, we need to
|
|
|
|
|
use the appropriate register section, else we just use `.reg'. */
|
|
|
|
|
|
|
|
|
|
/* XXX - same thing needs to be done for floating-point (.reg2) sections. */
|
|
|
|
|
|
|
|
|
|
if (inferior_pid)
|
|
|
|
|
sprintf (secname, ".reg/%d", inferior_pid);
|
|
|
|
|
else
|
|
|
|
|
strcpy (secname, ".reg");
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
|
1993-09-25 00:40:20 +00:00
|
|
|
|
reg_sec = bfd_get_section_by_name (core_bfd, secname);
|
1994-10-16 00:19:02 +00:00
|
|
|
|
if (!reg_sec)
|
|
|
|
|
goto cant;
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
size = bfd_section_size (core_bfd, reg_sec);
|
|
|
|
|
the_regs = alloca (size);
|
|
|
|
|
if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr)0, size))
|
|
|
|
|
{
|
|
|
|
|
fetch_core_registers (the_regs, size, 0,
|
|
|
|
|
(unsigned) bfd_section_vma (abfd,reg_sec));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cant:
|
1994-10-16 00:19:02 +00:00
|
|
|
|
fprintf_filtered (gdb_stderr,
|
|
|
|
|
"Couldn't fetch registers from core file: %s\n",
|
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now do it again for the float registers, if they exist. */
|
|
|
|
|
reg_sec = bfd_get_section_by_name (core_bfd, ".reg2");
|
1994-10-16 00:19:02 +00:00
|
|
|
|
if (reg_sec)
|
|
|
|
|
{
|
|
|
|
|
size = bfd_section_size (core_bfd, reg_sec);
|
|
|
|
|
the_regs = alloca (size);
|
|
|
|
|
if (bfd_get_section_contents (core_bfd, reg_sec, the_regs, (file_ptr)0,
|
|
|
|
|
size))
|
|
|
|
|
{
|
|
|
|
|
fetch_core_registers (the_regs, size, 2,
|
|
|
|
|
(unsigned) bfd_section_vma (abfd,reg_sec));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fprintf_filtered (gdb_stderr,
|
|
|
|
|
"Couldn't fetch register set 2 from core file: %s\n",
|
|
|
|
|
bfd_errmsg (bfd_get_error ()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
registers_fetched ();
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
core_files_info (t)
|
|
|
|
|
struct target_ops *t;
|
|
|
|
|
{
|
|
|
|
|
print_section_info (t, core_bfd);
|
|
|
|
|
}
|
|
|
|
|
|
1993-07-23 18:18:41 +00:00
|
|
|
|
/* If mourn is being called in all the right places, this could be say
|
1993-10-07 11:16:35 +00:00
|
|
|
|
`gdb internal error' (since generic_mourn calls breakpoint_init_inferior). */
|
1993-07-23 18:18:41 +00:00
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
ignore (addr, contents)
|
|
|
|
|
CORE_ADDR addr;
|
|
|
|
|
char *contents;
|
|
|
|
|
{
|
* Makefile.in (c-exp.tab.o): Remove notice about shift/reduce conflicts
which no longer occur.
gcc -Wall lint:
* findvar.c (symbol_read_needs_frame), corelow.c (ignore),
inflow.c (gdb_has_a_terminal): Make sure to return a value.
* regex.h: Declare re_set_syntax.
* printcmd.c: Include valprint.h.
* infcmd.c, exec.c, maint.c, core.c: Include language.h.
* maint.c: Include expression.h.
* infrun.c, fork-child.c, corelow.c, inflow.c: Include thread.h.
* inftarg.c: Include command.h.
* coredep.c: Include value.h.
* c-exp.y, m2-exp.y, ch-exp.y: Include bfd.h, symfile.h and objfiles.h.
* ch-typeprint.c: Include typeprint.h.
* ch-valprint.c: Include c-lang.h.
* nlmread.c: Include buildsym.h.
* environ.c: Include gdbcore.h. Only include defs.h once.
(set_in_environ): Cast const char * to char * when passing to
set_gnutarget.
Remove unused variables:
* printcmd.c (printf_command): args_to_vprintf.
* coffread.c (coff_symfile_init): strsection.
Move variables to within the #ifdefs where they are used:
* symtab.c (gdb_mangle_name): opname.
* inftarg.c (child_attach): pid and exec_file.
* inftarg.c (child_detach): siggnal.
* objfiles.c (allocate_objfile): mapto, md, and fd.
* objfiles.c (free_objfile): mmfd.
* infrun.c (wait_for_inferior): Include BPSTAT_WHAT_LAST in switch.
* infrun.c (wait_for_inferior): Remove unused same_pid label.
* inferior.h: Declare set_sigint_trap and clear_sigint_trap.
* parser-defs.h: Declare write_exp_elt_block.
* stabsread.h: Declare elfstab_offset_sections and
coffstab_build_psymtabs.
1993-10-21 20:41:50 +00:00
|
|
|
|
return 0;
|
1993-07-23 18:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
struct target_ops core_ops = {
|
* corelow.c, exec.c, inftarg.c, m3-nat.c, op50-rom.c, procfs.c,
remote-adapt.c, remote-e7000.c, remote-eb.c, remote-es.c,
remote-hms.c, remote-mips.c, remote-mm.c, remote-mon.c,
remote-nindy.c, remote-os9k.c, remote-pa.c, remote-sim.c,
remote-st.c, remote-udi.c, remote-vx.c, remote-z8k.c, remote.c,
w89k-rom.c, target.c, target.h: Add support for target_stop().
* gdbtk.c (gdb_stop): Switch to target_stop().
* ChangeLog: Fix comment to make shebs happy...
1994-11-03 22:40:14 +00:00
|
|
|
|
"core", /* to_shortname */
|
|
|
|
|
"Local core dump file", /* to_longname */
|
|
|
|
|
"Use a core file as a target. Specify the filename of the core file.", /* to_doc */
|
|
|
|
|
core_open, /* to_open */
|
|
|
|
|
core_close, /* to_close */
|
|
|
|
|
find_default_attach, /* to_attach */
|
|
|
|
|
core_detach, /* to_detach */
|
|
|
|
|
0, /* to_resume */
|
|
|
|
|
0, /* to_wait */
|
|
|
|
|
get_core_registers, /* to_fetch_registers */
|
|
|
|
|
0, /* to_store_registers */
|
|
|
|
|
0, /* to_prepare_to_store */
|
|
|
|
|
xfer_memory, /* to_xfer_memory */
|
|
|
|
|
core_files_info, /* to_files_info */
|
|
|
|
|
ignore, /* to_insert_breakpoint */
|
|
|
|
|
ignore, /* to_remove_breakpoint */
|
|
|
|
|
0, /* to_terminal_init */
|
|
|
|
|
0, /* to_terminal_inferior */
|
|
|
|
|
0, /* to_terminal_ours_for_output */
|
|
|
|
|
0, /* to_terminal_ours */
|
|
|
|
|
0, /* to_terminal_info */
|
|
|
|
|
0, /* to_kill */
|
|
|
|
|
0, /* to_load */
|
|
|
|
|
0, /* to_lookup_symbol */
|
|
|
|
|
find_default_create_inferior, /* to_create_inferior */
|
|
|
|
|
0, /* to_mourn_inferior */
|
|
|
|
|
0, /* to_can_run */
|
|
|
|
|
0, /* to_notice_signals */
|
|
|
|
|
0, /* to_stop */
|
|
|
|
|
core_stratum, /* to_stratum */
|
|
|
|
|
0, /* to_next */
|
|
|
|
|
0, /* to_has_all_memory */
|
|
|
|
|
1, /* to_has_memory */
|
|
|
|
|
1, /* to_has_stack */
|
|
|
|
|
1, /* to_has_registers */
|
|
|
|
|
0, /* to_has_execution */
|
|
|
|
|
0, /* to_sections */
|
|
|
|
|
0, /* to_sections_end */
|
|
|
|
|
OPS_MAGIC, /* to_magic */
|
Separate core functions along target vector in preparation for
native support. Functions above vector now live in core.c. Those
below in corelow.c.
* core.c (solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved to corelow.c
(_initialize_core): removed addition of core_ops target.
* corelow.c: new file.
(solib_add_stub, core_close, core_open, core_detach,
get_core_registers, core_files_info, core_ops): moved from core.c
(_initialize_corelow): new function.
* gdbcore.h (core_open, core_detach): added prototypes.
(core_ops): add forward declaration.
* Makefile.in (SFILES_MAINDIR): add core.c
(OBS): add core.o
(TSOBS): change core.o to corelow.o
1992-09-25 17:03:55 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_initialize_corelow()
|
|
|
|
|
{
|
|
|
|
|
add_target (&core_ops);
|
|
|
|
|
}
|