ld/src/ld/debugline.c
/* Find the region (START->pc through END->pc) in the debug_line
   information which contains PC.  This routine starts searching at
   the current position (which is returned as END), and will go all
   the way around the debug_line information.  It will return false if
   an error occurs or if there is no matching region; these may be
   distinguished by looking at START->end_of_sequence, which will be
   false on error and true if there was no matching region.
   You could write this routine using line_next, but this version
   will be slightly more efficient, and of course more convenient.  */
Find the region (START->pc through END->pc) in the debug_line
information which contains PC.  This routine starts searching at
the current position (which is returned as END), and will go all
the way around the debug_line information.  It will return false if
an error occurs or if there is no matching region; these may be
distinguished by looking at START->end_of_sequence, which will be
false on error and true if there was no matching region.
You could write this routine using line_next, but this version
will be slightly more efficient, and of course more convenient.
Find the region ( START - > pc through END - > pc ) in the debug_line information which contains PC . This routine starts searching at the current position ( which is returned as END ) and will go all the way around the debug_line information . It will return false if an error occurs or if there is no matching region ; these may be distinguished by looking at START - > end_of_sequence which will be false on error and true if there was no matching region . You could write this routine using line_next but this version will be slightly more efficient and of course more convenient .
int
line_find_addr (struct line_reader_data * lnd,
		struct line_info * start,
		struct line_info * end,
		uint64_t pc)
{
  const uint8_t * startpos;
  struct line_info prev;
  if (lnd->cur.end_of_sequence && lnd->cpos == lnd->end)
    line_reset (lnd);
  startpos = lnd->cpos;
  do {
    prev = lnd->cur;
    if (! next_state (lnd))
      {
	start->end_of_sequence = false;
	return false;
      }
    if (lnd->cur.end_of_sequence && lnd->cpos == lnd->end)
      line_reset (lnd);
    if (lnd->cpos == startpos)
      {
	start->end_of_sequence = true;
	return false;
      }
  } while (lnd->cur.pc <= pc || prev.pc > pc || prev.end_of_sequence);
  *start = prev;
  *end = lnd->cur;
  return true;
}
int line_find_addr ( struct line_reader_data * lnd , struct line_info * start , struct line_info * end , uint64_t pc ) { const uint8_t * startpos ; struct line_info prev ; if ( lnd -> cur . end_of_sequence && lnd -> cpos == lnd -> end ) line_reset ( lnd ) ; startpos = lnd -> cpos ; do { prev = lnd -> cur ; if ( ! next_state ( lnd ) ) { start -> end_of_sequence = false ; return false ; } if ( lnd -> cur . end_of_sequence && lnd -> cpos == lnd -> end ) line_reset ( lnd ) ; if ( lnd -> cpos == startpos ) { start -> end_of_sequence = true ; return false ; } } while ( lnd -> cur . pc <= pc || prev . pc > pc || prev . end_of_sequence ) ; * start = prev ; * end = lnd -> cur ; return true ; }
Find the region (START->pc through END->pc) in the debug_line
information which contains PC.
Find the region ( START - > pc through END - > pc ) in the debug_line information which contains PC .