From fb182850985cdd243f9e4782e83a141edb5aabdf Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Tue, 12 Nov 1991 03:23:32 +0000 Subject: [PATCH] Minor rewording of message containing name of program that generated a core file (core.c), permanently remove the register_addr() stub (elfread.c), move a misplaced #endif (procfs.c), and add fetch_core_registers func for core file support (procfs.c). --- gdb/ChangeLog | 12 ++++++++++ gdb/core.c | 2 +- gdb/elfread.c | 17 -------------- gdb/procfs.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 75 insertions(+), 19 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e5c8bf38652..fdcea0c5dbe 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,15 @@ +Mon Nov 11 19:14:31 1991 Fred Fish (fnf at cygnus.com) + + * core.c: Minor rewording of message to user containing name of + (and possibly arguments to) the program that generated a core + file. + + * elfread.c: Remove the register_addr() stub now that it is no + longer needed. + + * procfs.c: Move misplaced #endif for ATTACH_DETACH. Add new + fetch_core_registers() function for core file support. + Sat Nov 9 13:37:57 1991 Fred Fish (fnf at cygnus.com) * dwarfread.c (dwarf_psymtab_to_symtab): Remove leftover call diff --git a/gdb/core.c b/gdb/core.c index ba1299268df..8ff3119bb3b 100644 --- a/gdb/core.c +++ b/gdb/core.c @@ -155,7 +155,7 @@ core_open (filename, from_tty) p = bfd_core_file_failing_command (core_bfd); if (p) - printf ("Core file invoked as `%s'.\n", p); + printf ("Core was generated by `%s'.\n", p); siggy = bfd_core_file_failing_signal (core_bfd); if (siggy > 0) diff --git a/gdb/elfread.c b/gdb/elfread.c index b442e65ca62..49b5d3415f5 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -63,23 +63,6 @@ struct elfinfo { unsigned int lnsize; /* Size of dwarf line number section */ }; -#ifndef REGISTER_U_ADDR - -/* FIXME - crude hack to resolve undefined global. If REGISTER_U_ADDR - is defined, this function gets compiled into coredep.c. If not, - it is left unresolved, so we need to resolve it until corefile - support for ELF corefiles is finished. */ - -unsigned int -DEFUN(register_addr, (regno, blockend), - int regno AND - int blockend) -{ - error ("Fetching registers from corefiles unimplemented."); -} - -#endif - /* We are called once per section from elf_symfile_read. We need to examine each section we are passed, check to see if it is something we are interested in processing, and diff --git a/gdb/procfs.c b/gdb/procfs.c index a2773699538..c745997273d 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -634,6 +634,8 @@ DEFUN(detach, (signal), attach_flag = 0; } +#endif /* ATTACH_DETACH */ + /* GLOBAL FUNCTION @@ -873,7 +875,66 @@ DEFUN_VOID(fetch_inferior_registers) #endif } -#endif /* ATTACH_DETACH */ +/* + +GLOBAL FUNCTION + + fetch_core_registers -- fetch current registers from core file data + +SYNOPSIS + + void fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, + int which) + +DESCRIPTION + + Read the values of either the general register set (WHICH equals 0) + or the floating point register set (WHICH equals 2) from the core + file data (pointed to by CORE_REG_SECT), and update gdb's idea of + their current values. The CORE_REG_SIZE parameter is ignored. + +NOTES + + Use the indicated sizes to validate the gregset and fpregset + structures. +*/ + +void +fetch_core_registers (core_reg_sect, core_reg_size, which) + char *core_reg_sect; + unsigned core_reg_size; + int which; +{ + + if (which == 0) + { + if (core_reg_size != sizeof (pi.gregset)) + { + warning ("wrong size gregset struct in core file"); + } + else + { + (void) memcpy ((char *) &pi.gregset, core_reg_sect, + sizeof (pi.gregset)); + supply_gregset (&pi.gregset); + } + } + else if (which == 2) + { + if (core_reg_size != sizeof (pi.fpregset)) + { + warning ("wrong size fpregset struct in core file"); + } + else + { + (void) memcpy ((char *) &pi.fpregset, core_reg_sect, + sizeof (pi.fpregset)); +#if defined (FP0_REGNUM) + supply_fpregset (&pi.fpregset); +#endif + } + } +} /* -- 2.30.2