mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
b52cac6b76
before testing against reg_ptr. * eval.c (evaluate_subexp_standard): Cast type of TYPE_FN_FIELD_VOFFSET to int. * findvar.c (extract_signed_integer, extract_unsigned_integer, extract_long_unsigned_integer): Cast type of sizeof to int. * values.c (unpack_field_as_long, modify_field): Ditto. * valops.c (value_assign, call_function_by_hand): Ditto. * infcmd.c (do_registers_info): Ditto. * ser-tcp.c (tcp_open): Ditto * remote.c (putpkt): Ditto. * dcache.c (dcache_peek): Ditto. * dcache.c (dcache_poke): Ditto. * m2-exp.y (yylex): Ditto. * gnu-regex.c (re_match_2): Ditto. * f-lang.c (ADD_BF_SYMNUM, saved_bf_list_end, tmp_bf_ptr): Ifdef out unused macro definition and variables. * inftarg.c (proc_wait): Move from main.c to here, and make static. * valprint.c (val_print_string): Change bufsize from int to unsigned. * main.c (wait.h): Include * top.c (command_line_input): Remove unused variable "c". * f-typeprint.c (f_type_print_varspec_prefix): Add missing enum value TYPE_CODE_TYPEDEF to switch statement. (f_type_print_varspec_suffix): Add missing enum value TYPE_CODE_TYPEDEF to switch statement. * ch-exp.c (parse_primval): Add remaining enumeration values to switch statement, with no specific action. (ch_lex): Add LOC_UNRESOLVED in switch statement. (pushback_token): Ifdef out, since code using it is ifdef'd out. * stabsread.c (cleanup_undefined_types): Remove unused label "badtype". * objfiles.h (print_symbol_bcache_statistics): Add prototype. * maint.c (objfiles.h): Include. (maintenance_print_statistics): Remove unused variable "temp". * minsyms.c (lookup_minimal_symbol_solib_trampoline): Remove unused variable "found_file_symbol". * m2-exp.y (yylex): Add LOC_UNRESOLVED case to switch. * language.c (lang_bool_type): Use existing function local type variable rather than create block local variables. * solib.c (disable_break): Enclose in ifndef SVR4_SHARED_LIBS. * infptrace.c (wait.h, command.h): Include. * ser-tcp.c (gdb_string.h): Include * i386-tdep.c (codestream_seek): Change "place" to CORE_ADDR. (i386_get_frame_setup): Change "pc" from int to CORE_ADDR. * command.c (complete_on_enum): Make assignment used as truth value explictly check against NULL. (wait.h): Include. * infrun.c (wait_for_inferior): Ifdef out prologue_pc since code that uses it is ifdef'd out. * parser-defs.h: Add prototype for write_dollar_variable. * infrun.c: Add prototype for write_pc_pid. * breakpoint.h: Add prototype for re_enable_breakpoints_in_shlibs. * symmisc.c (bcache.h): Include. * bcache.h: Add prototype for print_bcache_statistics. * symfile.c: Include <time.h>. * printcmd.c (print_scalar_formatted): Change len to unsigned int. * valarith.c (value_equal): Cast result of TYPE_LENGTH to int. * valarith.c (value_binop): Change result_len, promoted_len1, and promoted_len2 to unsigned int. * valarith.c (value_subscripted_rvalue): Change elt_offs and elt_size to unsigned int. * valops.c (value_array): Change typelength to unsigned int. (destructor_name_p): Change len to unsigned int. * scm-lang.h (scm_parse): Add prototype for scm_unpack. * symfile.c (decrement_reading_symtab): Change return type to void. * valarith.c (value_subscript): Remove unused variable "word". (value_subscript): Remove unused variable "tint". * valops.c (auto_abandon): Ifdef out, since code using it is also ifdef'd out. * eval.c (init_array_element): Remove unused variable "val". * Makefile.in (values.o): Depends on scm-lang.h. (command.o): Depends upon wait_h. (ser-tcp.o): Depends upon gdb_string.h. (infptrace.o): Depends upon wait_h and command_h. (maint.o): Depends on objfiles.h and symfile.h. * values.c (allocate_repeat_value): Remove unused variable "element_type". (scm-lang.h): Include. * breakpoint.c (create_longjmp_breakpoint): Enclose in GET_LONGJMP_TARGET define, unused otherwise. * config/i386/nm-linux.h: Add prototypes for i386_insert_watchpoint, i386_remove_watchpoint and i386_stopped_by_watchpoint.
144 lines
4.2 KiB
C
144 lines
4.2 KiB
C
/* Extract registers from a "standard" core file, for GDB.
|
||
Copyright (C) 1988-1995 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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||
|
||
/* Typically used on systems that have a.out format executables.
|
||
corefile.c is supposed to contain the more machine-independent
|
||
aspects of reading registers from core files, while this file is
|
||
more machine specific. */
|
||
|
||
#include "defs.h"
|
||
#include <sys/types.h>
|
||
#include <sys/param.h>
|
||
#include "gdbcore.h"
|
||
#include "value.h" /* For supply_register. */
|
||
#include "inferior.h" /* For ARCH_NUM_REGS. */
|
||
|
||
/* These are needed on various systems to expand REGISTER_U_ADDR. */
|
||
#ifndef USG
|
||
#include <sys/dir.h>
|
||
#include <sys/file.h>
|
||
#include "gdb_stat.h"
|
||
#include <sys/user.h>
|
||
#ifndef NO_PTRACE_H
|
||
# ifdef PTRACE_IN_WRONG_PLACE
|
||
# include <ptrace.h>
|
||
# else /* !PTRACE_IN_WRONG_PLACE */
|
||
# include <sys/ptrace.h>
|
||
# endif /* !PTRACE_IN_WRONG_PLACE */
|
||
#endif /* NO_PTRACE_H */
|
||
#endif
|
||
|
||
#ifndef CORE_REGISTER_ADDR
|
||
#define CORE_REGISTER_ADDR(regno, regptr) register_addr(regno, regptr)
|
||
#endif /* CORE_REGISTER_ADDR */
|
||
|
||
#ifdef NEED_SYS_CORE_H
|
||
#include <sys/core.h>
|
||
#endif
|
||
|
||
/* Extract the register values out of the core file and store
|
||
them where `read_register' will find them.
|
||
|
||
CORE_REG_SECT points to the register values themselves, read into memory.
|
||
CORE_REG_SIZE is the size of that area.
|
||
WHICH says which set of registers we are handling (0 = int, 2 = float
|
||
on machines where they are discontiguous).
|
||
REG_ADDR is the offset from u.u_ar0 to the register values relative to
|
||
core_reg_sect. This is used with old-fashioned core files to
|
||
locate the registers in a large upage-plus-stack ".reg" section.
|
||
Original upage address X is at location core_reg_sect+x+reg_addr.
|
||
*/
|
||
|
||
static void
|
||
fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
|
||
char *core_reg_sect;
|
||
unsigned core_reg_size;
|
||
int which;
|
||
unsigned reg_addr;
|
||
{
|
||
register int regno;
|
||
register unsigned int addr;
|
||
int bad_reg = -1;
|
||
register reg_ptr = -reg_addr; /* Original u.u_ar0 is -reg_addr. */
|
||
int numregs = ARCH_NUM_REGS;
|
||
|
||
/* If u.u_ar0 was an absolute address in the core file, relativize it now,
|
||
so we can use it as an offset into core_reg_sect. When we're done,
|
||
"register 0" will be at core_reg_sect+reg_ptr, and we can use
|
||
CORE_REGISTER_ADDR to offset to the other registers. If this is a modern
|
||
core file without a upage, reg_ptr will be zero and this is all a big
|
||
NOP. */
|
||
if (reg_ptr > (int) core_reg_size)
|
||
reg_ptr -= KERNEL_U_ADDR;
|
||
|
||
for (regno = 0; regno < numregs; regno++)
|
||
{
|
||
addr = CORE_REGISTER_ADDR (regno, reg_ptr);
|
||
if (addr >= core_reg_size) {
|
||
if (bad_reg < 0)
|
||
bad_reg = regno;
|
||
} else {
|
||
supply_register (regno, core_reg_sect + addr);
|
||
}
|
||
}
|
||
if (bad_reg >= 0)
|
||
{
|
||
error ("Register %s not found in core file.", reg_names[bad_reg]);
|
||
}
|
||
}
|
||
|
||
|
||
#ifdef REGISTER_U_ADDR
|
||
|
||
/* Return the address in the core dump or inferior of register REGNO.
|
||
BLOCKEND is the address of the end of the user structure. */
|
||
|
||
unsigned int
|
||
register_addr (regno, blockend)
|
||
int regno;
|
||
int blockend;
|
||
{
|
||
int addr;
|
||
|
||
if (regno < 0 || regno >= ARCH_NUM_REGS)
|
||
error ("Invalid register number %d.", regno);
|
||
|
||
REGISTER_U_ADDR (addr, blockend, regno);
|
||
|
||
return addr;
|
||
}
|
||
|
||
#endif /* REGISTER_U_ADDR */
|
||
|
||
|
||
/* Register that we are able to handle aout (trad-core) file formats. */
|
||
|
||
static struct core_fns aout_core_fns =
|
||
{
|
||
bfd_target_unknown_flavour,
|
||
fetch_core_registers,
|
||
NULL
|
||
};
|
||
|
||
void
|
||
_initialize_core_aout ()
|
||
{
|
||
add_core_fns (&aout_core_fns);
|
||
}
|