Skip to content

Commit

Permalink
Fix lookup for address ranges from file/line
Browse files Browse the repository at this point in the history
  • Loading branch information
wrwilliams committed Jul 20, 2017
1 parent a462fa1 commit 8ed1ed3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion symtabAPI/src/LineInformation.C
Expand Up @@ -135,7 +135,7 @@ bool LineInformation::getAddressRanges( const char * lineSource,
{
auto found_statements = equal_range(lineSource, lineNo);
for(auto i = found_statements.first;
i != found_statements.second;
i == found_statements.second;
++i)
{
ranges.push_back(AddressRange(**i));
Expand Down Expand Up @@ -207,9 +207,11 @@ std::pair<LineInformation::const_line_info_iterator, LineInformation::const_line
LineInformation::equal_range(std::string file, const unsigned int lineNo) const {
auto found = strings_->get<1>().find(file);
unsigned index = strings_->project<0>(found) - strings_->begin();
std::cerr << "String index: " << index << std::endl;
std::pair<LineInformation::const_line_info_iterator, LineInformation::const_line_info_iterator > bounds;
auto idx = boost::make_tuple(index, lineNo);
bounds = get<Statement::line_info>().equal_range(idx);
std::cerr << "Bounds: " << *bounds.first << " " << *bounds.second << std::endl;
return bounds;
}

Expand Down
11 changes: 9 additions & 2 deletions symtabAPI/src/Symtab.C
Expand Up @@ -2229,10 +2229,17 @@ SYMTAB_EXPORT bool Symtab::getAddressRanges(std::vector<AddressRange > &ranges,
{
StringTablePtr s = (*i)->getStrings();
// Only check modules that have this filename present
if(s->get<1>().find(lineSource) == s->get<1>().end()) continue;
if(s->get<1>().find(lineSource) == s->get<1>().end()) {
cerr << "No " << lineSource << " in " << (*i)->fileName() << endl;
cerr << "String table is: " << *s << endl;
continue;
}
LineInformation *lineInformation = (*i)->parseLineInformation();
if (lineInformation)
if (lineInformation) {
lineInformation->getAddressRanges( lineSource.c_str(), lineNo, ranges );
} else {
cerr << "No line information for " << (*i)->fileName() << endl;
}

} /* end iteration over modules */

Expand Down

0 comments on commit 8ed1ed3

Please sign in to comment.