[patch] bfd/dwarf2.c gives wrong line number for inlined code

Alan Modra amodra@bigpond.net.au
Sat Sep 19 05:02:00 GMT 2009


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



More information about the Binutils mailing list