Discussion:
Segmentation fault when creating callgraph output from opreport for gprof2dot
(too old to reply)
Vrijnsen, Jeroen
2016-03-21 13:55:08 UTC
Permalink
Raw Message
Hi,


I'm trying to create a callgraph plot usign opreport and gprof2dot, but for some reason have a segmentation fault, seemingly caused by Xerces-C.


I have created the following sample code to reproduce the problem:


-------------------------------------------------------------------------------------------

[main.cpp]

#include "xercesc/util/PlatformUtils.hpp"

int main(int argc, char *argv[])
{
xercesc::XMLPlatformUtils::Initialize();
xercesc::XMLPlatformUtils::Terminate();

return 0;
}


[Makefile]

CC = g++
CCFLAGS = -std=c++11 -g -O2 -fno-omit-frame-pointer

LIBS = -lxerces-c

SOURCES = main.cpp
OBJECTS = $(SOURCES:.cpp=.o)

all: $(OBJECTS)
$(CC) $(CCFLAGS) $(LIBS) -o dummy $(OBJECTS)


[opcommand]

#!/bin/sh
TMPDIR=`mktemp --tmpdir -d "oprofile_XXXXXXXXXX"`
OPERFOPTIONS="--vmlinux=/usr/lib/debug/lib/modules/`uname -r`+debug/vmlinux --callgraph --session-dir ${TMPDIR} --lazy-conversion --events CPU_CLK_UNHALTED:90000:0:1:1"

echo operf ${OPERFOPTIONS} $@
operf ${OPERFOPTIONS} $@

OUTF=$1_oprofile_`date +%Y%m%d%H%M%S`
opreport -cgf -Dsmart -p /lib/modules/`uname -r`/ --session-dir=${TMPDIR} `which $1`



So, I build the code, and then run 'opcommand ./dummy', and get the following trace:
BFD: Dwarf Error: Offset (201326650) greater than or equal to .debug_str size (932004).
BFD: Dwarf Error: Offset (11776819) greater than or equal to .debug_str size (932004).
BFD: Dwarf Error: Offset (1337459531) greater than or equal to .debug_str size (932004).
BFD: Dwarf Error: Offset (2550398981) greater than or equal to .debug_str size (932004).
/usr/bin/opcommand: line 9: 8651 Segmentation fault (core dumped) opreport -cgf -Dsmart -p /lib/modules/`uname -r`/ --session-dir=${TMPDIR} `which $1`


I have Fedora 20, OProfile 0.9.9-3, Xerces-c 3.1.1-6, gcc 4.8.3-7.


When I leave the '-g' option from the 'opreport' arguments, all runs fine, but 'gprof2dot' is not happy.


What is causing this SEGFAULT in OPREPORT, and how to fix it?


Kind regards,

Jeroen Vrijnsen



________________________________
The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
Loading...