forked from Imagelibrary/rtems
New files added to ease debugging.
This commit is contained in:
55
c/src/lib/libmisc/dumpbuf/Makefile.in
Normal file
55
c/src/lib/libmisc/dumpbuf/Makefile.in
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
RTEMS_ROOT = @top_srcdir@
|
||||||
|
PROJECT_ROOT = @PROJECT_ROOT@
|
||||||
|
|
||||||
|
LIB=${ARCH}/libdumpbuf-tmp.a
|
||||||
|
|
||||||
|
# C source names, if any, go here -- minus the .c
|
||||||
|
C_PIECES=dumpbuf
|
||||||
|
C_FILES=$(C_PIECES:%=%.c)
|
||||||
|
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
|
||||||
|
|
||||||
|
H_FILES=
|
||||||
|
INSTALLED_H_FILES=$(srcdir)/dumpbuf.h
|
||||||
|
|
||||||
|
SRCS=$(C_FILES) $(H_FILES) $(INSTALLED_H_FILES)
|
||||||
|
OBJS=$(C_O_FILES)
|
||||||
|
|
||||||
|
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||||
|
include $(RTEMS_ROOT)/make/lib.cfg
|
||||||
|
|
||||||
|
#
|
||||||
|
# (OPTIONAL) Add local stuff here using +=
|
||||||
|
#
|
||||||
|
|
||||||
|
DEFINES +=
|
||||||
|
CPPFLAGS += -I.
|
||||||
|
CFLAGS +=
|
||||||
|
|
||||||
|
LD_PATHS +=
|
||||||
|
LD_LIBS +=
|
||||||
|
LDFLAGS +=
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add your list of files to delete here. The config files
|
||||||
|
# already know how to delete some stuff, so you may want
|
||||||
|
# to just run 'make clean' first to see what gets missed.
|
||||||
|
# 'make clobber' already includes 'make clean'
|
||||||
|
#
|
||||||
|
|
||||||
|
CLEAN_ADDITIONS +=
|
||||||
|
CLOBBER_ADDITIONS +=
|
||||||
|
|
||||||
|
${LIB}: ${SRCS} preinstall ${OBJS}
|
||||||
|
$(make-library)
|
||||||
|
|
||||||
|
all: ${ARCH} $(SRCS) preinstall $(LIB)
|
||||||
|
|
||||||
|
preinstall:
|
||||||
|
$(INSTALL) -m 444 ${INSTALLED_H_FILES} $(PROJECT_INCLUDE)/rtems
|
||||||
75
c/src/lib/libmisc/dumpbuf/dumpbuf.c
Normal file
75
c/src/lib/libmisc/dumpbuf/dumpbuf.c
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1997.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may in
|
||||||
|
* the file LICENSE in this distribution or at
|
||||||
|
* http://www.OARcorp.com/rtems/license.html.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <rtems/dumpbuf.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Put the body below Dump_Buffer so it won't get inlined.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline void Dump_Line(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
);
|
||||||
|
|
||||||
|
void Dump_Buffer(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
int i, mod, max;
|
||||||
|
|
||||||
|
if ( !length ) return;
|
||||||
|
|
||||||
|
mod = length % 16;
|
||||||
|
|
||||||
|
max = length - mod;
|
||||||
|
|
||||||
|
for ( i=0 ; i<max ; i+=16 )
|
||||||
|
Dump_Line( &buffer[ i ], 16 );
|
||||||
|
|
||||||
|
if ( mod )
|
||||||
|
Dump_Line( &buffer[ max ], mod );
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void Dump_Line(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
int i;
|
||||||
|
char line_buffer[120];
|
||||||
|
|
||||||
|
line_buffer[0] = '\0';
|
||||||
|
|
||||||
|
for( i=0 ; i<length ; i++ )
|
||||||
|
sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] );
|
||||||
|
|
||||||
|
for( ; i<16 ; i++ )
|
||||||
|
strcat( line_buffer, " " );
|
||||||
|
|
||||||
|
strcat( line_buffer, "|" );
|
||||||
|
for( i=0 ; i<length ; i++ )
|
||||||
|
sprintf( line_buffer, "%s%c", line_buffer,
|
||||||
|
isprint( buffer[ i ] ) ? buffer[ i ] : '.' );
|
||||||
|
|
||||||
|
for( ; i<16 ; i++ )
|
||||||
|
strcat( line_buffer, " " );
|
||||||
|
|
||||||
|
strcat( line_buffer, "|\n" );
|
||||||
|
|
||||||
|
printf( line_buffer );
|
||||||
|
}
|
||||||
21
c/src/lib/libmisc/dumpbuf/dumpbuf.h
Normal file
21
c/src/lib/libmisc/dumpbuf/dumpbuf.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1997.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may in
|
||||||
|
* the file LICENSE in this distribution or at
|
||||||
|
* http://www.OARcorp.com/rtems/license.html.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __DUMP_BUFFER_h
|
||||||
|
#define __DUMP_BUFFER_h
|
||||||
|
|
||||||
|
void Dump_Buffer(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/* end of include file */
|
||||||
55
c/src/libmisc/dumpbuf/Makefile.in
Normal file
55
c/src/libmisc/dumpbuf/Makefile.in
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
|
||||||
|
@SET_MAKE@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
RTEMS_ROOT = @top_srcdir@
|
||||||
|
PROJECT_ROOT = @PROJECT_ROOT@
|
||||||
|
|
||||||
|
LIB=${ARCH}/libdumpbuf-tmp.a
|
||||||
|
|
||||||
|
# C source names, if any, go here -- minus the .c
|
||||||
|
C_PIECES=dumpbuf
|
||||||
|
C_FILES=$(C_PIECES:%=%.c)
|
||||||
|
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
|
||||||
|
|
||||||
|
H_FILES=
|
||||||
|
INSTALLED_H_FILES=$(srcdir)/dumpbuf.h
|
||||||
|
|
||||||
|
SRCS=$(C_FILES) $(H_FILES) $(INSTALLED_H_FILES)
|
||||||
|
OBJS=$(C_O_FILES)
|
||||||
|
|
||||||
|
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
|
||||||
|
include $(RTEMS_ROOT)/make/lib.cfg
|
||||||
|
|
||||||
|
#
|
||||||
|
# (OPTIONAL) Add local stuff here using +=
|
||||||
|
#
|
||||||
|
|
||||||
|
DEFINES +=
|
||||||
|
CPPFLAGS += -I.
|
||||||
|
CFLAGS +=
|
||||||
|
|
||||||
|
LD_PATHS +=
|
||||||
|
LD_LIBS +=
|
||||||
|
LDFLAGS +=
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add your list of files to delete here. The config files
|
||||||
|
# already know how to delete some stuff, so you may want
|
||||||
|
# to just run 'make clean' first to see what gets missed.
|
||||||
|
# 'make clobber' already includes 'make clean'
|
||||||
|
#
|
||||||
|
|
||||||
|
CLEAN_ADDITIONS +=
|
||||||
|
CLOBBER_ADDITIONS +=
|
||||||
|
|
||||||
|
${LIB}: ${SRCS} preinstall ${OBJS}
|
||||||
|
$(make-library)
|
||||||
|
|
||||||
|
all: ${ARCH} $(SRCS) preinstall $(LIB)
|
||||||
|
|
||||||
|
preinstall:
|
||||||
|
$(INSTALL) -m 444 ${INSTALLED_H_FILES} $(PROJECT_INCLUDE)/rtems
|
||||||
75
c/src/libmisc/dumpbuf/dumpbuf.c
Normal file
75
c/src/libmisc/dumpbuf/dumpbuf.c
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1997.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may in
|
||||||
|
* the file LICENSE in this distribution or at
|
||||||
|
* http://www.OARcorp.com/rtems/license.html.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <rtems/dumpbuf.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Put the body below Dump_Buffer so it won't get inlined.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline void Dump_Line(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
);
|
||||||
|
|
||||||
|
void Dump_Buffer(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
int i, mod, max;
|
||||||
|
|
||||||
|
if ( !length ) return;
|
||||||
|
|
||||||
|
mod = length % 16;
|
||||||
|
|
||||||
|
max = length - mod;
|
||||||
|
|
||||||
|
for ( i=0 ; i<max ; i+=16 )
|
||||||
|
Dump_Line( &buffer[ i ], 16 );
|
||||||
|
|
||||||
|
if ( mod )
|
||||||
|
Dump_Line( &buffer[ max ], mod );
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void Dump_Line(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
int i;
|
||||||
|
char line_buffer[120];
|
||||||
|
|
||||||
|
line_buffer[0] = '\0';
|
||||||
|
|
||||||
|
for( i=0 ; i<length ; i++ )
|
||||||
|
sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] );
|
||||||
|
|
||||||
|
for( ; i<16 ; i++ )
|
||||||
|
strcat( line_buffer, " " );
|
||||||
|
|
||||||
|
strcat( line_buffer, "|" );
|
||||||
|
for( i=0 ; i<length ; i++ )
|
||||||
|
sprintf( line_buffer, "%s%c", line_buffer,
|
||||||
|
isprint( buffer[ i ] ) ? buffer[ i ] : '.' );
|
||||||
|
|
||||||
|
for( ; i<16 ; i++ )
|
||||||
|
strcat( line_buffer, " " );
|
||||||
|
|
||||||
|
strcat( line_buffer, "|\n" );
|
||||||
|
|
||||||
|
printf( line_buffer );
|
||||||
|
}
|
||||||
21
c/src/libmisc/dumpbuf/dumpbuf.h
Normal file
21
c/src/libmisc/dumpbuf/dumpbuf.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1997.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may in
|
||||||
|
* the file LICENSE in this distribution or at
|
||||||
|
* http://www.OARcorp.com/rtems/license.html.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __DUMP_BUFFER_h
|
||||||
|
#define __DUMP_BUFFER_h
|
||||||
|
|
||||||
|
void Dump_Buffer(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/* end of include file */
|
||||||
75
cpukit/libmisc/dumpbuf/dumpbuf.c
Normal file
75
cpukit/libmisc/dumpbuf/dumpbuf.c
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1997.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may in
|
||||||
|
* the file LICENSE in this distribution or at
|
||||||
|
* http://www.OARcorp.com/rtems/license.html.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <rtems/dumpbuf.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Put the body below Dump_Buffer so it won't get inlined.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static inline void Dump_Line(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
);
|
||||||
|
|
||||||
|
void Dump_Buffer(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
int i, mod, max;
|
||||||
|
|
||||||
|
if ( !length ) return;
|
||||||
|
|
||||||
|
mod = length % 16;
|
||||||
|
|
||||||
|
max = length - mod;
|
||||||
|
|
||||||
|
for ( i=0 ; i<max ; i+=16 )
|
||||||
|
Dump_Line( &buffer[ i ], 16 );
|
||||||
|
|
||||||
|
if ( mod )
|
||||||
|
Dump_Line( &buffer[ max ], mod );
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void Dump_Line(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
int i;
|
||||||
|
char line_buffer[120];
|
||||||
|
|
||||||
|
line_buffer[0] = '\0';
|
||||||
|
|
||||||
|
for( i=0 ; i<length ; i++ )
|
||||||
|
sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] );
|
||||||
|
|
||||||
|
for( ; i<16 ; i++ )
|
||||||
|
strcat( line_buffer, " " );
|
||||||
|
|
||||||
|
strcat( line_buffer, "|" );
|
||||||
|
for( i=0 ; i<length ; i++ )
|
||||||
|
sprintf( line_buffer, "%s%c", line_buffer,
|
||||||
|
isprint( buffer[ i ] ) ? buffer[ i ] : '.' );
|
||||||
|
|
||||||
|
for( ; i<16 ; i++ )
|
||||||
|
strcat( line_buffer, " " );
|
||||||
|
|
||||||
|
strcat( line_buffer, "|\n" );
|
||||||
|
|
||||||
|
printf( line_buffer );
|
||||||
|
}
|
||||||
21
cpukit/libmisc/dumpbuf/dumpbuf.h
Normal file
21
cpukit/libmisc/dumpbuf/dumpbuf.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* COPYRIGHT (c) 1997.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may in
|
||||||
|
* the file LICENSE in this distribution or at
|
||||||
|
* http://www.OARcorp.com/rtems/license.html.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __DUMP_BUFFER_h
|
||||||
|
#define __DUMP_BUFFER_h
|
||||||
|
|
||||||
|
void Dump_Buffer(
|
||||||
|
unsigned char *buffer,
|
||||||
|
int length
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/* end of include file */
|
||||||
Reference in New Issue
Block a user