This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/407: static CORE_ADDR examine_prologue ();
- From: magdar at codan dot com dot au
- To: gdb-gnats at sources dot redhat dot com
- Cc: ac131313 at cygnus dot com
- Date: 8 Mar 2002 00:32:36 -0000
- Subject: gdb/407: static CORE_ADDR examine_prologue ();
- Reply-to: magdar at codan dot com dot au
>Number: 407
>Category: gdb
>Synopsis: static CORE_ADDR examine_prologue ();
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Mar 07 16:38:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: magdar@codan.com.au
>Release: Current GDB or file h8300-tdep.c REV.1.7(latest)
>Organization:
>Environment:
>Description:
The bug is in:
FILE : h8300-tdep.c
FUNCTION: static CORE_ADDR examine_prologue ();
CODE : In 'examine_prologue' function when checking
for multiple pop/push instructions (see the code
below) in the 'for' statement, when initialising
fsr->regs[i] it will count one more location.
As result frame registers to be wrong and
'backtrace' and 'show registers' in GDB will be
wrong.
>
> /* Now check for push multiple insns. */
> if (insn_word == 0x0110 || insn_word == 0x0120 || insn_word ==
> 0x0130)
> {
> int count = ((insn_word >> 4) & 0xf) + 1;
> int start, i;
>
> ip = next_ip;
> next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn_word);
> start = insn_word & 0x7;
>
> for (i = start; i <= start + count; i++)
> {
> fsr->regs[i] = after_prolog_fp + auto_depth;
> auto_depth += 4;
> }
> }
>
I've tested the fix for Hitachi HS2000 series
microcontrollers and it works.
For Hitachi H8300 series it is not a problem as
they don't have multiple pop/push instructions.
>How-To-Repeat:
Run GDB with code compiled with gcc_h8s that has multiple
pop/push instructions.
Do 'Backtrace' or 'Show registers' and the result will
be wrong.
>Fix:
The 'for' statement should be :
> for (i = start; i < start + count; i++)
========
INSTEAD OF:
> for (i = start; i <= start + count; i++)
=======
>Release-Note:
>Audit-Trail:
>Unformatted: