<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/79631>79631</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [LLDB] downloading remote binary on launch despite target.exec-search-paths
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          weliveindetail
      </td>
    </tr>
</table>

<pre>
    I am remote debugging clang-repl on my Raspberry Pi like this: https://gist.github.com/weliveindetail/932dc316af7a2ba2346cb30f08dcc21a I cross-compile it on my host to `/home/ez/Develop/llvm-project/build-ubuntu20.04-aarch32/bin/clang-repl` and transfer it to the target device. Since the debug binary is 3.7G in size, this takes a while.

Now, when I start debugging it via lldb-server on the device, it would usually download the binary. `target.exec-search-paths` is supposed to avoid that and use the existing binary on my host instead. This works great when **attaching** to the running process:
```
settings append target.exec-search-paths /home/ez/Develop/llvm-project/build-ubuntu20.04-aarch32/bin
platform select remote-linux
platform connect connect://192.168.1.104:9001
log enable lldb platform
process attach --name clang-repl
detach
```

However, when **launching** the remote target, LLDB still transfers the full binary on launch and this takes a lot of time again:
```
settings append target.exec-search-paths /home/ez/Develop/llvm-project/build-ubuntu20.04-aarch32/bin
platform select remote-linux
platform connect connect://192.168.1.104:9001
log enable lldb platform
target create /home/ez/Develop/clang-repl/bin-prebuilt/clang-repl
run
detach
```

I think the download would usually happen on `target create` already. So, the setting has some effect, but it's not sufficient. I can reproduce it with lldb-17 @ Ubuntu 22.04 connecting to lldb-server-17 @ 32-bit Raspberry Pi OS (bullseye-based).

Here is a diff of the two logs with execution times:
<img width="2023" alt="Screenshot 2024-01-20 at 14 23 24" src="https://github.com/llvm/llvm-project/assets/7307454/97c28b29-bb32-4c57-afcb-f640dd943523">
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVtGO27YS_Rr6ZSCBIm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