diff options
author | Daniel Jacobowitz <drow@false.org> | 2001-07-11 18:39:12 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2001-07-11 18:39:12 +0000 |
commit | f175af981800f9ab8fbcd8af1823c1ab411404ab (patch) | |
tree | 0041683cc019b5dbc06b11f7c2e75c4d88aa5eb0 /gdb/m68klinux-nat.c | |
parent | 216246961f047f51248e0c8d724c4b0be919c383 (diff) | |
download | gdb-f175af981800f9ab8fbcd8af1823c1ab411404ab.zip gdb-f175af981800f9ab8fbcd8af1823c1ab411404ab.tar.gz gdb-f175af981800f9ab8fbcd8af1823c1ab411404ab.tar.bz2 |
fix m68k-linux build
Diffstat (limited to 'gdb/m68klinux-nat.c')
-rw-r--r-- | gdb/m68klinux-nat.c | 84 |
1 files changed, 79 insertions, 5 deletions
diff --git a/gdb/m68klinux-nat.c b/gdb/m68klinux-nat.c index 414f0d4..8ab0aed 100644 --- a/gdb/m68klinux-nat.c +++ b/gdb/m68klinux-nat.c @@ -66,9 +66,9 @@ m68k_linux_register_u_addr (int blockend, int regnum) return (blockend + 4 * regmap[regnum]); } -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ +/* Given a pointer to a general register set in /proc format + (elf_gregset_t *), unpack the register contents and supply + them as gdb's idea of the current register values. */ /* Note both m68k-tdep.c and m68klinux-nat.c contain definitions @@ -85,7 +85,7 @@ m68k_linux_register_u_addr (int blockend, int regnum) #include "gregset.h" void -supply_gregset (gregset_t *gregsetp) +supply_gregset (elf_gregset_t *gregsetp) { int regi; @@ -100,7 +100,7 @@ supply_gregset (gregset_t *gregsetp) idea of the current floating point register values. */ void -supply_fpregset (fpregset_t *fpregsetp) +supply_fpregset (elf_fpregset_t *fpregsetp) { int regi; @@ -112,6 +112,62 @@ supply_fpregset (fpregset_t *fpregsetp) } #endif + + +/* Interpreting register set info found in core files. */ + +/* Provide registers to GDB from a core file. + + (We can't use the generic version of this function in + core-regset.c, because we need to use elf_gregset_t instead of + gregset_t.) + + CORE_REG_SECT points to an array of bytes, which are the contents + of a `note' from a core file which BFD thinks might contain + register contents. CORE_REG_SIZE is its size. + + WHICH says which register set corelow suspects this is: + 0 --- the general-purpose register set, in elf_gregset_t format + 2 --- the floating-point register set, in elf_fpregset_t format + + REG_ADDR isn't used on Linux. */ + +static void +fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, + int which, CORE_ADDR reg_addr) +{ + elf_gregset_t gregset; + elf_fpregset_t fpregset; + + switch (which) + { + case 0: + if (core_reg_size != sizeof (gregset)) + warning ("Wrong size gregset in core file."); + else + { + memcpy (&gregset, core_reg_sect, sizeof (gregset)); + supply_gregset (&gregset); + } + break; + + case 2: + if (core_reg_size != sizeof (fpregset)) + warning ("Wrong size fpregset in core file."); + else + { + memcpy (&fpregset, core_reg_sect, sizeof (fpregset)); + supply_fpregset (&fpregset); + } + break; + + default: + /* We've covered all the kinds of registers we know about here, + so this must be something we wouldn't know what to do with + anyway. Just ignore it. */ + break; + } +} int @@ -153,3 +209,21 @@ in_sigtramp (CORE_ADDR pc) return 0; } + + +/* Register that we are able to handle Linux ELF core file formats. */ + +static struct core_fns linux_elf_core_fns = +{ + bfd_target_elf_flavour, /* core_flavour */ + default_check_format, /* check_format */ + default_core_sniffer, /* core_sniffer */ + fetch_core_registers, /* core_read_registers */ + NULL /* next */ +}; + +void +_initialize_m68k_linux_nat () +{ + add_core_fns (&linux_elf_core_fns); +} |