Bug 252919

Summary: Bogus error about invalid Mach-O file for i386 files on SnowLeopard
Product: [Developer tools] valgrind Reporter: Daniel Dunbar <daniel>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: pjfloyd
Priority: NOR    
Version First Reported In: 3.6 SVN   
Target Milestone: ---   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Daniel Dunbar 2010-10-01 04:20:20 UTC
Version:           3.6 SVN
OS:                Linux

Valgrind 3.6SVN (r11391) gives bogus warnings when trying to run i386 code without debug info:
--
ddunbar@ozzy:tmp$ cat t.c
int main() { return 0; }
ddunbar@ozzy:tmp$ gcc t.c
ddunbar@ozzy:tmp$ valgrind -q ./a.out
ddunbar@ozzy:tmp$ gcc -m32 t.c
ddunbar@ozzy:tmp$ valgrind -q ./a.out
--82216-- WARNING: Serious error when reading debug info
--82216-- When reading debug info from ./a.out:
--82216-- Invalid Mach-O file (bad magic).
--82216-- WARNING: Serious error when reading debug info
--82216-- When reading debug info from ./a.out:
--82216-- Error reading Mach-O object.
ddunbar@ozzy:tmp$ gcc -g -m32 t.c
ddunbar@ozzy:tmp$ valgrind -q ./a.out
ddunbar@ozzy:tmp$ 
--


Reproducible: Always
Comment 1 Daniel Dunbar 2010-10-01 04:24:52 UTC
Ah, I see what is happening here, this is because I had a .dSYM file in the current directory for a different arch. Here is a more complete test scenario:
--
ddunbar@ozzy:foo$ echo "int main() { return 0; }" > t.c
ddunbar@ozzy:foo$ gcc -g -m64 t.c
ddunbar@ozzy:foo$ gcc -m32 t.c && valgrind -q ./a.out
--82441-- WARNING: Serious error when reading debug info
--82441-- When reading debug info from ./a.out:
--82441-- Invalid Mach-O file (bad magic).
--82441-- WARNING: Serious error when reading debug info
--82441-- When reading debug info from ./a.out:
--82441-- Error reading Mach-O object.
ddunbar@ozzy:foo$ 
--

The error message makes more sense now, but it would be nice if it would either mention that the .dSYM file is what is out of date, or simply ignore it if the archs don't match.
Comment 2 Paul Floyd 2023-02-18 21:05:51 UTC
The oldest mac I can access is 10.7 so I'm closing this.