[LLVMbugs] [Bug 12358] New: apps built with code coverage crash due to llvm_gcda_start_file if path missing

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 26 07:18:59 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12358

             Bug #: 12358
           Summary: apps built with code coverage crash due to
                    llvm_gcda_start_file if path missing
           Product: new-bugs
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sean at rogue-research.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Summary:
I create nightly builds of my app (with code coverage enabled) on a build
machine, and when I run the resulting app on a different machine it crashes
because of insufficient error checking in llvm_gcda_start_file().

Repro:
- build a 'hello world' C application with code coverage enabled
- run the executable on a different computer

Expected:
- no crash

Actual:
- crash at quit due to llvm_gcda_start_file()

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000068

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_c.dylib                 0x00007fff8bd021ec flockfile + 15
1   libsystem_c.dylib                 0x00007fff8bce3c86 fwrite + 87
2   com.rogue-research.brainsight2    0x000000010285e366 llvm_gcda_start_file +
262
3   com.rogue-research.brainsight2    0x00000001016e9e80 __llvm_gcov_writeout +
16
4   dyld                              0x00007fff6ecc015c
ImageLoaderMachO::doTermination(ImageLoader::LinkContext const&) + 178
5   dyld                              0x00007fff6ecb4591
dyld::runTerminators(void*) + 67
6   libsystem_c.dylib                 0x00007fff8bcad7c8 __cxa_finalize + 274
7   libsystem_c.dylib                 0x00007fff8bcad652 exit + 18

Using Intruments, I see the path it's trying to access is a path on the build
machine, which does not exist on running machine. In my case:

#    Caller    Function    FD    Path
1195    llvm_gcda_start_file    open_nocancel    -1   
/Users/builder/rogue_nightly_build/working_copy/brainsight2/trunk/build/Brainsight2.build/Debug/Brainsight.build/Objects-normal/x86_64/RRPCAPointFilterCore.gcda

llvm_gcda_start_file() should at the very least handle the error gracefully,
write no coverage, log an error, and not crash.

(I also can't help but wonder how well all this would work with Apple's App
Sandbox on OS X)

Also filed this as rdar://11111686

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list