Date: Mon, 17 Jun 2019 02:48:03 +0000 From: "Farhan Khan" <farhan@farhan.codes> To: "David CARLIER" <devnexen@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Valgrind memcheck showing question marks Message-ID: <c3618d93b9e3f420a84923f2ce0efe95@farhan.codes> In-Reply-To: <CA%2BXhMqxx48M4Xhx6QLfzFdaNgWPht99utHQbU-HFKPfaext%2B3A@mail.gmail.com> References: <CA%2BXhMqxx48M4Xhx6QLfzFdaNgWPht99utHQbU-HFKPfaext%2B3A@mail.gmail.com> <20190605095411.GA8120@pc.farhan.codes>
next in thread | previous in thread | raw e-mail | index | archive | help
June 5, 2019 5:58 AM, "David CARLIER" <devnexen@gmail.com> wrote:=0A=0A> = Hi if that helps you can try -O0 in addition of -g.=0A> =0A> Regards.=0A>= =0A> On Wed, 5 Jun 2019 at 09:56, Farhan Khan via freebsd-hackers=0A> <f= reebsd-hackers@freebsd.org> wrote:=0A> =0A>> Hi all,=0A>> =0A>> I am havi= ng a Segmentation fault error and trying to use valgrind to help me find = where the=0A>> overflow occurs. I run valgrind on the prog.full version o= f the executable.=0A>> =0A>> I am running it as follows:=0A>> =0A>> $ val= grind --tool=3Dmemcheck ogit.full [arguments omitted]=0A>> =0A>> =3D=3D14= 457=3D=3D Memcheck, a memory error detector=0A>> =3D=3D14457=3D=3D Copyri= ght (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.=0A>> =3D=3D1445= 7=3D=3D Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright inf= o=0A>> =3D=3D14457=3D=3D Command: ogit.full clone http://git.farhan.codes= /farhan/opengit=0A>> =3D=3D14457=3D=3D=0A>> =3D=3D14457=3D=3D Conditional= jump or move depends on uninitialised value(s)=0A>> =3D=3D14457=3D=3D at= 0x49D1867: ??? (in /lib/libc.so.7)=0A>> =3D=3D14457=3D=3D by 0x7FF00051F= : ???=0A>> =3D=3D14457=3D=3D by 0x20DE7D: ??? (in /usr/home/farhan/opengi= t/ogit.full)=0A>> =3D=3D14457=3D=3D by 0x20ECE1: ??? (in /usr/home/farhan= /opengit/ogit.full)=0A>> =3D=3D14457=3D=3D by 0x2054B5: ??? (in /usr/home= /farhan/opengit/ogit.full)=0A>> =3D=3D14457=3D=3D by 0x20511A: ??? (in /u= sr/home/farhan/opengit/ogit.full)=0A>> =3D=3D14457=3D=3D by 0x4826FFF: ??= ?=0A>> =3D=3D14457=3D=3D=0A>> [snippet]=0A>> =0A>> Please note that the s= tack trace does not show the function names, which I need. How do I enabl= e=0A>> those symbols?=0A>> =0A>> The Makefile is as follows:=0A>> -------= -----------=0A>> MAN=3D=0A>> =0A>> CFLAGS=3D -Wall -lmd -lz -lfetch=0A>> = =0A>> PROG=3D ogit=0A>> =0A>> SRCS=3D ogit.c lib/ini.c lib/index.c lib/co= mmon.c lib/pack.c remote.c init.c \=0A>> lib/zlib-handler.c lib/buffering= .c lib/loose.c \=0A>> hash-object.c update-index.c cat-file.c log.c clone= .c index-pack.c=0A>> =0A>> CLEANFILES+=3D ${PROG}.core=0A>> =0A>> .includ= e <bsd.prog.mk>=0A>> ------------------=0A>> =0A>> An example compilation= line and the ending is as follows. The first line is for "index-pack.c",= but=0A>> there are others as the SRCS line shows.=0A>> -----------------= -=0A>> cc -Wall -lmd -lz -lfetch -g -MD -MF.depend.index-pack.o -MTindex-= pack.o -std=3Dgnu99=0A>> -fstack-protector-strong -Qunused-arguments -c i= ndex-pack.c -o index-pack.o=0A>> cc -Wall -lmd -lz -lfetch -g -std=3Dgnu9= 9 -fstack-protector-strong -Qunused-arguments -o ogit.full=0A>> ogit.o li= b/ini.o lib/index.o lib/common.o lib/pack.o remote.o init.o lib/zlib-hand= ler.o=0A>> lib/buffering.o lib/loose.o hash-object.o update-index.o cat-f= ile.o log.o clone.o index-pack.o=0A>> objcopy --only-keep-debug ogit.full= ogit.debug=0A>> objcopy --strip-debug --add-gnu-debuglink=3Dogit.debug o= git.full ogit=0A>> ------------------=0A>> =0A>> Am I missing a necessary= compilation flag to have those symbols appear? I have "-g" turned on=0A>= > during compilation.=0A>> Thanks,=0A>> =0A>> ---=0A>> Farhan Khan=0A>> P= GP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE=0A=0AI = have -O0 and -g in my Makefile, but that does not appear to change the is= sue. It appears that debugging symbols are stripped out towards the end o= f the compilation and creates 'prog.full' and 'prog.debug', as follows:= =0A=0Acc -O2 -pipe -Wunreachable-code -Werror -O0 -g -Wall -I/usr/home/fa= rhan/opengit/src/.. -g -std=3Dgnu99 -fstack-protector-strong -Qunused-arg= uments -lmd -lz -lfetch /usr/home/farhan/opengit/src/../lib/libogit.a -= o ogit.full ogit.o remote.o init.o hash-object.o update-index.o cat-file.= o log.o clone.o clone_http.o index-pack.o =0Aobjcopy --only-keep-debug o= git.full ogit.debug=0Aobjcopy --strip-debug --add-gnu-debuglink=3Dogit.de= bug ogit.full ogit=0A=0ANotice how the debugging symbols are written to = "ogit.debug". Is there a way to use that debug file with valgrind?=0AI sh= ould add, I also tried to manually run the compilation line without the t= wo objcopy(1) lines, but valgrind also produced the same result.=0A=0AAss= istance is appreciated :)=0A=0AThanks,=0A---=0AFarhan Khan=0APGP Fingerpr= int: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c3618d93b9e3f420a84923f2ce0efe95>