Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Martin M. Hunt" <hunt@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] mips find_proc_desc()
Date: Thu, 26 Sep 2002 15:03:00 -0000	[thread overview]
Message-ID: <200209261501.54430.hunt@redhat.com> (raw)

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);




             reply	other threads:[~2002-09-26 22:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-26 15:03 Martin M. Hunt [this message]
2002-09-26 15:48 ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200209261501.54430.hunt@redhat.com \
    --to=hunt@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox