Valgrind memcheck showing question marks

Farhan Khan farhan at farhan.codes
Wed Jun 5 09:54:17 UTC 2019


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20190605/e2a132b7/attachment.sig>


More information about the freebsd-hackers mailing list