2007-08-02 Joel Sherrill <joel.sherrill@OARcorp.com>

* configure.ac, wrapup/Makefile.am: Remove RDBG.
	* aclocal/check-rdbg.m4, aclocal/enable-rdbg.m4, librdbg/.cvsignore,
	librdbg/Makefile.am, librdbg/preinstall.am,
	librdbg/include/rdbg/rdbg.h, librdbg/include/rdbg/servrpc.h,
	librdbg/include/rdbg/i386/rdbg_f.h, librdbg/include/rdbg/i386/reg.h,
	librdbg/include/rdbg/m68k/rdbg_f.h, librdbg/include/rdbg/m68k/reg.h,
	librdbg/include/rdbg/powerpc/rdbg_f.h,
	librdbg/include/rdbg/powerpc/reg.h, librdbg/src/_servtgt.c,
	librdbg/src/awk.svc, librdbg/src/excep.c, librdbg/src/ptrace.c,
	librdbg/src/rdbg.c, librdbg/src/remdeb.x, librdbg/src/servbkpt.c,
	librdbg/src/servcon.c, librdbg/src/servrpc.c, librdbg/src/servtgt.c,
	librdbg/src/servtsp.c, librdbg/src/servutil.c,
	librdbg/src/i386/excep_f.c, librdbg/src/i386/rdbg_cpu_asm.S,
	librdbg/src/i386/rdbg_f.c, librdbg/src/i386/any/remdeb.h,
	librdbg/src/i386/any/remdeb_f.x, librdbg/src/i386/any/remdeb_svc.c,
	librdbg/src/i386/any/remdeb_xdr.c, librdbg/src/m68k/excep_f.c,
	librdbg/src/m68k/rdbg_cpu_asm.S, librdbg/src/m68k/rdbg_f.c,
	librdbg/src/m68k/any/remdeb.h, librdbg/src/m68k/any/remdeb_f.x,
	librdbg/src/m68k/any/remdeb_svc.c, librdbg/src/m68k/any/remdeb_xdr.c,
	librdbg/src/powerpc/excep_f.c, librdbg/src/powerpc/rdbg_cpu_asm.S,
	librdbg/src/powerpc/rdbg_f.c,
	librdbg/src/powerpc/new_exception_processing/remdeb.h,
	librdbg/src/powerpc/new_exception_processing/remdeb_f.x,
	librdbg/src/powerpc/new_exception_processing/remdeb_svc.c,
	librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c: Removed.
