[llvm-bugs] [Bug 49420] New: [LLVM-COV] No coverage with "Aborted(core dumped)"

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 3 18:27:17 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49420

            Bug ID: 49420
           Summary: [LLVM-COV] No coverage with "Aborted(core dumped)"
           Product: Runtime Libraries
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: libprofile library
          Assignee: unassignedbugs at nondot.org
          Reporter: cnwy1996 at outlook.com
                CC: llvm-bugs at lists.llvm.org

$ clang -v
clang version 11.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wangyang/llvm-project/build/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

$ cat test.c
#include <x86intrin.h>
#include <stdio.h>

extern void abort(void);

#ifdef __x86_64__
#define EFLAGS_TYPE unsigned long long int
#else
#define EFLAGS_TYPE unsigned int
#endif

int main() {
  printf("1\n");
  EFLAGS_TYPE flags = 0xD7; /* 111010111b  */
  __writeeflags(flags);
  flags = __readeflags();
  printf("2\n");
  if ((flags & 0xFF) != 0xD7)
    abort();
  printf("3\n");
#ifdef DEBUG
  printf("PASSED\n");
#endif
}


$ clang -w -O0 -g -fcoverage-mapping -fprofile-instr-generate=test.profraw
test.c; ./a.out; llvm-profdata merge test.profraw -o test.profdata; llvm-cov
show a.out -instr-profile=test.profdata test.c > test.lcov; cat test.lcov
1
2
Aborted (core dumped)
    1|       |#include <x86intrin.h>
    2|       |#include <stdio.h>
    3|       |
    4|       |extern void abort(void);
    5|       |
    6|       |#ifdef __x86_64__
    7|      0|#define EFLAGS_TYPE unsigned long long int
    8|       |#else
    9|       |#define EFLAGS_TYPE unsigned int
   10|       |#endif
   11|       |
   12|      0|int main() {
   13|      0|  printf("1\n");
   14|      0|  EFLAGS_TYPE flags = 0xD7; /* 111010111b  */
   15|      0|  __writeeflags(flags);
   16|      0|  flags = __readeflags();
   17|      0|  printf("2\n");
   18|      0|  if ((flags & 0xFF) != 0xD7)
   19|      0|    abort();
   20|      0|  printf("3\n");
   21|       |#ifdef DEBUG
   22|       |  printf("PASSED\n");
   23|       |#endif
   24|      0|}


We can see that line 13,14 are executed,which means that main function executed
too. However, no coverage generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210304/906e4411/attachment.html>


More information about the llvm-bugs mailing list