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>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Hi all,

I am having a Segmentation fault error and trying to use valgrind to help me find where the overflow occurs. I run valgrind on the prog.full version of the executable.

I am running it as follows:

$ valgrind --tool=memcheck ogit.full [arguments omitted]

==14457== Memcheck, a memory error detector
==14457== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==14457== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==14457== Command: ogit.full clone http://git.farhan.codes/farhan/opengit
==14457== 
==14457== Conditional jump or move depends on uninitialised value(s)
==14457==    at 0x49D1867: ??? (in /lib/libc.so.7)
==14457==    by 0x7FF00051F: ???
==14457==    by 0x20DE7D: ??? (in /usr/home/farhan/opengit/ogit.full)
==14457==    by 0x20ECE1: ??? (in /usr/home/farhan/opengit/ogit.full)
==14457==    by 0x2054B5: ??? (in /usr/home/farhan/opengit/ogit.full)
==14457==    by 0x20511A: ??? (in /usr/home/farhan/opengit/ogit.full)
==14457==    by 0x4826FFF: ???
==14457== 
[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=

CFLAGS= -Wall -lmd -lz -lfetch
    
PROG=   ogit

SRCS=   ogit.c lib/ini.c lib/index.c lib/common.c lib/pack.c remote.c init.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+=    ${PROG}.core    

.include <bsd.prog.mk> 
------------------

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=gnu99 -fstack-protector-strong    -Qunused-arguments  -c index-pack.c -o index-pack.o
cc -Wall -lmd -lz -lfetch -g -std=gnu99 -fstack-protector-strong -Qunused-arguments   -o ogit.full ogit.o lib/ini.o lib/index.o lib/common.o lib/pack.o remote.o init.o lib/zlib-handler.o lib/buffering.o lib/loose.o hash-object.o update-index.o cat-file.o log.o clone.o index-pack.o  
objcopy --only-keep-debug ogit.full ogit.debug
objcopy --strip-debug --add-gnu-debuglink=ogit.debug  ogit.full ogit
------------------

Am I missing a necessary compilation flag to have those symbols appear? I have "-g" turned on during compilation.
Thanks,

---
Farhan Khan
PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE

[-- Attachment #2 --]
-----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-----
help

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