ted added a comment.

In D155117#4505538 <https://reviews.llvm.org/D155117#4505538>, @labath wrote:

> I am wondering if we actually need the second step (the architecture setting) 
> here. The main reason it exists is the usage in `GetSupportedArchitectures` 
> (which is called before a target is created) it seems like the value derived 
> from the target should always be more correct. WDYT? What are the values you 
> get in steps 2 and 3 for your use case?

I don't think we need to specify the architecture, because I think we can 
always get it from the triple. There might be a case where someone is using a 
qemu that isn't named the same as the Triple ArchName, but that case could be 
covered by emulator-path.

In my case, I'm loading a target, then running, letting the platform get 
ArchName from the target Triple, then turning that into qemu-riscv32 (or 
riscv64), and launching that from my PATH.

An example (with my experimental RISC-V ABI plugin):

> bin/lldb

(lldb) platform select qemu-user

  Platform: qemu-user
    Triple: x86_64-*-linux-gnu

OS Version: 5.4.0 (5.4.0-136-generic)

  Hostname: 127.0.0.1

WorkingDir: /local/mnt/ted/8.8/riscv

  Kernel: #153~18.04.1-Ubuntu SMP Wed Nov 30 15:47:57 UTC 2022

(lldb) file ~/lldb_test/factrv32
Current executable set to '/usr2/tedwood/lldb_test/factrv32' (riscv32).
(lldb) b main
Breakpoint 1: where = factrv32`main + 28 at factorial.c:32:8, address = 
0x000104ea
(lldb) r
Process 1 launched: '/usr2/tedwood/lldb_test/factrv32' (riscv32)
Process 1 stopped

- thread #1, stop reason = breakpoint 1.1 frame #0: 0x000104ea 
factrv32`main(argc=1, argv=0x408005a4) at factorial.c:32:8 29      } 30         
 */ 31

-> 32     base = 10;

  33    
  34      printf("Factorial of %d is %d\n", base, factorial(base));
  35      return 0;

(lldb) target list
Current targets:

- target #0: /usr2/tedwood/lldb_test/factrv32 ( arch=riscv32-*-linux, 
platform=qemu-user, pid=1, state=stopped )

(lldb)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155117

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to