c - Valgrind not showing line numbers - Yosemite 10.10.3 -


i'm doing chapter in learn c hard way valgrind, line numbers aren't showing despite using -g. i'm running yosemite 10.10.3 , valgrind 3.10.1.

my makefile:

cc = gcc cflags=-wall -g -static  files = ex1 ex3 ex4  all: $(files)  ex1: ex1.c     $(cc) $(cflags) -o ex1 ex1.c  ex3: ex3.c     $(cc) $(cflags) -o ex3 ex3.c  ex4: ex4.c     $(cc) $(cflags) -o ex4 ex4.c  clean:     $(rm) $(files) 

and ex4.c file: (intentionally broken)

#include <stdio.h>  int main(int argc, char *argv[]){     int age  = 18;     int height;      printf("i %d years old.\n");     printf("i %d inches tall.\n", height);      return 0; } 

i've looked @ this, exact issue through on ubuntu solution isn't working me. i've created .dsym file. valgrind output is:

macbook-pro:c jaredramirez$ valgrind --dsymutil=yes --track-origins=yes   ./ex4 ==649== memcheck, memory error detector ==649== copyright (c) 2002-2013, , gnu gpl'd, julian seward et al. ==649== using valgrind-3.11.0.svn , libvex; rerun -h copyright info ==649== command: ./ex4 ==649==  --649-- run: /usr/bin/dsymutil "./ex4" warning: no debug symbols in executable (-arch x86_64) ==649== conditional jump or move depends on uninitialised value(s) ==649==    @ 0x1003fac3f: _platform_memchr$variant$haswell (in /usr/lib/system/libsystem_platform.dylib) ==649==    0x1001eeb96: __sfvwrite (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f8fe5: __vfprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021e9ae: __v2printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021ec80: __xvprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f4b71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f29d7: printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x100000f2d: main (in ./ex4) ==649==  uninitialised value created stack allocation ==649==    @ 0x1001f4bf8: __vfprintf (in /usr/lib/system/libsystem_c.dylib) ==649==  75508496 years old. ==649== conditional jump or move depends on uninitialised value(s) ==649==    @ 0x1001f69f1: __vfprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021e9ae: __v2printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021ec80: __xvprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f4b71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f29d7: printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x100000f41: main (in ./ex4) ==649==  uninitialised value created stack allocation ==649==    @ 0x7fff5fc01036: _dyld_start (in /usr/lib/dyld) ==649==  ==649== conditional jump or move depends on uninitialised value(s) ==649==    @ 0x1001f6b1b: __vfprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021e9ae: __v2printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021ec80: __xvprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f4b71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f29d7: printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x100000f41: main (in ./ex4) ==649==  uninitialised value created stack allocation ==649==    @ 0x7fff5fc01036: _dyld_start (in /usr/lib/dyld) ==649==  ==649== conditional jump or move depends on uninitialised value(s) ==649==    @ 0x1001f9555: __ultoa (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f6b5e: __vfprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021e9ae: __v2printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021ec80: __xvprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f4b71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f29d7: printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x100000f41: main (in ./ex4) ==649==  uninitialised value created stack allocation ==649==    @ 0x7fff5fc01036: _dyld_start (in /usr/lib/dyld) ==649==  ==649== syscall param write(buf) points uninitialised byte(s) ==649==    @ 0x1002f997a: write$nocancel (in /usr/lib/system/libsystem_kernel.dylib) ==649==    0x1001f39ec: _swrite (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001ec4a6: __sflush (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001eec50: __sfvwrite (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f906c: __vfprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021e9ae: __v2printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021ec80: __xvprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f4b71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f29d7: printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x100000f41: main (in ./ex4) ==649==  address 0x100820385 5 bytes inside block of size 4,096 alloc'd ==649==    @ 0x1000084bb: malloc (in /usr/local/cellar/valgrind/head/lib/valgrind/vgpreload_memcheck-amd64-darwin.so) ==649==    0x1001ef836: __smakebuf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x100204387: __swsetup (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021e75d: __v2printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x10021ec80: __xvprintf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f4b71: vfprintf_l (in /usr/lib/system/libsystem_c.dylib) ==649==    0x1001f29d7: printf (in /usr/lib/system/libsystem_c.dylib) ==649==    0x100000f2d: main (in ./ex4) ==649==  uninitialised value created stack allocation ==649==    @ 0x7fff5fc01036: _dyld_start (in /usr/lib/dyld) ==649==  0 inches tall. ==649==  ==649== heap summary: ==649==     in use @ exit: 38,782 bytes in 425 blocks ==649==   total heap usage: 504 allocs, 79 frees, 44,886 bytes allocated ==649==  ==649== leak summary: ==649==    lost: 0 bytes in 0 blocks ==649==    indirectly lost: 0 bytes in 0 blocks ==649==      possibly lost: 0 bytes in 0 blocks ==649==    still reachable: 0 bytes in 0 blocks ==649==         suppressed: 38,782 bytes in 425 blocks ==649==  ==649== counts of detected , suppressed errors, rerun with: -v ==649== error summary: 6 errors 5 contexts (suppressed: 0 0) 

thanks @jonathanleffler helping me solve issue. after comment, changed makefile to:

cc = gcc cflags=-wall -g -static  files = ex1 ex3 ex4  all: $(files)  ex1: ex1.c     $(cc) $(cflags) -o ex1 ex1.c  ex3: ex3.c     $(cc) $(cflags) -o ex3 ex3.c  ex4: ex4.c     $(cc) $(cflags) -o ex4 ex4.c  clean:     $(rm) $(files) 

and line numbers showing , warning: no debug symbols in executable (-arch x86_64 error gone.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -