[Lldb-commits] [lldb] [lldb] add stop-at-user-entry option to process launch (PR #67019)

José Lira Junior via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 2 11:20:52 PDT 2023


junior-jl wrote:

> You can use `lldb/test/Shell/Commands/command-thread-select.test` as an example to write your own test.

Using this file as a template, I wrote `command-process-launch-user-entry.test` as shown below:

```
# RUN: %clang_host -g %S/Inputs/main.c -o %t
# RUN: %lldb %t -s %s -o exit | FileCheck %s

process launch -m
# CHECK-LABEL: process launch -m
# CHECK: Process {{.*}} stopped
# CHECK: stop reason = one-shot breakpoint 1
# CHECK:   frame #0: {{.*}}`main at main.c
```

But I wanted to add the check line `# CHECK: Process {{.*}} launched: '{{.*}}' {{.*}}`, but this fails because the following is happening:

1. When the command is executed from the `(lldb)` prompt, it correctly shows that the process is launched then stopped.

```
$ ./bin/lldb ~/main.out
(lldb) target create "/home/jose/main.out"
Current executable set to '/home/jose/main.out' (x86_64).
(lldb) process launch -m
Process 63632 launched: '/home/jose/main.out' (x86_64)
Process 63632 stopped
* thread #1, name = 'main.out', stop reason = one-shot breakpoint 1
    frame #0: 0x0000555555555140 main.out`main at main.c:2
   1   	int foo() { return 0; }
-> 2   	int main() { return foo(); }
   3   	
(lldb) 
```

2. When I run like shown below, the `Process launched` message is shown after the stop.

```
$ ./bin/lldb ~/main.out -o 'process launch -m'
(lldb) target create "/home/jose/main.out"
Current executable set to '/home/jose/main.out' (x86_64).
(lldb) process launch -m
Process 63846 stopped
* thread #1, name = 'main.out', stop reason = one-shot breakpoint 1
    frame #0: 0x0000555555555140 main.out`main at main.c:2
   1   	int foo() { return 0; }
-> 2   	int main() { return foo(); }
   3
Process 63846 launched: '/home/jose/main.out' (x86_64)
(lldb) 
```

Is this behaviour expected?

https://github.com/llvm/llvm-project/pull/67019


More information about the lldb-commits mailing list