Patch for gdb to correctly read elf core dumps

Thomas Bogendoerfer (tsbogend@alpha.franken.de)
Sun, 15 Feb 1998 22:42:04 +0100


While trying to debug some programs, I've noticed that gdb doesn't
like the elf core file when it comes to the registers in the core file.
So I looked a little bit closer, how an elf core looks like, and found
out, that the register layout in an elf core is different from that of
an ecoff core. But gdb does handle it nearly the same. Below is a patch
which fixes this.

Thomas.

diff -ru gdb-4.16.orig/gdb/alpha-nat.c gdb-4.16/gdb/alpha-nat.c
--- gdb-4.16.orig/gdb/alpha-nat.c Sun Feb 15 22:31:35 1998
+++ gdb-4.16/gdb/alpha-nat.c Sun Feb 15 22:34:22 1998
@@ -146,15 +146,15 @@
static int core_reg_mapping[NUM_REGS] =
{
#define EFL (EF_SIZE / 8)
- EF_V0, EF_T0, EF_T1, EF_T2, EF_T3, EF_T4, EF_T5, EF_T6,
- EF_T7, EF_S0, EF_S1, EF_S2, EF_S3, EF_S4, EF_S5, EF_S6,
- EF_A0, EF_A1, EF_A2, EF_A3, EF_A4, EF_A5, EF_T8, EF_T9,
- EF_T10, EF_T11, EF_RA, EF_T12, EF_AT, EF_GP, EF_SP, -1,
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, -1,
EFL+0, EFL+1, EFL+2, EFL+3, EFL+4, EFL+5, EFL+6, EFL+7,
EFL+8, EFL+9, EFL+10, EFL+11, EFL+12, EFL+13, EFL+14, EFL+15,
EFL+16, EFL+17, EFL+18, EFL+19, EFL+20, EFL+21, EFL+22, EFL+23,
EFL+24, EFL+25, EFL+26, EFL+27, EFL+28, EFL+29, EFL+30, EFL+31,
- EF_PC, -1
+ 31, -1
};

static char zerobuf[MAX_REGISTER_RAW_SIZE] = {0};

-- 
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
                   [Linus Torvalds in <4rikft$7g5@linux.cs.Helsinki.FI>]