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

Re: [RFA] mips find_proc_desc()


Yes, ok.


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


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