Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] mips find_proc_desc()
@ 2002-09-26 15:03 Martin M. Hunt
  2002-09-26 15:48 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Martin M. Hunt @ 2002-09-26 15:03 UTC (permalink / raw)
  To: gdb-patches

In mips-tdep.c, we have

static mips_extra_func_info_t
find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame, int cur_frame)
{
  mips_extra_func_info_t proc_desc;
  CORE_ADDR startaddr;

  proc_desc = non_heuristic_proc_desc (pc, &startaddr);
  if (proc_desc)
    {
      [...]
    }
 else
    {
      [...]
      if (startaddr == 0)
        startaddr = heuristic_proc_start (pc);
    }
}

and we have

static mips_extra_func_info_t
non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
{
  CORE_ADDR startaddr;
  mips_extra_func_info_t proc_desc;
  struct block *b = block_for_pc (pc);
  struct symbol *sym;
  struct obj_section *sec;
  struct mips_objfile_private *priv;

  if (PC_IN_CALL_DUMMY (pc, 0, 0))
    return NULL;
  [...]
}

Looking at "startaddr" in find_proc_desc(), it is passed into 
non_heuristic_proc_desc uninitialized and never initialized if 
PC_IN_CALL_DUMMY().  Nevertheless find_proc_desc attempts to use it anyway.

There are several simple fixes.  The easiest is to initialize it to 0 as it 
appears that is what find_proc_desc() expects.

-- 
Martin Hunt
GDB Engineer
Red Hat, Inc.


2002-09-26  Martin M. Hunt  <hunt@redhat.com>

        * mips-tdep.c (find_proc_desc): Initialize startaddr.


Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.126
diff -u -u -r1.126 mips-tdep.c
--- mips-tdep.c 18 Sep 2002 15:37:18 -0000      1.126
+++ mips-tdep.c 26 Sep 2002 22:01:54 -0000
@@ -2336,7 +2336,7 @@
 find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame, int cur_frame)
 {
   mips_extra_func_info_t proc_desc;
-  CORE_ADDR startaddr;
+  CORE_ADDR startaddr = 0;

   proc_desc = non_heuristic_proc_desc (pc, &startaddr);




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-26 22:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-26 15:03 [RFA] mips find_proc_desc() Martin M. Hunt
2002-09-26 15:48 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox