LLDB  mainline
LineTable.cpp
Go to the documentation of this file.
1 //===-- LineTable.cpp -------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
10 #include "lldb/Core/Address.h"
11 #include "lldb/Core/Module.h"
12 #include "lldb/Core/Section.h"
14 #include "lldb/Utility/Stream.h"
15 #include <algorithm>
16 
17 using namespace lldb;
18 using namespace lldb_private;
19 
20 // LineTable constructor
21 LineTable::LineTable(CompileUnit *comp_unit)
22  : m_comp_unit(comp_unit), m_entries() {}
23 
24 // Destructor
26 
28  uint16_t column, uint16_t file_idx,
29  bool is_start_of_statement,
30  bool is_start_of_basic_block,
31  bool is_prologue_end, bool is_epilogue_begin,
32  bool is_terminal_entry) {
33  Entry entry(file_addr, line, column, file_idx, is_start_of_statement,
34  is_start_of_basic_block, is_prologue_end, is_epilogue_begin,
35  is_terminal_entry);
36 
37  entry_collection::iterator begin_pos = m_entries.begin();
38  entry_collection::iterator end_pos = m_entries.end();
40  entry_collection::iterator pos =
41  upper_bound(begin_pos, end_pos, entry, less_than_bp);
42 
43  // Stream s(stdout);
44  // s << "\n\nBefore:\n";
45  // Dump (&s, Address::DumpStyleFileAddress);
46  m_entries.insert(pos, entry);
47  // s << "After:\n";
48  // Dump (&s, Address::DumpStyleFileAddress);
49 }
50 
52 
54 
56  return new LineTable::LineSequenceImpl();
57 }
58 
60  LineSequence *sequence, lldb::addr_t file_addr, uint32_t line,
61  uint16_t column, uint16_t file_idx, bool is_start_of_statement,
62  bool is_start_of_basic_block, bool is_prologue_end, bool is_epilogue_begin,
63  bool is_terminal_entry) {
64  assert(sequence != nullptr);
65  LineSequenceImpl *seq = reinterpret_cast<LineSequenceImpl *>(sequence);
66  Entry entry(file_addr, line, column, file_idx, is_start_of_statement,
67  is_start_of_basic_block, is_prologue_end, is_epilogue_begin,
68  is_terminal_entry);
69  entry_collection &entries = seq->m_entries;
70  // Replace the last entry if the address is the same, otherwise append it. If
71  // we have multiple line entries at the same address, this¬†indicates illegal
72  // DWARF so this "fixes" the line table to be correct. If not fixed this can
73  // cause a line entry's address that when resolved back to a symbol context,
74  // could resolve to a different line entry. We really want a
75  // 1 to 1 mapping
76  // here to avoid these kinds of inconsistencies. We will need tor revisit
77  // this if the DWARF line tables are updated to allow multiple entries at the
78  // same address legally.
79  if (!entries.empty() && entries.back().file_addr == file_addr) {
80  // GCC don't use the is_prologue_end flag to mark the first instruction
81  // after the prologue.
82  // Instead of it it is issuing a line table entry for the first instruction
83  // of the prologue and one for the first instruction after the prologue. If
84  // the size of the prologue is 0 instruction then the 2 line entry will
85  // have the same file address. Removing it will remove our ability to
86  // properly detect the location of the end of prologe so we set the
87  // prologue_end flag to preserve this information (setting the prologue_end
88  // flag for an entry what is after the prologue end don't have any effect)
89  entry.is_prologue_end = entry.file_idx == entries.back().file_idx;
90  entries.back() = entry;
91  } else
92  entries.push_back(entry);
93 }
94 
96  assert(sequence != nullptr);
97  LineSequenceImpl *seq = reinterpret_cast<LineSequenceImpl *>(sequence);
98  if (seq->m_entries.empty())
99  return;
100  Entry &entry = seq->m_entries.front();
101 
102  // If the first entry address in this sequence is greater than or equal to
103  // the address of the last item in our entry collection, just append.
104  if (m_entries.empty() ||
105  !Entry::EntryAddressLessThan(entry, m_entries.back())) {
106  m_entries.insert(m_entries.end(), seq->m_entries.begin(),
107  seq->m_entries.end());
108  return;
109  }
110 
111  // Otherwise, find where this belongs in the collection
112  entry_collection::iterator begin_pos = m_entries.begin();
113  entry_collection::iterator end_pos = m_entries.end();
115  entry_collection::iterator pos =
116  upper_bound(begin_pos, end_pos, entry, less_than_bp);
117 
118  // We should never insert a sequence in the middle of another sequence
119  if (pos != begin_pos) {
120  while (pos < end_pos && !((pos - 1)->is_terminal_entry))
121  pos++;
122  }
123 
124 #ifndef NDEBUG
125  // If we aren't inserting at the beginning, the previous entry should
126  // terminate a sequence.
127  if (pos != begin_pos) {
128  entry_collection::iterator prev_pos = pos - 1;
129  assert(prev_pos->is_terminal_entry);
130  }
131 #endif
132  m_entries.insert(pos, seq->m_entries.begin(), seq->m_entries.end());
133 }
134 
136  LineTable *line_table)
137  : m_line_table(line_table) {}
138 
140 operator()(const LineTable::Entry &a, const LineTable::Entry &b) const {
141 #define LT_COMPARE(a, b) \
142  if (a != b) \
143  return a < b
145  // b and a reversed on purpose below.
147  LT_COMPARE(a.line, b.line);
148  LT_COMPARE(a.column, b.column);
151  // b and a reversed on purpose below.
155  return false;
156 #undef LT_COMPARE
157 }
158 
159 uint32_t LineTable::GetSize() const { return m_entries.size(); }
160 
162  if (idx < m_entries.size()) {
163  ConvertEntryAtIndexToLineEntry(idx, line_entry);
164  return true;
165  }
166  line_entry.Clear();
167  return false;
168 }
169 
171  LineEntry &line_entry,
172  uint32_t *index_ptr) {
173  if (index_ptr != nullptr)
174  *index_ptr = UINT32_MAX;
175 
176  bool success = false;
177 
178  if (so_addr.GetModule().get() == m_comp_unit->GetModule().get()) {
179  Entry search_entry;
180  search_entry.file_addr = so_addr.GetFileAddress();
181  if (search_entry.file_addr != LLDB_INVALID_ADDRESS) {
182  entry_collection::const_iterator begin_pos = m_entries.begin();
183  entry_collection::const_iterator end_pos = m_entries.end();
184  entry_collection::const_iterator pos = lower_bound(
185  begin_pos, end_pos, search_entry, Entry::EntryAddressLessThan);
186  if (pos != end_pos) {
187  if (pos != begin_pos) {
188  if (pos->file_addr != search_entry.file_addr)
189  --pos;
190  else if (pos->file_addr == search_entry.file_addr) {
191  // If this is a termination entry, it shouldn't match since entries
192  // with the "is_terminal_entry" member set to true are termination
193  // entries that define the range for the previous entry.
194  if (pos->is_terminal_entry) {
195  // The matching entry is a terminal entry, so we skip ahead to
196  // the next entry to see if there is another entry following this
197  // one whose section/offset matches.
198  ++pos;
199  if (pos != end_pos) {
200  if (pos->file_addr != search_entry.file_addr)
201  pos = end_pos;
202  }
203  }
204 
205  if (pos != end_pos) {
206  // While in the same section/offset backup to find the first line
207  // entry that matches the address in case there are multiple
208  while (pos != begin_pos) {
209  entry_collection::const_iterator prev_pos = pos - 1;
210  if (prev_pos->file_addr == search_entry.file_addr &&
211  prev_pos->is_terminal_entry == false)
212  --pos;
213  else
214  break;
215  }
216  }
217  }
218  }
219  else
220  {
221  // There might be code in the containing objfile before the first
222  // line table entry. Make sure that does not get considered part of
223  // the first line table entry.
224  if (pos->file_addr > so_addr.GetFileAddress())
225  return false;
226  }
227 
228  // Make sure we have a valid match and that the match isn't a
229  // terminating entry for a previous line...
230  if (pos != end_pos && pos->is_terminal_entry == false) {
231  uint32_t match_idx = std::distance(begin_pos, pos);
232  success = ConvertEntryAtIndexToLineEntry(match_idx, line_entry);
233  if (index_ptr != nullptr && success)
234  *index_ptr = match_idx;
235  }
236  }
237  }
238  }
239  return success;
240 }
241 
243  LineEntry &line_entry) {
244  if (idx < m_entries.size()) {
245  const Entry &entry = m_entries[idx];
246  ModuleSP module_sp(m_comp_unit->GetModule());
247  if (module_sp &&
248  module_sp->ResolveFileAddress(entry.file_addr,
249  line_entry.range.GetBaseAddress())) {
250  if (!entry.is_terminal_entry && idx + 1 < m_entries.size())
251  line_entry.range.SetByteSize(m_entries[idx + 1].file_addr -
252  entry.file_addr);
253  else
254  line_entry.range.SetByteSize(0);
255 
256  line_entry.file =
257  m_comp_unit->GetSupportFiles().GetFileSpecAtIndex(entry.file_idx);
258  line_entry.original_file =
259  m_comp_unit->GetSupportFiles().GetFileSpecAtIndex(entry.file_idx);
260  line_entry.line = entry.line;
261  line_entry.column = entry.column;
262  line_entry.is_start_of_statement = entry.is_start_of_statement;
264  line_entry.is_prologue_end = entry.is_prologue_end;
265  line_entry.is_epilogue_begin = entry.is_epilogue_begin;
266  line_entry.is_terminal_entry = entry.is_terminal_entry;
267  return true;
268  }
269  }
270  return false;
271 }
272 
274  uint32_t start_idx, const std::vector<uint32_t> &file_indexes,
275  uint32_t line, bool exact, LineEntry *line_entry_ptr) {
276 
277  const size_t count = m_entries.size();
278  std::vector<uint32_t>::const_iterator begin_pos = file_indexes.begin();
279  std::vector<uint32_t>::const_iterator end_pos = file_indexes.end();
280  size_t best_match = UINT32_MAX;
281 
282  for (size_t idx = start_idx; idx < count; ++idx) {
283  // Skip line table rows that terminate the previous row (is_terminal_entry
284  // is non-zero)
285  if (m_entries[idx].is_terminal_entry)
286  continue;
287 
288  if (find(begin_pos, end_pos, m_entries[idx].file_idx) == end_pos)
289  continue;
290 
291  // Exact match always wins. Otherwise try to find the closest line > the
292  // desired line.
293  // FIXME: Maybe want to find the line closest before and the line closest
294  // after and
295  // if they're not in the same function, don't return a match.
296 
297  if (m_entries[idx].line < line) {
298  continue;
299  } else if (m_entries[idx].line == line) {
300  if (line_entry_ptr)
301  ConvertEntryAtIndexToLineEntry(idx, *line_entry_ptr);
302  return idx;
303  } else if (!exact) {
304  if (best_match == UINT32_MAX)
305  best_match = idx;
306  else if (m_entries[idx].line < m_entries[best_match].line)
307  best_match = idx;
308  }
309  }
310 
311  if (best_match != UINT32_MAX) {
312  if (line_entry_ptr)
313  ConvertEntryAtIndexToLineEntry(best_match, *line_entry_ptr);
314  return best_match;
315  }
316  return UINT32_MAX;
317 }
318 
321  uint32_t line, bool exact,
322  LineEntry *line_entry_ptr) {
323  const size_t count = m_entries.size();
324  size_t best_match = UINT32_MAX;
325 
326  for (size_t idx = start_idx; idx < count; ++idx) {
327  // Skip line table rows that terminate the previous row (is_terminal_entry
328  // is non-zero)
329  if (m_entries[idx].is_terminal_entry)
330  continue;
331 
332  if (m_entries[idx].file_idx != file_idx)
333  continue;
334 
335  // Exact match always wins. Otherwise try to find the closest line > the
336  // desired line.
337  // FIXME: Maybe want to find the line closest before and the line closest
338  // after and
339  // if they're not in the same function, don't return a match.
340 
341  if (m_entries[idx].line < line) {
342  continue;
343  } else if (m_entries[idx].line == line) {
344  if (line_entry_ptr)
345  ConvertEntryAtIndexToLineEntry(idx, *line_entry_ptr);
346  return idx;
347  } else if (!exact) {
348  if (best_match == UINT32_MAX)
349  best_match = idx;
350  else if (m_entries[idx].line < m_entries[best_match].line)
351  best_match = idx;
352  }
353  }
354 
355  if (best_match != UINT32_MAX) {
356  if (line_entry_ptr)
357  ConvertEntryAtIndexToLineEntry(best_match, *line_entry_ptr);
358  return best_match;
359  }
360  return UINT32_MAX;
361 }
362 
364  SymbolContextList &sc_list) {
365 
366  if (!append)
367  sc_list.Clear();
368 
369  size_t num_added = 0;
370  const size_t count = m_entries.size();
371  if (count > 0) {
373 
374  for (size_t idx = 0; idx < count; ++idx) {
375  // Skip line table rows that terminate the previous row
376  // (is_terminal_entry is non-zero)
377  if (m_entries[idx].is_terminal_entry)
378  continue;
379 
380  if (m_entries[idx].file_idx == file_idx) {
382  ++num_added;
383  sc_list.Append(sc);
384  }
385  }
386  }
387  }
388  return num_added;
389 }
390 
392  Address::DumpStyle fallback_style, bool show_line_ranges) {
393  const size_t count = m_entries.size();
394  LineEntry line_entry;
395  FileSpec prev_file;
396  for (size_t idx = 0; idx < count; ++idx) {
397  ConvertEntryAtIndexToLineEntry(idx, line_entry);
398  line_entry.Dump(s, target, prev_file != line_entry.original_file, style,
399  fallback_style, show_line_ranges);
400  s->EOL();
401  prev_file = line_entry.original_file;
402  }
403 }
404 
406  DescriptionLevel level) {
407  const size_t count = m_entries.size();
408  LineEntry line_entry;
409  for (size_t idx = 0; idx < count; ++idx) {
410  ConvertEntryAtIndexToLineEntry(idx, line_entry);
411  line_entry.GetDescription(s, level, m_comp_unit, target, true);
412  s->EOL();
413  }
414 }
415 
417  bool append) {
418  if (!append)
419  file_ranges.Clear();
420  const size_t initial_count = file_ranges.GetSize();
421 
422  const size_t count = m_entries.size();
423  LineEntry line_entry;
425  for (size_t idx = 0; idx < count; ++idx) {
426  const Entry &entry = m_entries[idx];
427 
428  if (entry.is_terminal_entry) {
429  if (range.GetRangeBase() != LLDB_INVALID_ADDRESS) {
430  range.SetRangeEnd(entry.file_addr);
431  file_ranges.Append(range);
433  }
434  } else if (range.GetRangeBase() == LLDB_INVALID_ADDRESS) {
435  range.SetRangeBase(entry.file_addr);
436  }
437  }
438  return file_ranges.GetSize() - initial_count;
439 }
440 
442  std::unique_ptr<LineTable> line_table_up(new LineTable(m_comp_unit));
443  LineSequenceImpl sequence;
444  const size_t count = m_entries.size();
445  LineEntry line_entry;
446  const FileRangeMap::Entry *file_range_entry = nullptr;
447  const FileRangeMap::Entry *prev_file_range_entry = nullptr;
448  lldb::addr_t prev_file_addr = LLDB_INVALID_ADDRESS;
449  bool prev_entry_was_linked = false;
450  bool range_changed = false;
451  for (size_t idx = 0; idx < count; ++idx) {
452  const Entry &entry = m_entries[idx];
453 
454  const bool end_sequence = entry.is_terminal_entry;
455  const lldb::addr_t lookup_file_addr =
456  entry.file_addr - (end_sequence ? 1 : 0);
457  if (file_range_entry == nullptr ||
458  !file_range_entry->Contains(lookup_file_addr)) {
459  prev_file_range_entry = file_range_entry;
460  file_range_entry = file_range_map.FindEntryThatContains(lookup_file_addr);
461  range_changed = true;
462  }
463 
464  lldb::addr_t prev_end_entry_linked_file_addr = LLDB_INVALID_ADDRESS;
465  lldb::addr_t entry_linked_file_addr = LLDB_INVALID_ADDRESS;
466 
467  bool terminate_previous_entry = false;
468  if (file_range_entry) {
469  entry_linked_file_addr = entry.file_addr -
470  file_range_entry->GetRangeBase() +
471  file_range_entry->data;
472  // Determine if we need to terminate the previous entry when the previous
473  // entry was not contiguous with this one after being linked.
474  if (range_changed && prev_file_range_entry) {
475  prev_end_entry_linked_file_addr =
476  std::min<lldb::addr_t>(entry.file_addr,
477  prev_file_range_entry->GetRangeEnd()) -
478  prev_file_range_entry->GetRangeBase() + prev_file_range_entry->data;
479  if (prev_end_entry_linked_file_addr != entry_linked_file_addr)
480  terminate_previous_entry = prev_entry_was_linked;
481  }
482  } else if (prev_entry_was_linked) {
483  // This entry doesn't have a remapping and it needs to be removed. Watch
484  // out in case we need to terminate a previous entry needs to be
485  // terminated now that one line entry in a sequence is not longer valid.
486  if (!sequence.m_entries.empty() &&
487  !sequence.m_entries.back().is_terminal_entry) {
488  terminate_previous_entry = true;
489  }
490  }
491 
492  if (terminate_previous_entry && !sequence.m_entries.empty()) {
493  assert(prev_file_addr != LLDB_INVALID_ADDRESS);
494  UNUSED_IF_ASSERT_DISABLED(prev_file_addr);
495  sequence.m_entries.push_back(sequence.m_entries.back());
496  if (prev_end_entry_linked_file_addr == LLDB_INVALID_ADDRESS)
497  prev_end_entry_linked_file_addr =
498  std::min<lldb::addr_t>(entry.file_addr,
499  prev_file_range_entry->GetRangeEnd()) -
500  prev_file_range_entry->GetRangeBase() + prev_file_range_entry->data;
501  sequence.m_entries.back().file_addr = prev_end_entry_linked_file_addr;
502  sequence.m_entries.back().is_terminal_entry = true;
503 
504  // Append the sequence since we just terminated the previous one
505  line_table_up->InsertSequence(&sequence);
506  sequence.Clear();
507  }
508 
509  // Now link the current entry
510  if (file_range_entry) {
511  // This entry has an address remapping and it needs to have its address
512  // relinked
513  sequence.m_entries.push_back(entry);
514  sequence.m_entries.back().file_addr = entry_linked_file_addr;
515  }
516 
517  // If we have items in the sequence and the last entry is a terminal entry,
518  // insert this sequence into our new line table.
519  if (!sequence.m_entries.empty() &&
520  sequence.m_entries.back().is_terminal_entry) {
521  line_table_up->InsertSequence(&sequence);
522  sequence.Clear();
523  prev_entry_was_linked = false;
524  } else {
525  prev_entry_was_linked = file_range_entry != nullptr;
526  }
527  prev_file_addr = entry.file_addr;
528  range_changed = false;
529  }
530  if (line_table_up->m_entries.empty())
531  return nullptr;
532  return line_table_up.release();
533 }
~LineTable()
Destructor.
Definition: LineTable.cpp:25
A line table entry class.
Definition: LineEntry.h:20
void Clear(BaseType b=0)
Definition: RangeMap.h:40
uint16_t is_epilogue_begin
Indicates this entry is one (of possibly many) where execution should be suspended for an exit breakp...
Definition: LineEntry.h:159
#define UNUSED_IF_ASSERT_DISABLED(x)
Definition: lldb-defines.h:134
Defines a list of symbol context objects.
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
bool Contains(BaseType r) const
Definition: RangeMap.h:77
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
FileSpec original_file
The original source file, from debug info.
Definition: LineEntry.h:153
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:33
uint32_t is_start_of_statement
Indicates this entry is the beginning of a statement.
Definition: LineTable.h:288
void Clear()
Clear the object&#39;s state.
Definition: LineEntry.cpp:34
void GetDescription(Stream *s, Target *target, lldb::DescriptionLevel level)
Definition: LineTable.cpp:405
uint32_t is_terminal_entry
Indicates this entry is that of the first byte after the end of a sequence of target machine instruct...
Definition: LineTable.h:299
bool GetLineEntryAtIndex(uint32_t idx, LineEntry &line_entry)
Get the line entry from the line table at index idx.
Definition: LineTable.cpp:161
bool ConvertEntryAtIndexToLineEntry(uint32_t idx, LineEntry &line_entry)
Definition: LineTable.cpp:242
A file utility class.
Definition: FileSpec.h:55
uint32_t GetSize() const
Gets the size of the line table in number of line table entries.
Definition: LineTable.cpp:159
uint16_t file_idx
The file index into CompileUnit&#39;s file table, or zero if there is no file information.
Definition: LineTable.h:305
lldb::addr_t GetFileAddress() const
Get the file address.
Definition: Address.cpp:272
uint16_t is_prologue_end
Indicates this entry is one (of possibly many) where execution should be suspended for an entry break...
Definition: LineEntry.h:159
void AppendLineEntryToSequence(LineSequence *sequence, lldb::addr_t file_addr, uint32_t line, uint16_t column, uint16_t file_idx, bool is_start_of_statement, bool is_start_of_basic_block, bool is_prologue_end, bool is_epilogue_begin, bool is_terminal_entry)
Definition: LineTable.cpp:59
void SetRangeEnd(BaseType end)
Definition: RangeMap.h:64
DumpStyle
Dump styles allow the Address::Dump(Stream *,DumpStyle) const function to display Address contents in...
Definition: Address.h:84
void InsertLineEntry(lldb::addr_t file_addr, uint32_t line, uint16_t column, uint16_t file_idx, bool is_start_of_statement, bool is_start_of_basic_block, bool is_prologue_end, bool is_epilogue_begin, bool is_terminal_entry)
Adds a new line entry to this line table.
Definition: LineTable.cpp:27
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Definition: ModuleChild.cpp:27
A class that describes a compilation unit.
Definition: CompileUnit.h:35
uint16_t is_start_of_basic_block
Indicates this entry is the beginning of a basic block.
Definition: LineEntry.h:159
LineTable * LinkLineTable(const FileRangeMap &file_range_map)
Definition: LineTable.cpp:441
uint32_t is_epilogue_begin
Indicates this entry is one (of possibly many) where execution should be suspended for an exit breakp...
Definition: LineTable.h:296
uint32_t is_start_of_basic_block
Indicates this entry is the beginning of a basic block.
Definition: LineTable.h:290
#define UINT32_MAX
Definition: lldb-defines.h:31
uint32_t is_prologue_end
Indicates this entry is one (of possibly many) where execution should be suspended for an entry break...
Definition: LineTable.h:293
#define LLDB_INVALID_ADDRESS
Invalid value definitions.
Definition: lldb-defines.h:85
bool operator()(const LineTable::Entry &, const LineTable::Entry &) const
Definition: LineTable.cpp:140
Entry * FindEntryThatContains(B addr)
Definition: RangeMap.h:737
uint16_t column
The column number of the source line, or zero if there is no column information.
Definition: LineEntry.h:156
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:127
entry_collection m_entries
The collection of line entries in this line table.
Definition: LineTable.h:323
A line table class.
Definition: LineTable.h:37
uint16_t column
The column number of the source line, or zero if there is no column information.
Definition: LineTable.h:302
uint16_t is_terminal_entry
Indicates this entry is that of the first byte after the end of a sequence of target machine instruct...
Definition: LineEntry.h:159
size_t GetSize() const
Definition: RangeMap.h:241
FileSpec file
The source file, possibly mapped by the target.source-map setting.
Definition: LineEntry.h:151
void Clear()
Clear the object&#39;s state.
uint32_t line
The source line number, or zero if there is no line number information.
Definition: LineEntry.h:154
FileSpecList & GetSupportFiles()
Get the compile unit&#39;s support file list.
uint32_t FindLineEntryIndexByFileIndex(uint32_t start_idx, uint32_t file_idx, uint32_t line, bool exact, LineEntry *line_entry_ptr)
Find a line entry index that has a matching file index and source line number.
Definition: LineTable.cpp:319
static bool EntryAddressLessThan(const Entry &lhs, const Entry &rhs)
Definition: LineTable.h:277
void Append(const SymbolContext &sc)
Append a new symbol context to the list.
A section + offset based address class.
Definition: Address.h:80
void Dump(Stream *s, Target *target, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_line_ranges)
Dump all line entries in this line table to the stream s.
Definition: LineTable.cpp:391
LineTable(CompileUnit *comp_unit)
Construct with compile unit.
Definition: LineTable.cpp:21
bool FindLineEntryByAddress(const Address &so_addr, LineEntry &line_entry, uint32_t *index_ptr=nullptr)
Find a line entry that contains the section offset address so_addr.
Definition: LineTable.cpp:170
#define LT_COMPARE(a, b)
uint64_t addr_t
Definition: lldb-types.h:83
LineSequence * CreateLineSequenceContainer()
Definition: LineTable.cpp:55
lldb::ModuleSP GetModule() const
Get accessor for the module for this address.
Definition: Address.cpp:264
An abstract base class used during symbol table creation.
Definition: LineTable.h:23
LineEntry line_entry
The LineEntry for a given query.
Definition: SBAddress.h:15
void SetRangeBase(BaseType b)
Definition: RangeMap.h:48
CompileUnit * m_comp_unit
The compile unit that this line table belongs to.
Definition: LineTable.h:321
BaseType GetRangeEnd() const
Definition: RangeMap.h:62
Address & GetBaseAddress()
Get accessor for the base address of the range.
Definition: AddressRange.h:220
void InsertSequence(LineSequence *sequence)
Definition: LineTable.cpp:95
uint16_t is_start_of_statement
Indicates this entry is the beginning of a statement.
Definition: LineEntry.h:159
size_t FineLineEntriesForFileIndex(uint32_t file_idx, bool append, SymbolContextList &sc_list)
Definition: LineTable.cpp:363
lldb::addr_t file_addr
The file address for this line entry.
Definition: LineTable.h:283
entry_collection m_entries
The collection of line entries in this sequence.
Definition: LineTable.h:335
bool Dump(Stream *s, Target *target, bool show_file, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_range) const
Dump a description of this object to a Stream.
Definition: LineEntry.cpp:71
size_t GetContiguousFileAddressRanges(FileAddressRanges &file_ranges, bool append)
Gets all contiguous file address ranges for the entire line table.
Definition: LineTable.cpp:416
AddressRange range
The section offset address range for this line entry.
Definition: LineEntry.h:150
std::vector< Entry > entry_collection
The collection type for the line entries.
Definition: LineTable.h:318
bool GetDescription(Stream *s, lldb::DescriptionLevel level, CompileUnit *cu, Target *target, bool show_address_only) const
Definition: LineEntry.cpp:106
void Append(const Entry &entry)
Definition: RangeMap.h:139
void SetByteSize(lldb::addr_t byte_size)
Set accessor for the byte size of this range.
Definition: AddressRange.h:248
BaseType GetRangeBase() const
Definition: RangeMap.h:46
uint32_t line
The source line number, or zero if there is no line number information.
Definition: LineTable.h:286