This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] fix for PR:1291


This patch addresses an issue with SH processors where gdb cannot
backtrace out of function with more than 256 bytes of local variables.

Code such as:

sub1()
{
        int buf[64];
}

sub2()
{
        int buf[65];
}

generates prologues such as:

sub1:
	mov.l	r14,@-r15
	add	#-128,r15
	add	#-128,r15
	mov	r15,r14
.L8:
	mov.w	.L9,r7
	add	r7,r14
	mov	r14,r15
	mov.l	@r15+,r14
	rts
	nop
	.align 1
.L9:
	.short	256

and

sub2:
	mov.l	r14,@-r15
	mov.w	.L11,r3
	sub	r3,r15
	mov	r15,r14
.L10:
	mov.w	.L11,r7
	add	r7,r14
	mov	r14,r15
	mov.l	@r15+,r14
	rts
	nop
	.align 1
.L11:
	.short	260


The second form is not recognized properly by the frame code in gdb.  In
the gcc 3 series, r1 is used instead of r3 so this patch expands on the
original patch attached to the PR.

Credit to inaba@src.ricoh.co.jp for his original find and patch and to
Colin Burgess for noting the differences between gcc 2 and 3.

ChangeLog:

2003-09-16  Kris Warkentin  <kewarken@qnx.com>

	* sh-tdep.c: Properly detect frame prologues for functions with
	more than 256 bytes of local variables.

Attachment: sh-tdep.c.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]