Module Name: src Committed By: skrll Date: Sat Nov 3 15:06:55 UTC 2012
Modified Files: src/external/gpl3/gdb/dist/gdb: mipsnbsd-tdep.c Log Message: Supply MIPS_ZERO_REGNUM and MIPS_UNUSED_REGNUM (as zero). Idea stolen from mips-linux-tdep.c To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/mipsnbsd-tdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/gpl3/gdb/dist/gdb/mipsnbsd-tdep.c diff -u src/external/gpl3/gdb/dist/gdb/mipsnbsd-tdep.c:1.1.1.1 src/external/gpl3/gdb/dist/gdb/mipsnbsd-tdep.c:1.2 --- src/external/gpl3/gdb/dist/gdb/mipsnbsd-tdep.c:1.1.1.1 Sat Sep 24 20:11:33 2011 +++ src/external/gpl3/gdb/dist/gdb/mipsnbsd-tdep.c Sat Nov 3 15:06:55 2012 @@ -83,15 +83,23 @@ mipsnbsd_supply_gregset (const struct re const void *gregs, size_t len) { size_t regsize = mips_isa_regsize (get_regcache_arch (regcache)); + char zerobuf[MAX_REGISTER_SIZE]; const char *regs = gregs; int i; + memset (zerobuf, 0, MAX_REGISTER_SIZE); + gdb_assert (len >= MIPSNBSD_NUM_GREGS * regsize); for (i = 0; i <= MIPS_PC_REGNUM; i++) { if (regnum == i || regnum == -1) - regcache_raw_supply (regcache, i, regs + i * regsize); + { + if (i == MIPS_ZERO_REGNUM || i == MIPS_UNUSED_REGNUM) + regcache_raw_supply (regcache, i, zerobuf); + else + regcache_raw_supply (regcache, i, regs + i * regsize); + } } if (len >= (MIPSNBSD_NUM_GREGS + MIPSNBSD_NUM_FPREGS) * regsize) @@ -144,13 +152,18 @@ void mipsnbsd_supply_reg (struct regcache *regcache, const char *regs, int regno) { struct gdbarch *gdbarch = get_regcache_arch (regcache); + char zerobuf[MAX_REGISTER_SIZE]; int i; + memset (zerobuf, 0, MAX_REGISTER_SIZE); + for (i = 0; i <= gdbarch_pc_regnum (gdbarch); i++) { if (regno == i || regno == -1) { - if (gdbarch_cannot_fetch_register (gdbarch, i)) + if (i == MIPS_ZERO_REGNUM || i == MIPS_UNUSED_REGNUM) + regcache_raw_supply (regcache, i, zerobuf); + else if (gdbarch_cannot_fetch_register (gdbarch, i)) regcache_raw_supply (regcache, i, NULL); else regcache_raw_supply (regcache, i,