From 28444bf3a1e0d6422cb9236baacb6cac11f384de Mon Sep 17 00:00:00 2001 From: Dawn Perchik Date: Mon, 11 Nov 1996 21:02:55 +0000 Subject: * mips-tdep.c, remote-mips.c, values.c, mdebugread.c, config/mips/tm-mips.h: Add/fix bugs for 64-bit mips support. * defs.h: Cleanup; add prototypess * corefile.c: Change FIXME #ifdef * win32-nat.c: Include windefs instead of windows.h. * utils.c: Add routines for printing addresses and registers based on type size. --- gdb/utils.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) (limited to 'gdb/utils.c') diff --git a/gdb/utils.c b/gdb/utils.c index 9687ca0..abb7d11 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2268,10 +2268,11 @@ floatformat_from_doublest (fmt, from, to) if (mant_bits_left == fmt->man_len && fmt->intbit == floatformat_intbit_no) { - mant_long &= 0x7fffffff; + mant_long <<= 1; mant_bits -= 1; } - else if (mant_bits < 32) + + if (mant_bits < 32) { /* The bits we want are in the most significant MANT_BITS bits of mant_long. Move them to the least significant. */ @@ -2284,3 +2285,63 @@ floatformat_from_doublest (fmt, from, to) mant_bits_left -= mant_bits; } } + +/* temporary storage using circular buffer */ +#define MAXCELLS 16 +#define CELLSIZE 32 +char* +get_cell() +{ + static char buf[MAXCELLS][CELLSIZE]; + static int cell=0; + if (++cell>MAXCELLS) cell=0; + return buf[cell]; +} + +/* print routines to handle variable size regs, etc */ +char* +paddr(addr) + t_addr addr; +{ + char *paddr_str=get_cell(); + switch (sizeof(t_addr)) + { + case 8: + sprintf(paddr_str,"%08x%08x", + (unsigned long)(addr>>32),(unsigned long)(addr&0xffffffff)); + break; + case 4: + sprintf(paddr_str,"%08x",(unsigned long)addr); + break; + case 2: + sprintf(paddr_str,"%04x",(unsigned short)(addr&0xffff)); + break; + default: + sprintf(paddr_str,"%x",addr); + } + return paddr_str; +} + +char* +preg(reg) + t_reg reg; +{ + char *preg_str=get_cell(); + switch (sizeof(t_reg)) + { + case 8: + sprintf(preg_str,"%08x%08x", + (unsigned long)(reg>>32),(unsigned long)(reg&0xffffffff)); + break; + case 4: + sprintf(preg_str,"%08x",(unsigned long)reg); + break; + case 2: + sprintf(preg_str,"%04x",(unsigned short)(reg&0xffff)); + break; + default: + sprintf(preg_str,"%x",reg); + } + return preg_str; +} + -- cgit v1.1