Replace preg() with phex(). Cleanup monitor.c.
This commit is contained in:
parent
e8475ad463
commit
5683e87aa5
5 changed files with 56 additions and 87 deletions
|
@ -1,3 +1,16 @@
|
|||
Mon May 22 12:05:13 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* defs.h (t_reg): Delete typedef.
|
||||
(preg, preg_nz): Delete function. Replaced by phex and phex_nz.
|
||||
* utils.c (phex, phex_nz): New functions.
|
||||
(paddr, paddr_nz): Use.
|
||||
|
||||
* monitor.c (monitor_store_register): Replace preg with phex.
|
||||
|
||||
Mon May 22 11:46:01 2000 Andrew Cagney <cagney@b1.cygnus.com>
|
||||
|
||||
* TODO: Add note on typecast using catch_errors_ftype.
|
||||
|
||||
2000-05-21 Mark Kettenis <kettenis@gnu.org>
|
||||
|
||||
* i387-tdep.c (print_i387_value): Cast &value to (char *) in
|
||||
|
|
11
gdb/TODO
11
gdb/TODO
|
@ -250,6 +250,12 @@ http://sourceware.cygnus.com/ml/gdb-patches/2000-q1/msg00814.html
|
|||
|
||||
--
|
||||
|
||||
Elimination of ``(catch_errors_ftype *) func''.
|
||||
|
||||
Like make_cleanup_func it isn't portable.
|
||||
|
||||
--
|
||||
|
||||
Re: Various C++ things
|
||||
|
||||
value_headof/value_from_vtable_info are worthless, and should be removed.
|
||||
|
@ -348,13 +354,14 @@ Send debug and log output log gdb_stdlog.
|
|||
|
||||
GDB still contains many cases where (f)printf or printf_filtered () is
|
||||
used when it should be sending the messages to gdb_stderror or
|
||||
gdb_stdlog.
|
||||
gdb_stdlog. The thought of #defining printf to something has crossed
|
||||
peoples minds ;-)
|
||||
|
||||
--
|
||||
|
||||
Rationalize the host-endian code (grep for HOST_BYTE_ORDER).
|
||||
|
||||
At preent defs.h includes <endian.h> (which is linux specific) yet
|
||||
At present defs.h includes <endian.h> (which is linux specific) yet
|
||||
almost nothing depends on it. Suggest "gdb_endian.h" which can also
|
||||
handle <machine/endian.h> and only include that where it is really
|
||||
needed.
|
||||
|
|
|
@ -482,9 +482,8 @@ extern char *paddr_nz (CORE_ADDR addr);
|
|||
extern char *paddr_u (CORE_ADDR addr);
|
||||
extern char *paddr_d (LONGEST addr);
|
||||
|
||||
typedef bfd_vma t_reg;
|
||||
extern char *preg (t_reg reg);
|
||||
extern char *preg_nz (t_reg reg);
|
||||
extern char *phex (ULONGEST l, int sizeof_l);
|
||||
extern char *phex_nz (ULONGEST l, int sizeof_l);
|
||||
|
||||
extern void fprintf_symbol_filtered (struct ui_file *, char *,
|
||||
enum language, int);
|
||||
|
|
|
@ -1377,7 +1377,8 @@ monitor_store_register (regno)
|
|||
}
|
||||
|
||||
val = read_register (regno);
|
||||
monitor_debug ("MON storeg %d %s\n", regno, preg (val));
|
||||
monitor_debug ("MON storeg %d %s\n", regno,
|
||||
phex (val, REGISTER_RAW_SIZE (regno)));
|
||||
|
||||
/* send the register deposit command */
|
||||
|
||||
|
|
111
gdb/utils.c
111
gdb/utils.c
|
@ -2836,6 +2836,8 @@ floatformat_from_doublest (fmt, from, to)
|
|||
}
|
||||
}
|
||||
|
||||
/* print routines to handle variable size regs, etc. */
|
||||
|
||||
/* temporary storage using circular buffer */
|
||||
#define NUMCELLS 16
|
||||
#define CELLSIZE 32
|
||||
|
@ -2849,79 +2851,22 @@ get_cell ()
|
|||
return buf[cell];
|
||||
}
|
||||
|
||||
/* print routines to handle variable size regs, etc.
|
||||
|
||||
FIXME: Note that t_addr is a bfd_vma, which is currently either an
|
||||
unsigned long or unsigned long long, determined at configure time.
|
||||
If t_addr is an unsigned long long and sizeof (unsigned long long)
|
||||
is greater than sizeof (unsigned long), then I believe this code will
|
||||
probably lose, at least for little endian machines. I believe that
|
||||
it would also be better to eliminate the switch on the absolute size
|
||||
of t_addr and replace it with a sequence of if statements that compare
|
||||
sizeof t_addr with sizeof the various types and do the right thing,
|
||||
which includes knowing whether or not the host supports long long.
|
||||
-fnf
|
||||
|
||||
*/
|
||||
|
||||
int
|
||||
strlen_paddr (void)
|
||||
{
|
||||
return (TARGET_PTR_BIT / 8 * 2);
|
||||
}
|
||||
|
||||
|
||||
/* eliminate warning from compiler on 32-bit systems */
|
||||
static int thirty_two = 32;
|
||||
|
||||
char *
|
||||
paddr (CORE_ADDR addr)
|
||||
{
|
||||
char *paddr_str = get_cell ();
|
||||
switch (TARGET_PTR_BIT / 8)
|
||||
{
|
||||
case 8:
|
||||
sprintf (paddr_str, "%08lx%08lx",
|
||||
(unsigned long) (addr >> thirty_two), (unsigned long) (addr & 0xffffffff));
|
||||
break;
|
||||
case 4:
|
||||
sprintf (paddr_str, "%08lx", (unsigned long) addr);
|
||||
break;
|
||||
case 2:
|
||||
sprintf (paddr_str, "%04x", (unsigned short) (addr & 0xffff));
|
||||
break;
|
||||
default:
|
||||
sprintf (paddr_str, "%lx", (unsigned long) addr);
|
||||
}
|
||||
return paddr_str;
|
||||
return phex (addr, TARGET_PTR_BIT / 8);
|
||||
}
|
||||
|
||||
char *
|
||||
paddr_nz (CORE_ADDR addr)
|
||||
{
|
||||
char *paddr_str = get_cell ();
|
||||
switch (TARGET_PTR_BIT / 8)
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
unsigned long high = (unsigned long) (addr >> thirty_two);
|
||||
if (high == 0)
|
||||
sprintf (paddr_str, "%lx", (unsigned long) (addr & 0xffffffff));
|
||||
else
|
||||
sprintf (paddr_str, "%lx%08lx",
|
||||
high, (unsigned long) (addr & 0xffffffff));
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
sprintf (paddr_str, "%lx", (unsigned long) addr);
|
||||
break;
|
||||
case 2:
|
||||
sprintf (paddr_str, "%x", (unsigned short) (addr & 0xffff));
|
||||
break;
|
||||
default:
|
||||
sprintf (paddr_str, "%lx", (unsigned long) addr);
|
||||
}
|
||||
return paddr_str;
|
||||
return phex_nz (addr, TARGET_PTR_BIT / 8);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2976,54 +2921,58 @@ paddr_d (LONGEST addr)
|
|||
return paddr_str;
|
||||
}
|
||||
|
||||
/* eliminate warning from compiler on 32-bit systems */
|
||||
static int thirty_two = 32;
|
||||
|
||||
char *
|
||||
preg (reg)
|
||||
t_reg reg;
|
||||
phex (ULONGEST l, int sizeof_l)
|
||||
{
|
||||
char *preg_str = get_cell ();
|
||||
switch (sizeof (t_reg))
|
||||
char *str = get_cell ();
|
||||
switch (sizeof_l)
|
||||
{
|
||||
case 8:
|
||||
sprintf (preg_str, "%08lx%08lx",
|
||||
(unsigned long) (reg >> thirty_two), (unsigned long) (reg & 0xffffffff));
|
||||
sprintf (str, "%08lx%08lx",
|
||||
(unsigned long) (l >> thirty_two),
|
||||
(unsigned long) (l & 0xffffffff));
|
||||
break;
|
||||
case 4:
|
||||
sprintf (preg_str, "%08lx", (unsigned long) reg);
|
||||
sprintf (str, "%08lx", (unsigned long) l);
|
||||
break;
|
||||
case 2:
|
||||
sprintf (preg_str, "%04x", (unsigned short) (reg & 0xffff));
|
||||
sprintf (str, "%04x", (unsigned short) (l & 0xffff));
|
||||
break;
|
||||
default:
|
||||
sprintf (preg_str, "%lx", (unsigned long) reg);
|
||||
phex (l, sizeof (l));
|
||||
break;
|
||||
}
|
||||
return preg_str;
|
||||
return str;
|
||||
}
|
||||
|
||||
char *
|
||||
preg_nz (reg)
|
||||
t_reg reg;
|
||||
phex_nz (ULONGEST l, int sizeof_l)
|
||||
{
|
||||
char *preg_str = get_cell ();
|
||||
switch (sizeof (t_reg))
|
||||
char *str = get_cell ();
|
||||
switch (sizeof_l)
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
unsigned long high = (unsigned long) (reg >> thirty_two);
|
||||
unsigned long high = (unsigned long) (l >> thirty_two);
|
||||
if (high == 0)
|
||||
sprintf (preg_str, "%lx", (unsigned long) (reg & 0xffffffff));
|
||||
sprintf (str, "%lx", (unsigned long) (l & 0xffffffff));
|
||||
else
|
||||
sprintf (preg_str, "%lx%08lx",
|
||||
high, (unsigned long) (reg & 0xffffffff));
|
||||
sprintf (str, "%lx%08lx",
|
||||
high, (unsigned long) (l & 0xffffffff));
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
sprintf (preg_str, "%lx", (unsigned long) reg);
|
||||
sprintf (str, "%lx", (unsigned long) l);
|
||||
break;
|
||||
case 2:
|
||||
sprintf (preg_str, "%x", (unsigned short) (reg & 0xffff));
|
||||
sprintf (str, "%x", (unsigned short) (l & 0xffff));
|
||||
break;
|
||||
default:
|
||||
sprintf (preg_str, "%lx", (unsigned long) reg);
|
||||
phex_nz (l, sizeof (l));
|
||||
break;
|
||||
}
|
||||
return preg_str;
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue