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

[Bug gdb/16797] New: GDB for mips-elf target will crash the remote embedded target


https://sourceware.org/bugzilla/show_bug.cgi?id=16797

            Bug ID: 16797
           Summary: GDB for mips-elf target will crash the remote embedded
                    target
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: critical
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: guosheng_gao at realsil dot com.cn

In the function mips-tdep.c:heuristic_pro_start(struct *gdbarch, CORE_ADDR pc)
If the pc value < instlen,
Are we still need to search back for previous return.

static CORE_ADDR
heuristic_proc_start (struct gdbarch *gdbarch, CORE_ADDR pc)
{
  CORE_ADDR start_pc;
  CORE_ADDR fence;
  int instlen;
  int seen_adjsp = 0;
  struct inferior *inf;

  pc = gdbarch_addr_bits_remove (gdbarch, pc);
  start_pc = pc;
  fence = start_pc - heuristic_fence_post;
  if (start_pc == 0)
    return 0;

  if (heuristic_fence_post == UINT_MAX || fence < VM_MIN_ADDRESS)
    fence = VM_MIN_ADDRESS;

  instlen = mips_pc_is_mips (pc) ? MIPS_INSN32_SIZE : MIPS_INSN16_SIZE;

  inf = current_inferior ();

/* Search back for previous return.  */ 
/* if pc (start_pc ) < instlen, the first value of start_pc -= instlen will
skip over 0xffffffff, 
In this case, GDB will try to read the memory at string address, which will
crash the remote embedded target. 
Is this true ï */
  for (start_pc -= instlen;; start_pc -= instlen)
    if (start_pc < fence)
      {

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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