[DynInst_API:] Enumerating linked shared libraries with SymtabAPI/ ParseAPI


Date: Wed, 23 Jan 2019 21:49:27 +0530
From: Buddhika Chamith Kahawitage Don <budkahaw@xxxxxx>
Subject: [DynInst_API:] Enumerating linked shared libraries with SymtabAPI/ ParseAPI
Hi All,

I need to enumerate and parse linked shared libraries of a binary using Symtab API and Parse API. How can I do that? I am currently using below code sequence to parse the binary.

 Dyninst::SymtabAPI::Symtab* symtab;
 bool isParsable = Dyninst::SymtabAPI::Symtab::openFile(symtab, binary);
 if (isParsable == false) {
ÂÂÂ const char* error = "error: file can not be parsed";
ÂÂÂ std::cout << error;
ÂÂÂ return;
 }

 // Create a new binary code object from the filename argument
 Dyninst::ParseAPI::SymtabCodeSource* sts =
ÂÂÂÂÂ new Dyninst::ParseAPI::SymtabCodeSource(binary.c_str());
 Dyninst::ParseAPI::CodeObject* co = new Dyninst::ParseAPI::CodeObject(sts);
 co->parse();

 auto fit = co->funcs().begin();
 for (; fit != co->funcs().end(); ++fit) {
ÂÂÂ Dyninst::ParseAPI::Function* f = *fit;
ÂÂÂ ....
 }

Regards
Buddhika
[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] Enumerating linked shared libraries with SymtabAPI/ ParseAPI, Buddhika Chamith Kahawitage Don <=