bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

precise code for different returns


From: Torsten Reichert
Subject: precise code for different returns
Date: Wed, 03 Jan 2001 23:51:52 +0100

Hello,

first of all thank you for taking the effort to fix that.

You wrote:
--- begin ---
And changed "return (pst);" fallback to...
    /* Best we've got so far, but it's still unimpressive. */
    /* Maybe a more likely match further down the chain. */
    best = pst;

And changd the final "return (NULL);" to...
    return (best);
--- end ---

There are different
- return(pst) statements in my source,
- as well as one return(tpst);

Did you really mean you changed
  return(pst); -> best = pst;
or did you the change so as to keep control flow the same ? Like change:
  return(pst); -> { best = pst; return(best); }

Is the following source correct then ?

/* Xref: news.t-online.com gnu.gdb.bug:3093 */
/* John Love-Jensen" <address@hidden> fixed this bug */
#define PATCH_3093 !0

/* Find which partial symtab on contains PC and SECTION.  Return 0 if none.  */

struct partial_symtab *
find_pc_sect_psymtab (pc, section)
     CORE_ADDR pc;
     asection *section;
{
  register struct partial_symtab *pst;
  register struct objfile *objfile;
# if PATCH_3093
    register struct partical_symtab *best = NULL;
# endif

  ALL_PSYMTABS (objfile, pst)
  {
    if (pc >= pst->textlow && pc < pst->texthigh)
      {
 struct minimal_symbol *msymbol;
 struct partial_symtab *tpst;

 /* An objfile that has its functions reordered might have
    many partial symbol tables containing the PC, but
    we want the partial symbol table that contains the
    function containing the PC.  */
 if (!(objfile->flags & OBJF_REORDERED) &&
     section == 0) /* can't validate section this way */
#         if PATCH_3093
            { best = pst; }
#         else
     return (pst);
#         endif

 msymbol = lookup_minimal_symbol_by_pc_section (pc, section);
 if (msymbol == NULL)
#         if PATCH_3093
            { best = pst; }
#         else
     return (pst);
#         endif

 for (tpst = pst; tpst != NULL; tpst = tpst->next)
   {
     if (pc >= tpst->textlow && pc < tpst->texthigh)
       {
  struct partial_symbol *p;

  p = find_pc_sect_psymbol (tpst, pc, section);
  if (p != NULL
      && SYMBOL_VALUE_ADDRESS (p)
      == SYMBOL_VALUE_ADDRESS (msymbol))
    return (tpst);
       }
   }
#         if PATCH_3093
            { best = pst; }
#         else
     return (pst);
#         endif
      }
  }
# if PATCH_3093
    return (best);
# else
    return (NULL);
# endif
}

Thank you again

Attachment: Torsten.Reichert.vcf
Description: Card for Torsten Reichert


reply via email to

[Prev in Thread] Current Thread [Next in Thread]