Hi,
I have solved the problem of Valgrind not displaying function names
and file names when it detects a problem.
Could not display symbols with current Valgrind as below:
$ cd /usr/src/usr.bin/grep
$ make COPTS="-g
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/binary.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/file.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/grep.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/mmfile.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/queue.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/util.c
cc -o grep binary.o file.o grep.o mmfile.o queue.o util.o -lz
$ valgrind obj/grep PATH /etc/skel/.profile
==67899== Memcheck, a memory error detector
==67899== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==67899== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==67899== Command: obj/grep PATH /etc/skel/.profile
==67899==
==67899== Use of uninitialised value of size 8
==67899== at 0x49AD34D: ??? (in obj/grep)
==67899== by 0x10EF2A: ??? (in obj/grep)
==67899== by 0x10CDFF: ??? (in obj/grep)
==67899== by 0x10CB02: ??? (in obj/grep)
==67899== by 0x10B821: ??? (in obj/grep)
</snip>
And applied following patch as below:
$ cd /usr/src/usr.bin/grep
$ make COPTS="-g"
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/binary.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/file.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/grep.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/mmfile.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/queue.c
cc -O2 -pipe -Wall -g -MD -MP -c /usr/src/usr.bin/grep/util.c
cc -o grep binary.o file.o grep.o mmfile.o queue.o util.o -lz
$ valgrind obj/grep PATH /etc/skel/.profile
==78943== Memcheck, a memory error detector
==78943== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==78943== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==78943== Command: obj/grep PATH /etc/skel/.profile
==78943==
==78943== Use of uninitialised value of size 8
==78943== at 0x49D9B0D: realloc (stdlib/malloc.c:1897)
==78943== by 0x10EF2A: grep_reallocarray (util.c:615)
==78943== by 0x10CDFF: add_pattern (grep.c:186)
==78943== by 0x10CB02: add_patterns (grep.c:224)
==78943== by 0x10CB02: main (grep.c:473)
</snip>
comments, ok?
--
ASOU Masato
? devel/valgrind/old-patches
? devel/valgrind/patches/patch-coregrind_m_options_c
Index: devel/valgrind/patches/patch-coregrind_m_debuginfo_debuginfo_c
===================================================================
RCS file: /cvs/ports/devel/valgrind/patches/patch-coregrind_m_debuginfo_debuginfo_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-coregrind_m_debuginfo_debuginfo_c
--- devel/valgrind/patches/patch-coregrind_m_debuginfo_debuginfo_c 18 Jul 2023 06:17:15 -0000 1.1
+++ devel/valgrind/patches/patch-coregrind_m_debuginfo_debuginfo_c 3 Aug 2023 06:52:29 -0000
@@ -27,7 +27,17 @@
ok = ML_(read_elf_debug_info)( di );
# elif defined(VGO_darwin)
ok = ML_(read_macho_debug_info)( di );
-@@ -1347,7 +1347,7 @@
+@@ -1265,6 +1265,9 @@
+ || defined(VGA_mips64) || defined(VGA_nanomips)
+ is_rx_map = seg->hasR && seg->hasX;
+ is_rw_map = seg->hasR && seg->hasW;
++# elif defined(VGO_openbsd)
++ is_rx_map = seg->hasX;
++ is_rw_map = seg->hasR && seg->hasW;
+ # elif defined(VGA_amd64) || defined(VGA_ppc64be) || defined(VGA_ppc64le) \
+ || defined(VGA_arm) || defined(VGA_arm64)
+ is_rx_map = seg->hasR && seg->hasX && !seg->hasW;
+@@ -1347,7 +1350,7 @@
No comments:
Post a Comment