This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
PowerPC GDB backtrace fix
- From: Jonathan Larmour <jifl at eCosCentric dot com>
- To: eCos Patches List <ecos-patches at sources dot redhat dot com>
- Date: Sat, 08 Mar 2003 03:38:32 +0000
- Subject: PowerPC GDB backtrace fix
The attached patch which had been mentioned before, does appear to fix the
problem with GDB backtraces on PPC. Checked in to trunk.
Jifl
--
eCosCentric http://www.eCosCentric.com/ The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/powerpc/arch/current/ChangeLog,v
retrieving revision 1.47
diff -u -5 -p -r1.47 ChangeLog
--- ChangeLog 4 Jan 2003 03:37:12 -0000 1.47
+++ ChangeLog 8 Mar 2003 03:37:41 -0000
@@ -1,5 +1,11 @@
+2003-03-08 Jonathan Larmour <jifl at eCosCentric dot com>
+
+ * include/hal_arch.h (HAL_THREAD_INIT_CONTEXT): Initialize
+ what would be FP and LR in the previous stack frame to make
+ GDB backtraces happy.
+
2003-01-03 Gary Thomas <gary at mlbassoc dot com>
* include/hal_mem.h (CYGARC_MEMDESC_NOCACHE_PA): New macro which
allows defining non-cached space with non 1-1 mapping.
Index: include/hal_arch.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/powerpc/arch/current/include/hal_arch.h,v
retrieving revision 1.11
diff -u -5 -p -r1.11 hal_arch.h
--- include/hal_arch.h 23 May 2002 23:04:12 -0000 1.11
+++ include/hal_arch.h 8 Mar 2003 03:37:42 -0000
@@ -142,10 +142,12 @@ externC void cyg_hal_deliver_exception(
CYG_MACRO_START \
register CYG_WORD _sp_ = (((CYG_WORD)_sparg_) &~15) \
- CYGARC_PPC_STACK_FRAME_SIZE; \
register HAL_SavedRegisters *_regs_; \
int _i_; \
+ ((CYG_WORD *)_sp_)[0] = 0; /* Zero old FP and LR for EABI */ \
+ ((CYG_WORD *)_sp_)[1] = 0; /* to make GDB backtraces sane */ \
_regs_ = (HAL_SavedRegisters *)((_sp_) - sizeof(HAL_SavedRegisters)); \
for( _i_ = 0; _i_ < 32; _i_++ ) (_regs_)->d[_i_] = (_id_)|_i_; \
(_regs_)->d[01] = (CYG_WORD)(_sp_); /* SP = top of stack */ \
(_regs_)->d[03] = (CYG_WORD)(_thread_); /* R3 = arg1 = thread ptr */ \
(_regs_)->cr = 0; /* CR = 0 */ \