Fortran language support in lldb · Issue #109119 · llvm/llvm-project (original) (raw)
As prompted by https://discourse.llvm.org/t/flang-fortran-plugin-for-lldb-status/81301, this is a tracking issue for Fortran support. It existing doesn't mean work is being done or not, it's just a place to find the most recent status.
Currently lldb has no specific support for Fortran. All it knows is that there is such a language. We can still display source and line step though.
$ cat /tmp/test.f90
program hello
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
print *, 'Hello, World!'
end program hello
$ gfortran /tmp/test.f90 -o /tmp/test -g
I had to lookup what MAIN__
is from objdump, flang uses a different symbol "_QQmain". Perhaps we can grab this from some elf attribute instead.
$ ./bin/lldb /tmp/test -o "b MAIN__" -o "run"
(lldb) target create "/tmp/test"
Current executable set to '/tmp/test' (aarch64).
(lldb) b MAIN__
Breakpoint 1: where = test`MAIN__ + 12, address = 0x0000000000000920
(lldb) run
Process 1824608 launched: '/tmp/test' (aarch64)
Process 1824608 stopped
* thread #1, name = 'test', stop reason = breakpoint 1.1
frame #0: 0x0000aaaaaaaaa920 test`MAIN__ at test.f90:2:26
1 program hello
-> 2 print *, 'Hello, World!'
3 print *, 'Hello, World!'
4 print *, 'Hello, World!'
5 print *, 'Hello, World!'
6 print *, 'Hello, World!'
7 print *, 'Hello, World!'
warning: This version of LLDB has no plugin for the language "fortran08". Inspection of frame variables will be limited.
(lldb) n
Hello, World!
Process 1824608 stopped
* thread #1, name = 'test', stop reason = step over
frame #0: 0x0000aaaaaaaaa96c test`MAIN__ at test.f90:3:26
1 program hello
2 print *, 'Hello, World!'
-> 3 print *, 'Hello, World!'
4 print *, 'Hello, World!'
5 print *, 'Hello, World!'
6 print *, 'Hello, World!'
7 print *, 'Hello, World!'