From owner-freebsd-hackers@freebsd.org Wed Jun 5 09:54:17 2019 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B028E15A7966 for ; Wed, 5 Jun 2019 09:54:17 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from mail.farhan.codes (mail.farhan.codes [155.138.165.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87B3974368 for ; Wed, 5 Jun 2019 09:54:16 +0000 (UTC) (envelope-from farhan@farhan.codes) Received: from pc.farhan.codes (pool-100-36-37-117.washdc.fios.verizon.net [100.36.37.117]) by mail.farhan.codes (Postfix) with ESMTPSA id B85FDE975 for ; Wed, 5 Jun 2019 05:54:13 -0400 (EDT) Date: Wed, 5 Jun 2019 05:54:12 -0400 From: Farhan Khan To: freebsd-hackers@freebsd.org Subject: Valgrind memcheck showing question marks Message-ID: <20190605095411.GA8120@pc.farhan.codes> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PNTmBPCT7hxwcZjr" Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 87B3974368 X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.89 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[farhan.codes:s=mail]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MX_GOOD(-0.01)[cached: mail.farhan.codes]; DKIM_TRACE(0.00)[farhan.codes:+]; DMARC_POLICY_ALLOW(-0.50)[farhan.codes,reject]; NEURAL_HAM_SHORT(-0.77)[-0.770,0]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; IP_SCORE(-0.01)[asn: 20473(-0.01), country: US(-0.06)]; ASN(0.00)[asn:20473, ipnet:155.138.160.0/20, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[117.37.36.100.zen.spamhaus.org : 127.0.0.10] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jun 2019 09:54:17 -0000 --PNTmBPCT7hxwcZjr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi all, I am having a Segmentation fault error and trying to use valgrind to help m= e find where the overflow occurs. I run valgrind on the prog.full version o= f the executable. I am running it as follows: $ valgrind --tool=3Dmemcheck ogit.full [arguments omitted] =3D=3D14457=3D=3D Memcheck, a memory error detector =3D=3D14457=3D=3D Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward = et al. =3D=3D14457=3D=3D Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyr= ight info =3D=3D14457=3D=3D Command: ogit.full clone http://git.farhan.codes/farhan/o= pengit =3D=3D14457=3D=3D=20 =3D=3D14457=3D=3D Conditional jump or move depends on uninitialised value(s) =3D=3D14457=3D=3D at 0x49D1867: ??? (in /lib/libc.so.7) =3D=3D14457=3D=3D by 0x7FF00051F: ??? =3D=3D14457=3D=3D by 0x20DE7D: ??? (in /usr/home/farhan/opengit/ogit.ful= l) =3D=3D14457=3D=3D by 0x20ECE1: ??? (in /usr/home/farhan/opengit/ogit.ful= l) =3D=3D14457=3D=3D by 0x2054B5: ??? (in /usr/home/farhan/opengit/ogit.ful= l) =3D=3D14457=3D=3D by 0x20511A: ??? (in /usr/home/farhan/opengit/ogit.ful= l) =3D=3D14457=3D=3D by 0x4826FFF: ??? =3D=3D14457=3D=3D=20 [snippet] Please note that the stack trace does not show the function names, which I = need. How do I enable those symbols? The Makefile is as follows: ------------------ MAN=3D CFLAGS=3D -Wall -lmd -lz -lfetch =20 PROG=3D ogit SRCS=3D ogit.c lib/ini.c lib/index.c lib/common.c lib/pack.c remote.c ini= t.c \ lib/zlib-handler.c lib/buffering.c lib/loose.c \ hash-object.c update-index.c cat-file.c log.c clone.c index-pack.c CLEANFILES+=3D ${PROG}.core =20 =2Einclude =20 ------------------ An example compilation line and the ending is as follows. The first line is= for "index-pack.c", but there are others as the SRCS line shows. ------------------ cc -Wall -lmd -lz -lfetch -g -MD -MF.depend.index-pack.o -MTindex-pack.= o -std=3Dgnu99 -fstack-protector-strong -Qunused-arguments -c index-pac= k.c -o index-pack.o cc -Wall -lmd -lz -lfetch -g -std=3Dgnu99 -fstack-protector-strong -Qunused= -arguments -o ogit.full ogit.o lib/ini.o lib/index.o lib/common.o lib/pac= k.o remote.o init.o lib/zlib-handler.o lib/buffering.o lib/loose.o hash-obj= ect.o update-index.o cat-file.o log.o clone.o index-pack.o =20 objcopy --only-keep-debug ogit.full ogit.debug objcopy --strip-debug --add-gnu-debuglink=3Dogit.debug ogit.full ogit ------------------ Am I missing a necessary compilation flag to have those symbols appear? I h= ave "-g" turned on during compilation. Thanks, --- Farhan Khan PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE --PNTmBPCT7hxwcZjr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEG8zEBbZbSkdr8t3eZNYqKtDTorUFAlz3kUMACgkQZNYqKtDT orW/BAwAqMNEN/RO6fnErjKbb3PvwI9TB1xgi0zYgY2tKz01zY7KAqvqR/sA9ldn Yxa5Yaj8hRSvJBHsaUzkbu45JCHfbYmvCLmFb5VLy7Ho26TrePDQS+WXU2Hyd76M SDaEtQ7JR2zWSM9Zq7ZloXBB3Ak1eUUX+xU5Pe137mUi3AGVsqUTELbv4+a7ijV2 RV8PYfPEv+FdXV5OeKUW9rJ1eQ5p4zOAuZuloJvEozmmbuGap8AsmVFLgUpJLvKc yCEfbN3rFRTcPGnETDzldaQslGaW1QM2VFVWdv84j6duPZ6g09lxDvh1jcPaQf29 uLXhgVsPdyeUAHZuMqOo+7NdaUtANfz8IMvqkWchSQ91+N2/gC5AUPRyjH/m24mQ DUyYfy2ndM0Z84NPS8XEg2c5faqH6TCiAKtqKnE5cVOmktHOtxji23aF5hJKtWDW k7f/KNi98O0cPNeXjKMaqs6q1aR7uoCEhGRta7R6g9kZhbUilamDaiEr4zQhrVIC jjGY0Dve =sa2f -----END PGP SIGNATURE----- --PNTmBPCT7hxwcZjr--