diff options
author | Dawn Perchik <dawn@cygnus> | 1996-11-11 21:02:55 +0000 |
---|---|---|
committer | Dawn Perchik <dawn@cygnus> | 1996-11-11 21:02:55 +0000 |
commit | 28444bf3a1e0d6422cb9236baacb6cac11f384de (patch) | |
tree | 22cf8c1c95890224f092567bc591d40f55b7debb /gdb/utils.c | |
parent | 77814fa88214b4a2b27284bb66aeb67689e23187 (diff) | |
download | gdb-28444bf3a1e0d6422cb9236baacb6cac11f384de.zip gdb-28444bf3a1e0d6422cb9236baacb6cac11f384de.tar.gz gdb-28444bf3a1e0d6422cb9236baacb6cac11f384de.tar.bz2 |
* 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.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r-- | gdb/utils.c | 65 |
1 files changed, 63 insertions, 2 deletions
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; +} + |