This is the mail archive of the gdb-prs@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]

gdb/407: static CORE_ADDR examine_prologue ();



>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:


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