|
From: İsmail D. <is...@na...> - 2010-07-29 07:20:44
|
Hello;
I was happy to hear Valgrind is ported darwin/amd64, so I grabbed the
sources from trunk and compiled it. But it crashes on startup, here are some
details;
[~/Sources/valgrind]> svnversion
11234
[~/Sources/valgrind]> gcc -v
Using built-in specs.
Target: i686-apple-darwin10
Configured with: /var/tmp/gcc/gcc-5664~50/src/configure --disable-checking
--enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib
--build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10-
--host=x86_64-apple-darwin10 --target=i686-apple-darwin10
--with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5664)
make check does not compile;
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I../../../include
-I../../../coregrind -I../../../include -I../../../VEX/pub -DVGA_amd64=1
-DVGO_darwin=1 -DVGP_amd64_darwin=1 -Winline -Wall -Wshadow -g -m32 -mmmx
-msse -mdynamic-no-pic -Wno-long-long -Wno-pointer-sign -fno-stack-protector
-MT faultstatus.o -MD -MP -MF .deps/faultstatus.Tpo -c -o faultstatus.o
faultstatus.c
/var/folders/BE/BEgfDjmtELG1+m8CImXwIU+++TM/-Tmp-//cchO6HaF.s:437:suffix or
operands invalid for `bound'
make[5]: *** [faultstatus.o] Error 1
valgrind segfaults at startup;
[~]> valgrind
zsh: segmentation fault valgrind
Since strace is unavailable lets see what DTrace can show us;
[~]> sudo dtruss valgrind
SYSCALL(args) = return
getpid(0x7FFF5FBFF770, 0x7FFFFFE00050, 0x0) = 21071 0
open_nocancel("/dev/urandom\0", 0x0, 0x0) = 3 0
read_nocancel(0x3,
"-\324\252r\371\271SK\v\251\213\352K\373\206\355,\341\2670\205H\b\361~i@\217h\336\364\267HdzAQ\261\305\027\331n\356\302^GEx\245\254\a\2505\232\227\327\033\021Z\273\255C\203\251N\376\004\335?\033\312;=\231\024C\352is\354\205|\310\323\001u\177\341\331C\316\367LSv\256o\023D\376%\275\206\231\332o\376\321\0",
0x6C) = 108 0
close_nocancel(0x3) = 0 0
issetugid(0x100000000, 0x7FFF5FBFFA50, 0x7FFF5FC40530) = 0 0
geteuid(0x100000000, 0x7FFF5FBFFA50, 0x0) = 0 0
__sysctl(0x7FFF5FBFD660, 0x2, 0x7FFF5FBFD620) = 0 0
__sysctl(0x7FFF5FBFD620, 0x2, 0x7FFF5FBFD6BC) = 0 0
shared_region_check_np(0x7FFF5FBFD828, 0x0, 0x7FFF5FC1DC86) = 0 0
stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF5FBFCC30,
0x7FFF5FBFD270) = 0 0
open("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x0, 0x0) = 3 0
pread(0x3, "\312\376\272\276\0", 0x1000, 0x0) = 4096 0
pread(0x3, "\317\372\355\376\a\0", 0x1000, 0x1000) = 4096 0
mmap(0x100006000, 0x2000, 0x5, 0x12, 0x3, 0x7FFF00000001) = 0x6000 0
mmap(0x100008000, 0x1000, 0x3, 0x12, 0x3, 0x7FFF00000001) = 0x8000 0
mmap(0x100009000, 0x1F10, 0x1, 0x12, 0x3, 0x7FFF00000001) = 0x9000 0
close(0x3) = 0 0
stat64("/usr/lib/libgcc_s.1.dylib\0", 0x7FFF5FBFC9D0, 0x7FFF5FBFD010) = 0 0
stat64("/usr/lib/libSystem.B.dylib\0", 0x7FFF5FBFC940, 0xC) = 0 0
stat64("/usr/lib/system/libmathCommon.A.dylib\0", 0x7FFF5FBFC880,
0x7FFF5FBFCEC0) = 0 0
madvise(0x7FFF89531000, 0x2000, 0x5) = 0 0
open("/dev/dtracehelper\0", 0x2, 0x7FFF5FC45220) = 3 0
ioctl(0x3, 0x80086804, 0x7FFF5FBFD5C0) = 0 0
close(0x3) = 0 0
stat64("/usr/lib/libstdc++.6.dylib\0", 0x7FFF5FBFC9D0, 0x7FFF5FBFD010) = 0 0
open("/dev/dtracehelper\0", 0x2, 0x7FFF5FC452E8) = 3 0
ioctl(0x3, 0x80086804, 0x7FFF5FBFD5C0) = 0 0
close(0x3) = 0 0
__sysctl(0x7FFF5FBFD4B0, 0x2, 0x7FFF5FBFD4A0) = 0 0
bsdthread_register(0x7FFF849072FC, 0x7FFF848E7F18, 0x2000) = 0 0
thread_selfid(0x7FFF849072FC, 0x7FFF848E7F18, 0x0) = 104035 0
open_nocancel("/dev/urandom\0", 0x0, 0x7FFF7072CB60) = 3 0
read_nocancel(0x3,
"\313\230\336\241\2262G\346\023\267i\232w[!~!\003\203\267\306@\236T@f\235\374\310\211\216\265\357\200|\177f\026`Z-\340\302\b\373\203\t\f\025\265\262\354v*\225\"\v\"\320\2414\322\v?\0",
0x40) = 64 0
close_nocancel(0x3) = 0 0
mmap(0x0, 0x3000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001) = 0xB000 0
__sysctl(0x7FFF5FBFD330, 0x2, 0x7FFF5FBFD2F0) = 0 0
__sysctl(0x7FFF5FBFD2F0, 0x2, 0x7FFF5FBFD388) = 0 0
getpid(0x7FFF5FBFD280, 0x7FFFFFE00050, 0x0) = 21071 0
open_nocancel("/dev/urandom\0", 0x0, 0x0) = 3 0
read_nocancel(0x3,
"\374'\315\276&\267\323b\313|\377\266\016\225\223A\264\254y\3307
'\322\323\337\323\246#\350\331\236#}\327J\341x<\177\r
\372y\322\262\2111\227\027-\022\223p)\177\237\207I\036r$!\325N\227\253b\363\303m\205@\370\317\005\342\332=\211&\253\253R\325W\317\363\266\261\313\376QLr\365i\017\0218R\3677\\\217\252)\256\0",
0x6C) = 108 0
close_nocancel(0x3) = 0 0
__sysctl(0x7FFF5FBFD330, 0x2, 0x7FFF5FBFD35C) = 0 0
mmap(0x0, 0xD000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001) = 0xE000 0
mmap(0x0, 0xD000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001) = 0x1B000 0
mmap(0x0, 0x1000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001) = 0x28000 0
mmap(0x0, 0x200000, 0x3, 0x1002, 0x7000000, 0x7FFF00000001) = 0x29000 0
munmap(0x100029000, 0xD7000) = 0 0
munmap(0x100200000, 0x29000) = 0 0
__sysctl(0x7FFF5FBFD490, 0x2, 0x7FFF5FBFD450) = 0 0
__sysctl(0x7FFF5FBFD450, 0x2, 0x7FFF707396C0) = 0 0
__sysctl(0x7FFF5FBFD490, 0x2, 0x7FFF5FBFD450) = 0 0
__sysctl(0x7FFF5FBFD450, 0x2, 0x7FFF707396C4) = 0 0
__sysctl(0x7FFF5FBFD490, 0x2, 0x7FFF5FBFD450) = 0 0
__sysctl(0x7FFF5FBFD450, 0x2, 0x7FFF707396C8) = 0 0
mmap(0x0, 0x3000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001) = 0x29000 0
__sysctl(0x7FFF5FBFD460, 0x2, 0x7FFF5FBFD420) = 0 0
__sysctl(0x7FFF5FBFD420, 0x2, 0x7FFF5FBFD4B8) = 0 0
__sysctl(0x7FFF5FBFD460, 0x2, 0x7FFF5FBFD48C) = 0 0
mmap(0x0, 0xD000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001) = 0x2C000 0
mmap(0x0, 0xD000, 0x3, 0x1002, 0x1000000, 0x7FFF00000001) = 0x39000 0
mmap(0x0, 0x200000, 0x3, 0x1002, 0x7000000, 0x7FFF00000001) = 0x200000 0
munmap(0x100300000, 0x100000) = 0 0
access("/usr/local/lib/valgrind/vgpreload_core-x86-darwin.so\0", 0x5, 0x0) =
0 0
access("/usr/local/lib/valgrind/vgpreload_core-amd64-darwin.so\0", 0x5, 0x0) =
0 0
access("/usr/local/lib/valgrind/vgpreload_core-arm-darwin.so\0", 0x5, 0x0) =
-1 Err#2
access("/usr/local/lib/valgrind/vgpreload_core-ppc32-darwin.so\0", 0x5, 0x0) =
-1 Err#2
access("/usr/local/lib/valgrind/vgpreload_core-ppc64-darwin.so\0", 0x5, 0x0) =
-1 Err#2
mmap(0x0, 0x1000000, 0x3, 0x1002, 0x2000000, 0x22801500000000) = 0x300000 0
munmap(0x100300000, 0x500000) = 0 0
munmap(0x101000000, 0x300000) = 0 0
open_nocancel(".\0", 0x0, 0x0) = 3 0
fstat64(0x3, 0x7FFF5FBFE270, 0x0) = 0 0
fcntl_nocancel(0x3, 0x32, 0x100800000) = 0 0
close_nocancel(0x3) = 0 0
stat64("/Users/ismail\0", 0x7FFF5FBFE1E0, 0x0) = 0 0
gdb is not helping either;
[~]> gdb valgrind
GNU gdb 6.3.50-20050815 (Apple version gdb-1502) (Thu Jul 8 12:27:19 UTC
2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for
shared libraries .. done
(gdb) run
Starting program: /usr/local/bin/valgrind
Reading symbols for shared libraries +. done
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0000000138034d40 in ?? ()
Any ideas appreciated.
Regards,
ismail
|
|
From: Julian S. <js...@ac...> - 2010-07-29 07:39:13
|
On Thursday, July 29, 2010, İsmail Dönmez wrote: > Hello; > > I was happy to hear Valgrind is ported darwin/amd64, so I grabbed the > sources from trunk and compiled it. But it crashes on startup, here are > some details; I am surprised to hear this. I have been using trunk on Mac OSX 10.6 64bit for a while now and it successfully runs a multi-million-lines-of-C++ application. I believe others also use it successfully. Is this a clean from-scratch build? > Starting program: /usr/local/bin/valgrind Is that the version you built, or one from MacPorts ? dtruss/gdb of $prefix/bin/valgrind will tell you nothing since that is merely a wrapper program which starts the real tool executable. If it continues to segfault, run with the flags "-d -d -v -v" and send the resulting debug output. J |
|
From: İsmail D. <is...@na...> - 2010-07-29 07:44:50
|
On Thu, Jul 29, 2010 at 10:41 AM, İsmail Dönmez <is...@na...> wrote: > Hi Julian; > > On Thu, Jul 29, 2010 at 10:41 AM, Julian Seward <js...@ac...> wrote: > >> On Thursday, July 29, 2010, İsmail Dönmez wrote: >> > Hello; >> > >> > I was happy to hear Valgrind is ported darwin/amd64, so I grabbed the >> > sources from trunk and compiled it. But it crashes on startup, here are >> > some details; >> >> I am surprised to hear this. I have been using trunk on >> Mac OSX 10.6 64bit for a while now and it successfully runs a >> multi-million-lines-of-C++ application. I believe others also >> use it successfully. >> >> And here is the real reason it crashes; [~]> gdb /usr/local/lib/valgrind/memcheck-amd64-darwin GNU gdb 6.3.50-20050815 (Apple version gdb-1502) (Thu Jul 8 12:27:19 UTC 2010) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin"... (gdb) run Starting program: /usr/local/lib/valgrind/memcheck-amd64-darwin Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000134000000 _start_in_C_darwin (pArgc=0x134000000) at m_main.c:3033 3033 Int argc = *(Int *)pArgc; // not pArgc[0] on LP64 (gdb) print pArgc $1 = (UWord *) 0x134000000 (gdb) print *pArgc Cannot access memory at address 0x134000000 Regards, ismail |
|
From: Julian S. <js...@ac...> - 2010-07-29 08:02:29
|
> Program received signal EXC_BAD_ACCESS, Could not access memory. > Reason: KERN_INVALID_ADDRESS at address: 0x0000000134000000 > _start_in_C_darwin (pArgc=0x134000000) at m_main.c:3033 > 3033 Int argc = *(Int *)pArgc; // not pArgc[0] on LP64 > (gdb) print pArgc > $1 = (UWord *) 0x134000000 > (gdb) print *pArgc > Cannot access memory at address 0x134000000 Urr, that's strange. That segfault is within 15 instructions of the process startup. Try single stepping from _start, which is defined at m_main.c:2984. It takes control from the kernel, switches stacks, and calls the routine that segfaults. Without being able to reproduce this, my changes of figuring out what's going wrong are essentially zero, so you'll have to do it. See also the comment at m_main.c:2942. That might be related. J |
|
From: İsmail D. <is...@na...> - 2010-07-29 08:31:30
|
Hi; 2010/7/29 Julian Seward <js...@ac...> > > > Program received signal EXC_BAD_ACCESS, Could not access memory. > > Reason: KERN_INVALID_ADDRESS at address: 0x0000000134000000 > > _start_in_C_darwin (pArgc=0x134000000) at m_main.c:3033 > > 3033 Int argc = *(Int *)pArgc; // not pArgc[0] on LP64 > > (gdb) print pArgc > > $1 = (UWord *) 0x134000000 > > (gdb) print *pArgc > > Cannot access memory at address 0x134000000 > > Urr, that's strange. That segfault is within 15 instructions > of the process startup. Try single stepping from _start, which > is defined at m_main.c:2984. It takes control from the > kernel, switches stacks, and calls the routine that segfaults. > Without being able to reproduce this, my changes of figuring out > what's going wrong are essentially zero, so you'll have to do it. > > See also the comment at m_main.c:2942. That might be related. Trying to set a breakpoint in m_main.c:2984 does not work, looks like gdb cannot set a breakpoint inside inline ASM. I will try to figure whats wrong and will report back anything interesting. Regards, ismail > |
|
From: John R. <jr...@bi...> - 2010-07-29 13:38:10
|
> Trying to set a breakpoint in m_main.c:2984 does not work, looks like > gdb cannot set a breakpoint inside inline ASM. Here's an example from the x86_64 version: $ readelf --headers /usr/bin/valgrind | grep Entry Entry point address: 0x400b20 $ gdb /usr/bin/valgrind (gdb) b *(4+ 0x400b20) ## the second instruction: sometimes the first fails (gdb) run <<args>> -- |