forked from Imagelibrary/rtems
libdebugger: ARM fixes for Cortex-A8 and ARM mode.
- Fix destorying the target and thread parts. - Fix the ARM backend to support Cortex-A8 and ARM mode code. - Use the DBGDSCR interrupt mask when single stepping. - Use the DBGDSCR method of entry to debug mode to filter the execptions. - Add support for BSPs to control the ARM backend.
This commit is contained in:
@@ -1882,6 +1882,7 @@ project_lib_LIBRARIES += libdebugger.a
|
||||
|
||||
libdebugger_a_SOURCES =
|
||||
libdebugger_a_SOURCES += libdebugger/rtems-debugger-block.c
|
||||
libdebugger_a_SOURCES += libdebugger/rtems-debugger-bsp.c
|
||||
libdebugger_a_SOURCES += libdebugger/rtems-debugger-cmd.c
|
||||
libdebugger_a_SOURCES += libdebugger/rtems-debugger-remote.c
|
||||
libdebugger_a_SOURCES += libdebugger/rtems-debugger-remote-tcp.c
|
||||
|
||||
66
cpukit/include/rtems/debugger/rtems-debugger-bsp.h
Normal file
66
cpukit/include/rtems/debugger/rtems-debugger-bsp.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2019 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 BSP support.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_DEBUGGER_BSP_h
|
||||
#define _RTEMS_DEBUGGER_BSP_h
|
||||
|
||||
#include <rtems/rtems-debugger.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* ARM
|
||||
*/
|
||||
|
||||
/**
|
||||
* Debug registers
|
||||
*
|
||||
* Return the debugger registers for you BSP if the SoC requires memory mapped
|
||||
* registers and the DBGDRAR and DBGDSAR are not support or return 0. This
|
||||
* function is provided in the ARM backend and declared weak.
|
||||
*/
|
||||
void* rtems_debugger_arm_debug_registers(void);
|
||||
|
||||
/**
|
||||
* Configure the debug interface.
|
||||
*
|
||||
* Some ARM devices need special configurations to enable the debugging
|
||||
* hardware. The device are often locked down for securty reasons and
|
||||
* the debug hardware in the ARM needs to be enabled (asserting DBGEN).
|
||||
*/
|
||||
bool rtems_debugger_arm_debug_configure(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
46
cpukit/libdebugger/rtems-debugger-bsp.c
Normal file
46
cpukit/libdebugger/rtems-debugger-bsp.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2019 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/debugger/rtems-debugger-bsp.h>
|
||||
|
||||
void* rtems_debugger_arm_debug_registers(void) __attribute__ ((weak));
|
||||
bool rtems_debugger_arm_debug_configure(void) __attribute__ ((weak));
|
||||
|
||||
void*
|
||||
rtems_debugger_arm_debug_registers(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
rtems_debugger_arm_debug_configure(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1704,13 +1704,13 @@ rtems_debugger_session(void)
|
||||
|
||||
r = rtems_debugger_target_create();
|
||||
if (r < 0) {
|
||||
rtems_debugger_thread_destroy();
|
||||
rtems_debugger_unlock();
|
||||
return r;
|
||||
}
|
||||
|
||||
r = rtems_debugger_thread_create();
|
||||
if (r < 0) {
|
||||
rtems_debugger_target_destroy();
|
||||
rtems_debugger_unlock();
|
||||
return r;
|
||||
}
|
||||
@@ -1725,8 +1725,8 @@ rtems_debugger_session(void)
|
||||
0,
|
||||
&rtems_debugger->events_task);
|
||||
if (r < 0) {
|
||||
rtems_debugger_target_destroy();
|
||||
rtems_debugger_thread_destroy();
|
||||
rtems_debugger_target_destroy();
|
||||
rtems_debugger_unlock();
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -362,6 +362,7 @@ rtems_debugger_thread_system_resume(bool detaching)
|
||||
rtems_debugger_thread* thread = ¤t[i];
|
||||
rtems_status_code sc;
|
||||
int rr;
|
||||
bool has_exception;
|
||||
/*
|
||||
* Check if resuming, which can be continuing, a step, or stepping a
|
||||
* range.
|
||||
@@ -380,11 +381,13 @@ rtems_debugger_thread_system_resume(bool detaching)
|
||||
r = rr;
|
||||
}
|
||||
}
|
||||
has_exception =
|
||||
rtems_debugger_thread_flag(thread,
|
||||
RTEMS_DEBUGGER_THREAD_FLAG_EXCEPTION);
|
||||
if (rtems_debugger_verbose())
|
||||
rtems_debugger_printf("rtems-db: sys: : resume: 0x%08" PRIx32 "\n",
|
||||
thread->id);
|
||||
if (rtems_debugger_thread_flag(thread,
|
||||
RTEMS_DEBUGGER_THREAD_FLAG_EXCEPTION)) {
|
||||
rtems_debugger_printf("rtems-db: sys: : resume: 0x%08" PRIx32 " %c\n",
|
||||
thread->id, has_exception ? 'E' : ' ');
|
||||
if (has_exception) {
|
||||
rtems_debugger_target_exception_thread_resume(thread);
|
||||
} else {
|
||||
sc = rtems_task_resume(thread->id);
|
||||
|
||||
Reference in New Issue
Block a user