mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-10-29 02:37:54 +08:00
cpukit: Add libdebugger, a remote debugger agent for GDB.
This commit is contained in:
1 parent
8fd465e67e
commit
a0d4e9933c
30 files changed
+6991
No files matched your search
@@ -18,6 +18,7 @@ SUBDIRS += libmd
|
||||
SUBDIRS += libgnat
|
||||
SUBDIRS += libdl
|
||||
SUBDIRS += libstdthreads
|
||||
SUBDIRS += libdebugger
|
||||
SUBDIRS += wrapup
|
||||
|
||||
SUBDIRS += zlib
|
||||
@@ -99,6 +100,14 @@ include_rtems_rtl_HEADERS += libdl/rtl-indirect-ptr.h libdl/rtl-sym.h libdl/rtl-
|
||||
include_rtems_rtl_HEADERS += libdl/rap.h libdl/rap-shell.h
|
||||
endif
|
||||
|
||||
if LIBDEBUGGER
|
||||
include_rtems_HEADERS += libdebugger/rtems-debugger.h
|
||||
include_rtems_debuggerdir = $(includedir)/rtems/debugger
|
||||
include_rtems_debugger_HEADERS =
|
||||
include_rtems_debugger_HEADERS += libdebugger/rtems-debugger-server.h
|
||||
include_rtems_debugger_HEADERS += libdebugger/rtems-debugger-remote.h
|
||||
endif
|
||||
|
||||
include_rtems_HEADERS += include/rtems/bspIo.h
|
||||
include_rtems_HEADERS += include/rtems/print.h
|
||||
include_rtems_HEADERS += include/rtems/printer.h
|
||||
|
||||
@@ -396,6 +396,17 @@ esac
|
||||
AM_CONDITIONAL(LIBDL,[test x"$HAVE_LIBDL" = x"yes"])
|
||||
AC_MSG_RESULT([$HAVE_LIBDL])
|
||||
|
||||
# Filter debugger to only build for architectures that have a target backend
|
||||
AC_MSG_CHECKING([whether CPU supports libdebugger])
|
||||
case $RTEMS_CPU in
|
||||
arm | i386)
|
||||
HAVE_LIBDEBUGGER=yes ;;
|
||||
*)
|
||||
HAVE_LIBDEBUGGER=no ;;
|
||||
esac
|
||||
AM_CONDITIONAL(LIBDEBUGGER,[test x"$HAVE_LIBDEBUGGER" = x"yes"])
|
||||
AC_MSG_RESULT([$HAVE_LIBDEBUGGER])
|
||||
|
||||
AC_MSG_CHECKING([whether CPU supports SHA])
|
||||
case $RTEMS_CPU in
|
||||
m32c)
|
||||
@@ -474,6 +485,7 @@ libi2c/Makefile
|
||||
libmd/Makefile
|
||||
libdl/Makefile
|
||||
libstdthreads/Makefile
|
||||
libdebugger/Makefile
|
||||
zlib/Makefile
|
||||
ftpd/Makefile
|
||||
telnetd/Makefile
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
if LIBDEBUGGER
|
||||
|
||||
include $(top_srcdir)/automake/compile.am
|
||||
|
||||
noinst_LIBRARIES = libdebugger.a
|
||||
libdebugger_a_SOURCES = \
|
||||
rtems-debugger-block.c \
|
||||
rtems-debugger-cmd.c \
|
||||
rtems-debugger-remote.c \
|
||||
rtems-debugger-server.c \
|
||||
rtems-debugger-target.c \
|
||||
rtems-debugger-threads.c \
|
||||
rtems-debugger-@RTEMS_CPU@.c
|
||||
|
||||
if LIBNETWORKING
|
||||
libdebugger_a_SOURCES += \
|
||||
rtems-debugger-remote-tcp.c
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
include $(srcdir)/preinstall.am
|
||||
include $(top_srcdir)/automake/local.am
|
||||
@@ -0,0 +1,9 @@
|
||||
## Automatically generated by ampolish3 - Do not edit
|
||||
|
||||
if AMPOLISH3
|
||||
$(srcdir)/preinstall.am: Makefile.am
|
||||
$(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
|
||||
endif
|
||||
|
||||
if LIBDEBUGGER
|
||||
endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Chris Johns <chrisj@rtems.org>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "rtems-debugger-block.h"
|
||||
|
||||
int
|
||||
rtems_debugger_block_create(rtems_debugger_block* block,
|
||||
size_t step,
|
||||
size_t size)
|
||||
{
|
||||
int r = 0;
|
||||
block->level = 0;
|
||||
block->step = step;
|
||||
block->count = step;
|
||||
block->size = size;
|
||||
block->block = calloc(block->count, block->size);
|
||||
if (block->block == NULL)
|
||||
errno = ENOMEM;
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
rtems_debugger_block_destroy(rtems_debugger_block* block)
|
||||
{
|
||||
free(block->block);
|
||||
block->block = NULL;
|
||||
block->level = 0;
|
||||
block->count = 0;
|
||||
block->size = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
rtems_debugger_block_resize(rtems_debugger_block* block)
|
||||
{
|
||||
int r = 0;
|
||||
if (block->level >= block->count) {
|
||||
block->count += block->step;
|
||||
block->block = realloc(block->block, block->count * block->size);
|
||||
if (block->block == NULL) {
|
||||
block->level = 0;
|
||||
block->count = 0;
|
||||
errno = ENOMEM;
|
||||
r = -1;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Chris Johns <chrisj@rtems.org>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Debugger for RTEMS.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_DEBUGGER_BLOCK_h
|
||||
#define _RTEMS_DEBUGGER_BLOCK_h
|
||||
|
||||
#include <rtems/rtems-debugger.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* DB server block manages a block of re-sizable memory. The block only
|
||||
* grows. As more threads enter the system the block becomes the peak and then
|
||||
* sits at that level.
|
||||
*/
|
||||
typedef struct rtems_debugger_block
|
||||
{
|
||||
void* block; /**< The block of memory. */
|
||||
size_t step; /**< The step size the block is increased by. */
|
||||
size_t size; /**< The size of the elements in the block. */
|
||||
size_t count; /**< The number of elements in the block. */
|
||||
size_t level; /**< The usage level in the block. */
|
||||
} rtems_debugger_block;
|
||||
|
||||
/**
|
||||
* Create a block.
|
||||
*/
|
||||
extern int rtems_debugger_block_create(rtems_debugger_block* block,
|
||||
size_t step,
|
||||
size_t size);
|
||||
|
||||
/**
|
||||
* Destroy a block.
|
||||
*/
|
||||
extern int rtems_debugger_block_destroy(rtems_debugger_block* block);
|
||||
|
||||
/**
|
||||
* Resize a block.
|
||||
*/
|
||||
extern int rtems_debugger_block_resize(rtems_debugger_block* block);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Chris Johns <chrisj@rtems.org>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Debugger for RTEMS.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_DEBUGGER_REMOTE_TCP_h
|
||||
#define _RTEMS_DEBUGGER_REMOTE_TCP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* Register a remote with the server.
|
||||
*/
|
||||
int rtems_debugger_register_tcp_remote(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Chris Johns <chrisj@rtems.org>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rtems/rtems-debugger.h>
|
||||
#include <rtems/debugger/rtems-debugger-server.h>
|
||||
#include <rtems/debugger/rtems-debugger-remote.h>
|
||||
|
||||
static rtems_debugger_remote* remotes[4];
|
||||
|
||||
int
|
||||
rtems_debugger_remote_register(rtems_debugger_remote* remote)
|
||||
{
|
||||
size_t r;
|
||||
if (remote->begin == NULL || remote->end == NULL ||
|
||||
remote->connect == NULL || remote->disconnect == NULL ||
|
||||
remote->isconnected == NULL ||
|
||||
remote->read == NULL || remote->write == NULL) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
for (r = 0; r < RTEMS_DEBUGGER_NUMOF(remotes); ++r) {
|
||||
if (remotes[r] == NULL) {
|
||||
remotes[r] = remote;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
errno = ENOSPC;
|
||||
return -1;
|
||||
}
|
||||
|
||||
rtems_debugger_remote*
|
||||
rtems_debugger_remote_find(const char* name)
|
||||
{
|
||||
size_t r;
|
||||
for (r = 0; r < RTEMS_DEBUGGER_NUMOF(remotes); ++r) {
|
||||
if (remotes[r] != NULL) {
|
||||
if (strcasecmp(name, remotes[r]->name) == 0)
|
||||
return remotes[r];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Chris Johns <chrisj@rtems.org>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Debugger for RTEMS.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_DEBUGGER_REMOTE_h
|
||||
#define _RTEMS_DEBUGGER_REMOTE_h
|
||||
|
||||
#include <rtems/rtems-debugger.h>
|
||||
#include <rtems/debugger/rtems-debugger-server.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* Debugger remote.
|
||||
*/
|
||||
struct rtems_debugger_remote
|
||||
{
|
||||
const char* name;
|
||||
int (*begin)(rtems_debugger_remote* remote, const char* device);
|
||||
int (*end)(rtems_debugger_remote* remote);
|
||||
int (*connect)(rtems_debugger_remote* remote);
|
||||
int (*disconnect)(rtems_debugger_remote* remote);
|
||||
bool (*isconnected)(rtems_debugger_remote* remote);
|
||||
ssize_t (*read)(rtems_debugger_remote* remote, void* buf, size_t nbytes);
|
||||
ssize_t (*write)(rtems_debugger_remote* remote, const void* buf, size_t nbytes);
|
||||
void* data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register a remote with the server.
|
||||
*/
|
||||
int rtems_debugger_remote_register(rtems_debugger_remote* remote);
|
||||
|
||||
/**
|
||||
* Find a remote by name.
|
||||
*/
|
||||
rtems_debugger_remote* rtems_debugger_remote_find(const char* name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Chris Johns <chrisj@rtems.org>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Debugger for RTEMS.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_DEBUGGER_h
|
||||
#define _RTEMS_DEBUGGER_h
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/printer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* Timeout period for an ack
|
||||
*/
|
||||
#define RTEMS_DEBUGGER_TIMEOUT (3)
|
||||
|
||||
/**
|
||||
* Start the Debugger.
|
||||
*/
|
||||
extern int rtems_debugger_start(const char* remote,
|
||||
const char* device,
|
||||
int timeout,
|
||||
rtems_task_priority priority,
|
||||
const rtems_printer* printer);
|
||||
|
||||
/**
|
||||
* Stop the Debugger.
|
||||
*/
|
||||
extern int rtems_debugger_stop(void);
|
||||
|
||||
/**
|
||||
* Is the Debugger running?.
|
||||
*/
|
||||
extern bool rtems_debugger_running(void);
|
||||
|
||||
/**
|
||||
* Verbose control.
|
||||
*/
|
||||
extern void rtems_debugger_set_verbose(bool on);
|
||||
|
||||
/**
|
||||
* Control remote debug printing.
|
||||
*/
|
||||
extern int rtems_debugger_remote_debug(bool state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
@@ -233,6 +233,24 @@ $(PROJECT_INCLUDE)/rtems/rtl/rap-shell.h: libdl/rap-shell.h $(PROJECT_INCLUDE)/r
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtl/rap-shell.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtl/rap-shell.h
|
||||
endif
|
||||
if LIBDEBUGGER
|
||||
$(PROJECT_INCLUDE)/rtems/rtems-debugger.h: libdebugger/rtems-debugger.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtems-debugger.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtems-debugger.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/debugger/$(dirstamp):
|
||||
@$(MKDIR_P) $(PROJECT_INCLUDE)/rtems/debugger
|
||||
@: > $(PROJECT_INCLUDE)/rtems/debugger/$(dirstamp)
|
||||
PREINSTALL_DIRS += $(PROJECT_INCLUDE)/rtems/debugger/$(dirstamp)
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/debugger/rtems-debugger-server.h: libdebugger/rtems-debugger-server.h $(PROJECT_INCLUDE)/rtems/debugger/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/debugger/rtems-debugger-server.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/debugger/rtems-debugger-server.h
|
||||
|
||||
$(PROJECT_INCLUDE)/rtems/debugger/rtems-debugger-remote.h: libdebugger/rtems-debugger-remote.h $(PROJECT_INCLUDE)/rtems/debugger/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/debugger/rtems-debugger-remote.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/debugger/rtems-debugger-remote.h
|
||||
endif
|
||||
$(PROJECT_INCLUDE)/rtems/bspIo.h: include/rtems/bspIo.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/bspIo.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/bspIo.h
|
||||
|
||||
@@ -95,6 +95,10 @@ if LIBDL
|
||||
TMP_LIBS += ../libdl/libdl.a
|
||||
endif
|
||||
|
||||
if LIBDEBUGGER
|
||||
TMP_LIBS += ../libdebugger/libdebugger.a
|
||||
endif
|
||||
|
||||
librtemscpu.a: $(TMP_LIBS)
|
||||
rm -f $@
|
||||
$(MKDIR_P) $(ARCH)
|
||||
|
||||
@@ -53,5 +53,9 @@ _SUBDIRS += dl04 dl05
|
||||
endif
|
||||
endif
|
||||
|
||||
if DEBUGGERTESTS
|
||||
_SUBDIRS += debugger01
|
||||
endif
|
||||
|
||||
include $(top_srcdir)/../automake/test-subdirs.am
|
||||
include $(top_srcdir)/../automake/local.am
|
||||
@@ -80,6 +80,17 @@ AS_IF([test x"$TEST_LIBDL" = x"yes"],[
|
||||
|
||||
AM_CONDITIONAL(DLTESTS,[test x"$TEST_LIBDL" = x"yes"])
|
||||
|
||||
# Must match the list in cpukit.
|
||||
AC_MSG_CHECKING([whether CPU supports libdebugger])
|
||||
case $RTEMS_CPU in
|
||||
arm | i386)
|
||||
TEST_LIBDEBUGGER=yes ;;
|
||||
*)
|
||||
TEST_LIBDEBUGGER=no ;;
|
||||
esac
|
||||
AC_MSG_RESULT([$TEST_LIBDEBUGGER])
|
||||
AM_CONDITIONAL(DEBUGGERTESTS,[test x"$TEST_LIBDEBUGGER" = x"yes"])
|
||||
|
||||
# Explicitly list all Makefiles here
|
||||
AC_CONFIG_FILES([Makefile
|
||||
networking01/Makefile
|
||||
@@ -169,5 +180,6 @@ math/Makefile
|
||||
mathf/Makefile
|
||||
mathl/Makefile
|
||||
complex/Makefile
|
||||
debugger01/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
rtems_tests_PROGRAMS = debugger01
|
||||
debugger01_SOURCES = init.c remote.c system.h
|
||||
|
||||
dist_rtems_tests_DATA = debugger01.scn
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../automake/compile.am
|
||||
include $(top_srcdir)/../automake/leaf.am
|
||||
|
||||
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
|
||||
|
||||
LINK_OBJS = $(debugger01_OBJECTS)
|
||||
LINK_LIBS = $(debugger01_LDLIBS)
|
||||
|
||||
debugger01$(EXEEXT): $(debugger01_OBJECTS) $(debugger01_DEPENDENCIES)
|
||||
@rm -f debugger01$(EXEEXT)
|
||||
$(make-exe)
|
||||
|
||||
include $(top_srcdir)/../automake/local.am
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2016 Chris Johns <chrisj@rtems.org>
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.rtems.org/license/LICENSE.
|
||||
#
|
||||
|
||||
This file describes the directives and concepts tested by this test set.
|
||||
|
||||
test set name: debugger01
|
||||
|
||||
directives:
|
||||
|
||||
rtems_debugger_start
|
||||
|
||||
concepts:
|
||||
|
||||
+ Starts a debugging session with the test remote backend.
|
||||
@@ -0,0 +1,188 @@
|
||||
|
||||
*** BEGIN OF TEST DEBUGGER01 ***
|
||||
error: rtems-db: remote not found: test
|
||||
error: rtems-db: test remote: begin
|
||||
rtems-db: remote-debug is on
|
||||
rtems-db: remote running
|
||||
rtems-db: test remote: isconnected: not-connected
|
||||
error: rtems-db: test remote: connect
|
||||
rtems-db: remote running
|
||||
rtems-db: arm debug: (v3.0) ARMv7 [v7, all CP14 registers] breakpoints:5
|
||||
watchpoints:3
|
||||
rtems-db: sys: : suspending
|
||||
rtems-db: sys: thd: 0a010001: signal: 0
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=0 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK?]]
|
||||
remote: rx: message=1 length=5
|
||||
remote: rx: xxxxx
|
||||
remote: rx: message=2 length=5
|
||||
remote: rx: $x#aa
|
||||
rtems-db: get: 5: xxxxx [[junk dropped]]
|
||||
rtems-db: get: : $x#aa [[invalid checksum]]
|
||||
rtems-db: put: 1: -
|
||||
remote: tx: message=0 length=1
|
||||
remote: tx: -
|
||||
remote: rx: message=3 length=141
|
||||
remote: rx: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+#df
|
||||
rtems-db: get: 141: [[junk dropped]]
|
||||
rtems-db: get: : $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+#df
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=1 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 167: $qSupported:PacketSize=4096;QNonStop-;multiprocess+;swbreak+;hwbreak-;qRelocInsn-;fork-events-;vfork-events-;exec-events-;vContSupported+;QThreadEvents-;no-resumed+#b3
|
||||
remote: tx: message=2 length=167
|
||||
remote: tx: $qSupported:PacketSize=4096;QNonStop-;multiprocess+;swbreak+;hwbreak-;qRelocInsn-;fork-events-;vfork-events-;exec-events-;vContSupported+;QThreadEvents-;no-resumed+#b3
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=4 length=19
|
||||
remote: rx: $vMustReplyEmpty#3a
|
||||
rtems-db: get: 19: $vMustReplyEmpty#3a
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=3 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 4: $#00
|
||||
remote: tx: message=4 length=4
|
||||
remote: tx: $#00
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=5 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK]]
|
||||
remote: rx: message=6 length=10
|
||||
remote: rx: $Hgp0.0#ad
|
||||
rtems-db: get: 10: $Hgp0.0#ad
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=5 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 6: $OK#9a
|
||||
remote: tx: message=6 length=6
|
||||
remote: tx: $OK#9a
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=7 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK]]
|
||||
remote: rx: message=8 length=12
|
||||
remote: rx: $qTStatus#49
|
||||
rtems-db: get: 12: $qTStatus#49
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=7 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 4: $#00
|
||||
remote: tx: message=8 length=4
|
||||
remote: tx: $#00
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=9 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK]]
|
||||
remote: rx: message=10 length=5
|
||||
remote: rx: $?#3f
|
||||
rtems-db: get: 5: $?#3f
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=9 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 26: $T00thread:p1.0a010001;#23
|
||||
remote: tx: message=10 length=26
|
||||
remote: tx: $T00thread:p1.0a010001;#23
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=11 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK]]
|
||||
remote: rx: message=12 length=16
|
||||
remote: rx: $qfThreadInfo#bb
|
||||
rtems-db: get: 16: $qfThreadInfo#bb
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=11 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 16: $mp1.0a010001#ef
|
||||
remote: tx: message=12 length=2
|
||||
remote: tx: $mp1.0a010001#ef
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=13 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK]]
|
||||
remote: rx: message=14 length=16
|
||||
remote: rx: $qsThreadInfo#c8
|
||||
rtems-db: get: 16: $qsThreadInfo#c8
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=13 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 5: $l#6c
|
||||
remote: tx: message=14 length=5
|
||||
remote: tx: $l#6c
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=15 length=1
|
||||
remote: rx: -
|
||||
rtems-db: get: 1: - [[NACK]]
|
||||
rtems-db: put: 5: $l#6c
|
||||
remote: tx: message=15 length=5
|
||||
remote: tx: $l#6c
|
||||
remote: rx: message=16 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK]]
|
||||
remote: rx: message=17 length=15
|
||||
remote: rx: $qAttached:1#fa
|
||||
rtems-db: get: 15: $qAttached:1#fa
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=16 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 5: $1#31
|
||||
remote: tx: message=17 length=5
|
||||
remote: tx: $1#31
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=18 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK]]
|
||||
remote: rx: message=19 length=8
|
||||
remote: rx: $Hc-1#09
|
||||
rtems-db: get: 8: $Hc-1#09
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=18 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 6: $OK#9a
|
||||
remote: tx: message=19 length=6
|
||||
remote: tx: $OK#9a
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=20 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK]]
|
||||
remote: rx: message=21 length=12
|
||||
remote: rx: $qOffsets#4b
|
||||
rtems-db: get: 12: $qOffsets#4b
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=20 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 4: $#00
|
||||
remote: tx: message=21 length=4
|
||||
remote: tx: $#00
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=22 length=1
|
||||
remote: rx: +
|
||||
rtems-db: get: 1: + [[ACK]]
|
||||
remote: rx: message=23 length=6
|
||||
remote: rx: $g#67+
|
||||
rtems-db: get: 6: $g#67
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=22 length=1
|
||||
remote: tx: +
|
||||
+ [[extra data: 0x2b]]rtems-db: put: 212: $cc381200cc381200cc381200cc3812004c162000a83f2000704520004c16200040362000481620000000000020ee1100cc38120028a2200089dc100089dc1000cc381200cc381200cc381200cc381200cc381200cc381200cc381200cc381200cc381200cc381200#95
|
||||
remote: tx: message=23 length=2
|
||||
remote: tx: $cc381200cc381200cc381200cc3812004c162000a83f2000704520004c16200040362000481620000000000020ee1100cc38120028a2200089dc100089dc1000cc381200cc381200cc381200cc381200cc381200cc381200cc381200cc381200cc3812g00cc381200#95
|
||||
rtems-db: test remote: isconnected: connected
|
||||
remote: rx: message=24 length=7
|
||||
remote: rx: $D;1#b0
|
||||
rtems-db: get: 7: $D;1#b0
|
||||
rtems-db: put: 1: +
|
||||
remote: tx: message=24 length=1
|
||||
remote: tx: +
|
||||
rtems-db: put: 6: $OK#9a
|
||||
remote: tx: message=25 length=6
|
||||
remote: tx: $OK#9a
|
||||
rtems-db: test remote: isconnected: connected
|
||||
rtems-db: test remote: disconnect host
|
||||
rtems-db: test remote: isconnected: not-connected
|
||||
rtems-db: events running
|
||||
rtems-db: events finishing
|
||||
rtems-db: sys: : resuming
|
||||
rtems-db: test remote: isconnected: not-connected
|
||||
rtems-db: test remote: isconnected: not-connected
|
||||
*** END OF TEST DEBUGGER01 ***
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Debugger test.
|
||||
*
|
||||
* Copyright (c) 2016 Chris Johns (chrisj@rtems.org)
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
#include "system.h"
|
||||
|
||||
#include "tmacros.h"
|
||||
|
||||
#include <rtems/rtems-debugger.h>
|
||||
|
||||
#include "system.h"
|
||||
|
||||
static void test(void)
|
||||
{
|
||||
rtems_printer printer;
|
||||
|
||||
rtems_print_printer_fprintf(&printer, stdout);
|
||||
rtems_test_assert(rtems_debugger_start("test", "something",
|
||||
3, 10, &printer) < 0);
|
||||
rtems_test_assert(rtems_debugger_register_test_remote() == 0);
|
||||
rtems_test_assert(rtems_debugger_start("test", "something",
|
||||
3, 10, &printer) == 0);
|
||||
rtems_debugger_set_verbose(true);
|
||||
rtems_test_assert(rtems_debugger_remote_debug(true) == 0);
|
||||
|
||||
/*
|
||||
* This thread is suspended when the debugger is active until the debugger
|
||||
* disconnects.
|
||||
*/
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
const char rtems_test_name[] = "DEBUGGER01";
|
||||
|
||||
rtems_task Init(rtems_task_argument argument)
|
||||
{
|
||||
TEST_BEGIN();
|
||||
|
||||
test();
|
||||
|
||||
TEST_END();
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,37 @@
|
||||
/* system.h
|
||||
*
|
||||
* This include file contains information that is included in every
|
||||
* function in the test set.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1999.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <tmacros.h>
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task Init(rtems_task_argument argument);
|
||||
|
||||
int rtems_debugger_register_test_remote(void);
|
||||
void test_wake(void);
|
||||
|
||||
/* configuration information */
|
||||
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
|
||||
#define CONFIGURE_MAXIMUM_TASKS 10
|
||||
#define CONFIGURE_MAXIMUM_SEMAPHORES 10
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#include <rtems/confdefs.h>
|
||||
|
||||
/* end of include file */
|
||||
Reference in new issue
Block a user