diff options
Diffstat (limited to 'source/Symbol/SymbolContext.cpp')
-rw-r--r-- | source/Symbol/SymbolContext.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp index 54db5e090b80..1e55ce652e0d 100644 --- a/source/Symbol/SymbolContext.cpp +++ b/source/Symbol/SymbolContext.cpp @@ -365,6 +365,10 @@ SymbolContext::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *t s->PutCString("kind = local, "); break; + case eValueTypeVariableThreadLocal: + s->PutCString("kind = thread local, "); + break; + default: break; } @@ -595,6 +599,7 @@ SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc, next_frame_pc = range.GetBaseAddress(); next_frame_sc.line_entry.range.GetBaseAddress() = next_frame_pc; next_frame_sc.line_entry.file = curr_inlined_block_inlined_info->GetCallSite().GetFile(); + next_frame_sc.line_entry.original_file = curr_inlined_block_inlined_info->GetCallSite().GetFile(); next_frame_sc.line_entry.line = curr_inlined_block_inlined_info->GetCallSite().GetLine(); next_frame_sc.line_entry.column = curr_inlined_block_inlined_info->GetCallSite().GetColumn(); return true; @@ -857,6 +862,73 @@ SymbolContext::GetFunctionStartLineEntry () const return LineEntry(); } +bool +SymbolContext::GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, Error &error) +{ + if (!line_entry.IsValid()) + { + error.SetErrorString("Symbol context has no line table."); + return false; + } + + range = line_entry.range; + if (line_entry.line > end_line) + { + error.SetErrorStringWithFormat("end line option %d must be after the current line: %d", + end_line, + line_entry.line); + return false; + } + + uint32_t line_index = 0; + bool found = false; + while (1) + { + LineEntry this_line; + line_index = comp_unit->FindLineEntry(line_index, line_entry.line, nullptr, false, &this_line); + if (line_index == UINT32_MAX) + break; + if (LineEntry::Compare(this_line, line_entry) == 0) + { + found = true; + break; + } + } + + LineEntry end_entry; + if (!found) + { + // Can't find the index of the SymbolContext's line entry in the SymbolContext's CompUnit. + error.SetErrorString("Can't find the current line entry in the CompUnit - can't process " + "the end-line option"); + return false; + } + + line_index = comp_unit->FindLineEntry(line_index, end_line, nullptr, false, &end_entry); + if (line_index == UINT32_MAX) + { + error.SetErrorStringWithFormat("could not find a line table entry corresponding " + "to end line number %d", + end_line); + return false; + } + + Block *func_block = GetFunctionBlock(); + if (func_block && func_block->GetRangeIndexContainingAddress(end_entry.range.GetBaseAddress()) == UINT32_MAX) + { + error.SetErrorStringWithFormat("end line number %d is not contained within the current function.", + end_line); + return false; + } + + lldb::addr_t range_size = end_entry.range.GetBaseAddress().GetFileAddress() + - range.GetBaseAddress().GetFileAddress(); + range.SetByteSize(range_size); + return true; +} + + + //---------------------------------------------------------------------- // // SymbolContextSpecifier |