This commit is contained in:
Joel Sherrill
2007-08-02 15:00:07 +00:00
parent 51131354d0
commit 261f99bdac
49 changed files with 28 additions and 11184 deletions
+28
View File
@@ -1,3 +1,31 @@
2007-08-02 Joel Sherrill <joel.sherrill@OARcorp.com>
* configure.ac, wrapup/Makefile.am: Remove RDBG.
* aclocal/check-rdbg.m4, aclocal/enable-rdbg.m4, librdbg/.cvsignore,
librdbg/Makefile.am, librdbg/preinstall.am,
librdbg/include/rdbg/rdbg.h, librdbg/include/rdbg/servrpc.h,
librdbg/include/rdbg/i386/rdbg_f.h, librdbg/include/rdbg/i386/reg.h,
librdbg/include/rdbg/m68k/rdbg_f.h, librdbg/include/rdbg/m68k/reg.h,
librdbg/include/rdbg/powerpc/rdbg_f.h,
librdbg/include/rdbg/powerpc/reg.h, librdbg/src/_servtgt.c,
librdbg/src/awk.svc, librdbg/src/excep.c, librdbg/src/ptrace.c,
librdbg/src/rdbg.c, librdbg/src/remdeb.x, librdbg/src/servbkpt.c,
librdbg/src/servcon.c, librdbg/src/servrpc.c, librdbg/src/servtgt.c,
librdbg/src/servtsp.c, librdbg/src/servutil.c,
librdbg/src/i386/excep_f.c, librdbg/src/i386/rdbg_cpu_asm.S,
librdbg/src/i386/rdbg_f.c, librdbg/src/i386/any/remdeb.h,
librdbg/src/i386/any/remdeb_f.x, librdbg/src/i386/any/remdeb_svc.c,
librdbg/src/i386/any/remdeb_xdr.c, librdbg/src/m68k/excep_f.c,
librdbg/src/m68k/rdbg_cpu_asm.S, librdbg/src/m68k/rdbg_f.c,
librdbg/src/m68k/any/remdeb.h, librdbg/src/m68k/any/remdeb_f.x,
librdbg/src/m68k/any/remdeb_svc.c, librdbg/src/m68k/any/remdeb_xdr.c,
librdbg/src/powerpc/excep_f.c, librdbg/src/powerpc/rdbg_cpu_asm.S,
librdbg/src/powerpc/rdbg_f.c,
librdbg/src/powerpc/new_exception_processing/remdeb.h,
librdbg/src/powerpc/new_exception_processing/remdeb_f.x,
librdbg/src/powerpc/new_exception_processing/remdeb_svc.c,
librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c: Removed.
2007-07-27 Ralf Corsépius <ralf.corsepius@rtems.org>
* nfsclient/src/dirutils.c: Use PATH_MAX instead of MAXPATHLEN.
-33
View File
@@ -1,33 +0,0 @@
dnl $Id$
dnl
AC_DEFUN([RTEMS_CHECK_RDBG],
[dnl
AC_REQUIRE([RTEMS_TOP])dnl
AC_REQUIRE([RTEMS_CANONICAL_TARGET_CPU])dnl
AC_REQUIRE([RTEMS_CHECK_NETWORKING])dnl
AC_REQUIRE([RTEMS_ENABLE_RDBG])dnl
AC_CACHE_CHECK([whether BSP supports librdbg],
rtems_cv_HAS_RDBG,
[
if test -d "$srcdir/${RTEMS_TOPdir}/c/src/librdbg/src/${RTEMS_CPU}/${$1}";
then
rtems_cv_HAS_RDBG="yes" ;
elif test -d "$srcdir/${RTEMS_TOPdir}/c/src/librdbg/src/${RTEMS_CPU}/any";
then
rtems_cv_HAS_RDBG="yes" ;
elif test "${RTEMS_CPU}" = "powerpc";
then
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[#if defined(_OLD_EXCEPTIONS)
choke me
#endif])],
[rtems_cv_HAS_RDBG=yes],
[rtems_cv_HAS_RDBG=no])
else
rtems_cv_HAS_RDBG="no";
fi
])
HAS_RDBG="$rtems_cv_HAS_RDBG"
])
-15
View File
@@ -1,15 +0,0 @@
dnl $Id$
AC_DEFUN([RTEMS_ENABLE_RDBG],
[
AC_BEFORE([$0], [RTEMS_CHECK_RDBG])dnl
AC_ARG_ENABLE(rdbg,
[AS_HELP_STRING(--enable-rdbg,enable remote debugger)],
[case "${enableval}" in
yes) RTEMS_HAS_RDBG=yes ;;
no) RTEMS_HAS_RDBG=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for enable-rdbg option) ;;
esac],[RTEMS_HAS_RDBG=no])
AC_SUBST(RTEMS_HAS_RDBG)dnl
])
-19
View File
@@ -9,7 +9,6 @@ RTEMS_TOP(../..)
RTEMS_ENABLE_CXX
RTEMS_ENABLE_NETWORKING
RTEMS_ENABLE_RDBG
RTEMS_CANONICAL_TARGET_CPU
@@ -105,12 +104,6 @@ AM_PROG_CC_C_O
RTEMS_PROG_CCAS
RTEMS_CANONICALIZE_TOOLS
AS_IF([test "$HAS_NETWORKING" = "yes"],[
AS_IF([test "$RTEMS_HAS_RDBG" = "yes"],[
RTEMS_CHECK_RDBG(RTEMS_BSP)
])
])
RTEMS_CHECK_GCC_WEAK
AC_SUBST(CUSTOM_CFG_FILES)
@@ -152,7 +145,6 @@ fi
BSP_SUBDIRS="$BSP_SUBDIRS lib"
BSP_SUBDIRS="$BSP_SUBDIRS libchip"
BSP_SUBDIRS="$BSP_SUBDIRS librdbg"
BSP_SUBDIRS="$BSP_SUBDIRS nfsclient"
AS_IF([test "$RTEMS_HAS_CPLUSPLUS" = "yes"],[
@@ -220,15 +212,6 @@ AS_IF([test "$host_cpu" = sparc],[
AM_CONDITIONAL([HAS_NETWORKING],[test "$HAS_NETWORKING" = "yes"])
# FIXME: This is sick
AM_CONDITIONAL([HAS_RDBG],[test "$HAS_RDBG" = "yes"])
AM_CONDITIONAL([HAS_RDBG_i386],[test "$HAS_RDBG" = "yes" \
&& test $RTEMS_CPU = "i386"])
AM_CONDITIONAL([HAS_RDBG_m68k],[test "$HAS_RDBG" = "yes" \
&& test $RTEMS_CPU = "m68k"])
AM_CONDITIONAL([HAS_RDBG_powerpc],[test "$HAS_RDBG" = "yes" \
&& test $RTEMS_CPU = "powerpc"])
AM_CONDITIONAL(HAS_POSIX,test "$HAS_POSIX_API" = "yes")
# The posix bsp doesn't support libchip
@@ -259,8 +242,6 @@ AC_CONFIG_FILES([Makefile],
AC_CONFIG_FILES([
support/Makefile
librdbg/Makefile
libchip/Makefile
optman/Makefile
-14
View File
@@ -1,14 +0,0 @@
aclocal.m4
autom4te*.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
Makefile
Makefile.in
missing
mkinstalldirs
-174
View File
@@ -1,174 +0,0 @@
##
## $Id$
##
include $(top_srcdir)/automake/compile.am
DISTCLEANFILES =
CLEANFILES =
BUILT_SOURCES =
MAINTAINERCLEANFILES =
## FIXME: This Makefile.am is one blatant ugly HACK
## May-be this should be put into libcpu?
if HAS_RDBG
include_rdbgdir = $(includedir)/rdbg
include_rdbg_HEADERS = include/rdbg/rdbg.h include/rdbg/servrpc.h
noinst_LIBRARIES = librdbg.a
librdbg_a_CPPFLAGS = $(AM_CPPFLAGS)
librdbg_a_SOURCES = src/rdbg.c src/servcon.c src/servbkpt.c src/servrpc.c \
src/excep.c src/servtgt.c src/servtsp.c src/servutil.c src/_servtgt.c \
src/ptrace.c
endif
X_FILES = src/remdeb.x
EXTRA_DIST = src/remdeb.x
if HAS_RDBG
if HAS_RDBG_powerpc
librdbg_a_SOURCES += src/powerpc/excep_f.c src/powerpc/rdbg_f.c \
src/powerpc/rdbg_cpu_asm.S
# Generated sources
librdbg_a_SOURCES += src/powerpc/new_exception_processing/remdeb_xdr.c
librdbg_a_SOURCES += src/powerpc/new_exception_processing/remdeb_svc.c
librdbg_a_SOURCES += src/powerpc/new_exception_processing/remdeb.h
include_rdbg_HEADERS += src/powerpc/new_exception_processing/remdeb.h
include_rdbg_HEADERS += include/rdbg/powerpc/rdbg_f.h \
include/rdbg/powerpc/reg.h
endif
endif
# X source names
EXTRA_DIST += src/powerpc/new_exception_processing/remdeb_f.x
BUILT_SOURCES += src/powerpc/new_exception_processing/remdeb.h
BUILT_SOURCES += src/powerpc/new_exception_processing/remdeb_xdr.c
BUILT_SOURCES += src/powerpc/new_exception_processing/remdeb_svc.c
MAINTAINERCLEANFILES += src/powerpc/new_exception_processing/remdeb_xdr.c
MAINTAINERCLEANFILES += src/powerpc/new_exception_processing/remdeb_svc.c
MAINTAINERCLEANFILES += src/powerpc/new_exception_processing/remdeb.h
if RPCTOOLS
$(srcdir)/src/powerpc/new_exception_processing/remdeb.h: $(X_FILES) \
src/powerpc/new_exception_processing/remdeb_f.x
rm -f $@; ( cd $(srcdir) && \
$(RPCGEN) -h -DFRONTEND=\"powerpc/new_exception_processing/remdeb_f.x\" \
-o src/powerpc/new_exception_processing/remdeb.h src/remdeb.x )
$(srcdir)/src/powerpc/new_exception_processing/remdeb_xdr.c: $(X_FILES) \
src/powerpc/new_exception_processing/remdeb_f.x
rm -f $@; ( cd $(srcdir) && \
$(RPCGEN) -c -DFRONTEND=\"powerpc/new_exception_processing/remdeb_f.x\" src/remdeb.x \
| sed "s,^#include.*remdeb\.h.*,#include \"src/powerpc/new_exception_processing/remdeb.h\"," \
> src/powerpc/new_exception_processing/remdeb_xdr.c )
$(srcdir)/src/powerpc/new_exception_processing/remdeb_svc.c: $(X_FILES) \
src/powerpc/new_exception_processing/remdeb_f.x
rm -f $@; ( cd $(srcdir) && \
$(RPCGEN) -m -DFRONTEND=\"powerpc/new_exception_processing/remdeb_f.x\" \
-o src/powerpc/new_exception_processing/tmpSvc.c src/remdeb.x; \
$(AWK) -f src/awk.svc THEPROG="remdeb.h" src/powerpc/new_exception_processing/tmpSvc.c \
> src/powerpc/new_exception_processing/remdeb_svc.c; \
sed -e 's/fprintf.*,/printf(/' src/powerpc/new_exception_processing/remdeb_svc.c > src/powerpc/new_exception_processing/remdeb_svc.tmp; \
mv src/powerpc/new_exception_processing/remdeb_svc.tmp src/powerpc/new_exception_processing/remdeb_svc.c; \
rm -f src/powerpc/new_exception_processing/tmpSvc.c )
endif
if HAS_RDBG
if HAS_RDBG_i386
librdbg_a_SOURCES += src/i386/excep_f.c src/i386/rdbg_f.c \
src/i386/rdbg_cpu_asm.S
# Generated sources
librdbg_a_SOURCES += src/i386/any/remdeb_xdr.c
librdbg_a_SOURCES += src/i386/any/remdeb_svc.c
librdbg_a_SOURCES += src/i386/any/remdeb.h
include_rdbg_HEADERS += src/i386/any/remdeb.h
include_rdbg_HEADERS += include/rdbg/i386/rdbg_f.h include/rdbg/i386/reg.h
endif
endif
# X source names
EXTRA_DIST += src/i386/any/remdeb_f.x
BUILT_SOURCES += src/i386/any/remdeb.h
BUILT_SOURCES += src/i386/any/remdeb_xdr.c
BUILT_SOURCES += src/i386/any/remdeb_svc.c
MAINTAINERCLEANFILES += src/i386/any/remdeb_xdr.c
MAINTAINERCLEANFILES += src/i386/any/remdeb_svc.c
MAINTAINERCLEANFILES += src/i386/any/remdeb.h
if RPCTOOLS
$(srcdir)/src/i386/any/remdeb.h: $(X_FILES) src/i386/any/remdeb_f.x
rm -f $@; ( cd $(srcdir) && \
$(RPCGEN) -h -DFRONTEND=\"i386/any/remdeb_f.x\" \
-o src/i386/any/remdeb.h src/remdeb.x )
$(srcdir)/src/i386/any/remdeb_xdr.c: $(X_FILES) src/i386/any/remdeb_f.x
rm -f $@; ( cd $(srcdir) && \
$(RPCGEN) -c -DFRONTEND=\"i386/any/remdeb_f.x\" src/remdeb.x \
| sed "s,^#include.*remdeb\.h.*,#include \"src/i386/any/remdeb.h\"," \
> src/i386/any/remdeb_xdr.c )
$(srcdir)/src/i386/any/remdeb_svc.c: $(X_FILES) src/i386/any/remdeb_f.x
rm -f $@; ( cd $(srcdir) && \
$(RPCGEN) -m -DFRONTEND=\"i386/any/remdeb_f.x\" \
-o src/i386/any/tmpSvc.c src/remdeb.x; \
$(AWK) -f src/awk.svc THEPROG="remdeb.h" src/i386/any/tmpSvc.c \
> src/i386/any/remdeb_svc.c; \
sed -e 's/fprintf.*,/printf(/' src/i386/any/remdeb_svc.c > src/i386/any/remdeb_svc.tmp; \
mv src/i386/any/remdeb_svc.tmp src/i386/any/remdeb_svc.c; \
rm -f src/i386/any/tmpSvc.c )
endif
if HAS_RDBG
if HAS_RDBG_m68k
librdbg_a_SOURCES += src/m68k/excep_f.c src/m68k/rdbg_f.c \
src/m68k/rdbg_cpu_asm.S
# Generated sources
librdbg_a_SOURCES += src/m68k/any/remdeb_xdr.c
librdbg_a_SOURCES += src/m68k/any/remdeb_svc.c
librdbg_a_SOURCES += src/m68k/any/remdeb.h
include_rdbg_HEADERS += src/m68k/any/remdeb.h
include_rdbg_HEADERS += include/rdbg/m68k/rdbg_f.h include/rdbg/m68k/reg.h
endif
endif
# X source names
EXTRA_DIST += src/m68k/any/remdeb_f.x
BUILT_SOURCES += src/m68k/any/remdeb.h
BUILT_SOURCES += src/m68k/any/remdeb_xdr.c
BUILT_SOURCES += src/m68k/any/remdeb_svc.c
MAINTAINERCLEANFILES += src/m68k/any/remdeb_xdr.c
MAINTAINERCLEANFILES += src/m68k/any/remdeb_svc.c
MAINTAINERCLEANFILES += src/m68k/any/remdeb.h
if RPCTOOLS
$(srcdir)/src/m68k/any/remdeb.h: $(X_FILES) src/m68k/any/remdeb_f.x
rm -f $@; ( cd $(srcdir) && \
$(RPCGEN) -h -DFRONTEND=\"m68k/any/remdeb_f.x\" \
-o src/m68k/any/remdeb.h src/remdeb.x )
$(srcdir)/src/m68k/any/remdeb_xdr.c: $(X_FILES) src/m68k/any/remdeb_f.x
rm -f $@; ( cd $(srcdir) && \
$(RPCGEN) -c -DFRONTEND=\"m68k/any/remdeb_f.x\" src/remdeb.x \
| sed "s,^#include.*remdeb\.h.*,#include \"src/m68k/any/remdeb.h\"," \
> src/m68k/any/remdeb_xdr.c )
$(srcdir)/src/m68k/any/remdeb_svc.c: $(X_FILES) src/m68k/any/remdeb_f.x
rm -f $@; ( cd $(srcdir) && \
$(RPCGEN) -m -DFRONTEND=\"m68k/any/remdeb_f.x\" \
-o src/m68k/any/tmpSvc.c src/remdeb.x; \
$(AWK) -f src/awk.svc THEPROG="remdeb.h" src/m68k/any/tmpSvc.c \
> src/m68k/any/remdeb_svc.c; \
sed -e 's/fprintf.*,/printf(/' src/m68k/any/remdeb_svc.c > src/m68k/any/remdeb_svc.tmp; \
mv src/m68k/any/remdeb_svc.tmp src/m68k/any/remdeb_svc.c; \
rm -f src/m68k/any/tmpSvc.c )
endif
EXTRA_DIST += src/awk.svc
include $(srcdir)/preinstall.am
include $(top_srcdir)/automake/local.am
-39
View File
@@ -1,39 +0,0 @@
/*
**************************************************************************
*
* Component = RDBG
* Module = rdbg_f.h
*
* Synopsis = Machine-dependent header file
*
* $Id$
*
**************************************************************************
*/
#ifndef RDBG_F_H
#define RDBG_F_H
#include <rtems.h>
#include <rdbg/remdeb.h>
#define EFLAGS_TF 0x00100
static inline int isRdbgException(Exception_context *ctx)
{
if (
ctx->ctx->idtIndex != I386_EXCEPTION_DEBUG &&
ctx->ctx->idtIndex != I386_EXCEPTION_BREAKPOINT &&
ctx->ctx->idtIndex != I386_EXCEPTION_ENTER_RDBG
) return 0;
else return 1;
}
static inline int getExcNum(Exception_context *ctx)
{
return ctx->ctx->idtIndex;
}
extern void connect_rdbg_exception();
extern void disconnect_rdbg_exception();
#endif
-32
View File
@@ -1,32 +0,0 @@
/*
* Registers Offset in frame definition
*
* $Id$
*/
#define NBREGS 19
#define SS 18
#define UESP 17
#define EFL 16
#define CS 15
#define EIP 14
#define ERR 13
#define TRAPNO 12
#define EAX 11
#define ECX 10
#define EDX 9
#define EBX 8
#define ESP 7
#define EBP 6
#define ESI 5
#define EDI 4
#define DS 3
#define ES 2
#define FS 1
#define GS 0
typedef unsigned int regs[NBREGS];
/* To be used in common code */
typedef regs REGS;
-37
View File
@@ -1,37 +0,0 @@
/*
**************************************************************************
*
* Component = RDBG
* Module = rdbg_f.h
*
* Synopsis = Machine-dependent header file
*
* $Id$
*
**************************************************************************
*/
#ifndef RDBG_F_H
#define RDBG_F_H
#include <rtems.h>
#include <rdbg/remdeb.h>
static inline int isRdbgException(Exception_context *ctx)
{
if (
ctx->ctx->vecnum != 9 /* trace - singlestep */
&& ctx->ctx->vecnum != 47 /* trap #15 - breakpoint */
&& ctx->ctx->vecnum != 36 /* trap #4 - enter RDBG */
) return 0;
else return 1;
}
static inline int getExcNum(Exception_context *ctx)
{
return ctx->ctx->vecnum;
}
extern void connect_rdbg_exception();
extern void disconnect_rdbg_exception();
#endif
-12
View File
@@ -1,12 +0,0 @@
/*
* Registers frame offset definition
*
* $Id$
*/
#define NBREGS 18
typedef unsigned int regs[NBREGS];
/* To be used in common code */
typedef regs REGS;
@@ -1,37 +0,0 @@
/*
**************************************************************************
*
* Component = RDBG
* Module = rdbg_f.h
*
* Synopsis = Machine-dependent header file
*
* $Id$
*
**************************************************************************
*/
#ifndef RDBG_F_H
#define RDBG_F_H
#include <rtems.h>
#include <rdbg/remdeb.h>
static inline int isRdbgException(Exception_context *ctx)
{
if (
ctx->ctx->_EXC_number != ASM_SYS_VECTOR &&
ctx->ctx->_EXC_number != ASM_PROG_VECTOR &&
ctx->ctx->_EXC_number != ASM_TRACE_VECTOR
) return 0;
else return 1;
}
static inline int getExcNum(Exception_context *ctx)
{
return ctx->ctx->_EXC_number;
}
extern void connect_rdbg_exception();
extern void disconnect_rdbg_exception();
#endif
-12
View File
@@ -1,12 +0,0 @@
/*
* Registers frame offset definition
*
* $Id$
*/
#define NBREGS 43
typedef unsigned int regs[NBREGS];
/* To be used in common code */
typedef regs REGS;
-92
View File
@@ -1,92 +0,0 @@
/*
**************************************************************************
*
* Component = RDBG
*
* Synopsis = rdbg.h
*
* $Id$
*
**************************************************************************
*/
#ifndef RDBG_H
#define RDBG_H
#include <rpc/rpc.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdlib.h> /* For malloc() and free() prototypes */
#include <bsp.h>
#include <rtems.h>
#define Malloc(size) malloc (size)
#define Free(block) free (block)
#define Realloc(block,size) realloc (block, size)
#define StrDup(str) strdup(str)
#define LIST_PID 16 /* dynamic list of processes/tasks */
#define LIST_PID_DEB 17 /* list of processes under debug now */
#define LIST_PID_THREAD 18 /* list of threads for specific process */
#define LIST_CONN 19 /* dynamic list of connections */
/* RTEMS internals */
extern void remotedeb_2 (struct svc_req* rqstp, SVCXPRT* transp);
extern void setErrno (int error);
extern int getErrno ();
extern int ptrace (int request, int pid, char* addr,
int data, char* addr2);
extern int TSP_RETRIES;
extern volatile int ExitForSingleStep;
extern volatile int justSaveContext;
extern volatile Objects_Id currentTargetThread;
extern volatile int CannotRestart;
extern volatile int TotalReboot;
/* Missing RPC prototypes */
SVCXPRT* svcudp_create (int fd);
void svc_processrequest (SVCXPRT* xprt,
u_long prog, u_long vers,
void (*dispatch)());
int svcudp_enablecache (SVCXPRT *transp, u_long size);
typedef struct Exception_context_struct {
struct Exception_context_struct *next;
struct Exception_context_struct *previous;
Objects_Id id;
Objects_Id semaphoreId;
CPU_Exception_frame *ctx;
} Exception_context;
struct xdr_regs;
extern int PushExceptCtx (Objects_Id Id,
Objects_Id semId,
CPU_Exception_frame *ctx);
extern int PopExceptCtx (Objects_Id Id);
extern Exception_context *GetExceptCtx (Objects_Id Id);
extern int Single_Step (CPU_Exception_frame* ctx);
extern int CheckForSingleStep (CPU_Exception_frame* ctx);
extern void BreakPointExcHdl (CPU_Exception_frame *ctx);
extern void CtxToRegs (const CPU_Exception_frame*,struct xdr_regs*);
extern void RegsToCtx (const struct xdr_regs*,CPU_Exception_frame*);
extern void enterRdbg ();
extern void get_ctx_thread (Thread_Control *thread,
CPU_Exception_frame* ctx);
extern void set_ctx_thread (Thread_Control *thread,
CPU_Exception_frame* ctx);
extern int PushSavedExceptCtx ( Objects_Id Id,
CPU_Exception_frame *ctx );
extern int ExcepToSig (Exception_context *ctx);
extern rtems_id serializeSemId;
extern rtems_id wakeupEventSemId;
extern volatile unsigned int NbSerializedCtx;
void copyback_data_cache_and_invalidate_instr_cache(unsigned char* addr, int size);
#include <rdbg/rdbg_f.h>
#endif /* !RDBG_H */
-279
View File
@@ -1,279 +0,0 @@
/*
* $Id$
*/
#ifndef SERVRPC_H
#define SERVRPC_H
#include <rtems/system.h>
#include <rtems/score/cpu.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rpc/types.h>
#include <rdbg/remdeb.h>
#include <rpc/rpc.h>
#include <rpc/svc.h>
extern int CONN_LIST_INC;
extern int PID_LIST_INC;
extern int TSP_RETRIES;
extern int BackPort;
extern char taskName[];
extern int getId();
#ifdef DDEBUG
int rdb_debug; /* True if env var RDB_DEBUG defined */
extern const char* PtraceNames[]; /* list of ptrace requests for debug out */
extern const char* BmsgNames[]; /* list of BMSG_xxx names */
extern const char* PtraceName(int req);
#ifdef i386 /* low-high machine such as 386 */
#define HL_W(w) (((UINT16)(w)>>8)+((((w)&0xFF)<<8)))
#define HL_D(d) (((UINT32)(d)>>24)+(((d)&0x00FF0000)>>8) \
+(((d)&0xFF00)<<8)+(((d)&0xFF)<<24))
#else
#define HL_W(w) w
#define HL_D(d) d
#endif
# define DPRINTF(a) (rdb_debug ? printk ("%d >>> ", getId()), printk a : 0)
#else
# define DPRINTF(a) /* suppress */
#endif
/* Macros for analyzing/creating process status values. Presently do
not need to be separated per target. Could even use WIF... */
#define STS_SIGNALLED(status) (((status) & 0xFF) == 0x7F)
#define STS_TERMONSIG(status) (((status) & 0xFF) && !STS_SIGNALLED(status))
#define STS_TERMGETSIG(status) ((status) & 0x7F)
#define STS_MAKESIG(sig) (((sig) << 8) | 0x7f)
#define STS_GETSIG(status) ((status) >> 8)
#define STS_GETCODE(status) ((status) >> 8)
/* now define base types */
#ifndef UCHAR_DEFINED
#define UCHAR_DEFINED /* to handle duplicate typedes */
typedef unsigned char UCHAR;
typedef unsigned char UINT8;
typedef char INT8;
typedef unsigned short UINT16;
typedef short INT16;
typedef unsigned long UINT32;
typedef long INT32;
#endif /* UCHAR_DEFINED */
typedef long PID; /* generalized process id */
#ifndef True
# define True 1
# define False 0
typedef char Boolean;
#endif
#define MAX_FILENAME 1024 /* largest filename with path */
#define MAX_SEND 5 /* up to 5 pended outbound messages */
#define SERVER_VERS 1
typedef enum
{ /* message types */
BMSG_WARM=1, /* warm test for network connection */
BMSG_WAIT, /* wait change (stopped/started) */
BMSG_BREAK, /* breakpoint changed */
BMSG_EXEC_FAIL, /* exec failed from spawn */
BMSG_DETACH, /* process detached from server */
BMSG_KILLED, /* killed by server */
BMSG_NOT_PRIM, /* no longer the primary owner */
BMSG_NEW_PID /* the process was restart with new pid (in
context). Same ownership rules. */
} BACK_MSG;
typedef struct
{ /* this is the break_list[0] entry of pid */
UCHAR clr_step; /* true if step off break in last_break */
UCHAR pad1; /* Set if STEPEMUL breakpoints exist */
UINT16 last_break; /* last breakpoint we stopped on (if break) */
UINT32 range_start; /* start address of range */
UINT32 range_end; /* end address inclusive */
} BASE_BREAK;
enum
{ /* last start values */
LAST_NONE, /* stopped already */
LAST_STEP, /* did a step last - do not send to prim */
LAST_CONT, /* did a continue last */
LAST_RANGE, /* in the middle of step-in-range */
LAST_STEPOFF, /* stepped off break, now need to cont */
LAST_KILLED, /* was killed by ptrace */
LAST_DETACHED /* was detached by ptrace */
};
#define LAST_START 0x80 /* first execed. This is to handle MiX
bug where we need to start again */
typedef struct
{ /* one per open process */
PID pid; /* process id (or 0 if free) */
int state; /* status from last wait if stopped */
UCHAR running; /* True if running, else stopped/term */
/* now connection control over process */
UCHAR owners; /* count of owners for notify and term release */
UCHAR primary_conn; /* primary owner connection or 255=none */
UCHAR filler; /* Preserve alignment */
/* now break control and support */
UINT8 last_start; /* LAST_xx start info for wait() */
UINT8 flags; /* PIDFLG_xxx flags */
UINT16 break_alloc; /* number of entries in break_list */
xdr_break *break_list; /* list of breakpoints ([0] is BASE_BREAK) */
/* now registers and other save information */
xdr_regs regs; /* saved registers when stopped */
int is_step; /* Was break or step (regs ambiguous often) */
int stop_wanted; /* Don't ignore next stop */
UINT32 thread; /* current stopped thread or -1 if none */
char *name; /* full pathname or NULL if not known */
INT32 child; /* child pid that manages the pid */
UINT32 textStart; /* for relocating breakpoints at restart */
} PID_LIST;
PID_LIST *pid_list; /* array of processes being managed */
int pid_list_cnt; /* number of entries allocated */
UINT16 last_break; /* unique handle generator for breaks */
#define NO_PRIMARY ((UCHAR)-1)
typedef union
{ /* an opaque net address */
unsigned long l[4];
unsigned char c[16]; /* corresponds to IP, enough for ChIPC */
} NET_OPAQUE;
typedef struct
{ /* one per connection */
UCHAR in_use; /* True if in use */
UCHAR debug_type; /* type of connection */
UINT16 flags; /* flags for connection (CFLG_xxx) */
NET_OPAQUE sender; /* opaque address for transport compare */
NET_OPAQUE back_port; /* opaque address for transport event msgs */
NET_OPAQUE route; /* optional route address */
UINT32 pid_map[10]; /* map of pids owned relative to pid list */
/* this allows up to 320 pids to be managed */
UCHAR last_msg_num; /* msg number used last to handle multi-send */
/* next field associated with UDP send messages */
UCHAR retry; /* count of retries. If 0, ok. If not 0, we
are in active wait for reply to an event */
UCHAR send_idx; /* current number of send's pended */
struct SEND_LIST
{ /* holds pending msgs */
UCHAR send_type; /* BMSG_xxx type of message */
UCHAR retry; /* number of times to retry */
UINT16 spec; /* spec field */
PID pid; /* pid if applies */
UINT32 context; /* additional context if needed */
} send_list[MAX_SEND]; /* pended list of messages being sent */
char user_name[NAMEMAX]; /* name of user connecting in */
/* next fields are managed at runtime to handle lists, command upload, and
command download. */
enum {LST_NONE, LST_SPAWN, LST_INFO, LST_CMD_DOWN} list_type;
char *list; /* curr list we are sending/getting (malloced) */
UINT16 list_sz; /* size of current list (string len) */
UINT16 list_num; /* number of current list or position */
UINT16 list_alloc; /* amount allocated so far */
UINT16 list_save; /* used internally */
} CONN_LIST;
CONN_LIST *conn_list; /* an array of connections */
int conn_list_cnt; /* number allocated */
/* Operations over the PID map. Each indexes into long and then bit */
/* 5 is log2 of 32, the number of bits in an int */
#define PIDMAP_TEST(conn,idx) \
(conn_list [conn].pid_map [(idx) >> 5] & (1 << ((idx) & 31)))
#define PIDMAP_SET(conn,idx) \
(conn_list [conn].pid_map [(idx) >> 5] |= 1 << ((idx) & 31))
#define PIDMAP_CLEAR(conn,idx) \
(conn_list [conn].pid_map [(idx) >> 5] &= ~(1 << ((idx) &31)))
#define PROC_TERMINATED(plst) \
(!(plst)->running && !STS_SIGNALLED ((plst)->state))
/* first define the Connection routines exported from servcon.c */
int ConnCreate (struct svc_req *rqstp, open_in *in);
void ConnDelete (int conn_idx, struct svc_req *rqstp, close_control control);
void TspInit (int rpc_io_channel);
Boolean TspTranslateRpcAddr (struct svc_req *rqstp, NET_OPAQUE *opaque);
Boolean TspValidateAddr (NET_OPAQUE *opaque, NET_OPAQUE *sender);
int TspConnGetIndex (struct svc_req *rqstp);
void TspSendWaitChange (int conn_idx, BACK_MSG msg, UINT16 spec, PID pid,
UINT32 context, Boolean force);
void TspSendMessage (int conn_idx, Boolean resend);
void TspMessageReceive (int conn_idx, PID pid);
char* TspGetHostName (int conn_idx);
void TgtCreateNew (PID pid, int conn_idx, INT32 child,
char *name, Boolean spawn);
Boolean TgtAttach (int conn_idx, PID pid);
void TgtNotifyWaitChange(PID pid, int status, Boolean exclude);
void TgtNotifyAll (int pid_idx, BACK_MSG msg, UINT16 spec,
UINT32 context, int exclude_conn, Boolean force);
void TgtDelete (PID_LIST*, int conn_idx, BACK_MSG notify);
int TgtKillAndDelete (PID_LIST *plst, struct svc_req *rqstp, Boolean term);
void TgtDetachCon (int conn_idx, int pid_idx, Boolean delete);
int TgtThreadList (PID_LIST*, unsigned* buf, unsigned int size);
int TgtGetThreadName (PID_LIST*, unsigned thLi, char* name);
int TgtPtrace (int req, PID pid, char *addr, int data, void *addr2);
int TgtRealPtrace (int req, PID pid, char *addr, int data, void *addr2);
Boolean TgtHandleChildChange(PID pid, int* status, int* unexp,
CPU_Exception_frame *ctx);
#ifdef DDEBUG
/* TgtDbgPtrace is a wrapper for RealPtrace() doing traces */
int TgtDbgPtrace (int req, PID pid, char *addr, int data, void *addr2);
#endif
/* Information stored in "handle" */
#define BKPT_INACTIVE 1 /* bkpt inactive for this execution */
#define BKPT_ACTIVE 0 /* bkpt active for this execution */
int BreakOverwrite (const PID_LIST* plst,const char* addr,
unsigned int size);
int BreakSet (PID_LIST*, int conn_idx, xdr_break*);
int BreakSetAt (PID_LIST*, int conn_idx, unsigned long addr,break_type);
int BreakClear (PID_LIST*, int conn_idx, int handle);
int BreakGetIndex (PID_LIST*, void* addr);
int BreakGet (const PID_LIST*, int data, xdr_break*);
void BreakHide (const PID_LIST*, void*, int, void*);
int BreakStepOff (const PID_LIST*, void** paddr2);
void BreakSteppedOff (PID_LIST*);
int BreakRespawn (PID_LIST*);
int BreakIdentify (PID_LIST*, int adjust, int thread);
void BreakPcChanged (PID_LIST*);
int BreakStepRange (PID_LIST*, void* addr, int len);
void BreaksDisable (int pid);
void BreaksEnable (int pid);
int TgtBreakRestoreOrig (int pid, void* addr, void* addr2);
void TgtBreakCancelStep (PID_LIST* plst);
Boolean ListAlloc (char *buff, CONN_LIST *clst);
int FindPidEntry (int pid);
open_out* RPCGENSRVNAME(open_connex_2_svc) (open_in *in,
struct svc_req *rqstp);
signal_out* RPCGENSRVNAME(send_signal_2_svc) (signal_in *in,
struct svc_req *rqstp);
ptrace_out* RPCGENSRVNAME(ptrace_2_svc) (ptrace_in *in,
struct svc_req *rqstp);
wait_out* RPCGENSRVNAME(wait_info_2_svc) (wait_in *in,
struct svc_req *rqstp);
#endif /* !SERVRPC_H */
-74
View File
@@ -1,74 +0,0 @@
## Automatically generated by ampolish3 - Do not edit
if AMPOLISH3
$(srcdir)/preinstall.am: Makefile.am
$(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
endif
PREINSTALL_DIRS =
DISTCLEANFILES += $(PREINSTALL_DIRS)
all-am: $(PREINSTALL_FILES)
PREINSTALL_FILES =
CLEANFILES += $(PREINSTALL_FILES)
if HAS_RDBG
$(PROJECT_INCLUDE)/rdbg/$(dirstamp):
@$(MKDIR_P) $(PROJECT_INCLUDE)/rdbg
@: > $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
PREINSTALL_DIRS += $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(PROJECT_INCLUDE)/rdbg/rdbg.h: include/rdbg/rdbg.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/rdbg.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/rdbg.h
$(PROJECT_INCLUDE)/rdbg/servrpc.h: include/rdbg/servrpc.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/servrpc.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/servrpc.h
endif
if HAS_RDBG
if HAS_RDBG_powerpc
$(PROJECT_INCLUDE)/rdbg/remdeb.h: src/powerpc/new_exception_processing/remdeb.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/remdeb.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/remdeb.h
$(PROJECT_INCLUDE)/rdbg/rdbg_f.h: include/rdbg/powerpc/rdbg_f.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/rdbg_f.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/rdbg_f.h
$(PROJECT_INCLUDE)/rdbg/reg.h: include/rdbg/powerpc/reg.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/reg.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/reg.h
endif
endif
if HAS_RDBG
if HAS_RDBG_i386
$(PROJECT_INCLUDE)/rdbg/remdeb.h: src/i386/any/remdeb.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/remdeb.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/remdeb.h
$(PROJECT_INCLUDE)/rdbg/rdbg_f.h: include/rdbg/i386/rdbg_f.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/rdbg_f.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/rdbg_f.h
$(PROJECT_INCLUDE)/rdbg/reg.h: include/rdbg/i386/reg.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/reg.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/reg.h
endif
endif
if HAS_RDBG
if HAS_RDBG_m68k
$(PROJECT_INCLUDE)/rdbg/remdeb.h: src/m68k/any/remdeb.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/remdeb.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/remdeb.h
$(PROJECT_INCLUDE)/rdbg/rdbg_f.h: include/rdbg/m68k/rdbg_f.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/rdbg_f.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/rdbg_f.h
$(PROJECT_INCLUDE)/rdbg/reg.h: include/rdbg/m68k/reg.h $(PROJECT_INCLUDE)/rdbg/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rdbg/reg.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rdbg/reg.h
endif
endif
-308
View File
@@ -1,308 +0,0 @@
/*
============================================================================
_SERVTGT
$Id$
============================================================================
*/
#include <string.h>
#include <rtems.h>
#include <rtems/error.h>
#include <rdbg/rdbg.h>
#include <rdbg/rdbg_f.h>
#include <rdbg/servrpc.h>
#include <errno.h>
#include <sys/socket.h>
#include <assert.h>
#include <rtems/score/cpu.h>
#ifdef DDEBUG
#define Ptrace TgtDbgPtrace
#else
#define Ptrace TgtRealPtrace
#endif
extern int errno;
rtems_id eventTaskId;
rtems_id serializeSemId;
rtems_id wakeupEventSemId;
rtems_id debugId;
CPU_Exception_frame Idle_frame;
/* -----------------------------------------------------------------
TgtRealPtrace - lowest level ptrace() wrapper
----------------------------------------------------------------- */
int
TgtRealPtrace (int req, PID aid, char *addr, int d, void *addr2)
{
return ptrace (req, aid, addr, d, addr2);
}
/* -----------------------------------------------------------------------
TgtChange() is called when the system stops.
It informs the generic layers must be informed of
that fact.
----------------------------------------------------------------------- */
static int
TgtChange (PID pid, CPU_Exception_frame * ctx, int status)
{
if (TgtHandleChildChange (pid, &status, NULL, ctx)) {
TgtNotifyWaitChange (pid, status, -1);
}
return 0;
}
/* -----------------------------------------------------------------------
eventTask
----------------------------------------------------------------------- */
rtems_task
eventTask (rtems_task_argument pid)
{
Exception_context *ctx;
DPRINTF (("event task: pid %d\n", pid));
/*
* we spend all our time waiting for a semaphore.
* If wait change, we send info
*/
for (;;) {
DPRINTF (("Event Task: wait event\n"));
rtems_semaphore_obtain (wakeupEventSemId, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
DPRINTF (("Event Task: wake up !!!!!!!!!!!!!\n"));
errno = 0;
ctx = GetExceptCtx (currentTargetThread);
CheckForSingleStep (ctx->ctx);
TgtChange (pid, ctx->ctx, STS_MAKESIG (ExcepToSig (ctx)));
}
}
/* -------------------------------------------------------------------
MyThreadIdle -
This task is used to initiate the exception mechanism:
It calls the enterDebug function with justSaveContext=1
only to push a first valid context in the list
---------------------------------------------------------------------*/
rtems_task
MyThreadIdle (rtems_task_argument argument)
{
enterRdbg ();
rtems_task_delete (RTEMS_SELF);
}
/* -----------------------------------------------------------------------
TgtAttach - attach to a process that is running without control.
Notes:
- this function performs a ptrace ATTACH equivalent (attaching to a
process that we do not control now).
----------------------------------------------------------------------- */
Boolean
TgtAttach (int conn_idx, /* client that is requesting */
PID pid)
{ /* process to attach to */
rtems_name task_name;
rtems_status_code status;
errno = 0;
DPRINTF (("TgtAttach pid=%d\n", pid));
Ptrace (RPT_ATTACH, pid, NULL, 0, NULL);
if (errno)
return (False); /* failed */
TgtCreateNew (pid, conn_idx, 0, NULL, False);
connect_rdbg_exception ();
/*
* Search for and remove debugging tasks / semaphores left over from
* a previous attach without a detach.
*/
if (rtems_task_ident (rtems_build_name ('E', 'v', 'n', 't'),
RTEMS_SEARCH_ALL_NODES,
&eventTaskId) == RTEMS_SUCCESSFUL)
rtems_task_delete (eventTaskId);
if (rtems_semaphore_ident (rtems_build_name ('D', 'B', 'G', 's'),
RTEMS_SEARCH_ALL_NODES,
&serializeSemId) == RTEMS_SUCCESSFUL)
rtems_semaphore_delete (serializeSemId);
if (rtems_semaphore_ident (rtems_build_name ('D', 'B', 'G', 'w'),
RTEMS_SEARCH_ALL_NODES,
&wakeupEventSemId) == RTEMS_SUCCESSFUL)
rtems_semaphore_delete (wakeupEventSemId);
/*
* Create the attach debugger task
*/
task_name = rtems_build_name ('E', 'v', 'n', 't');
if ((status = rtems_task_create (task_name, 10, 24576,
RTEMS_INTERRUPT_LEVEL (0),
RTEMS_DEFAULT_ATTRIBUTES |
RTEMS_SYSTEM_TASK, &eventTaskId))
!= RTEMS_SUCCESSFUL) {
printf ("status = %d\n", status);
rtems_panic ("Can't create task.\n");
}
status = rtems_task_start (eventTaskId, eventTask, pid);
status = rtems_semaphore_create (rtems_build_name ('D', 'B', 'G', 's'),
1,
RTEMS_FIFO |
RTEMS_COUNTING_SEMAPHORE |
RTEMS_NO_INHERIT_PRIORITY |
RTEMS_NO_PRIORITY_CEILING |
RTEMS_LOCAL, 0, &serializeSemId);
if (status != RTEMS_SUCCESSFUL)
rtems_panic ("Can't create serialize semaphore: `%s'\n",
rtems_status_text (status));
status = rtems_semaphore_create (rtems_build_name ('D', 'B', 'G', 'w'),
0,
RTEMS_FIFO |
RTEMS_COUNTING_SEMAPHORE |
RTEMS_NO_INHERIT_PRIORITY |
RTEMS_NO_PRIORITY_CEILING |
RTEMS_LOCAL, 0, &wakeupEventSemId);
if (status != RTEMS_SUCCESSFUL)
rtems_panic ("Can't create wakeup semaphore: `%s'\n",
rtems_status_text (status));
/*
* Create the MyThreadIdle task to init Exception mechanism
*/
task_name = rtems_build_name ('R', 'i', 'n', 'i');
if ((status = rtems_task_create (task_name, 10, 24576,
RTEMS_INTERRUPT_LEVEL (0),
RTEMS_DEFAULT_ATTRIBUTES, &debugId))
!= RTEMS_SUCCESSFUL) {
printf ("status = %d (%s)\n", status, rtems_status_text (status));
rtems_panic ("Can't create task.\n");
}
status = rtems_task_start (debugId, MyThreadIdle, pid);
return (True);
}
/* -----------------------------------------------------------------------
TgtPtrace - handle ptrace requests for server.
----------------------------------------------------------------------- */
int
TgtPtrace (int req, PID pid, char *addr, int data, void *addr2)
{
if ((req == RPT_SINGLESTEP || req == RPT_CONT)
&& addr2) { /* clear then step */ /* addr2 is the old value */
int ret;
errno = 0;
TgtBreakRestoreOrig (pid, addr, addr2);
ret = Ptrace (RPT_SINGLESTEP, pid, addr, data, NULL); /* step over */
if (ret) { /* error, cannot single-step */
int pid_idx = FindPidEntry (pid);
TgtBreakCancelStep (&pid_list[pid_idx]);
}
return (ret); /* failed or done */
} else
return (Ptrace (req, pid, addr, data, addr2)); /* normal call */
}
/* -----------------------------------------------------------------
TgtGetThreadName - get thread name
--------------------------------------------------------------- */
int
TgtGetThreadName (PID_LIST * plst, /* Process entry */
unsigned Id, /* Thread ID */
char *ThrName)
{ /* Thread name */
int index;
unsigned name;
if (Id < _Objects_Information_table[OBJECTS_CLASSIC_API][1]->maximum_id &&
Id > _Objects_Information_table[OBJECTS_CLASSIC_API][1]->minimum_id) {
index = Id - _Objects_Information_table[OBJECTS_CLASSIC_API][1]->minimum_id;
name =
*(unsigned *) (_Objects_Information_table[OBJECTS_CLASSIC_API][1]->
local_table[1 + index]->name);
ThrName[0] = (char) ((name >> 24) & 0xFF);
ThrName[1] = (char) ((name >> 16) & 0xFF);
ThrName[2] = (char) ((name >> 8) & 0xFF);
ThrName[3] = (char) (name & 0xFF);
ThrName[4] = 0x0;
return 0;
}
if (Id < _Objects_Information_table[OBJECTS_POSIX_API][1]->maximum_id &&
Id > _Objects_Information_table[OBJECTS_POSIX_API][1]->minimum_id) {
index =
Id - _Objects_Information_table[OBJECTS_POSIX_API][1]->minimum_id;
name =
*(unsigned *) (_Objects_Information_table[OBJECTS_POSIX_API][1]->
local_table[1 + index]->name);
ThrName[0] = (char) ((name >> 24) & 0xFF);
ThrName[1] = (char) ((name >> 16) & 0xFF);
ThrName[2] = (char) ((name >> 8) & 0xFF);
ThrName[3] = (char) (name & 0xFF);
ThrName[4] = 0x0;
return 0;
}
return -1;
}
/* -----------------------------------------------------------------
TgtThreadList - return all the threads in the system
----------------------------------------------------------------- */
int
TgtThreadList (PID_LIST * plst, /* Process entry */
unsigned *threads, /* Output buffer */
unsigned size)
{ /* Output buffer size */
int curr = 0;
int api;
Objects_Id id, min_id, max_id;
unsigned index;
for ( api=OBJECTS_CLASSIC_API ; api <= OBJECTS_ITRON_API ; api++ ) {
min_id = _Objects_Information_table[api][1]->minimum_id;
max_id = _Objects_Information_table[api][1]->maximum_id;
id = min_id;
while (id < max_id) {
index = id - min_id;
if (_Objects_Information_table[api][1]->local_table[1 + index] != NULL) {
threads[curr] = (unsigned) id;
curr++;
}
id++;
}
}
return curr;
}
-65
View File
@@ -1,65 +0,0 @@
#########################################################################
#
# Component: RDBG
# Module: awk.svc
#
# Synopsis: AWK script which transforms the server skeleton produced
# by rpcgen(1) into something suitable for RDB servers.
#
#########################################################################
#
# $Id$
#
BEGIN {
headerstarted = 0
withinproc = 0
brack = 0
}
$1 ~ /^\/\*HEADER_START\*\/$/ {
headerstarted = 1
printf("#include <rpc/types.h>\n");
printf("#include <rpc/rpc.h>\n");
printf("#include <stdio.h>\n");
printf("#include <stdlib.h>\n");
printf("#include <string.h>\n");
printf("#include <bsp.h>\n");
printf("#include <rdbg/servrpc.h>\n");
printf("#include <rdbg/%s>\n", THEPROG);
printf("#define fprintf(a,b,c) printf(b,c)\n");
}
$1 ~ /^\/\*HEADER_END\*\/$/ {
headerstarted = 0
}
{
if (headerstarted == 1) {
print $0
} else if ($1 ~ /.*_2.*/) {
withinproc = 1
printf("void\n");
print $0
} else if (withinproc == 1) {
if ($1 == "switch") {
print "\tDPRINTF ((\"remotedeb_2: %s (%d)\\n\", "
print "\t\t(unsigned) rqstp->rq_proc < "
print "\t\t(unsigned) (sizeof names / sizeof names[0]) ?"
print "\t\tnames [rqstp->rq_proc] : \"???\", "
print "\t\t(int) rqstp->rq_proc));\n"
}
for (i = 1; i <= NF; i++) {
if ($i == "{") {
brack++;
} else if ($i == "}") {
brack--;
if (brack == 0) {
withinproc = 0;
}
}
}
if ($1 != "_rpcsvcdirty" ) {
print $0
}
}
}
-146
View File
@@ -1,146 +0,0 @@
/*
**************************************************************************
*
* Component =
*
* Synopsis = rdbgexcep.c
*
* $Id$
*
**************************************************************************
*/
#include <rtems.h>
#include <rtems/error.h>
#include <assert.h>
#include <errno.h>
#include <rdbg/rdbg.h>
#include <rdbg/servrpc.h>
unsigned int NbExceptCtx;
volatile unsigned int NbSerializedCtx;
Exception_context *FirstCtx = NULL;
Exception_context *LastCtx = NULL;
CPU_Exception_frame SavedContext;
/*
* Save an exception context at the end of a list
*/
int
PushExceptCtx (Objects_Id Id, Objects_Id semId, CPU_Exception_frame * ctx)
{
Exception_context *SaveCtx;
SaveCtx = (Exception_context *) malloc (sizeof (Exception_context));
if (SaveCtx == NULL)
rtems_panic ("Can't allocate memory to save Exception context");
SaveCtx->id = Id;
SaveCtx->ctx = ctx;
SaveCtx->semaphoreId = semId;
SaveCtx->previous = NULL;
SaveCtx->next = NULL;
if (FirstCtx == NULL) { /* initialization */
FirstCtx = SaveCtx;
LastCtx = SaveCtx;
NbExceptCtx = 1;
} else {
NbExceptCtx++;
LastCtx->next = SaveCtx;
SaveCtx->previous = LastCtx;
LastCtx = SaveCtx;
}
return 0;
}
/*
* Save an temporary exception context in a global variable
*/
int
PushSavedExceptCtx (Objects_Id Id, CPU_Exception_frame * ctx)
{
memcpy (&(SavedContext), ctx, sizeof (CPU_Exception_frame));
return 0;
}
/*
* Remove the context of the specified Id thread.
* If Id = -1, then return the first context
*/
int
PopExceptCtx (Objects_Id Id)
{
Exception_context *ExtractCtx;
if (FirstCtx == NULL)
return -1;
if (Id == -1) {
ExtractCtx = LastCtx;
LastCtx = LastCtx->previous;
free (ExtractCtx);
NbExceptCtx--;
return 0;
}
ExtractCtx = LastCtx;
while (ExtractCtx->id != Id && ExtractCtx != NULL) {
ExtractCtx = ExtractCtx->previous;
}
if (ExtractCtx == NULL)
return -1;
if (ExtractCtx->previous != NULL)
(ExtractCtx->previous)->next = ExtractCtx->next;
if (ExtractCtx->next != NULL)
(ExtractCtx->next)->previous = ExtractCtx->previous;
if (ExtractCtx == FirstCtx)
FirstCtx = FirstCtx->next;
else if (ExtractCtx == LastCtx)
LastCtx = LastCtx->previous;
free (ExtractCtx);
NbExceptCtx--;
return 0;
}
/*
* Return the context of the specified Id thread.
* If Id = -1, then return the first context.
*/
Exception_context *
GetExceptCtx (Objects_Id Id)
{
Exception_context *ExtractCtx;
if (FirstCtx == NULL)
return NULL;
if (Id == -1) {
return LastCtx;
}
ExtractCtx = LastCtx;
while (ExtractCtx->id != Id && ExtractCtx != NULL) {
ExtractCtx = ExtractCtx->previous;
}
if (ExtractCtx == NULL)
return NULL;
return ExtractCtx;
}
File diff suppressed because it is too large Load Diff
-56
View File
@@ -1,56 +0,0 @@
/*
**************************************************************************
*
* Component = rdblib
*
* Synopsis = remdeb_f.x
*
* $Id$
*
**************************************************************************
*/
struct xdr_regs
{
unsigned int tabreg[19];
};
#ifdef RPC_HDR
%/* now define register macros to apply to xdr_reg struct */
%
%#define GS 0
%#define FS 1
%#define ES 2
%#define DS 3
%#define EDI 4
%#define ESI 5
%#define EBP 6
%#define ESP 7
%#define EBX 8
%#define EDX 9
%#define ECX 10
%#define EAX 11
%#define TRAPNO 12
%#define ERR 13
%#define EIP 14
%#define CS 15
%#define EFL 16
%#define UESP 17
%#define SS 18
%
%#define REG_PC tabreg[EIP] /* PC (eip) register offset */
%#define REG_SP tabreg[UESP] /* SP (uesp) register offset */
%#define REG_FP tabreg[EBP] /* FP (ebp) register offset */
%/* now define the BREAKPOINT mask technique to a long word */
%#define SET_BREAK(l) ((l&0xFFFFFF00) | 0xCC)
%#define IS_BREAK(l) (((l) & 0xFF) == 0xCC)
%#define ORG_BREAK(c,p) (((c) & 0xFFFFFF00) | ((p) & 0xFF))
%#define IS_STEP(regs) (regs.tabreg[TRAPNO] == 1) /* was step and not break */
%#define BREAK_ADJ 1 /* must subtract one from address after bp */
%#define BREAK_SIZE 1 /* Breakpoint occupies one byte */
%#define TARGET_PROC_TYPE 0
#endif
-120
View File
@@ -1,120 +0,0 @@
#include <rpc/types.h>
#include <rpc/rpc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bsp.h>
#include <rdbg/servrpc.h>
#include <rdbg/remdeb.h>
#define printf(c)
/*HEADER_START*/
#define RTEMS_PORT 2071
#define RTEMS_BACK_PORT 2073
/*
* Sun request values for the remote ptrace system call
*/
/*
* Memory data for read/write text or data. The size is in data. The target
* addr is in the addr field.
* Be careful before modifying because this value goes into internal
* pipes and is allocated on stack too. Pipes and/or the stack could
* become too small if this value gets incremented.
*/
/* now open_connex() routine which establishes a connection to server */
#define DEBUGGER_IS_GDB 0x2 /* */
/* now close_connex() routine which detaches from server */
/* now send_signal() routine which sends signals to processes like kill(2) */
/* now wait_info() routine which returns results of polling the wait status
of a process/actor. It may return 0 if running, else pid or -1 */
/* now ptrace() routine. This matches the Sun UNIX ptrace as well as
some additions */
/* now define the actual calls we support */
const char* names [] = {
"NULLPROC", "OPEN_CONNEX", "SEND_SIGNAL", "name3",
"name4", "name5", "name6", "name7",
"name8", "name9", "CLOSE_CONNEX", "PTRACE",
"name12", "WAIT_INFO", "name14", "name15",
"name16", "GET_SIGNAL_NAMES", "name18"
};
void
remotedeb_2(struct svc_req *rqstp, register SVCXPRT *transp)
{
union {
open_in open_connex_2_arg;
signal_in send_signal_2_arg;
close_in close_connex_2_arg;
ptrace_in ptrace_2_arg;
wait_in wait_info_2_arg;
} argument;
char *result;
xdrproc_t _xdr_argument, _xdr_result;
char *(*local)(char *, struct svc_req *);
DPRINTF (("remotedeb_2: %s (%d)\n",
(unsigned) rqstp->rq_proc <
(unsigned) (sizeof names / sizeof names[0]) ?
names [rqstp->rq_proc] : "???",
(int) rqstp->rq_proc));
switch (rqstp->rq_proc) {
case NULLPROC:
(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
return;
case OPEN_CONNEX:
_xdr_argument = (xdrproc_t) xdr_open_in;
_xdr_result = (xdrproc_t) xdr_open_out;
local = (char *(*)(char *, struct svc_req *)) open_connex_2_svc;
break;
case SEND_SIGNAL:
_xdr_argument = (xdrproc_t) xdr_signal_in;
_xdr_result = (xdrproc_t) xdr_signal_out;
local = (char *(*)(char *, struct svc_req *)) send_signal_2_svc;
break;
case CLOSE_CONNEX:
_xdr_argument = (xdrproc_t) xdr_close_in;
_xdr_result = (xdrproc_t) xdr_void;
local = (char *(*)(char *, struct svc_req *)) close_connex_2_svc;
break;
case PTRACE:
_xdr_argument = (xdrproc_t) xdr_ptrace_in;
_xdr_result = (xdrproc_t) xdr_ptrace_out;
local = (char *(*)(char *, struct svc_req *)) ptrace_2_svc;
break;
case WAIT_INFO:
_xdr_argument = (xdrproc_t) xdr_wait_in;
_xdr_result = (xdrproc_t) xdr_wait_out;
local = (char *(*)(char *, struct svc_req *)) wait_info_2_svc;
break;
case GET_SIGNAL_NAMES:
_xdr_argument = (xdrproc_t) xdr_void;
_xdr_result = (xdrproc_t) xdr_get_signal_names_out;
local = (char *(*)(char *, struct svc_req *)) get_signal_names_2_svc;
break;
default:
svcerr_noproc (transp);
return;
}
memset ((char *)&argument, 0, sizeof (argument));
if (!svc_getargs (transp, _xdr_argument, (caddr_t) &argument)) {
svcerr_decode (transp);
return;
}
result = (*local)((char *)&argument, rqstp);
if (result != NULL && !svc_sendreply(transp, _xdr_result, result)) {
svcerr_systemerr (transp);
}
if (!svc_freeargs (transp, _xdr_argument, (caddr_t) &argument)) {
printf( "unable to free arguments");
exit (1);
}
return;
}
File diff suppressed because it is too large Load Diff
-144
View File
@@ -1,144 +0,0 @@
/*
**************************************************************************
*
* Component =
*
* Synopsis = rdbg/i386/excep.c
*
* $Id$
*
**************************************************************************
*/
#include <rtems.h>
#include <rtems/error.h>
#include <assert.h>
#include <errno.h>
#include <rdbg/rdbg.h>
#include <rdbg/servrpc.h>
/* -----------------------------------------------------------------
Maping of hardware exceptions into Unix-like signal numbers.
It is identical to the one used by the PM and the AM.
----------------------------------------------------------------- */
int
ExcepToSig (Exception_context * ctx)
{
int excep = getExcNum (ctx);
switch (excep) {
case I386_EXCEPTION_MATH_COPROC_UNAVAIL:
case I386_EXCEPTION_I386_COPROC_SEG_ERR:
case I386_EXCEPTION_FLOAT_ERROR:
case I386_EXCEPTION_BOUND:
return SIGFPE;
case I386_EXCEPTION_DEBUG:
case I386_EXCEPTION_BREAKPOINT:
case I386_EXCEPTION_ENTER_RDBG:
return SIGTRAP;
case I386_EXCEPTION_OVERFLOW:
case I386_EXCEPTION_DIVIDE_BY_ZERO:
case I386_EXCEPTION_ILLEGAL_INSTR:
return SIGILL;
case I386_EXCEPTION_SEGMENT_NOT_PRESENT:
case I386_EXCEPTION_STACK_SEGMENT_FAULT:
case I386_EXCEPTION_GENERAL_PROT_ERR:
case I386_EXCEPTION_PAGE_FAULT:
return SIGSEGV;
default:
break;
}
return SIGKILL;
}
/*----- Breakpoint Exception management -----*/
/*
* Handler for Breakpoint Exceptions :
* software breakpoints.
*/
void
BreakPointExcHdl (CPU_Exception_frame * ctx)
{
rtems_status_code status;
rtems_id continueSemId;
if ((justSaveContext) && (ctx->idtIndex == I386_EXCEPTION_ENTER_RDBG)) {
PushSavedExceptCtx (_Thread_Executing->Object.id, ctx);
justSaveContext = 0;
} else {
if (ctx->idtIndex != I386_EXCEPTION_DEBUG) {
NbSerializedCtx++;
rtems_semaphore_obtain (serializeSemId, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
NbSerializedCtx--;
}
currentTargetThread = _Thread_Executing->Object.id;
#ifdef DDEBUG
printk ("----------------------------------------------------------\n");
printk ("Exception %d caught at PC %x by thread %d\n",
ctx->idtIndex, ctx->eip, _Thread_Executing->Object.id);
printk ("----------------------------------------------------------\n");
printk ("Processor execution context at time of the fault was :\n");
printk ("----------------------------------------------------------\n");
printk (" EAX = %x EBX = %x ECX = %x EDX = %x\n",
ctx->eax, ctx->ebx, ctx->ecx, ctx->edx);
printk (" ESI = %x EDI = %x EBP = %x ESP = %x\n",
ctx->esi, ctx->edi, ctx->ebp, ctx->esp0);
printk ("----------------------------------------------------------\n");
printk ("Error code pushed by processor itself (if not 0) = %x\n",
ctx->faultCode);
printk ("----------------------------------------------------------\n\n");
#endif
status = rtems_semaphore_create (rtems_build_name ('D', 'B', 'G', 'c'),
0,
RTEMS_FIFO |
RTEMS_COUNTING_SEMAPHORE |
RTEMS_NO_INHERIT_PRIORITY |
RTEMS_NO_PRIORITY_CEILING |
RTEMS_LOCAL, 0, &continueSemId);
if (status != RTEMS_SUCCESSFUL)
rtems_panic ("Can't create continue semaphore: `%s'\n",
rtems_status_text (status));
PushExceptCtx (_Thread_Executing->Object.id, continueSemId, ctx);
switch (ctx->idtIndex) {
case I386_EXCEPTION_DEBUG:
DPRINTF ((" DEBUG EXCEPTION !!!\n"));
ctx->eflags &= ~EFLAGS_TF;
ExitForSingleStep--;
rtems_semaphore_release (wakeupEventSemId);
break;
case I386_EXCEPTION_BREAKPOINT:
DPRINTF ((" BREAKPOINT EXCEPTION !!!\n"));
rtems_semaphore_release (wakeupEventSemId);
break;
case I386_EXCEPTION_ENTER_RDBG:
DPRINTF ((" ENTER RDBG !!!\n"));
rtems_semaphore_release (wakeupEventSemId);
break;
default:
DPRINTF ((" OTHER EXCEPTION !!!\n"));
rtems_semaphore_release (wakeupEventSemId);
break;
}
rtems_semaphore_obtain (continueSemId, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
PopExceptCtx (_Thread_Executing->Object.id);
rtems_semaphore_delete (continueSemId);
}
}
-72
View File
@@ -1,72 +0,0 @@
/* cpu_asm.s
*
* This file contains all assembly code for the Intel i386 implementation
* of RDBG.
*
* $Id$
*
*/
#include <rtems/asm.h>
BEGIN_CODE
/*
* void copyback_data_cache_and_invalidate_instr_cache(addr, size)
*
* This routine performs a copy of the data cache
* and invalidate the instruction cache
*/
.p2align 1
PUBLIC (copyback_data_cache_and_invalidate_instr_cache)
SYM (copyback_data_cache_and_invalidate_instr_cache):
wbinvd
ret
/*
* void enterRdbg(void)
*
* This function perform a call to the exception 19
* It is used :
* 1 - in the user code, to simulate a Breakpoint.
* (with justSaveContext = 0)
* 2 - in the RDBG code, to push a ctx in the list.
* (with justSaveContext = 1)
*
* In most of case, it will be use as described in 1.
* The 2nd possibility will be used by RDBG to obtain
* its own ctx
*/
PUBLIC (enterRdbg)
SYM (enterRdbg):
int $50
ret
/*
* void rtems_exception_prologue_50(void)
*
* Exception 50 is used to enter Rdbg
*
*/
.p2align 4
PUBLIC (rtems_exception_prologue_50)
PUBLIC (_Exception_Handler)
SYM (rtems_exception_prologue_50):
pushl $ 0
pushl $ 50
jmp SYM(_Exception_Handler) ;
END_CODE
END
-168
View File
@@ -1,168 +0,0 @@
/*
**************************************************************************
*
* Component =
*
* Synopsis = rdbg/i386/rdbg_f.c
*
* $Id$
*
**************************************************************************
*/
#include <assert.h>
#include <errno.h>
#include <rdbg/reg.h>
#include <rdbg/remdeb.h>
#include <rdbg/rdbg.h>
#include <rtems/score/cpu.h>
#include <rtems/score/thread.h>
void
CtxToRegs (const CPU_Exception_frame * ctx, xdr_regs * regs)
{
regs->tabreg[GS] = 0;
regs->tabreg[FS] = 0;
regs->tabreg[ES] = 0;
regs->tabreg[DS] = 0;
regs->tabreg[EDI] = ctx->edi;
regs->tabreg[ESI] = ctx->esi;
regs->tabreg[EBP] = ctx->ebp;
regs->tabreg[ESP] = ctx->esp0;
regs->tabreg[EBX] = ctx->ebx;
regs->tabreg[EDX] = ctx->edx;
regs->tabreg[ECX] = ctx->ecx;
regs->tabreg[EAX] = ctx->eax;
regs->tabreg[TRAPNO] = ctx->idtIndex;
regs->tabreg[ERR] = ctx->faultCode;
regs->tabreg[EIP] = ctx->eip;
regs->tabreg[CS] = ctx->cs & 0xFFFF;
regs->tabreg[EFL] = ctx->eflags;
}
void
RegsToCtx (const xdr_regs * regs, CPU_Exception_frame * ctx)
{
ctx->edi = regs->tabreg[EDI];
ctx->esi = regs->tabreg[ESI];
ctx->ebp = regs->tabreg[EBP];
ctx->esp0 = regs->tabreg[ESP];
ctx->ebx = regs->tabreg[EBX];
ctx->edx = regs->tabreg[EDX];
ctx->ecx = regs->tabreg[ECX];
ctx->eax = regs->tabreg[EAX];
ctx->idtIndex = regs->tabreg[TRAPNO];
ctx->faultCode = regs->tabreg[ERR];
ctx->eip = regs->tabreg[EIP];
ctx->cs = regs->tabreg[CS];
ctx->eflags = regs->tabreg[EFL];
}
void
get_ctx_thread (Thread_Control * thread, CPU_Exception_frame * ctx)
{
ctx->edi = thread->Registers.edi;
ctx->esi = thread->Registers.esi;
ctx->ebp = (uint32_t) (thread->Registers.ebp);
ctx->esp0 = (uint32_t) (thread->Registers.esp);
ctx->ebx = thread->Registers.ebx;
ctx->edx = 0;
ctx->ecx = 0;
ctx->eax = 0;
ctx->idtIndex = 0;
ctx->faultCode = 0;
ctx->eip = *(unsigned int *) (thread->Registers.esp);
ctx->cs = 0;
ctx->eflags = thread->Registers.eflags;
}
void
set_ctx_thread (Thread_Control * thread, CPU_Exception_frame * ctx)
{
thread->Registers.edi = ctx->edi;
thread->Registers.esi = ctx->esi;
thread->Registers.ebp = (void *) (ctx->ebp);
thread->Registers.esp = (void *) (ctx->esp0);
thread->Registers.ebx = ctx->ebx;
thread->Registers.eflags = ctx->eflags;
}
int
Single_Step (CPU_Exception_frame * ctx)
{
/*
* Check if not already set
*/
if ((ctx->eflags & EFLAGS_TF) != 0 || ExitForSingleStep != 0) {
/*
* Check coherency
*/
assert ((ctx->eflags & EFLAGS_TF) != 0);
assert (ExitForSingleStep != 0);
return 0;
}
ctx->eflags |= EFLAGS_TF; /* eflags */
++ExitForSingleStep;
return 0;
}
int
CheckForSingleStep (CPU_Exception_frame * ctx)
{
if (ExitForSingleStep) {
/*
* This functions can be called both from
* INT1 and INT3 handlers. In case it is
* called from INT3, need to clear TF.
*/
ctx->eflags &= ~EFLAGS_TF;
ExitForSingleStep = 0;
return 1;
}
return 0;
}
void
CancelSingleStep (CPU_Exception_frame * ctx)
{
/*
* Cancel scheduled SS
*/
ctx->eflags &= ~EFLAGS_TF;
ExitForSingleStep--;
}
static cpuExcHandlerType old_currentExcHandler;
extern void rtems_exception_prologue_50 ();
void
connect_rdbg_exception ()
{
interrupt_gate_descriptor *currentIdtEntry;
unsigned limit;
unsigned level;
/*
* Connect the Exception used to debug
*/
i386_get_info_from_IDTR (&currentIdtEntry, &limit);
_CPU_ISR_Disable (level);
create_interrupt_gate_descriptor (&currentIdtEntry[50],
rtems_exception_prologue_50);
_CPU_ISR_Enable (level);
if (_currentExcHandler != BreakPointExcHdl) {
old_currentExcHandler = _currentExcHandler;
_currentExcHandler = BreakPointExcHdl;
}
}
void
disconnect_rdbg_exception ()
{
if (_currentExcHandler == BreakPointExcHdl) {
_currentExcHandler = old_currentExcHandler;
}
}
File diff suppressed because it is too large Load Diff
-70
View File
@@ -1,70 +0,0 @@
/*
**************************************************************************
*
* Component = rdblib
*
* Synopsis = remdeb_f.x
*
*
* Copyright(C) 2000 Canon Research Center France SA.
*
* Developped by :
* Eric Valette, mail to : valette@crf.canon.fr
* Emmanuel Raguet, mail to : raguet@crf.canon.fr
*
* $Header$
*
**************************************************************************
*/
/* Basic, host-specific, and target-specific definitions for GDB.
Copyright (C) 1986, 1989, 1991, 1992, 1993, 1994, 1995
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
struct xdr_regs {
int r_dreg[8]; /* data registers */
int r_areg[8]; /* address registers */
int r_sr; /* status register (actually a short) */
int r_pc; /* program counter */
int r_vec; /* last vector */
};
#ifdef RPC_HDR
%/* now define register macros to apply to xdr_reg struct */
%
%#define r_r0 r_dreg[0] /* r0 for portability */
%#define r_sp r_areg[7] /* user stack pointer */
%#define r_ps r_sr
%#define REG_PC r_pc /* PC register offset */
%#define REG_SP r_areg[7] /* SP register offset */
%#define REG_FP r_areg[6] /* FP register offset */
%/* now define the BREAKPOINT mask technique to a long word */
%#define SET_BREAK(l) ((l&0x0000FFFF) | 0x4E4F0000) /* TRAP 15 */
%#define IS_BREAK(l) (((l) & 0xFFFF0000) == 0x4E4F0000)
%#define ORG_BREAK(c,p) (((c) & 0x0000FFFF) | ((p) & 0xFFFF0000))
%#define IS_STEP(regs) ((regs).r_vec == 9)
%#define BREAK_ADJ 0
%#define BREAK_SIZE 2
%#define TARGET_PROC_TYPE 2
#endif
-120
View File
@@ -1,120 +0,0 @@
#include <rpc/types.h>
#include <rpc/rpc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bsp.h>
#include <rdbg/servrpc.h>
#include <rdbg/remdeb.h>
#define printf(c)
/*HEADER_START*/
#define RTEMS_PORT 2071
#define RTEMS_BACK_PORT 2073
/*
* Sun request values for the remote ptrace system call
*/
/*
* Memory data for read/write text or data. The size is in data. The target
* addr is in the addr field.
* Be careful before modifying because this value goes into internal
* pipes and is allocated on stack too. Pipes and/or the stack could
* become too small if this value gets incremented.
*/
/* now open_connex() routine which establishes a connection to server */
#define DEBUGGER_IS_GDB 0x2 /* */
/* now close_connex() routine which detaches from server */
/* now send_signal() routine which sends signals to processes like kill(2) */
/* now wait_info() routine which returns results of polling the wait status
of a process/actor. It may return 0 if running, else pid or -1 */
/* now ptrace() routine. This matches the Sun UNIX ptrace as well as
some additions */
/* now define the actual calls we support */
const char* names [] = {
"NULLPROC", "OPEN_CONNEX", "SEND_SIGNAL", "name3",
"name4", "name5", "name6", "name7",
"name8", "name9", "CLOSE_CONNEX", "PTRACE",
"name12", "WAIT_INFO", "name14", "name15",
"name16", "GET_SIGNAL_NAMES", "name18"
};
void
remotedeb_2(struct svc_req *rqstp, register SVCXPRT *transp)
{
union {
open_in open_connex_2_arg;
signal_in send_signal_2_arg;
close_in close_connex_2_arg;
ptrace_in ptrace_2_arg;
wait_in wait_info_2_arg;
} argument;
char *result;
xdrproc_t _xdr_argument, _xdr_result;
char *(*local)(char *, struct svc_req *);
DPRINTF (("remotedeb_2: %s (%d)\n",
(unsigned) rqstp->rq_proc <
(unsigned) (sizeof names / sizeof names[0]) ?
names [rqstp->rq_proc] : "???",
(int) rqstp->rq_proc));
switch (rqstp->rq_proc) {
case NULLPROC:
(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
return;
case OPEN_CONNEX:
_xdr_argument = (xdrproc_t) xdr_open_in;
_xdr_result = (xdrproc_t) xdr_open_out;
local = (char *(*)(char *, struct svc_req *)) open_connex_2_svc;
break;
case SEND_SIGNAL:
_xdr_argument = (xdrproc_t) xdr_signal_in;
_xdr_result = (xdrproc_t) xdr_signal_out;
local = (char *(*)(char *, struct svc_req *)) send_signal_2_svc;
break;
case CLOSE_CONNEX:
_xdr_argument = (xdrproc_t) xdr_close_in;
_xdr_result = (xdrproc_t) xdr_void;
local = (char *(*)(char *, struct svc_req *)) close_connex_2_svc;
break;
case PTRACE:
_xdr_argument = (xdrproc_t) xdr_ptrace_in;
_xdr_result = (xdrproc_t) xdr_ptrace_out;
local = (char *(*)(char *, struct svc_req *)) ptrace_2_svc;
break;
case WAIT_INFO:
_xdr_argument = (xdrproc_t) xdr_wait_in;
_xdr_result = (xdrproc_t) xdr_wait_out;
local = (char *(*)(char *, struct svc_req *)) wait_info_2_svc;
break;
case GET_SIGNAL_NAMES:
_xdr_argument = (xdrproc_t) xdr_void;
_xdr_result = (xdrproc_t) xdr_get_signal_names_out;
local = (char *(*)(char *, struct svc_req *)) get_signal_names_2_svc;
break;
default:
svcerr_noproc (transp);
return;
}
memset ((char *)&argument, 0, sizeof (argument));
if (!svc_getargs (transp, _xdr_argument, (caddr_t) &argument)) {
svcerr_decode (transp);
return;
}
result = (*local)((char *)&argument, rqstp);
if (result != NULL && !svc_sendreply(transp, _xdr_result, result)) {
svcerr_systemerr (transp);
}
if (!svc_freeargs (transp, _xdr_argument, (caddr_t) &argument)) {
printf( "unable to free arguments");
exit (1);
}
return;
}
File diff suppressed because it is too large Load Diff
-217
View File
@@ -1,217 +0,0 @@
/*
**************************************************************************
*
* Component =
*
* Synopsis = rdbg/m68k/excep_f.c
*
* $Id$
*
**************************************************************************
*/
#include <rtems.h>
#include <rtems/error.h>
#include <assert.h>
#include <errno.h>
#include <rdbg/rdbg.h>
#include <rdbg/servrpc.h>
int
ExcepToSig (Exception_context * ctx)
{
int excep = getExcNum (ctx);
switch (excep) {
case 2:
return 10;
break; /* bus error */
case 3:
return 10;
break; /* address error */
case 4:
return 4;
break; /* illegal instruction */
case 5:
return 8;
break; /* zero divide */
case 6:
return 8;
break; /* chk instruction */
case 7:
return 8;
break; /* trapv instruction */
case 8:
return 11;
break; /* privilege violation */
case 9:
return 5;
break; /* trace trap */
case 10:
return 4;
break; /* line 1010 emulator */
case 11:
return 4;
break; /* line 1111 emulator */
/*
* Coprocessor protocol violation. Using a standard MMU or FPU
* this cannot be triggered by software. Call it a SIGBUS.
*/
case 13:
return 10;
break;
case 31:
return 2;
break; /* interrupt */
case 33:
return 5;
break; /* monitor breakpoint */
case 34:
return 2;
break; /* lets use this for SCC1 interrupt */
case 35:
return 5;
break; /* rdbg breakpoint */
case 36:
return 2;
break; /* enter RDBG */
/*
* This is a trap #8 instruction. Apparently it is someone's software
* convention for some sort of SIGFPE condition. Whose? How many
* people are being screwed by having this code the way it is?
* Is there a clean solution?
*/
case 40:
return 8;
break; /* floating point err */
case 47:
return 5;
break; /* rdbg breakpoint */
case 48:
return 8;
break; /* floating point err */
case 49:
return 8;
break; /* floating point err */
case 50:
return 8;
break; /* zero divide */
case 51:
return 8;
break; /* underflow */
case 52:
return 8;
break; /* operand error */
case 53:
return 8;
break; /* overflow */
case 54:
return 8;
break; /* NAN */
default:
return 7; /* "software generated" */
}
return SIGKILL;
}
/*----- Breakpoint Exception management -----*/
/*
* Handler for Breakpoint Exceptions :
* software breakpoints.
*/
void
BreakPointExcHdl (CPU_Exception_frame * ctx)
{
rtems_status_code status;
rtems_id continueSemId;
connect_rdbg_exception (); /* monitor stub changes trace vector */
if ((justSaveContext) && (ctx->vecnum == 47)) { /* break */
PushSavedExceptCtx (_Thread_Executing->Object.id, ctx);
justSaveContext = 0;
} else {
if (ctx->vecnum != 9) { /* trace */
NbSerializedCtx++;
rtems_semaphore_obtain (serializeSemId, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
NbSerializedCtx--;
}
currentTargetThread = _Thread_Executing->Object.id;
#ifdef DDEBUG
printk ("----------------------------------------------------------\n");
printk ("Exception %d caught at PC %x by thread %d\n",
ctx->vecnum, ctx->pc, _Thread_Executing->Object.id);
printk ("----------------------------------------------------------\n");
printk ("Processor execution context at time of the fault was :\n");
printk ("----------------------------------------------------------\n");
printk ("\t A0 = %x\n", ctx->a0);
printk ("\t A1 = %x\n", ctx->a1);
printk ("\t A2 = %x\n", ctx->a2);
printk ("\t A3 = %x\n", ctx->a3);
printk ("\t A4 = %x\n", ctx->a4);
printk ("\t A5 = %x\n", ctx->a5);
printk ("\t A6 = %x\n", ctx->a6);
printk ("\t A7 = %x\n", ctx->a7);
printk ("\t D0 = %x\n", ctx->d0);
printk ("\t D1 = %x\n", ctx->d1);
printk ("\t D2 = %x\n", ctx->d2);
printk ("\t D3 = %x\n", ctx->d3);
printk ("\t D4 = %x\n", ctx->d4);
printk ("\t D5 = %x\n", ctx->d5);
printk ("\t D6 = %x\n", ctx->d6);
printk ("\t D7 = %x\n", ctx->d7);
printk ("\t SR = %x\n", ctx->sr);
#endif
status = rtems_semaphore_create (rtems_build_name ('D', 'B', 'G', 'c'),
0,
RTEMS_FIFO |
RTEMS_COUNTING_SEMAPHORE |
RTEMS_NO_INHERIT_PRIORITY |
RTEMS_NO_PRIORITY_CEILING |
RTEMS_LOCAL, 0, &continueSemId);
if (status != RTEMS_SUCCESSFUL)
rtems_panic ("Can't create continue semaphore: `%s'\n",
rtems_status_text (status));
PushExceptCtx (_Thread_Executing->Object.id, continueSemId, ctx);
switch (ctx->vecnum) {
case 9: /* trace */
DPRINTF ((" TRACE EXCEPTION !!!\n"));
ctx->sr &= ~(1 << 15);
ExitForSingleStep--;
rtems_semaphore_release (wakeupEventSemId);
break;
case 47: /* trap #15 */
DPRINTF ((" BREAKPOINT EXCEPTION !!!\n"));
rtems_semaphore_release (wakeupEventSemId);
break;
case 36: /* trap #4 */
DPRINTF ((" ENTER RDBG !!!\n"));
rtems_semaphore_release (wakeupEventSemId);
break;
default:
DPRINTF ((" OTHER EXCEPTION !!!\n"));
rtems_semaphore_release (wakeupEventSemId);
break;
}
rtems_semaphore_obtain (continueSemId, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
PopExceptCtx (_Thread_Executing->Object.id);
rtems_semaphore_delete (continueSemId);
}
connect_rdbg_exception (); /* monitor stub changes trace vector */
}
-244
View File
@@ -1,244 +0,0 @@
/* rdbg_cpu_asm.s
*
* This file contains all assembly code for the Motorola m68k implementation
* of RDBG.
*
* $Id$
*
*/
#include <rtems/asm.h>
#include <rtems/score/cpu.h>
BEGIN_CODE
/*
* void copyback_data_cache_and_invalidate_instr_cache(addr, size)
*
* This routine performs a copy of the data cache
* and invalidate the instruction cache
*/
.align 2
PUBLIC (copyback_data_cache_and_invalidate_instr_cache)
SYM (copyback_data_cache_and_invalidate_instr_cache):
nop | how?
rts
/*
* void enterRdbg(void)
*
* This function performs trap #4
* It is used :
* 1 - in the user code, to simulate a Breakpoint.
* (with justSaveContext = 0)
* 2 - in the RDBG code, to push a ctx in the list.
* (with justSaveContext = 1)
*
* In most of case, it will be use as described in 1.
* The 2nd possibility will be used by RDBG to obtain
* its own ctx
*/
PUBLIC (enterRdbg)
SYM (enterRdbg):
trap #4
rts
/*
* void excHandler(void)
*
* lotsa copypaste from cpu_asm.S
*
*/
/*
* The RTEMS jump table pushes vector
*
* The two types of exception frames on m68000 are
*
* uint16_t sr <- sp
* uint32_t pc
*
* uint16_t fc <- sp
* uint32_t addr
* uint16_t instr
* uint16_t sr
* uint32_t pc
*
* after real frame we push d0-d1/a0-a1
*
* after that we push CPU_Exception_frame
*
* exframe <- sp
* d0-d1/a0-a1
* frame
*/
#if ( M68K_COLDFIRE_ARCH == 1 )
.set SR_OFFSET, 2 | Status register offset
.set PC_OFFSET, 4 | Program Counter offset
.set FVO_OFFSET, 0 | Format/vector offset
#elif ( M68K_HAS_VBR == 1 )
.set SR_OFFSET, 0 | Status register offset
.set PC_OFFSET, 2 | Program Counter offset
.set FVO_OFFSET, 6 | Format/vector offset
#else
.set SR_OFFSET, 2 | Status register offset
.set PC_OFFSET, 4 | Program Counter offset
.set FVO_OFFSET, 0 | Format/vector offset placed in the stack
#endif /* M68K_HAS_VBR */
.align 4
PUBLIC (excHandler)
PUBLIC (BreakPointExcHdl)
SYM (excFormatLength):
/*
* size of exception stack frame depending on format type
* This is valid for m68k with VBR (68020/030/040/CPU32/CPU32+)
* size | format/name
*/
dc.w 4*2 | $0 standard
dc.w 4*2 | $1 throwaway stackframe
dc.w 6*2 | $2 CHK/CHK2/TRAPcc/TRAPV/DIV0/TRACE
dc.w 6*2 | $3 Coprocessor Post-Instruction (040)
dc.w 4*2 | $4 reserved
dc.w 4*2 | $5 reserved
dc.w 4*2 | $6 reserved
dc.w 30*2 | $7 Access Error (040)
dc.w 29*2 | $8 Bus Error (020)
dc.w 10*2 | $9 Coprocessor Mid-Instruction (020)
dc.w 16*2 | $A Short Bus-Error (020)
dc.w 46*2 | $B Long Bus-Error (020)
dc.w 12*2 | $C Bus Error/Address Error (CPU32)
dc.w 4*2 | $D reserved
dc.w 4*2 | $E reserved
dc.w 4*2 | $F reserved
SYM (excHandler):
#if ( M68K_COLDFIRE_ARCH == 1 )
lea a7@(-16),a7
movm.l d0-d1/a0-a1,a7@ | save d0-d1,a0-a1
movew a7@(16+FVO_OFFSET),d0 | d0 = F/VO
andl #0x0ffc,d0 | d0 = vector offset in vbr
lsrl #2,d0 | d0 = vector number
lea a7@(16),a1 | address of orig frame
lea a7@(16),a0 | address of orig frame
lea a0@(8),a0 | skip exception frame
#else
moveml d0-d1/a0-a1,a7@- | save d0-d1,a0-a1
movew a7@(16+FVO_OFFSET),d0 | d0 = F/VO
#if ( M68K_HAS_VBR == 1 )
movew d0,d1 | d1 is copy of F/VO
andl #0x0ffc,d0 | d0 = vector offset in vbr
lsrl #2,d0 | d0 = vector number
lsrl #8,d1
lsrl #3,d1
andl #0x001f,d1 | d1 is format number
lea SYM (excFormatLength),a1
movew a1@(d1),d1 | d1 = size of exc frame
lea a7@(16,d1),a0
lea a7@(16),a1 | address of orig frame
#else /* (M68k_HAS_VBR == 0) */
lea a7@(16),a1 | address of orig frame
lea a1@(6),a0 | skip stack frame
/*
* skip bus error stack frame...
*/
cmpi.l #3,d0
bgt 1f | if >3 then normal exc
lea a1@(8),a0 | skip extra stuff
lea a0@(6),a0 | a0 = orig sp
1:
#endif /* M68K_HAS_VBR */
#endif /* ( M68K_COLDFIRE_ARCH == 0 ) */
/*
* at this point:
* a0 points to stack above exception stack frame
* a1 points to start of exception stack frame
*/
movew a1@(SR_OFFSET),d1 | d1 = sr
andl #0xffff,d1
lea a7@(-76),a7 | reserve room for exception frame
| build CPU_Exception_frame
movel d0,a7@ | vecnum
movel d1,a7@(4) | sr
movel a1@(PC_OFFSET),d1 | d1 = pc
#if ( M68K_COLDFIRE_ARCH == 0 )
cmpiw #47,d0 | trap #15, breakpoint?
#else
cmpil #47,d0 | trap #15, breakpoint?
#endif
bne 2f
subql #2,d1 | real PC is at trap insn
2: movel d1,a7@(8) | store pc to exframe struct
movel a7@(76),a7@(12) | the orig d0 pushed at beginning
movel a7@(76+4),a7@(16) | the orig d1 pushed at beginning
movel d2,a7@(20)
movel d3,a7@(24)
movel d4,a7@(28)
movel d5,a7@(32)
movel d6,a7@(36)
movel d7,a7@(40)
movel a7@(76+8),a7@(44) | the orig a0 pushed at beginning
movel a7@(76+12),a7@(48) | the orig a1 pushed at beginning
movel a2,a7@(52)
movel a3,a7@(56)
movel a4,a7@(60)
movel a5,a7@(64)
movel a6,a7@(68)
movel a0,a7@(72) | stack pointer before exception
lea a7@,a0 | exframe address
movel a1,a7@- | save top of orig frame
movel a0,a7@- | push exframe address
jsr SYM(BreakPointExcHdl)
addql #4,a7 | pop exframe address
movel a7@+,a1 | restore orig frame address
| XXX what should be restored from exframe??
movel a7@(4),d1 | sr
movew d1,a1@(SR_OFFSET) | store sr to frame XXX ???
movel a7@(8),a1@(PC_OFFSET) | store pc to frame XXX ???
movel a7@(12),a7@(76) | d0 to be restored from stack
movel a7@(16),a7@(76+4) | d1 to be restored from stack
movel a7@(20),d2
movel a7@(24),d3
movel a7@(28),d4
movel a7@(32),d5
movel a7@(36),d6
movel a7@(40),d7
movel a7@(44),a7@(76+8) | a0 to be restored from stack
movel a7@(48),a7@(76+12) | a1 to be restored from stack
movel a7@(52),a2
movel a7@(56),a3
movel a7@(60),a4
movel a7@(64),a5
movel a7@(68),a6
addl #76,a7 | pop exframe
#if ( M68K_COLDFIRE_ARCH == 0 )
moveml a7@+,d0-d1/a0-a1 | restore d0-d1,a0-a1
#else
moveml a7@,d0-d1/a0-a1 | restore d0-d1,a0-a1
lea a7@(16),a7
#endif
#if ( M68K_HAS_VBR == 0 )
addql #2,a7 | pop format/id
#endif /* M68K_HAS_VBR */
| XXX bus err cleanup
rte
END_CODE
END
-178
View File
@@ -1,178 +0,0 @@
/*
**************************************************************************
*
* Component =
*
* Synopsis = rdbg/m68k/rdbg_f.c
*
* $Id$
*
**************************************************************************
*/
#include <assert.h>
#include <errno.h>
#include <rdbg/reg.h>
#include <rdbg/remdeb.h>
#include <rdbg/rdbg.h>
#include <rtems/score/cpu.h>
#include <rtems/score/thread.h>
m68k_isr_entry set_vector(
rtems_isr_entry handler,
rtems_vector_number vector,
int type
);
void CtxToRegs (const CPU_Exception_frame * ctx, xdr_regs * regs)
{
regs->r_dreg[0] = ctx->d0;
regs->r_dreg[1] = ctx->d1;
regs->r_dreg[2] = ctx->d2;
regs->r_dreg[3] = ctx->d3;
regs->r_dreg[4] = ctx->d4;
regs->r_dreg[5] = ctx->d5;
regs->r_dreg[6] = ctx->d6;
regs->r_dreg[7] = ctx->d7;
regs->r_areg[0] = ctx->a0;
regs->r_areg[1] = ctx->a1;
regs->r_areg[2] = ctx->a2;
regs->r_areg[3] = ctx->a3;
regs->r_areg[4] = ctx->a4;
regs->r_areg[5] = ctx->a5;
regs->r_areg[6] = ctx->a6;
regs->r_areg[7] = ctx->a7;
regs->r_sr = ctx->sr;
regs->r_pc = ctx->pc;
regs->r_vec = ctx->vecnum;
}
void
RegsToCtx (const xdr_regs * regs, CPU_Exception_frame * ctx)
{
ctx->d0 = regs->r_dreg[0];
ctx->d1 = regs->r_dreg[1];
ctx->d2 = regs->r_dreg[2];
ctx->d3 = regs->r_dreg[3];
ctx->d4 = regs->r_dreg[4];
ctx->d5 = regs->r_dreg[5];
ctx->d6 = regs->r_dreg[6];
ctx->d7 = regs->r_dreg[7];
ctx->a0 = regs->r_areg[0];
ctx->a1 = regs->r_areg[1];
ctx->a2 = regs->r_areg[2];
ctx->a3 = regs->r_areg[3];
ctx->a4 = regs->r_areg[4];
ctx->a5 = regs->r_areg[5];
ctx->a6 = regs->r_areg[6];
ctx->a7 = regs->r_areg[7];
ctx->sr = regs->r_sr;
ctx->pc = regs->r_pc;
ctx->vecnum = regs->r_vec;
}
void
get_ctx_thread (Thread_Control * thread, CPU_Exception_frame * ctx)
{
/*
* ISR stores d0-d1/a0-a1, calls _Thread_Dispatch
* _Thread_Dispatch calls _Context_Switch == _CPU_Context_switch
* _CPU_Context_switch stores/restores sr,d2-d7,a2-a7
* so if my reasoning is correct, *sp points to a location in
* _Thread_Dispatch
*/
ctx->vecnum = 0xdeadbeef;
ctx->sr = thread->Registers.sr;
ctx->pc = *(uint32_t *) thread->Registers.a7_msp;
ctx->d0 = 0xdeadbeef;
ctx->d1 = 0xdeadbeef;
ctx->a0 = 0xdeadbeef;
ctx->a1 = 0xdeadbeef;
ctx->a2 = (uint32_t) thread->Registers.a2;
ctx->a3 = (uint32_t) thread->Registers.a3;
ctx->a4 = (uint32_t) thread->Registers.a4;
ctx->a5 = (uint32_t) thread->Registers.a5;
ctx->a6 = (uint32_t) thread->Registers.a6;
ctx->a7 = (uint32_t) thread->Registers.a7_msp;
ctx->d2 = thread->Registers.d2;
ctx->d3 = thread->Registers.d3;
ctx->d4 = thread->Registers.d4;
ctx->d5 = thread->Registers.d5;
ctx->d6 = thread->Registers.d6;
ctx->d7 = thread->Registers.d7;
}
void
set_ctx_thread (Thread_Control * thread, CPU_Exception_frame * ctx)
{
thread->Registers.sr = ctx->sr;
thread->Registers.d2 = ctx->d2;
thread->Registers.d3 = ctx->d3;
thread->Registers.d4 = ctx->d4;
thread->Registers.d5 = ctx->d5;
thread->Registers.d6 = ctx->d6;
thread->Registers.d7 = ctx->d7;
thread->Registers.a2 = (void *) ctx->a2;
thread->Registers.a3 = (void *) ctx->a3;
thread->Registers.a4 = (void *) ctx->a4;
thread->Registers.a5 = (void *) ctx->a5;
thread->Registers.a6 = (void *) ctx->a6;
thread->Registers.a7_msp = (void *) ctx->a7;
}
int
Single_Step (CPU_Exception_frame * ctx)
{
if ((ctx->sr & (1 << 15)) != 0 || ExitForSingleStep != 0) {
/*
* Check coherency
*/
assert ((ctx->sr & (1 << 15)) != 0);
assert (ExitForSingleStep != 0);
return 0;
}
ctx->sr |= 1 << 15;
++ExitForSingleStep;
return 0;
}
int
CheckForSingleStep (CPU_Exception_frame * ctx)
{
if (ExitForSingleStep) {
ctx->sr &= ~(1 << 15);
ExitForSingleStep = 0;
return 1;
}
return 0;
}
void
CancelSingleStep (CPU_Exception_frame * ctx)
{
/*
* Cancel scheduled SS
*/
ctx->sr &= ~(1 << 15);
ExitForSingleStep--;
}
extern rtems_isr excHandler ();
void
connect_rdbg_exception (void)
{
set_vector (excHandler, 9, 0);
set_vector (excHandler, 47, 0);
set_vector (excHandler, 36, 0);
}
void
disconnect_rdbg_exception (void)
{
}
-180
View File
@@ -1,180 +0,0 @@
/*
**************************************************************************
*
* Component =
*
* Synopsis = rdbg/powerpc/excep_f.c
*
* $Id$
*
**************************************************************************
*/
#include <rtems.h>
#include <rtems/error.h>
#include <assert.h>
#include <errno.h>
#include <rdbg/rdbg.h>
#include <rdbg/servrpc.h>
int
ExcepToSig (Exception_context * ctx)
{
int excep = getExcNum (ctx);
switch (excep) {
case ASM_FLOAT_VECTOR:
return SIGFPE;
case ASM_TRACE_VECTOR:
case ASM_PROG_VECTOR:
case ASM_SYS_VECTOR:
return SIGTRAP;
/* At lest the MPC5xx series does not have this vector */
#if defined(ASM_ISI_VECTOR)
case ASM_ISI_VECTOR:
return SIGSEGV;
#endif
case ASM_RESET_VECTOR:
case ASM_MACH_VECTOR:
case ASM_EXT_VECTOR:
case ASM_ALIGN_VECTOR:
return SIGILL;
default:
break;
}
return SIGKILL;
}
/*----- Breakpoint Exception management -----*/
/*
* Handler for Breakpoint Exceptions :
* software breakpoints.
*/
void
BreakPointExcHdl (CPU_Exception_frame * ctx)
{
rtems_status_code status;
rtems_id continueSemId;
/*
* we must re-enable the floating point engine
* if the interrupted thread is FP. Otherwise,
* the semaphore primitives may crash when they
* try to save FP context while switching this
* thread... NB : deferred fp context switching
* would 1) avoid to have to save FP, make this code
* obsolete.
*/
if (ctx->EXC_SRR1 & MSR_FP) {
register unsigned long msr;
__asm__ __volatile__ ("mfmsr %0":"=r" (msr));
__asm__ __volatile__ ("mtmsr %0"::"r" (msr | MSR_FP));
}
if ((justSaveContext) && (ctx->_EXC_number == ASM_SYS_VECTOR)) {
PushSavedExceptCtx (_Thread_Executing->Object.id, ctx);
justSaveContext = 0;
} else {
if (ctx->_EXC_number != ASM_TRACE_VECTOR) {
NbSerializedCtx++;
rtems_semaphore_obtain (serializeSemId, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
NbSerializedCtx--;
}
currentTargetThread = _Thread_Executing->Object.id;
#ifdef DDEBUG
printk ("----------------------------------------------------------\n");
printk ("Exception %d caught at PC %x by thread %d\n",
ctx->_EXC_number, ctx->EXC_SRR0, _Thread_Executing->Object.id);
printk ("----------------------------------------------------------\n");
printk ("Processor execution context at time of the fault was :\n");
printk ("----------------------------------------------------------\n");
printk ("\t R0 = %x\n", ctx->GPR0);
printk ("\t R1 = %x\n", ctx->GPR1);
printk ("\t R2 = %x\n", ctx->GPR2);
printk ("\t R3 = %x\n", ctx->GPR3);
printk ("\t R4 = %x\n", ctx->GPR4);
printk ("\t R5 = %x\n", ctx->GPR5);
printk ("\t R6 = %x\n", ctx->GPR6);
printk ("\t R7 = %x\n", ctx->GPR7);
printk ("\t R8 = %x\n", ctx->GPR8);
printk ("\t R9 = %x\n", ctx->GPR9);
printk ("\t R10 = %x\n", ctx->GPR10);
printk ("\t R11 = %x\n", ctx->GPR11);
printk ("\t R12 = %x\n", ctx->GPR12);
printk ("\t R13 = %x\n", ctx->GPR13);
printk ("\t R14 = %x\n", ctx->GPR14);
printk ("\t R15 = %x\n", ctx->GPR15);
printk ("\t R16 = %x\n", ctx->GPR16);
printk ("\t R17 = %x\n", ctx->GPR17);
printk ("\t R18 = %x\n", ctx->GPR18);
printk ("\t R19 = %x\n", ctx->GPR19);
printk ("\t R20 = %x\n", ctx->GPR20);
printk ("\t R21 = %x\n", ctx->GPR21);
printk ("\t R22 = %x\n", ctx->GPR22);
printk ("\t R23 = %x\n", ctx->GPR23);
printk ("\t R24 = %x\n", ctx->GPR24);
printk ("\t R25 = %x\n", ctx->GPR25);
printk ("\t R26 = %x\n", ctx->GPR26);
printk ("\t R27 = %x\n", ctx->GPR27);
printk ("\t R28 = %x\n", ctx->GPR28);
printk ("\t R29 = %x\n", ctx->GPR29);
printk ("\t R30 = %x\n", ctx->GPR30);
printk ("\t R31 = %x\n", ctx->GPR31);
printk ("\t CR = %x\n", ctx->EXC_CR);
printk ("\t CTR = %x\n", ctx->EXC_CTR);
printk ("\t XER = %x\n", ctx->EXC_XER);
printk ("\t LR = %x\n", ctx->EXC_LR);
printk ("\t MSR = %x\n", ctx->EXC_SRR1);
#endif
status = rtems_semaphore_create (rtems_build_name ('D', 'B', 'G', 'c'),
0,
RTEMS_FIFO |
RTEMS_COUNTING_SEMAPHORE |
RTEMS_NO_INHERIT_PRIORITY |
RTEMS_NO_PRIORITY_CEILING |
RTEMS_LOCAL, 0, &continueSemId);
if (status != RTEMS_SUCCESSFUL)
rtems_panic ("Can't create continue semaphore: `%s'\n",
rtems_status_text (status));
PushExceptCtx (_Thread_Executing->Object.id, continueSemId, ctx);
switch (ctx->_EXC_number) {
case ASM_TRACE_VECTOR:
DPRINTF ((" TRACE EXCEPTION !!!\n"));
ctx->EXC_SRR1 &= ~MSR_SE;
ExitForSingleStep--;
rtems_semaphore_release (wakeupEventSemId);
break;
case ASM_PROG_VECTOR:
DPRINTF ((" BREAKPOINT EXCEPTION !!!\n"));
rtems_semaphore_release (wakeupEventSemId);
break;
case ASM_SYS_VECTOR:
DPRINTF ((" ENTER RDBG !!!\n"));
rtems_semaphore_release (wakeupEventSemId);
break;
default:
DPRINTF ((" OTHER EXCEPTION !!!\n"));
rtems_semaphore_release (wakeupEventSemId);
break;
}
rtems_semaphore_obtain (continueSemId, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
PopExceptCtx (_Thread_Executing->Object.id);
rtems_semaphore_delete (continueSemId);
}
}
File diff suppressed because it is too large Load Diff
@@ -1,75 +0,0 @@
/*
**************************************************************************
*
* Component = rdblib
* Synopsis = remdeb_f.x
*
**************************************************************************
* $Id$
**************************************************************************
*/
struct xdr_regs
{
unsigned int tabreg[40];
};
#ifdef RPC_HDR
%/* now define register macros to apply to xdr_regs struct */
%
%#define R_PC 0
%#define R_MSR 1
%#define R_EXCEPNB 2
%#define R_R0 3
%#define R_R1 (R_R0 + 1)
%#define R_R2 (R_R0 + 2)
%#define R_R3 (R_R0 + 3)
%#define R_R4 (R_R0 + 4)
%#define R_R5 (R_R0 + 5)
%#define R_R6 (R_R0 + 6)
%#define R_R7 (R_R0 + 7)
%#define R_R8 (R_R0 + 8)
%#define R_R9 (R_R0 + 9)
%#define R_R10 (R_R0 + 10)
%#define R_R11 (R_R0 + 11)
%#define R_R12 (R_R0 + 12)
%#define R_R13 (R_R0 + 13)
%#define R_R14 (R_R0 + 14)
%#define R_R15 (R_R0 + 15)
%#define R_R16 (R_R0 + 16)
%#define R_R17 (R_R0 + 17)
%#define R_R18 (R_R0 + 18)
%#define R_R19 (R_R0 + 19)
%#define R_R20 (R_R0 + 20)
%#define R_R21 (R_R0 + 21)
%#define R_R22 (R_R0 + 22)
%#define R_R23 (R_R0 + 23)
%#define R_R24 (R_R0 + 24)
%#define R_R25 (R_R0 + 25)
%#define R_R26 (R_R0 + 26)
%#define R_R27 (R_R0 + 27)
%#define R_R28 (R_R0 + 28)
%#define R_R29 (R_R0 + 29)
%#define R_R30 (R_R0 + 30)
%#define R_R31 (R_R0 + 31)
%#define R_CR 35
%#define R_CTR 36
%#define R_XER 37
%#define R_LR 38
%#define R_MQ 39
%
%#include <libcpu/raw_exception.h>
%
%#define REG_PC tabreg[R_PC] /* PC register offset */
%#define REG_SP tabreg[R_R1] /* SP register offset */
%#define REG_FP tabreg[R_R1] /* SP register offset (no FP on PPC) */
%#define BREAK_SIZE 4 /* Breakpoint occupies 4 bytes */
%#define BREAK_ADJ 0 /* Nothing to subtract from address after bp */
%#define IS_BREAK(l) ((l) == 0x7d8d6808)
%#define SET_BREAK(l) (0x7d8d6808)
%#define ORG_BREAK(c,p) (p)
%#define IS_STEP(regs) (regs.tabreg[R_EXCEPNB] == ASM_TRACE_VECTOR) /* Was step and not break */
%#define TARGET_PROC_TYPE 3
#endif
@@ -1,120 +0,0 @@
#include <rpc/types.h>
#include <rpc/rpc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bsp.h>
#include <rdbg/servrpc.h>
#include <rdbg/remdeb.h>
#define printf(c)
/*HEADER_START*/
#define RTEMS_PORT 2071
#define RTEMS_BACK_PORT 2073
/*
* Sun request values for the remote ptrace system call
*/
/*
* Memory data for read/write text or data. The size is in data. The target
* addr is in the addr field.
* Be careful before modifying because this value goes into internal
* pipes and is allocated on stack too. Pipes and/or the stack could
* become too small if this value gets incremented.
*/
/* now open_connex() routine which establishes a connection to server */
#define DEBUGGER_IS_GDB 0x2 /* */
/* now close_connex() routine which detaches from server */
/* now send_signal() routine which sends signals to processes like kill(2) */
/* now wait_info() routine which returns results of polling the wait status
of a process/actor. It may return 0 if running, else pid or -1 */
/* now ptrace() routine. This matches the Sun UNIX ptrace as well as
some additions */
/* now define the actual calls we support */
const char* names [] = {
"NULLPROC", "OPEN_CONNEX", "SEND_SIGNAL", "name3",
"name4", "name5", "name6", "name7",
"name8", "name9", "CLOSE_CONNEX", "PTRACE",
"name12", "WAIT_INFO", "name14", "name15",
"name16", "GET_SIGNAL_NAMES", "name18"
};
void
remotedeb_2(struct svc_req *rqstp, register SVCXPRT *transp)
{
union {
open_in open_connex_2_arg;
signal_in send_signal_2_arg;
close_in close_connex_2_arg;
ptrace_in ptrace_2_arg;
wait_in wait_info_2_arg;
} argument;
char *result;
xdrproc_t _xdr_argument, _xdr_result;
char *(*local)(char *, struct svc_req *);
DPRINTF (("remotedeb_2: %s (%d)\n",
(unsigned) rqstp->rq_proc <
(unsigned) (sizeof names / sizeof names[0]) ?
names [rqstp->rq_proc] : "???",
(int) rqstp->rq_proc));
switch (rqstp->rq_proc) {
case NULLPROC:
(void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
return;
case OPEN_CONNEX:
_xdr_argument = (xdrproc_t) xdr_open_in;
_xdr_result = (xdrproc_t) xdr_open_out;
local = (char *(*)(char *, struct svc_req *)) open_connex_2_svc;
break;
case SEND_SIGNAL:
_xdr_argument = (xdrproc_t) xdr_signal_in;
_xdr_result = (xdrproc_t) xdr_signal_out;
local = (char *(*)(char *, struct svc_req *)) send_signal_2_svc;
break;
case CLOSE_CONNEX:
_xdr_argument = (xdrproc_t) xdr_close_in;
_xdr_result = (xdrproc_t) xdr_void;
local = (char *(*)(char *, struct svc_req *)) close_connex_2_svc;
break;
case PTRACE:
_xdr_argument = (xdrproc_t) xdr_ptrace_in;
_xdr_result = (xdrproc_t) xdr_ptrace_out;
local = (char *(*)(char *, struct svc_req *)) ptrace_2_svc;
break;
case WAIT_INFO:
_xdr_argument = (xdrproc_t) xdr_wait_in;
_xdr_result = (xdrproc_t) xdr_wait_out;
local = (char *(*)(char *, struct svc_req *)) wait_info_2_svc;
break;
case GET_SIGNAL_NAMES:
_xdr_argument = (xdrproc_t) xdr_void;
_xdr_result = (xdrproc_t) xdr_get_signal_names_out;
local = (char *(*)(char *, struct svc_req *)) get_signal_names_2_svc;
break;
default:
svcerr_noproc (transp);
return;
}
memset ((char *)&argument, 0, sizeof (argument));
if (!svc_getargs (transp, _xdr_argument, (caddr_t) &argument)) {
svcerr_decode (transp);
return;
}
result = (*local)((char *)&argument, rqstp);
if (result != NULL && !svc_sendreply(transp, _xdr_result, result)) {
svcerr_systemerr (transp);
}
if (!svc_freeargs (transp, _xdr_argument, (caddr_t) &argument)) {
printf( "unable to free arguments");
exit (1);
}
return;
}
File diff suppressed because it is too large Load Diff
-83
View File
@@ -1,83 +0,0 @@
/* cpu_asm.s
*
* This file contains all assembly code for the Intel i386 implementation
* of RDBG.
*
* $Id$
*
*/
#include <rtems/asm.h>
#include <rtems/score/cpu.h>
#include <libcpu/io.h>
BEGIN_CODE
/*
* void copyback_data_cache_and_invalidate_instr_cache(addr, size)
*
* This routine performs a copy of the data cache
* and invalidate the instruction cache
*/
.p2align 5
PUBLIC_VAR (copyback_data_cache_and_invalidate_instr_cache)
SYM (copyback_data_cache_and_invalidate_instr_cache):
/* make sure the data changed is in the cache */
sync
/* r3 address to handle, r4 length in bytes */
addi r6, r0, PPC_CACHE_ALIGNMENT
/* r5 = last address to handle */
add r5,r3,r4
/* r3 = cache_align(r3, PPC_CACHE_ALIGNMENT) */
subi r0,r6,1
andc r3,r3,r0
/* R4 = R3 = copy of first address */
mr r4,r3
/*
* Copyback data cache
*/
1: cmplw r4,r5 /* r4 >= r5 then done */
dcbst 0,r4 /* flush (data cache bloc store) */
add r4,r4,r6 /* r4 = next cache line addr */
blt 1b /* end r4 >= r5 then done */
sync /* Wait for all dcbst to complete on bus */
/*
* invalidate instruction cache
*/
/* R4 = fisrt address */
mr r4,r3
2: cmplw r4,r5 /* r4 >= r5 then done */
icbi 0,r4 /* invalidate (instruction cache bloc invalidate) */
add r4,r4,r6 /* r4 = next cache line addr */
blt 2b /* end r4 >= r5 then done */
sync /* Wait for all icbi to complete on bus */
isync
blr
/*
* void enterRdbg(void)
*
* This function perform a call to the exception SYSTEM call
* It is used :
* 1 - in the user code, to simulate a Breakpoint.
* (with justSaveContext = 0)
* 2 - in the RDBG code, to push a ctx in the list.
* (with justSaveContext = 1)
*
* In most of case, it will be use as described in 1.
* The 2nd possibility will be used by RDBG to obtain
* its own ctx
*/
PUBLIC_VAR (enterRdbg)
SYM (enterRdbg):
sc
blr
END_CODE
END
-174
View File
@@ -1,174 +0,0 @@
/*
**************************************************************************
*
* Component =
*
* Synopsis = rdbg/powerpc/rdbg_f.c
*
* $Id$
*
**************************************************************************
*/
#include <rtems.h>
#include <assert.h>
#include <errno.h>
#include <rdbg/reg.h>
#include <rdbg/remdeb.h>
#include <rdbg/rdbg.h>
void
CtxToRegs (const CPU_Exception_frame * ctx, xdr_regs * regs)
{
*((CPU_Exception_frame *) regs) = *ctx;
}
void
RegsToCtx (const xdr_regs * regs, CPU_Exception_frame * ctx)
{
*ctx = *((CPU_Exception_frame *) regs);
}
void
get_ctx_thread (Thread_Control * thread, CPU_Exception_frame * ctx)
{
unsigned int *ptr;
unsigned int i;
ctx->EXC_SRR0 = thread->Registers.pc;
ctx->EXC_SRR1 = thread->Registers.msr;
ctx->_EXC_number = 0xdeadbeef;
ctx->GPR1 = thread->Registers.gpr1;
ctx->GPR2 = thread->Registers.gpr2;
/*
* Fill with dummy values...
*/
ptr = &ctx->GPR3;
for (i = 0; i < 10; i++)
ptr[i] = 0xdeadbeef;
ctx->GPR13 = thread->Registers.gpr13;
ctx->GPR14 = thread->Registers.gpr14;
ctx->GPR15 = thread->Registers.gpr15;
ctx->GPR16 = thread->Registers.gpr16;
ctx->GPR17 = thread->Registers.gpr17;
ctx->GPR18 = thread->Registers.gpr18;
ctx->GPR19 = thread->Registers.gpr19;
ctx->GPR20 = thread->Registers.gpr20;
ctx->GPR21 = thread->Registers.gpr21;
ctx->GPR22 = thread->Registers.gpr22;
ctx->GPR23 = thread->Registers.gpr23;
ctx->GPR24 = thread->Registers.gpr24;
ctx->GPR25 = thread->Registers.gpr25;
ctx->GPR26 = thread->Registers.gpr26;
ctx->GPR27 = thread->Registers.gpr27;
ctx->GPR28 = thread->Registers.gpr28;
ctx->GPR29 = thread->Registers.gpr29;
ctx->GPR30 = thread->Registers.gpr30;
ctx->GPR31 = thread->Registers.gpr31;
ctx->EXC_CR = thread->Registers.cr;
ctx->EXC_CTR = 0xdeadbeef;
ctx->EXC_XER = 0xdeadbeef;
ctx->EXC_LR = 0xdeadbeef;
ctx->EXC_MSR = 0xdeadbeef;
ctx->EXC_DAR = 0xdeadbeef;
}
void
set_ctx_thread (Thread_Control * thread, CPU_Exception_frame * ctx)
{
thread->Registers.gpr1 = ctx->GPR1;
thread->Registers.gpr2 = ctx->GPR2;
thread->Registers.gpr13 = ctx->GPR13;
thread->Registers.gpr14 = ctx->GPR14;
thread->Registers.gpr15 = ctx->GPR15;
thread->Registers.gpr16 = ctx->GPR16;
thread->Registers.gpr17 = ctx->GPR17;
thread->Registers.gpr18 = ctx->GPR18;
thread->Registers.gpr19 = ctx->GPR19;
thread->Registers.gpr20 = ctx->GPR20;
thread->Registers.gpr21 = ctx->GPR21;
thread->Registers.gpr22 = ctx->GPR22;
thread->Registers.gpr23 = ctx->GPR23;
thread->Registers.gpr24 = ctx->GPR24;
thread->Registers.gpr25 = ctx->GPR25;
thread->Registers.gpr26 = ctx->GPR26;
thread->Registers.gpr27 = ctx->GPR27;
thread->Registers.gpr28 = ctx->GPR28;
thread->Registers.gpr29 = ctx->GPR29;
thread->Registers.gpr30 = ctx->GPR30;
thread->Registers.gpr31 = ctx->GPR31;
thread->Registers.cr = ctx->EXC_CR;
thread->Registers.pc = ctx->EXC_SRR0;
thread->Registers.msr = ctx->EXC_SRR1;
}
int
Single_Step (CPU_Exception_frame * ctx)
{
if ((ctx->EXC_SRR1 & MSR_SE) != 0 || ExitForSingleStep != 0) {
/*
* Check coherency
*/
assert ((ctx->EXC_SRR1 & MSR_SE) != 0);
assert (ExitForSingleStep != 0);
return 0;
}
ctx->EXC_SRR1 |= MSR_SE;
++ExitForSingleStep;
return 0;
}
int
CheckForSingleStep (CPU_Exception_frame * ctx)
{
if (ExitForSingleStep) {
/*
* This functions can be called both from
* INT1 and INT3 handlers. In case it is
* called from INT3, need to clear TF.
*/
ctx->EXC_SRR1 &= ~MSR_SE;
ExitForSingleStep = 0;
return 1;
}
return 0;
}
void
CancelSingleStep (CPU_Exception_frame * ctx)
{
/*
* Cancel scheduled SS
*/
ctx->EXC_SRR1 &= ~MSR_SE;
ExitForSingleStep--;
}
static cpuExcHandlerType oldExcHandler;
void
connect_rdbg_exception ()
{
/*
* test if rdbg already connected its exception handler
*/
if (globalExceptHdl != BreakPointExcHdl) {
oldExcHandler = globalExceptHdl;
globalExceptHdl = BreakPointExcHdl;
}
}
void
disconnect_rdbg_exception ()
{
/*
* test if current execption handler is rdbg's one
* and restore the original one in this case.
*/
if (globalExceptHdl == BreakPointExcHdl) {
globalExceptHdl = oldExcHandler;
}
}
-328
View File
@@ -1,328 +0,0 @@
/*
**************************************************************************
*
* Component =
*
* Synopsis = rkdb/rkdb.c
*
* $Id$
*
**************************************************************************
*/
#include <assert.h>
#include <errno.h>
#include <rdbg/rdbg.h>
#include <rdbg/rdbg_f.h>
#include <rdbg/servrpc.h>
extern rtems_id serializeSemId;
extern rtems_id wakeupEventSemId;
extern rtems_id eventTaskId;
extern rtems_id debugId;
extern Exception_context *FirstCtx;
extern Exception_context *LastCtx;
extern CPU_Exception_frame SavedContext;
extern unsigned int NbExceptCtx;
/*
* return a pointer to the Thread Control structure of the specified
* Id
*/
Thread_Control *
Thread_Get_RDBG (Objects_Id Id)
{
unsigned index;
if (Id < _Objects_Information_table[OBJECTS_CLASSIC_API][1]->maximum_id &&
Id > _Objects_Information_table[OBJECTS_CLASSIC_API][1]->minimum_id) {
index = Id - _Objects_Information_table[OBJECTS_CLASSIC_API][1]->minimum_id;
if (_Objects_Information_table[OBJECTS_CLASSIC_API][1]->local_table[1 + index] != NULL) {
return (Thread_Control*) (_Objects_Information_table[OBJECTS_CLASSIC_API][1]->local_table[1 + index]);
}
}
if (Id < _Objects_Information_table[OBJECTS_POSIX_API][1]->maximum_id &&
Id > _Objects_Information_table[OBJECTS_POSIX_API][1]->minimum_id) {
index = Id - _Objects_Information_table[OBJECTS_POSIX_API][1]->minimum_id;
if (_Objects_Information_table[OBJECTS_POSIX_API][1]->
local_table[1 + index] != NULL)
return (Thread_Control*) (_Objects_Information_table[OBJECTS_POSIX_API][1]->local_table[1 + index]);
}
return 0;
}
int
safeMemRead (void *src, void *dest, int nbBytes)
{
/*
* safe because if it generates an exception,
* it must return normally
* TBD
*/
memcpy (dest, src, nbBytes);
return 0;
}
int
safeMemWrite (void *src, void *dest, int nbBytes)
{
/*
* safe because if it generates an exception,
* it must return normally
* TBD
*/
memcpy (dest, src, nbBytes);
return 0;
}
int
ptrace (int request, int pid, char *addr, int data, char *addr2)
{
int diag;
errno = 0;
if (pid != 1) {
errno = ESRCH;
return -1;
}
switch (request) {
case RPT_SINGLESTEP:{
Exception_context *ctx;
if (CannotRestart == 1) {
setErrno (EIO);
return -1;
}
if ((ctx = GetExceptCtx (currentTargetThread)) != NULL) {
Single_Step (ctx->ctx);
rtems_semaphore_release (ctx->semaphoreId);
return 0;
}
break;
}
case RPT_PEEKTEXT:
case RPT_PEEKDATA:{
diag = safeMemRead (addr, &data, sizeof data);
if (diag == 0)
return data;
mem_error:
return -1;
}
case RPT_POKETEXT:{
diag = safeMemWrite (&data, addr, sizeof data);
/*
* We must flush the INSTR and DATA cache to be sure the
* opcode modification is taken into account, because
* the breakpoint opcode is written via the data cache
* while execution code is fetched via the instruction
* cache
*/
if (diag == 0) {
copyback_data_cache_and_invalidate_instr_cache(
(unsigned char *)addr, sizeof data);
return 0;
}
goto mem_error;
}
case RPT_POKEDATA:{
diag = safeMemWrite (&data, addr, sizeof data);
if (diag == 0)
return 0;
goto mem_error;
}
case RPT_CONT:{
Exception_context *ctx;
if (CannotRestart == 1) {
setErrno (EIO);
return -1;
}
ctx = GetExceptCtx (currentTargetThread);
if (ctx == NULL)
ctx = GetExceptCtx (debugId);
if (ctx != NULL) {
if (!isRdbgException (ctx)) {
CannotRestart = 1;
setErrno (EIO);
return -1;
}
assert (data == 0);
assert (ExitForSingleStep == 0);
rtems_semaphore_release (ctx->semaphoreId);
}
rtems_semaphore_release (serializeSemId);
return 0;
}
case RPT_ATTACH:
return 0;
case RPT_DETACH:{
Exception_context *ctx;
if (NbExceptCtx || NbSerializedCtx) {
ctx = FirstCtx;
rtems_task_delete (eventTaskId);
rtems_semaphore_delete (serializeSemId);
rtems_semaphore_delete (wakeupEventSemId);
}
return 0;
}
case RPT_GETREGS:{
Exception_context *ctx;
if ((ctx = GetExceptCtx (currentTargetThread)) != NULL) {
CtxToRegs (ctx->ctx, (xdr_regs *) addr);
return 0;
}
break;
}
case RPT_SETREGS:{
Exception_context *ctx;
if ((ctx = GetExceptCtx (currentTargetThread)) != NULL) {
RegsToCtx ((xdr_regs *) addr, ctx->ctx);
return 0;
}
break;
}
case RPT_READTEXT:
case RPT_READDATA:{
diag = safeMemRead (addr, addr2, data);
if (diag == 0)
return 0;
goto mem_error;
}
case RPT_WRITETEXT:
case RPT_WRITEDATA:{
diag = safeMemWrite (addr2, addr, data);
if (diag == 0)
return 0;
goto mem_error;
}
case RPT_GETTARGETTHREAD:
if (!NbExceptCtx) {
errno = EBUSY;
return -1;
}
return currentTargetThread;
case RPT_SETTARGETTHREAD:
if (!NbExceptCtx) {
errno = EBUSY;
return -1;
}
currentTargetThread = data;
return 0;
case RPT_GETTHREADNAME:{
return TgtGetThreadName (NULL, (unsigned) (data), (char *) addr);
}
case RPT_THREADLIST:{
int count = TgtThreadList (NULL, (unsigned *) addr, UTHREAD_MAX
* sizeof (unsigned));
if (count < 0) {
errno = EINVAL;
return -1;
}
return count;
}
case RPT_SETTHREADREGS:{
Exception_context *ctx;
CPU_Exception_frame Ectx;
Thread_Control *thread;
rtems_id id;
rtems_task_ident (RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &id);
if (data == (unsigned) id)
break;
if ((ctx = GetExceptCtx (data)) != NULL) {
RegsToCtx ((xdr_regs *) addr, ctx->ctx);
return 0;
}
thread = Thread_Get_RDBG ((Objects_Id) (data));
if (thread != NULL) {
RegsToCtx ((xdr_regs *) addr, &Ectx);
set_ctx_thread (thread, &Ectx);
return 0;
}
break;
}
case RPT_GETTHREADREGS:{
Exception_context *ctx;
CPU_Exception_frame Ectx;
Thread_Control *thread;
rtems_id id;
rtems_task_ident (RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &id);
if (data == (unsigned) id) {
justSaveContext = 1;
enterRdbg ();
CtxToRegs (&(SavedContext), (xdr_regs *) addr);
return 0;
}
if ((ctx = GetExceptCtx (data)) != NULL) {
CtxToRegs (ctx->ctx, (xdr_regs *) addr);
return 0;
}
thread = Thread_Get_RDBG ((Objects_Id) (data));
if (thread != NULL) {
get_ctx_thread (thread, &Ectx);
CtxToRegs (&Ectx, (xdr_regs *) addr);
return 0;
}
break;
}
case RPT_KILL:
TotalReboot = 1;
return 0;
case RPT_TRACEME:
case RPT_PEEKUSER:
case RPT_POKEUSER:
case RPT_GETFPREGS:
case RPT_SETFPREGS:
case RPT_GETFPAREGS:
case RPT_SETFPAREGS:
case RPT_SYSCALL:
case RPT_DUMPCORE:
case RPT_GETUCODE:
case RPT_THREADSUSPEND:
case RPT_THREADRESUME:
case RPT_SETTHREADNAME:
default:
break;
}
errno = EINVAL;
return -1;
}
-149
View File
@@ -1,149 +0,0 @@
/*
**************************************************************************
*
* Component =
*
* Synopsis = rdbg.c
*
* $Id$
*
**************************************************************************
*/
#include <assert.h>
#include <errno.h>
#include <rtems.h>
#include <rtems/error.h>
#include <rdbg/rdbg.h>
#include <rdbg/servrpc.h>
#include <rtems/rtems_bsdnet.h>
#include <rpc/pmap_clnt.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <rtems/bspIo.h>
u_short rtemsPort = RTEMS_PORT;
int BackPort = RTEMS_BACK_PORT;
int rtemsActive = 0;
SVCXPRT *rtemsXprt;
int rtemsSock;
char taskName[] = "RTEMS rdbg daemon";
volatile int ExitForSingleStep = 0;
volatile int Continue;
volatile int justSaveContext;
volatile Objects_Id currentTargetThread;
volatile int CannotRestart = 0;
volatile int TotalReboot = 0;
int CONN_LIST_INC = 3;
int PID_LIST_INC = 1;
int TSP_RETRIES = 10;
int
getId ()
{
rtems_id id;
rtems_task_ident (RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &id);
return (int) (id);
}
static int
rdbgInit (void)
{
int sock;
struct sockaddr_in addr;
sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (sock == -1) {
printf ("%s: rdbgInit: cannot allocate socket\n", taskName);
return -1;
}
memset ((void *) &addr, 0, sizeof (struct sockaddr_in));
addr.sin_port = htons (rtemsPort);
if ((bind (sock, (struct sockaddr *) &addr, sizeof (addr))) == -1) {
printf ("%s: rdbgInit: cannot bind socket\n", taskName);
return -2;
}
rtemsXprt = svcudp_create (sock);
if (svcudp_enablecache (rtemsXprt, 1) == 0) {
printf ("%s: rdbgInit: cannot enable rpc cache\n", taskName);
return -3;
}
rtemsSock = sock;
if (!svc_register (rtemsXprt, REMOTEDEB, REMOTEVERS, remotedeb_2, 0)) {
fprintf (stderr, "unable to register (REMOTEDEB, REMOTEVERS, udp).");
return -4;
}
connect_rdbg_exception ();
return 0;
}
rtems_task
rdbgDaemon (rtems_task_argument argument)
{
svc_run ();
}
void
rtems_rdbg_initialize (void)
{
rtems_name task_name;
rtems_id tid;
rtems_status_code status;
#ifdef DDEBUG
rdb_debug = 1; /* DPRINTF now will display */
#endif
DPRINTF (("%s init starting\n", taskName));
/*
* Print version string
*/
#ifdef DDEBUG
printk ("RDBG v.%d built on [%s %s]\n", SERVER_VERS, __DATE__, __TIME__);
#else
printk ("RDBG v.%d\n", SERVER_VERS);
#endif
/*
* Create socket and init UDP RPC server
*/
if (rdbgInit () != 0)
goto error;
Continue = 1;
justSaveContext = 0;
currentTargetThread = 0;
task_name = rtems_build_name ('R', 'D', 'B', 'G');
if ((status = rtems_task_create (task_name, 5, 24576,
RTEMS_INTERRUPT_LEVEL (0),
RTEMS_DEFAULT_ATTRIBUTES |
RTEMS_SYSTEM_TASK, &tid))
!= RTEMS_SUCCESSFUL) {
printf ("status = %d\n", status);
rtems_panic ("Can't create task.\n");
}
status = rtems_task_start (tid, rdbgDaemon, 0);
return;
error:
printf ("initialization failed.\n");
}
void
setErrno (int error)
{
errno = error;
}
int
getErrno ()
{
return errno;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-155
View File
@@ -1,155 +0,0 @@
/*
**************************************************************************
*
* Component: RDBG
* Module: servcon.c
*
* Synopsis: Management of RPC client connections.
*
* $Id$
*
**************************************************************************
*/
#include <errno.h>
#include <rdbg/rdbg.h>
#include <rdbg/servrpc.h>
/*
* ConnCreate - create a new connection entry for a client.
*
* This function finds an empty entry in the connection array
* or makes space. It fills in the fields that are passed to it.
* It does not do any validation on net addresses nor does it
* start a validation cycle on other clients. This is done by
* the caller.
*/
int
ConnCreate (struct svc_req *rqstp, open_in * in)
{
NET_OPAQUE sender;
int idx;
CONN_LIST *clst;
setErrno (0);
/*
* Convert to valid Net address
*/
if (!TspTranslateRpcAddr (rqstp, &sender)) {
DPRINTF (("ConnCreate: TspTranslateRpcAddr failed\n"));
return -1;
}
if (!TspValidateAddr ((NET_OPAQUE *) in->back_port, &sender)) {
DPRINTF (("ConnCreate: TspValidateAddr failed\n"));
return -1; /* errno now setup with error */
}
/*
* look for an empty connection entry
*/
for (idx = 0; idx < conn_list_cnt; idx++) {
if (!conn_list[idx].in_use)
break; /* an empty one found */
}
if (idx >= conn_list_cnt) { /* no empties, create space */
CONN_LIST *tmp_conn_list = conn_list;
conn_list_cnt += CONN_LIST_INC;
if (conn_list) {
conn_list = (CONN_LIST *) Realloc (conn_list, /* extend */
conn_list_cnt * sizeof (CONN_LIST));
} else {
conn_list = (CONN_LIST *) Malloc (conn_list_cnt * sizeof (CONN_LIST));
}
if (!conn_list) { /* unable to get space */
if ((conn_list_cnt -= CONN_LIST_INC)) {
/*
* was realloc, restore space
*/
conn_list = tmp_conn_list;
}
return -1; /* errno set by failed alloc */
}
/*
* clear newly created memory
*/
memset (conn_list + idx, 0, CONN_LIST_INC * sizeof (CONN_LIST));
} else { /* clear new entry */
memset (conn_list + idx, 0, sizeof (CONN_LIST));
}
clst = conn_list + idx;
clst->in_use = True; /* now in use */
clst->sender = sender;
memcpy (&clst->back_port, &in->back_port, sizeof (NET_OPAQUE));
memcpy (&clst->route, &in->destination, sizeof (NET_OPAQUE));
clst->debug_type = (UCHAR) in->debug_type;
clst->flags = in->flags;
strncpy (clst->user_name, in->user_name, NAMEMAX - 1);
clst->user_name[NAMEMAX - 1] = 0;
return idx;
}
/*
* ConnDelete - remove connection entry when shutdown.
*
*/
void
ConnDelete (int conn, struct svc_req *rqstp, close_control control)
{
CONN_LIST *clst = conn_list + conn;
int idx;
Boolean prim;
if (!clst->in_use)
return; /* not active */
for (idx = 0; idx < pid_list_cnt; idx++) {
PID_LIST *plst = pid_list + idx;
if (!PIDMAP_TEST (conn, idx))
continue;
/*
* found a controlled pid
*/
prim = (plst->primary_conn == conn) ? True : False;
TgtDetachCon (conn, idx, True);
/*
* if still running or alive, we use close control on it
*/
if (!plst->pid)
continue; /* entry gone */
if (prim && control == CLOSE_KILL) {
/*
* kill off process
*/
TgtKillAndDelete (plst, rqstp, True);
} else if (!plst->owners) {
/*
* no owners left
*/
if (control == CLOSE_DETACH) {
TgtKillAndDelete (plst, rqstp, False);
}
if (control == CLOSE_DETACH || PROC_TERMINATED (plst)) {
TgtDelete (plst, conn, (control == CLOSE_DETACH) ? BMSG_DETACH : 0);
}
}
}
if (clst->list) {
Free (clst->list); /* free allocated memory */
}
DPRINTF (("ConnDelete: Connection closed for port %u\n",
HL_W (*((UINT16 *) & clst->back_port.c[2]))));
clst->in_use = False; /* free it back */
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-355
View File
@@ -1,355 +0,0 @@
/*
**************************************************************************
*
* Component: RDBG
* Module: servtsp.c
*
* Synopsis: Transport management for remote debug server.
*
* $Id$
*
**************************************************************************
*/
#include <errno.h>
#include <rdbg/rdbg.h>
#include <rdbg/servrpc.h>
#include <signal.h>
#include <rpc/rpc.h>
#include <rpc/svc.h>
#include <netinet/in.h>
#include <sys/socket.h>
static int out_sock;
static int warm_test;
static void TimeTestHandler ();
/*
* TspInit - Initialize the transport system.
*
*/
void
TspInit (int id)
{
struct sigaction sa;
struct sockaddr_in addr;
/*
* setup a socket to send event messages back through
*/
out_sock = socket (PF_INET, SOCK_DGRAM, 0);
if (out_sock < 0) {
DPRINTF (("TspInit: socket() failed %d errno %d\n",
out_sock, getErrno ()));
return; /* failed to open socket, let caller deal with */
}
memset ((void *) (&addr), 0, sizeof (addr));
addr.sin_family = AF_INET;
addr.sin_port = htons (BackPort);
if (bind (out_sock, (struct sockaddr *) &addr, sizeof (addr)) < 0) {
DPRINTF (("TspInit: bind() failed\n"));
}
/*
* setup alarm timer for warm testing
*/
memset (&sa, 0, sizeof (sa));
sa.sa_handler = TimeTestHandler;
sigaction (SIGALRM, &sa, 0);
}
/*
* TspTranslateRpcAddr - translate from an RPC handle to an
* opaque address.
*
* Converts the sender's address into the opaque data structure
* used for network addresses. This is used to look up the sender
* on each call.
*/
Boolean
TspTranslateRpcAddr (struct svc_req *rqstp, NET_OPAQUE * opaque)
{
struct sockaddr_in *addr; /* used as template to extract net info */
unsigned char *up;
memset (opaque, 0, sizeof (NET_OPAQUE));
/*
* We interpret the remote address as a standard netbuf name.
* The format is 2 bytes of address family (normally AF_INET)
* and then a length (5) and then the IP address.
*/
if (rqstp->rq_xprt->xp_addrlen != 16) {
DPRINTF (("TspTranslateRpcAddr: Unknown remote address!!!\n"));
setErrno (EPROTONOSUPPORT);
return False; /* invalid, so fails */
}
/*
* addr = &rqstp->rq_xprt->xp_raddr;
*/
addr = svc_getcaller (rqstp->rq_xprt);
/*
* verify it is AF_INET
*/
if (addr->sin_family != AF_INET) { /* no, error */
DPRINTF (("TspTranslateRpcAddr: Not an internet address!!\n"));
setErrno (EAFNOSUPPORT); /* invalid addr family */
return False;
}
/*
* good address type
*/
up = (unsigned char *) &addr->sin_addr.s_addr;
DPRINTF (("TspTranslateRpcAddr: Sent by %u.%u.%u.%u port #%u\n",
up[0], up[1], up[2], up[3], htons (addr->sin_port)));
memcpy (opaque, addr, sizeof (struct sockaddr_in));
return True;
}
/*
* TspValidateAddr - validate a passed in opaque address.
*
* Checks that the passed in address is in the format
* expected.
*/
Boolean
TspValidateAddr (NET_OPAQUE * opaque, NET_OPAQUE * sender)
{
struct sockaddr_in *addr; /* used as template to extract net info */
addr = (struct sockaddr_in *) opaque;
/*
* Verify it is AF_INET. Should check against sender IP address too
*/
if (addr->sin_family != AF_INET) {
DPRINTF (("TspValidateAddr: Back port invalid: %d\n",
htons (addr->sin_port)));
return False; /* not valid */
}
/*
* otherwise, we copy in the IP address, since client may not know it
*/
addr->sin_addr.s_addr = ((struct sockaddr_in *) sender)->sin_addr.s_addr;
DPRINTF (("TspValidateAddr: Back port is %d\n", htons (addr->sin_port)));
return True;
}
/*
* TspConnGetIndex - lookup an rpc caller's address as a connection entry.
*
* Looks up an ip address of a caller to locate the
* connection index in our connection array.
*/
int
TspConnGetIndex (struct svc_req *rqstp)
{
int conn;
/*
* &rqstp->rq_xprt->xp_raddr;
*/
struct sockaddr_in *addr = svc_getcaller (rqstp->rq_xprt);
for (conn = 0; conn < conn_list_cnt; conn++) {
if (!conn_list[conn].in_use)
continue; /* not used */
if (addr->sin_addr.s_addr == ((struct sockaddr_in *)
&conn_list[conn].sender)->sin_addr.s_addr
&& addr->sin_port == ((struct sockaddr_in *)
&conn_list[conn].sender)->sin_port) {
return conn;
}
}
return -1;
}
/*
* TspSendWaitChange - send wait-change message to clients to
* notify change.
*/
void
TspSendWaitChange (int conn, /* connection to send to */
BACK_MSG msg, /* BMSG type */
UINT16 spec, /* special information */
PID pid, /* pid it refers to */
UINT32 context, /* additional context for message */
Boolean force) /* force into being only message */
{
int idx;
struct SEND_LIST *snd_ptr;
if (force) {
/*
* force to top, which means others gone
*/
idx = 0;
conn_list[conn].send_idx = 1;
conn_list[conn].retry = 0;
} else {
for (idx = 0; idx < (int) conn_list[conn].send_idx; idx++) {
if (conn_list[conn].send_list[idx].send_type == msg
&& conn_list[conn].send_list[idx].pid == pid)
return; /* already pended for this pid */
}
idx = conn_list[conn].send_idx;
if (idx + 1 > MAX_SEND)
return; /* we lose it, what should we do??? */
conn_list[conn].send_idx++;
}
snd_ptr = &conn_list[conn].send_list[idx];
snd_ptr->send_type = msg; /* message to send */
snd_ptr->retry = TSP_RETRIES; /* about 1 minute of retries */
snd_ptr->spec = htons ((u_short) spec);
snd_ptr->pid = htonl (pid);
snd_ptr->context = htonl (context);
TspSendMessage (conn, False); /* now do the send */
}
/*
* TspSendMessage - send message at top of send list for connection.
*/
void
TspSendMessage (int conn, Boolean resend)
{
struct sockaddr_in addr;
struct UDP_MSG msg;
int cnt;
if (!resend && conn_list[conn].retry)
return; /* already waiting for reply */
/*
* Note on above: if no back port we can't remove unless
* someone blows off.
*/
if (!resend) {
/*
* first time, setup. Set retry count:
*/
conn_list[conn].retry = conn_list[conn].send_list[0].retry;
conn_list[conn].last_msg_num++; /* new sequence number */
if (!warm_test++) { /* starting, so enable timer */
alarm (2); /* resend every 2 seconds as needed */
}
}
msg.type = conn_list[conn].send_list[0].send_type;
msg.msg_num = conn_list[conn].last_msg_num;
msg.spec = conn_list[conn].send_list[0].spec;
msg.pid = conn_list[conn].send_list[0].pid;
msg.context = conn_list[conn].send_list[0].context;
memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
addr.sin_port =
((struct sockaddr_in *) &conn_list[conn].back_port)->sin_port;
addr.sin_addr.s_addr =
((struct sockaddr_in *) &conn_list[conn].back_port)->sin_addr.s_addr;
DPRINTF (("TspSendMessage: Sending msg %d (%s) to port %d\n",
msg.type, BmsgNames[msg.type], HL_W (addr.sin_port)));
cnt = sendto (out_sock, &msg, sizeof (msg), 0, (struct sockaddr *) &addr,
sizeof (addr));
if (cnt != sizeof (msg)) { /* failed on send */
printf ("%s: Failed to send msg %d to conn %d (%d vs. %ld)\n",
taskName, msg.type, conn, cnt, (long int) sizeof (msg));
}
}
/*
* TspMessageReceive - confirmation received, now send next if any.
*
* - since UDP is connectionless, we batch up the sends and use
* one at a time until we get a message indicating ready for
* next (from ack).
*/
void
TspMessageReceive (int conn, PID pid)
{
/*
* We remove the send list entry and use next if any
*/
conn_list[conn].retry = 0; /* reset */
if (!warm_test || !--warm_test) {
alarm (0); /* reset timer if not used */
}
#ifdef DDEBUG
if (conn_list[conn].send_list[0].send_type == BMSG_WARM) {
DPRINTF (("TspMessageReceive: Connection reset for conn %d\n", conn));
}
#endif
/*
* Move up by one if needed
*/
if (!--conn_list[conn].send_idx)
return; /* no more to do */
memcpy (conn_list[conn].send_list, conn_list[conn].send_list + 1, conn_list[conn].send_idx * sizeof (struct SEND_LIST)); /* copy down */
TspSendMessage (conn, 0);
}
/*
* TspGetHostName - return client's host name.
*
* - this routine returns the name of the client's host or the net
* number of unknown.
*/
char *
TspGetHostName (conn_idx)
int conn_idx; /* client connection number */
{
static char buff[30]; /* largest net num */
unsigned char *cp;
cp = conn_list[conn_idx].sender.c + 4;
sprintf (buff, "%u.%u.%u.%u", cp[0], cp[1], cp[2], cp[3]);
return buff;
}
/*
* TimeTestHandler - alarm timer handler to resend warm/wait test.
*/
static void
TimeTestHandler ()
{
int conn;
if (!warm_test)
return; /* no longer enabled */
for (conn = 0; conn < conn_list_cnt; conn++) {
/*
* locate all that are using this
*/
if (!conn_list[conn].in_use)
continue; /* not used */
if (!conn_list[conn].retry)
continue;
/*
* found one that we are testing
*/
if (!--conn_list[conn].retry) {
/*
* Counted down the retries: blow off.
* Need to have connection flag to indicate not blowing
* off for cases where client is stopped due to being
* debugged.
*/
ConnDelete (conn, NULL, CLOSE_IGNORE);
continue;
}
TspSendMessage (conn, True); /* send another message */
}
alarm (2); /* setup for 2 seconds from now */
}
-135
View File
@@ -1,135 +0,0 @@
/*
**********************************************************************
*
* Component: RDB
* Module: servutil.c
*
* Synopsis: Various utility routines
*
* $Id$
*
**********************************************************************
*/
#include <string.h>
#include <rdbg/rdbg.h>
#include <rdbg/servrpc.h>
/*----- Management of per-process list ----*/
/*
* ListAlloc - build up list entry.
*
* Notes:
* - this is a generic routine to build up entries in the per-connection
* list. The fields list, list_sz and list_alloc are affected.
*/
Boolean
ListAlloc (buff, clst)
char *buff;
CONN_LIST *clst; /* place to copy it */
{
int tmp;
char *name;
int new_len;
int len;
tmp = strlen (buff);
new_len = (int) clst->list_sz + 1 + tmp;
if (clst->list_alloc < (unsigned) new_len) {
/*
* need more space
*/
name = (char *) Realloc (clst->list, len = new_len + MAX_FILENAME);
if (name == NULL) {
return (False); /* failed, no space */
}
clst->list_alloc = len;
clst->list = name;
}
strcpy (clst->list + clst->list_sz, buff);
clst->list_sz += tmp;
return (True);
}
/*----- Management of processes -----*/
/*
* FindPidEntry - locate pid_list entry from pid
*/
int
FindPidEntry (int pid) /* pid = process identifier */
{
int idx;
/*
* pid 0 is invalid, and signals a free slot
*/
if (pid_list == NULL || pid == 0) {
return -1;
}
for (idx = 0; idx < pid_list_cnt; idx++) {
if (pid_list[idx].pid == pid)
return idx;
}
return -1;
}
/*----- Debug suport -----*/
#ifdef DDEBUG
/*
* Names of debug primitives
*/
const char *PtraceNames[] = {
"RPT_TRACEME", "RPT_PEEKTEXT", "RPT_PEEKDATA", "RPT_PEEKUSER",
"RPT_POKETEXT", "RPT_POKEDATA", "RPT_POKEUSER", "RPT_CONT",
"RPT_KILL", "RPT_SINGLESTEP", "RPT_ATTACH", "RPT_DETACH",
"RPT_GETREGS", "RPT_SETREGS", "RPT_GETFPREGS", "RPT_SETFPREGS",
"RPT_READDATA", "RPT_WRITEDATA", "RPT_READTEXT", "RPT_WRITETEXT",
"RPT_GETFPAREGS", "RPT_SETFPAREGS", "RPT_22", "RPT_23",
"RPT_SYSCALL", "RPT_DUMPCORE", "RPT_26", "RPT_27",
"RPT_28", "RPT_GETUCODE", "RPT_30", "RPT_31",
"RPT_32", "RPT_33", "RPT_34", "RPT_35",
"RPT_36", "RPT_37", "RPT_38", "RPT_39",
"RPT_40", "RPT_41", "RPT_42", "RPT_43",
"RPT_44", "RPT_45", "RPT_46", "RPT_47",
"RPT_48", "RPT_49", "RPT_GETTARGETTHREAD", "RPT_SETTARGETTHREAD",
"RPT_THREADSUSPEND", "RPT_THREADRESUME", "RPT_THREADLIST",
"RPT_GETTHREADNAME",
"RPT_SETTHREADNAME", "RPT_SETTHREADREGS", "RPT_GETTHREADREGS",
"RPT_59",
"RPT_60", "RPT_61", "RPT_62", "RPT_63",
"RPT_64", "RPT_65", "RPT_66", "RPT_67",
"RPT_68", "RPT_69", "RPT_70", "RPT_71",
"RPT_72", "RPT_73", "RPT_74", "RPT_STEPRANGE",
"RPT_CONTTO", "RPT_SETBREAK", "RPT_CLRBREAK", "RPT_GETBREAK",
"RPT_GETNAME", "RPT_STOP",
"RPT_PGETREGS", "RPT_PSETREGS",
"RPT_PSETTHREADREGS", "RPT_PGETTHREADREGS"
};
const char *
PtraceName (int req)
{
static char bufret[40];
if ((req < 0) || (req >= sizeof (PtraceNames) / sizeof (char *))) {
sprintf (bufret, "BAD_REQ_%d", req);
return bufret;
}
return PtraceNames[req];
}
const char *BmsgNames[] = {
"?", "WARM", "WAIT", "BREAK",
"EXEC_FAIL", "DETACH", "KILLED", "NOT_PRIM",
"NEW_PID"
};
#endif /* DDEBUG */
-4
View File
@@ -16,10 +16,6 @@ if HAS_LIBBSP
SRCS += ../lib/libbsp/@RTEMS_CPU@/@RTEMS_BSP_FAMILY@/libbsp.a
endif
if HAS_RDBG
SRCS += ../librdbg/librdbg.a
endif
# FIXME: ATM, there is no libcpu.a, anymore.
# SRCS += $(wildcard $(PROJECT_LIB)/libcpu.a)