101 #include <Function.h> 120 #define DEBUG_INLINE_NAMES 0 135 DIAG_Die(
"banal caught unexpected signal " << sig);
141 struct sigaction act;
143 memset(&act, 0,
sizeof(act));
146 sigemptyset(&act.sa_mask);
175 if (sigsetjmp(
jbuf, 1) == 0) {
192 DIAG_WMsgIf(1,
"SymtabAPI was unable to open: " << elfFile->
getFileName());
212 DIAG_WMsgIf(1,
"SymtabAPI had " <<
num_errors <<
" errors in " 229 ".C",
".cc",
".cpp",
".cxx",
".c++",
230 ".CC",
".CPP",
".CXX",
".hpp",
".hxx",
"" 241 set <Module *> modSet;
244 if (modSet.empty()) {
248 Module * mod = *(modSet.begin());
254 supportedLanguages lang = mod->language();
255 if (lang == lang_CPlusPlus || lang == lang_GnuCPlusPlus) {
258 if (lang != lang_Unknown) {
263 string filenm = mod->fileName();
264 long file_len = filenm.length();
270 for (
auto i = 0; cplus_exts[i] !=
""; i++) {
271 string ext = cplus_exts[i];
272 long len = ext.length();
274 if (file_len > len && filenm.compare(file_len - len, len, ext) == 0) {
290 FunctionBase *func, *parent;
300 if (sigsetjmp(
jbuf, 1) == 0) {
305 if (
the_symtab->getContainingInlinedFunction(addr, func))
309 parent = func->getInlinedParent();
310 while (parent !=
NULL) {
314 InlinedFunction *ifunc = static_cast <InlinedFunction *> (func);
315 pair <string, Offset> callsite = ifunc->getCallsite();
316 string filenm = callsite.first;
317 if (filenm !=
"") { realPath->
realpath(filenm); }
318 long lineno = callsite.second;
322 string procnm = func->getName();
323 string prettynm = procnm;
333 #if DEBUG_INLINE_NAMES 334 cout <<
"raw-inline: 0x" << hex << addr << dec
335 <<
" link: " << procnm <<
" pretty: " << prettynm <<
"\n";
338 nodelist.push_front(
InlineNode(filenm, procnm, prettynm, lineno));
341 parent = func->getInlinedParent();
371 VMA end_vma = vma + sinfo->
len;
386 auto sit = this->upper_bound(vma);
388 if (sit != this->begin()) {
391 left_end = left->
vma + left->
len;
393 if (sit != this->end()) {
398 if (left ==
NULL || left_end < vma) {
400 info =
new StmtInfo(vma, end_vma - vma, file, base, line);
406 end_vma = std::max(end_vma, left_end);
407 left->
len = end_vma - left->
vma;
413 if (left_end < end_vma && (right ==
NULL || left_end < right->vma)) {
415 info =
new StmtInfo(vma, end_vma - vma, file, base, line);
421 if (info !=
NULL && right !=
NULL && end_vma >= right->
vma) {
426 end_vma = right->
vma + right->
len;
427 info->
len = end_vma - info->
vma;
455 for (
auto it = path.begin(); it != path.end(); ++it) {
457 auto nit = node->
nodeMap.find(flp);
459 if (nit != node->
nodeMap.end()) {
473 StmtInfo info(vma, len, file, base, line);
490 for (
auto sit = src->
stmtMap.begin(); sit != src->
stmtMap.end(); ++sit) {
503 auto dit = dest->
nodeMap.find(flp);
506 if (dit == dest->
nodeMap.end()) {
537 for (
auto sit = src->
nodeMap.begin(); sit != src->
nodeMap.end(); ++sit) {
553 auto dit = path.begin();
554 auto sit = info->
path.begin();
556 while (dit != path.end() && sit != info->
path.end() && *dit == *sit) {
562 while (sit != info->
path.end()) {
564 auto nit = dest->
nodeMap.find(flp);
567 if (nit != dest->
nodeMap.end()) {
list< InlineNode > InlineSeqn
long str2index(const std::string &str)
Symtab * openSymtab(ElfFile *elfFile)
static Symtab * the_symtab
static void init_sighandler(void)
void mergeInlineLoop(TreeNode *dest, FLPSeqn &path, LoopInfo *info)
static bool analyzeDemangle(VMA vma)
static void banal_sighandler(int sig)
bool realpath(std::string &pathNm) const
static struct sigaction old_act_abrt
static string cplus_exts[]
void addStmtToTree(TreeNode *root, HPC::StringTable &strTab, RealPathMgr *realPath, VMA vma, int len, string &filenm, SrcFile::ln line)
void mergeInlineStmts(TreeNode *dest, TreeNode *src)
std::string getFileName()
static void restore_sighandler(void)
void mergeInlineEdge(TreeNode *dest, FLPIndex flp, TreeNode *src)
static struct sigaction old_act_segv
void mergeInlineTree(TreeNode *dest, TreeNode *src)
static const string UNKNOWN_PROC("unknown-proc")
string basename(const char *fName)
bool analyzeAddr(InlineSeqn &nodelist, VMA addr, RealPathMgr *realPath)
string demangleProcName(const std::string &name)