This is the mail archive of the gdb-patches@sourceware.org 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]

[committed] avr: improve skip_prologue


Hi,

the preferred method to skip the prologue is to use skip_prologue_using_sal. In particular this function
should be used instead of find_pc_line which is wrong when there is no prologue.


Tristan.

2009-11-10 Tristan Gingold <gingold@adacore.com>

	* avr-tdep.c (avr_skip_prologue): First try to skip prologue
	using skip_prologue_using_sal.

*** avr-tdep.c	10 Nov 2009 10:22:22 -0000	1.119
--- avr-tdep.c	10 Nov 2009 10:34:46 -0000
***************
*** 789,828 ****
  avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
  {
    CORE_ADDR func_addr, func_end;
!   CORE_ADDR prologue_end = pc;

/* See what the symbol table says */

! if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
! {
! struct symtab_and_line sal;
! struct avr_unwind_cache info = {0};
! struct trad_frame_saved_reg saved_regs[AVR_NUM_REGS];
!
! info.saved_regs = saved_regs;
!
! /* Need to run the prologue scanner to figure out if the function has a
! prologue and possibly skip over moving arguments passed via registers
! to other registers. */


! prologue_end = avr_scan_prologue (gdbarch, func_addr, func_end, &info);
!
! if (info.prologue_type == AVR_PROLOGUE_NONE)
! return pc;
! else
! {
! sal = find_pc_line (func_addr, 0);
!
! if (sal.line != 0 && sal.end < func_end)
! return sal.end;
! }
! }


/* Either we didn't find the start of this function (nothing we can do),
or there's no line info, or the line after the prologue is after
the end of the function (there probably isn't a prologue). */


!   return prologue_end;
  }

/* Not all avr devices support the BREAK insn. Those that don't should treat
--- 789,827 ----
avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
CORE_ADDR func_addr, func_end;
! CORE_ADDR post_prologue_pc;


/* See what the symbol table says */

!   if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
!     return pc;

! post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr);
! if (post_prologue_pc != 0)
! return max (pc, post_prologue_pc);
!
! {
! CORE_ADDR prologue_end = pc;
! struct avr_unwind_cache info = {0};
! struct trad_frame_saved_reg saved_regs[AVR_NUM_REGS];
!
! info.saved_regs = saved_regs;
!
! /* Need to run the prologue scanner to figure out if the function has a
! prologue and possibly skip over moving arguments passed via registers
! to other registers. */
!
! prologue_end = avr_scan_prologue (gdbarch, func_addr, func_end, &info);
!
! if (info.prologue_type != AVR_PROLOGUE_NONE)
! return prologue_end;
! }


/* Either we didn't find the start of this function (nothing we can do),
or there's no line info, or the line after the prologue is after
the end of the function (there probably isn't a prologue). */


!   return pc;
  }

/* Not all avr devices support the BREAK insn. Those that don't should treat


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