This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: [patch] bfd/dwarf2.c gives wrong line number for inlined code


On Sat, Sep 19, 2009 at 12:25:49PM +0930, Alan Modra wrote:
> Does anyone object to the following cleanup?
[snip]
That's still a bit messy.  This tidies the loop up, and I think still
has the same exit condition.  (Should be much easier to add a faster
search too, if so desired.)

static bfd_boolean
lookup_address_in_line_info_table (struct line_info_table *table,
				   bfd_vma addr,
				   const char **filename_ptr,
				   unsigned int *linenumber_ptr)
{
  /* Note: table->last_line should be a descendingly sorted list. */
  struct line_info *each_line;

  for (each_line = table->last_line;
       each_line;
       each_line = each_line->prev_line)
    if (addr >= each_line->address)
      break;

  if (each_line
      && !(each_line->end_sequence || each_line == table->last_line))
    {
      *filename_ptr = each_line->filename;
      *linenumber_ptr = each_line->line;
      return TRUE;
    }

  *filename_ptr = NULL;
  return FALSE;
}

-- 
Alan Modra
Australia Development Lab, IBM


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