SLAC RTEMS_gdb_stub_1_5 with RTEMS Git HEAD

Nick Withers nick.withers at anu.edu.au
Mon Jun 24 06:10:05 UTC 2013


Hi all,

I'm trying to compile Till / SLAC's RTEMS_gdb_stub_1_5 against the RTEMS
Git HEAD and am having troubles...

Looks like the PPC Context_Control struct was changed significantly in
http://git.rtems.org/rtems/commit/cpukit/score/cpu/powerpc/rtems/score/cpu.h?id=1869bb7101de25205f325287419aaa25a13143c7 and now the PC and GPRs 2 - 13 inclusive are no longer exposed in the same way (code mods to try to get at everything else below).


I suppose I should just use 4.10.2 to get around this (and the other
issues that I probably haven't got far enough to run into yet), but a
couple o' questions first...
  - Anyone got it working on a PPC since the change?
  - Why isn't RTEMS_gdb_stub_1_5 part of RTEMS-proper?
  - Should I be using / is there something else entirely (see
http://www.rtems.org/pipermail/rtems-users/2013-June/011644.html )? Does
its status as a third-party module indicate that it's not a long-term
thing in any way?


Here're the mods I've made so far to the RTEMS_gdb_stub_1_5 source
(available from http://www.slac.stanford.edu/~strauman/rtems/gdb/ ) to
get to where I am:
____

> diff -ur RTEMS_gdb_stub_1_5.orig/Makefile RTEMS_gdb_stub_1_5/Makefile
> --- RTEMS_gdb_stub_1_5.orig/Makefile	2008-08-01 10:47:34.000000000 +1000
> +++ RTEMS_gdb_stub_1_5/Makefile	2013-06-24 14:35:27.447426298 +1000
> @@ -68,7 +68,7 @@
>  include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
>  
>  include $(RTEMS_CUSTOM)
> -include $(RTEMS_ROOT)/make/lib.cfg
> +include $(RTEMS_SHARE)/make/lib.cfg
>  
>  #
>  # (OPTIONAL) Add local stuff here using +=
> diff -ur RTEMS_gdb_stub_1_5.orig/rtems-gdb-stub-ppc-shared.c RTEMS_gdb_stub_1_5/rtems-gdb-stub-ppc-shared.c
> --- RTEMS_gdb_stub_1_5.orig/rtems-gdb-stub-ppc-shared.c	2008-07-31 05:18:28.000000000 +1000
> +++ RTEMS_gdb_stub_1_5/rtems-gdb-stub-ppc-shared.c	2013-06-24 15:22:10.047373782 +1000
> @@ -8,7 +8,7 @@
>  
>  #include "rtems-gdb-stub-ppc-shared.h"
>  
> -#include <libcpu/raw_exception.h> 
> +//#include <libcpu/raw_exception.h> 
>  #include <libcpu/spr.h> 
>  #include <libcpu/stackTrace.h>
>  #include <libcpu/cpuIdent.h>
> @@ -210,17 +210,17 @@
>  		}
>  #endif
>  		if (!f) {
> -			Frame        sfr = (Frame)tcb->Registers.gpr1;
> -			unsigned pcdummy = tcb->Registers.pc - 4;
> +			Frame        sfr = (Frame)(ppc_get_context(&(tcb->Registers))->gpr1);
> +			unsigned pcdummy = ppc_get_context(&(tcb->Registers))->pc - 4;
>  			if (!sfr->lr)
>  				sfr = sfr->up;
>  			/* dummy up from the TCB */
> -			memcpy(buf + GPR0_OFF+4,    &tcb->Registers.gpr1,       2 *4);
> -			memcpy(buf + GPR0_OFF+4*13, &tcb->Registers.gpr13, (32-13)*4);
> -			memcpy(buf + LR___OFF,      &sfr->lr,                      4);
> -			memcpy(buf + CR___OFF,      &tcb->Registers.cr,            4);
> -			memcpy(buf + PC___OFF,      &pcdummy,                      4);
> -			memcpy(buf + PS___OFF,      &tcb->Registers.msr,           4);
> +			memcpy(buf + GPR0_OFF+4,    &(ppc_get_context(&(tcb->Registers))->gpr1),       2 *4);
> +			memcpy(buf + GPR0_OFF+4*13, &(ppc_get_context(&(tcb->Registers))->gpr13), (32-13)*4);
> +			memcpy(buf + LR___OFF,      &sfr->lr,                                             4);
> +			memcpy(buf + CR___OFF,      &(ppc_get_context(&(tcb->Registers))->cr),            4);
> +			memcpy(buf + PC___OFF,      &pcdummy,                                             4);
> +			memcpy(buf + PS___OFF,      &(ppc_get_context(&(tcb->Registers))->msr),           4);
>  		}
>  		_Thread_Enable_dispatch();
>  	}
> @@ -253,12 +253,12 @@
>  #endif
>  		if ( !f ) {
>  			/* setup TCB */
> -			memcpy(&tcb->Registers.gpr1,  buf + (GPR0_OFF + 4),         2 *4);
> -			memcpy(&tcb->Registers.gpr13, buf + (GPR0_OFF + 4*13), (32-13)*4);
> -/*			memcpy(&((Frame)tcb->Registers.gpr1)->lr, buf + LR___OFF, 4);       */
> -			memcpy(&tcb->Registers.pc,    buf + PC___OFF, 4);
> -			memcpy(&tcb->Registers.msr,   buf + PS___OFF, 4);
> -			memcpy(&tcb->Registers.cr,    buf + CR___OFF, 4);
> +			memcpy(&(ppc_get_context(&(tcb->Registers))->gpr1),  buf + (GPR0_OFF + 4),         2 *4);
> +			memcpy(&(ppc_get_context(&(tcb->Registers))->gpr13), buf + (GPR0_OFF + 4*13), (32-13)*4);
> +/*			memcpy(&((Frame) (ppc_get_context(&(tcb->Registers))->gpr1))->lr, buf + LR___OFF, 4);       */
> +			memcpy(&(ppc_get_context(&(tcb->Registers))->pc),    buf + PC___OFF, 4);
> +			memcpy(&(ppc_get_context(&(tcb->Registers))->msr),   buf + PS___OFF, 4);
> +			memcpy(&(ppc_get_context(&(tcb->Registers))->cr),    buf + CR___OFF, 4);
>  		}
>  		_Thread_Enable_dispatch();
>  	}
> @@ -646,7 +646,7 @@
>  
>  	if ( (tcb = get_tcb(msg->tid)) ) {
>  		if ( isBookE ) {
> -			tcb->Registers.msr |= MSR_BOOKE_DE;
> +			ppc_get_context(&(tcb->Registers))->msr |= MSR_BOOKE_DE;
>  			/* make sure there are no pending events */
>  			if ( PPC_BOOKE_405 == isBookE ) {
>  				_write_PPC405_DBSR(-1);
> @@ -657,7 +657,7 @@
>  			}
>  		} else {
>  			/* just set SE in the TCB :-) */
> -			tcb->Registers.msr |= MSR_SE;
> +			ppc_get_context(&(tcb->Registers))->msr |= MSR_SE;
>  		}
>  		_Thread_Enable_dispatch();
>  		return 0;
> diff -ur RTEMS_gdb_stub_1_5.orig/rtems-stub.c RTEMS_gdb_stub_1_5/rtems-stub.c
> --- RTEMS_gdb_stub_1_5.orig/rtems-stub.c	2008-07-31 10:30:07.000000000 +1000
> +++ RTEMS_gdb_stub_1_5/rtems-stub.c	2013-06-24 15:20:09.015376051 +1000
> @@ -23,6 +23,7 @@
>  #include <ctype.h>
>  #include <signal.h>
>  #include <inttypes.h>
> +#include <unistd.h>
>  
>  #ifdef HAVE_CONFIG_H
>  #include <config.h>
____

Thanks!
-- 
Nick Withers

Embedded Systems Programmer
Room 2.26, Building 57
Department of Nuclear Physics
Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)

eMail: nick.withers at anu.edu.au
Phone: +61 2 6125 2091
Mobile: +61 414 397 446





More information about the users mailing list