Fri Apr 10 10:35:35 1998 John Metzler <jmetzler@cygnus.com>
+ * utils.c (fmthex): A formatting function for hexdumps
+
* mips-tdep.c (unpack_mips16): Fixed instruction decoding, lots of
bit pattern interpretations. mips_fetch_instruction does not work
for 16 bit instructions. Some confusion remains about sign
static void fputs_maybe_filtered PARAMS ((const char *, FILE *, int));
-#if !defined (NO_MMALLOC) && !defined (NO_MMCHECK)
+#if defined (USE_MMALLOC) && !defined (NO_MMCHECK)
static void malloc_botch PARAMS ((void));
#endif
gdb_flush (gdb_stderr);
/* 3. The system-level buffer. */
- SERIAL_FLUSH_OUTPUT (gdb_stdout_serial);
+ SERIAL_DRAIN_OUTPUT (gdb_stdout_serial);
SERIAL_UN_FDOPEN (gdb_stdout_serial);
annotate_error_begin ();
#endif
#endif
-#if defined (NO_MMALLOC)
+#if !defined (USE_MMALLOC)
PTR
mmalloc (md, size)
free (ptr);
}
-#endif /* NO_MMALLOC */
+#endif /* USE_MMALLOC */
-#if defined (NO_MMALLOC) || defined (NO_MMCHECK)
+#if !defined (USE_MMALLOC) || defined (NO_MMCHECK)
void
init_malloc (md)
fprintf_filtered (stream, "%c", c);
}
}
+
+
+
+
+static char * hexlate = "0123456789abcdef" ;
+int fmthex(inbuf,outbuff,length,linelength)
+ unsigned char * inbuf ;
+ unsigned char * outbuff;
+ int length;
+ int linelength;
+{
+ unsigned char byte , nib ;
+ int outlength = 0 ;
+
+ while (length)
+ {
+ if (outlength >= linelength) break ;
+ byte = *inbuf ;
+ inbuf++ ;
+ nib = byte >> 4 ;
+ *outbuff++ = hexlate[nib] ;
+ nib = byte &0x0f ;
+ *outbuff++ = hexlate[nib] ;
+ *outbuff++ = ' ' ;
+ length-- ;
+ outlength += 3 ;
+ }
+ *outbuff = '\0' ; /* null terminate our output line */
+ return outlength ;
+}
+
\f
/* Number of lines per page or UINT_MAX if paging is disabled. */
static unsigned int lines_per_page;