lldb是否可以与fortran一起使用? [英] Is lldb working with fortran?

查看:131
本文介绍了lldb是否可以与fortran一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Mac OS 10.12.5系统上使用lldb断点fortran程序.我有

I am trying to breakpoint a fortran program with lldb on a Mac OS 10.12.5 system. I have

program badcall
      integer a,b
      a=2
      b=3

write(*,*) a, b
end

我(必须)使用英特尔编译器进行编译.

I (have to) compile with the intel compilers.

ifort -g badcall.f90 -o badcall

然后我用lldb运行并做

breakpoint set -f badcall.f90 -l 5

程序正常停止

Process 59474 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000f35 prova`MAIN__ at badcall.f90:6
   3          a=2
   4          b=3
   5          

但是,如果我随后尝试打印变量b,我什么也没得到

However if I then try to print the variable b I get nothing

(lldb) p b
(lldb) print b
(lldb) q

那么我想念什么吗? lldb真的可用于调试fortran代码吗?

So am I missing something? Is lldb really usable to debug fortran code?

推荐答案

似乎lldb不支持Fortran,但:(您必须使用gdb:

It seems that lldb doesn't support Fortran, yet :( You will have to go with gdb:

curl "http://ftp.gnu.org/gnu/gdb/gdb-8.0.tar.gz" -o gdb-8.0.tar.gz
tar zxf gdb-8.0.tar.gz
cd gdb-8.0
./configure
make

确保对gdb进行代码签名!请按照此处的说明进行操作:

Make sure to Code Sign the gdb! Follow instructions here:

https://gcc.gnu .org/onlinedocs/gcc-4.8.1/gnat_ugn_unw/Codesigning-the-Debugger.html

你应该很好走

gfortran -g -o fort_sample ./fort_sample.f90
gdb ./fort_sample
(gdb) list
1   program badcall
2         integer a,b
3         a=2
4         b=3
5
6   write(*,*) a, b
7   end
(gdb) break 6
Breakpoint 1 at 0x100000e0e: file ./fort_sample.f90, line 6.
(gdb) run
...
...
badcall () at ./fort_sample.f90:6
6   write(*,*) a, b
(gdb) print a
$1 = 2
(gdb) print b
$2 = 3
(gdb)

这篇关于lldb是否可以与fortran一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