Hello folks,

I compiled the valgrind and memcheck for powerpc and it went through fine.
However I see that leak is not getting detected.
Compiled the below program with -O0 -g flags

[mv_mm-dev valgrind-3.12.0 (IAP-MASTERSON)]$ cat valg.c
#include <stdlib.h>

  void f(void)
  {
     int* x = malloc(10 * sizeof(int));
     printf("hello \n");
     //x[10] = 0;        // problem 1: heap block overrun
  }                    // problem 2: memory leak -- x not freed

  int main(void)
  {
     f();
     return 0;
  }



/aruba/bin # ./valgrind_ppc -v --leak-check=full --show-leak-kinds=all
--trace-redir=yes ./ll
==5922== Memcheck, a memory error detector
==5922== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==5922== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==5922== Command: ./ll
==5922==
--5922-- Valgrind options:
--5922--    -v
--5922--    --leak-check=full
--5922--    --show-leak-kinds=all
--5922--    --trace-redir=yes
--5922-- Contents of /proc/version:
--5922--
--5922-- Aruba Networks
--5922-- ArubaOS Version 8.3.0.0-8.3.0.0 (build 0000 / label
#mdantakale@md_mm-dev-ENG.0000)
--5922-- Built by mdantak...@blrdev-mdantakale.arubanetworks.com on
2018-01-18 at 12:32:13 IST (gcc version 4.8.1)
--5922-- (c) Copyright 2018 Hewlett Packard Enterprise Development LP.
--5922--
--5922-- Arch and hwcaps: PPC32, BigEndian, ppc32-int-flt-GX
--5922-- Page sizes: currently 4096, max supported 65536
--5922-- Valgrind library directory: /usr/lib/valgrind
--5922-- <<
--5922--    ------ REDIR STATE after VG_(redir_initialise) ------
--5922--    TOPSPECS of soname (hardwired)
--5922--      ld.so.1                   index
RL-> (0000.0) 0x3805cb00
--5922--      ld.so.1                   strcmp
RL-> (0000.0) 0x3805ca8c
--5922--      ld.so.1                   strlen
RL-> (0000.0) 0x3805ca64
--5922--    ------ ACTIVE ------
--5922-- >>
--5922-- Reading syms from /lib/ld-uClibc.so.0
--5922--    svma 0x0000001130, avma 0x0004001130
--5922--   Considering /lib/ld-uClibc-0.9.34-git.so ..
--5922--   .. CRC mismatch (computed 4890ee42 wanted 93eb0f3e)
--5922--    object doesn't have a symbol table
--5922-- <<
--5922--    ------ REDIR STATE after VG_(redir_notify_new_DebugInfo) ------
--5922--    TOPSPECS of soname ld-uClibc.so.0 filename /lib/ld-uClibc.so.0
--5922--    TOPSPECS of soname (hardwired)
--5922--      ld.so.1                   index
RL-> (0000.0) 0x3805cb00
--5922--      ld.so.1                   strcmp
RL-> (0000.0) 0x3805ca8c
--5922--      ld.so.1                   strlen
RL-> (0000.0) 0x3805ca64
--5922--    ------ ACTIVE ------
--5922-- >>
--5922-- Reading syms from /aruba/bin/ll
--5922--    svma 0x0010000328, avma 0x0010000328
--5922-- <<
--5922--    ------ REDIR STATE after VG_(redir_notify_new_DebugInfo) ------
--5922--    TOPSPECS of soname NONE filename /aruba/bin/ll
--5922--    TOPSPECS of soname ld-uClibc.so.0 filename /lib/ld-uClibc.so.0
--5922--    TOPSPECS of soname (hardwired)
--5922--      ld.so.1                   index
RL-> (0000.0) 0x3805cb00
--5922--      ld.so.1                   strcmp
RL-> (0000.0) 0x3805ca8c
--5922--      ld.so.1                   strlen
RL-> (0000.0) 0x3805ca64
--5922--    ------ ACTIVE ------
--5922-- >>
--5922-- Reading syms from /usr/lib/valgrind/memcheck-ppc32-linux
--5922--    svma 0x0038000094, avma 0x0038000094
--5922--    object doesn't have a dynamic symbol table
--5922-- <<
--5922--    ------ REDIR STATE after VG_(redir_notify_new_DebugInfo) ------
--5922--    TOPSPECS of soname NONE filename
/usr/lib/valgrind/memcheck-ppc32-linux
--5922--    TOPSPECS of soname NONE filename /aruba/bin/ll
--5922--    TOPSPECS of soname ld-uClibc.so.0 filename /lib/ld-uClibc.so.0
--5922--    TOPSPECS of soname (hardwired)
--5922--      ld.so.1                   index
RL-> (0000.0) 0x3805cb00
--5922--      ld.so.1                   strcmp
RL-> (0000.0) 0x3805ca8c
--5922--      ld.so.1                   strlen
RL-> (0000.0) 0x3805ca64
--5922--    ------ ACTIVE ------
--5922-- >>
--5922-- Scheduler: using generic scheduler lock implementation.
--5922-- Reading suppressions file: /usr/lib/valgrind/default.supp
==5922== embedded gdbserver: reading from
/tmp/vgdb-pipe-from-vgdb-to-5922-by-root-on-???
==5922== embedded gdbserver: writing to
/tmp/vgdb-pipe-to-vgdb-from-5922-by-root-on-???
==5922== embedded gdbserver: shared mem
/tmp/vgdb-pipe-shared-mem-vgdb-5922-by-root-on-???
==5922==
==5922== TO CONTROL THIS PROCESS USING vgdb (which you probably
==5922== don't want to do, unless you know exactly what you're doing,
==5922== or are doing some strange experiment):
==5922==   /usr/lib/valgrind/../../bin/vgdb --pid=5922 ...command...
==5922==
==5922== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==5922==   /path/to/gdb ./ll
==5922== and then give GDB the following command
==5922==   target remote | /usr/lib/valgrind/../../bin/vgdb --pid=5922
==5922== --pid is optional if only one valgrind process is running
==5922==
--5922-- Reading syms from /usr/lib/valgrind/vgpreload_core-ppc32-linux.so
--5922--    svma 0x00000003cc, avma 0x000401a3cc
--5922-- <<
--5922--    ------ REDIR STATE after VG_(redir_notify_new_DebugInfo) ------
--5922--    TOPSPECS of soname NONE filename
/usr/lib/valgrind/vgpreload_core-ppc32-linux.so
--5922--    TOPSPECS of soname NONE filename
/usr/lib/valgrind/memcheck-ppc32-linux
--5922--    TOPSPECS of soname NONE filename /aruba/bin/ll
--5922--    TOPSPECS of soname ld-uClibc.so.0 filename /lib/ld-uClibc.so.0
--5922--    TOPSPECS of soname (hardwired)
--5922--      ld.so.1                   index
RL-> (0000.0) 0x3805cb00
--5922--      ld.so.1                   strcmp
RL-> (0000.0) 0x3805ca8c
--5922--      ld.so.1                   strlen
RL-> (0000.0) 0x3805ca64
--5922--    ------ ACTIVE ------
--5922-- >>
--5922-- Reading syms from /lib/libgcc_s.so.1
--5922--    svma 0x00000022b0, avma 0x000402d2b0
--5922--   Considering /lib/libgcc_s.so.1 ..
--5922--   .. CRC mismatch (computed a4a20c5f wanted b48b756d)
--5922--    object doesn't have a symbol table
--5922-- <<
--5922--    ------ REDIR STATE after VG_(redir_notify_new_DebugInfo) ------
--5922--    TOPSPECS of soname libgcc_s.so.1 filename /lib/libgcc_s.so.1
--5922--    TOPSPECS of soname NONE filename
/usr/lib/valgrind/vgpreload_core-ppc32-linux.so
--5922--    TOPSPECS of soname NONE filename
/usr/lib/valgrind/memcheck-ppc32-linux
--5922--    TOPSPECS of soname NONE filename /aruba/bin/ll
--5922--    TOPSPECS of soname ld-uClibc.so.0 filename /lib/ld-uClibc.so.0
--5922--    TOPSPECS of soname (hardwired)
--5922--      ld.so.1                   index
RL-> (0000.0) 0x3805cb00
--5922--      ld.so.1                   strcmp
RL-> (0000.0) 0x3805ca8c
--5922--      ld.so.1                   strlen
RL-> (0000.0) 0x3805ca64
--5922--    ------ ACTIVE ------
--5922-- >>
--5922-- Reading syms from /lib/libc.so.0
--5922--    svma 0x000000e1f0, avma 0x000405f1f0
--5922--   Considering /lib/libuClibc-0.9.34-git.so ..
--5922--   .. CRC mismatch (computed aca7e0ee wanted 30ca3855)
--5922--    object doesn't have a symbol table
--5922-- <<
--5922--    ------ REDIR STATE after VG_(redir_notify_new_DebugInfo) ------
--5922--    TOPSPECS of soname libc.so.0 filename /lib/libc.so.0
--5922--    TOPSPECS of soname libgcc_s.so.1 filename /lib/libgcc_s.so.1
--5922--    TOPSPECS of soname NONE filename
/usr/lib/valgrind/vgpreload_core-ppc32-linux.so
--5922--    TOPSPECS of soname NONE filename
/usr/lib/valgrind/memcheck-ppc32-linux
--5922--    TOPSPECS of soname NONE filename /aruba/bin/ll
--5922--    TOPSPECS of soname ld-uClibc.so.0 filename /lib/ld-uClibc.so.0
--5922--    TOPSPECS of soname (hardwired)
--5922--      ld.so.1                   index
RL-> (0000.0) 0x3805cb00
--5922--      ld.so.1                   strcmp
RL-> (0000.0) 0x3805ca8c
--5922--      ld.so.1                   strlen
RL-> (0000.0) 0x3805ca64
--5922--    ------ ACTIVE ------
--5922-- >>
hello
/aruba/bin/ll: can't resolve symbol '__libc_freeres' in lib
'/usr/lib/valgrind/vgpreload_core-ppc32-linux.so'.
==5922==
==5922== HEAP SUMMARY:
==5922==     in use at exit: 0 bytes in 0 blocks
==5922==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==5922==
==5922== All heap blocks were freed -- no leaks are possible
==5922==
==5922== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==5922== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
/aruba/bin #

On Fri, Jan 19, 2018 at 11:28 PM, Mahesh V
<maheshvenkateshwa...@gmail.com> wrote:
> Hello Folks,
>
> This is my first mail here.
>
> While cross compiling memcheck for ARM,  I get an unresolved symbol for
> vgSysWrap_generic_sys_mremap_before in coregrind/libcoregrind-arm-linux.a
>
> I can see that is is undefined in that library.
>
> Making all in .
> make[1]: Entering directory
> `/home/maheshvenkateshwaran/valgrind-3.12.0/memcheck'
> ../coregrind/link_tool_exe_linux 0x38000000 gcc     -o
> memcheck-arm-linux -O2 -g -std=gnu99 -Wall -Wmissing-prototypes
> -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations
> -Wcast-qual -Wwrite-strings -Wempty-body -Wformat -Wformat-security
> -Wignored-qualifiers -Wmissing-parameter-type -Wold-style-declaration
> -fno-stack-protector -fno-strict-aliasing -fno-builtin  -marm
> -mcpu=cortex-a8 -O2 -static -nodefaultlibs -nostartfiles -u _start
> memcheck_arm_linux-mc_leakcheck.o
> memcheck_arm_linux-mc_malloc_wrappers.o memcheck_arm_linux-mc_main.o
> memcheck_arm_linux-mc_translate.o memcheck_arm_linux-mc_machine.o
> memcheck_arm_linux-mc_errors.o ../coregrind/libcoregrind-arm-linux.a
> ../VEX/libvex-arm-linux.a -lgcc
> ../coregrind/libcoregrind-arm-linux.a(libcoregrind_arm_linux_a-syswrap-arm-linux.o):(.data+0x518):
> undefined reference to `vgSysWrap_generic_sys_mremap_before'
> collect2: ld returned 1 exit status
> make[1]: *** [memcheck-arm-linux] Error 1
>
> Any idea how to resolve this issue?
>
> Steps
> ./configure --host=armv7-none-linux-gnueabi --target=armv7-none-linux-gnueabi
> ./make
>
> Valgrind compiled fine and executable is built as well
> $ file ./valgrind
> ./valgrind: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
> dynamically linked (uses shared libs), not stripped
>
>
> regards
> Mahesh

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to