[PATCH] D49025: [XRay] basic mode PID and TID always fetch

Kamil Rytarowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 02:58:58 PST 2018


krytarowski added a comment.

In this test parent_tid = 1, child_tid = 1 always and distinguishing this way child and parent is broken. Switching syscall_gettid() to behave like getpid() is not sufficient as the test has assumptions that thread is like pid.

  $ /public/llvm-build/./bin/llvm-xray convert --symbolize --output-format=yaml -instr_map=/public/llvm-build/projects/compiler-rt/test/xray/X86_64NetBSDConfig/TestCases/Posix/Output/fork_basic_logging.cc.tmp      "`ls -S fork-basic-logging-test-* | head -1`"      | ./bin/FileCheck /public/compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cc --check-prefix=TRACE
  ---
  header:          
    version:         3
    type:            0
    constant-tsc:    true
    nonstop-tsc:     true
    cycle-frequency: 3392489040
  records:         
    - { type: 0, func-id: 1, function: 'log_syscall_gettid()', cpu: 0, thread: 1, process: 6843, kind: function-enter, tsc: 4422386299208 }
    - { type: 0, func-id: 1, function: 'log_syscall_gettid()', cpu: 0, thread: 1, process: 6843, kind: function-enter, tsc: 4422386299208 }
    - { type: 0, func-id: 1, function: 'log_syscall_gettid()', cpu: 0, thread: 1, process: 6843, kind: function-exit, tsc: 4422386409791 }
    - { type: 0, func-id: 1, function: 'log_syscall_gettid()', cpu: 0, thread: 1, process: 6843, kind: function-exit, tsc: 4422386409791 }
    - { type: 0, func-id: 4, function: 'print_parent_or_child()', cpu: 0, thread: 1, process: 6843, kind: function-enter, tsc: 4422386596150 }
    - { type: 0, func-id: 2, function: 'print_parent_tid(unsigned long)', args: [ 6843 ], cpu: 0, thread: 1, process: 6843, kind: function-enter-arg, tsc: 4422386614652 }
    - { type: 0, func-id: 2, function: 'print_parent_tid(unsigned long)', cpu: 0, thread: 1, process: 6843, kind: function-exit, tsc: 4422386648144 }
    - { type: 0, func-id: 4, function: 'print_parent_or_child()', cpu: 0, thread: 1, process: 6843, kind: function-exit, tsc: 4422386648972 }
    - { type: 0, func-id: 4, function: 'print_parent_or_child()', cpu: 0, thread: 1, process: 14316, kind: function-enter, tsc: 4422387049656 }
    - { type: 0, func-id: 3, function: 'print_child_tid(unsigned long)', args: [ 14316 ], cpu: 0, thread: 1, process: 14316, kind: function-enter-arg, tsc: 4422387125834 }
    - { type: 0, func-id: 3, function: 'print_child_tid(unsigned long)', cpu: 0, thread: 1, process: 14316, kind: function-exit, tsc: 4422387294637 }
    - { type: 0, func-id: 4, function: 'print_parent_or_child()', cpu: 0, thread: 1, process: 14316, kind: function-exit, tsc: 4422387295979 }
  ...



  /public/compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cc:94:15: error: TRACE-DAG: expected string not found in input
  // TRACE-DAG: - { type: 0, func-id: [[PPTARG:[0-9]+]], function: {{.*print_parent_tid.*}}, args: [ [[THREAD1]] ], cpu: {{.*}}, thread: [[THREAD1]], process: [[PROCESS1]], kind: function-enter-arg, tsc: {{[0-9]+}} }
                ^
  <stdin>:1:1: note: scanning from here
  ---
  ^
  <stdin>:1:1: note: with variable "THREAD1" equal to "1"
  ---
  ^
  <stdin>:1:1: note: with variable "THREAD1" equal to "1"
  ---
  ^
  <stdin>:1:1: note: with variable "PROCESS1" equal to "6843"
  ---
  ^

I've marked this test as UNSUPPORTED for NetBSD. It would be nice to keep a test for TID that is portable, but it would need significant rewrite.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D49025





More information about the llvm-commits mailing list