[Lldb-commits] [PATCH] D96637: Make sure the interpreter module was loaded before making checks against it

António Afonso via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 16 18:46:10 PST 2021


aadsm added a comment.

> We should have a test for this.

how do you recommend doing this? I spent a couple of hours on this but got no where. From what I understood we should prefer lit tests, so I was thinking of creating a binary that dlopens a module. However, I wasn't able to create a binary that I can start and capture its pid address so that I can attach to. Here's what I've tried so far:

  // RUN: cp %s %s.cpp
  // RUN: %clang -g -O0 --target=x86_64-linux-gnu %s.cpp -o %s.out
  // RUN: PID=$(%s.out)
  // RUN: %lldb -p $PID -b -o 'target list' | FileCheck %s
  // RUN: kill -9 $PID
  // CHECK: foo
  
  #include <stdio.h>
  #include <unistd.h>
  
  int main() {
      pid_t pid = fork();
      if (pid > 0) {
          // parent process, print child pid
          printf("%d", pid);
          return 0;
      } else if (pid < 0) {
          printf("Unable to fork\n");
          return -1;
      }
      // child process
      pause();
  }

The lit test get stuck on `// RUN: PID=$(%s.out)`. Not sure why, the parent process shouldn't wait on its children..


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96637/new/

https://reviews.llvm.org/D96637



More information about the lldb-commits mailing list