Re: [DynInst_API:] Dyninst LineInformation interface change between 9.2.0 and 9.3.2


Date: Wed, 17 May 2017 21:26:42 +0000
From: Bill Williams <bill@xxxxxxxxxxx>
Subject: Re: [DynInst_API:] Dyninst LineInformation interface change between 9.2.0 and 9.3.2
The test suite is always good for example code (test_line_info in the symtab tests). But what you want, in essence, are the Statement class and its filename/line number methods. (This has the benefit of being more readable code, as well. I hate pointless tuples when you can use meaningful names instead...)

I don't remember if we officially deprecated LineNoTuple, but it's been treated as deprecated for quite a few versions, and you should expect it to go away in favor of Statement when 10.0 is official.

--bw

________________________________________
From: Dyninst-api <dyninst-api-bounces@xxxxxxxxxxx> on behalf of Jim Galarowicz <jeg@xxxxxxxxxxxxx>
Sent: Wednesday, May 17, 2017 3:29 PM
To: dyninst-api@xxxxxxxxxxx
Subject: [DynInst_API:] Dyninst LineInformation interface change between        9.2.0 and 9.3.2

Hi Bill, all,

We are trying to upgrade from Dyninst-9.2.0 to Dyninst-9.3.2 - forced really because of Power 8 related Dyninst aborts with 9.2.0 that we hope are fixed in the newer version.

We have a snippet of code that gets line number information, that now does not compile with 9.3.2, but does with 9.2.0.

The snippet of code is:
   428
   429        for(unsigned i = 0; i< mods.size();i++) {
   430
   431        LineInformation *lineInformation = mods[i]->getLineInformation();
   432        if(lineInformation) {
   433            LineInformation::const_iterator iter = lineInformation->begin();
   434            for(;iter!=lineInformation->end();iter++) {
   435            const std::pair<Offset, Offset> range = iter->first;
   436            LineNoTuple line = iter->second;
   437            KrellInstitute::Core::Address b(range.first);
   438            KrellInstitute::Core::Address e(range.second);
   439    // DEBUG
   440    #ifndef NDEBUG
   441            if(is_debug_symtabapi_symbols_enabled) {
   442                output << "SymtabAPISymbols::getAllSymbols: ADDING STATEMENT " << b << ":" << e
   443                <<" " << line.first << ":" << line.second  << std::endl;
   444            }
   445    #endif
   446            st.addStatement(b,e,line.first,line.second,line.column);

The compile errors:

home/jeg/cbtf-krell/core/src/SymtabAPISymbols.cpp: In member function ‘void KrellInstitute::Core::SymtabAPISymbols::getAllSymbols(const KrellInstitute::Core::LinkedObjectEntry&, KrellInstitute::Core::SymbolTable&)’:
/home/jeg/cbtf-krell/core/src/SymtabAPISymbols.cpp:435:49: error: request for member ‘first’ in ‘*((boost::dereferenceable<boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<Dyninst::SymtabAPI::Statement*, std::allocator<Dyninst::SymtabAPI::Statement*> > > > > >, Dyninst::SymtabAPI::Statement* const*, boost::decrementable<boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<Dyninst::SymtabAPI::Statement*, std::allocator<Dyninst::SymtabAPI::Statement*> > > > > >, boost::iterator<std::bidirectional_iterator_tag, Dyninst::SymtabAPI::Statement*, long int, Dyninst::SymtabAPI::Statement* const*, Dyninst::SymtabAPI::Statement* const&> > >*)(& iter))->boost::dereferenceable<T, P, B>::operator-><boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<Dyninst::SymtabAPI::Statement*, std::allocator<Dyninst::SymtabAPI::Statement*> > > > > >, Dyninst::SymtabAPI::Statement* const*, boost::decrementable<boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<Dyninst::SymtabAPI::Statement*, std::allocator<Dyninst::SymtabAPI::Statement*> > > > > >, boost::iterator<std::bidirectional_iterator_tag, Dyninst::SymtabAPI::Statement*, long int, Dyninst::SymtabAPI::Statement* const*, Dyninst::SymtabAPI::Statement* const&> > >()’, which is of pointer type ‘Dyninst::SymtabAPI::Statement* const’ (maybe you meant to use ‘->’ ?)
   const std::pair<Offset, Offset> range = iter->first;
                                                 ^
/home/jeg/cbtf-krell/core/src/SymtabAPISymbols.cpp:436:28: error: request for member ‘second’ in ‘*((boost::dereferenceable<boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<Dyninst::SymtabAPI::Statement*, std::allocator<Dyninst::SymtabAPI::Statement*> > > > > >, Dyninst::SymtabAPI::Statement* const*, boost::decrementable<boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<Dyninst::SymtabAPI::Statement*, std::allocator<Dyninst::SymtabAPI::Statement*> > > > > >, boost::iterator<std::bidirectional_iterator_tag, Dyninst::SymtabAPI::Statement*, long int, Dyninst::SymtabAPI::Statement* const*, Dyninst::SymtabAPI::Statement* const&> > >*)(& iter))->boost::dereferenceable<T, P, B>::operator-><boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<Dyninst::SymtabAPI::Statement*, std::allocator<Dyninst::SymtabAPI::Statement*> > > > > >, Dyninst::SymtabAPI::Statement* const*, boost::decrementable<boost::multi_index::detail::bidir_node_iterator<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::ordered_index_node<boost::multi_index::detail::index_node_base<Dyninst::SymtabAPI::Statement*, std::allocator<Dyninst::SymtabAPI::Statement*> > > > > >, boost::iterator<std::bidirectional_iterator_tag, Dyninst::SymtabAPI::Statement*, long int, Dyninst::SymtabAPI::Statement* const*, Dyninst::SymtabAPI::Statement* const&> > >()’, which is of pointer type ‘Dyninst::SymtabAPI::Statement* const’ (maybe you meant to use ‘->’ ?)
   LineNoTuple line = iter->second;
                         ^

The documentation in symtabAPI/doc/symtab-text.txt around line 1117 agrees with he source we are currently using to get lineInformation.

// Get the Line Information for module foo.
LineInformation *info = mod->getLineInformation();

//Iterate over the line information
LineInformation::const_iterator iter;
for( iter = info->begin(); iter != info->end(); iter++)
{
                        // First component represents the address range for the line
                        const std::pair<Offset, Offset> addrRange = iter->first;

                        //Second component gives information about the line itself.
                        LineNoTuple lt = iter->second;
}

Is there a new section of documentation that describes how to get the address range and line number tuple from the module class?

Thanks much for your time.
Jim G

[← Prev in Thread] Current Thread [Next in Thread→]