Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Jun 2019 05:54:12 -0400
From:      Farhan Khan <farhan@farhan.codes>
To:        freebsd-hackers@freebsd.org
Subject:   Valgrind memcheck showing question marks
Message-ID:  <20190605095411.GA8120@pc.farhan.codes>

next in thread | raw e-mail | index | archive | help

--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 <bsd.prog.mk>=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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190605095411.GA8120>