为什么我在gdb backtrace中看不到行号?

时间:2019-05-29 16:53:53

标签: c gdb icc

我看不到gdb中的行号。我已经用mpiicc用-g标志编译了所有内容。

gdb甚至不显示断点行号。

问题可能出在“缺少单独的debuginfo,请使用:debuginfo-install glibc-2.12-1.166.el6_7.7.x86_64 numactl-2.0.9-2.el6.x86_64”,但我不是超级用户,所以我无法安装这些。

 gdb  --args ./central -g 5 51
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-83.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/dslavchev/NuclearTesting/MPI/project-a-test-mpi/central...done.
(gdb) break direct.c:55
Breakpoint 1 at 0x40855d: file direct.c, line 55.
(gdb) l direct.c:55
50  
51  void direct(int* N, double **PA, Coord **points)
52  {
53      int     i ,j ,k ,l, ir, irr,
54              md = suma(N , NUM_AIRFOILS) - NUM_AIRFOILS,
55              m;
56      double  *D, // **D,
57              *A, *sv;
58  
59      int matrix_size_D = md*md;
(gdb) r
Starting program: /home/dslavchev/NuclearTesting/MPI/project-a-test-mpi/central -g 5 51
[Thread debugging using libthread_db enabled]

Breakpoint 1, 0x000000000040855d in direct ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.166.el6_7.7.x86_64 numactl-2.0.9-2.el6.x86_64
(gdb) bt
#0  0x000000000040855d in direct ()
#1  0x0000000000405ee9 in main ()
(gdb) s
Single stepping until exit from function direct,
which has no line number information.
PMPI_Comm_size (comm=1140850688, size=0x7fffffffc240) at ../../src/mpi/comm/comm_size.c:57
57  ../../src/mpi/comm/comm_size.c: No such file or directory.
    in ../../src/mpi/comm/comm_size.c
(gdb) s
65  in ../../src/mpi/comm/comm_size.c
(gdb) s
57  in ../../src/mpi/comm/comm_size.c
(gdb) 
58  in ../../src/mpi/comm/comm_size.c
(gdb) 
59  in ../../src/mpi/comm/comm_size.c
(gdb) 
65  in ../../src/mpi/comm/comm_size.c
(gdb) 

以下是构建命令:

mpiicc -g -c -o central.o central.c -qopenmp 
mpiicc -g -c -o contours.o contours.c -qopenmp 
mpiicc -g -c -o mymath.o mymath.c -qopenmp 
mpiicc -g -c -o vort.o vort.c -qopenmp 
mpiicc -g -qopenmp   -I/opt/intel/parallel_studio_xe_2017.2.050/compilers_and_libraries_2017/linux/mkl/include -c -o  direct.o direct.c 
mpiicc -g -c -o a_liftarg.o a_liftarg.c -qopenmp 
mpiicc -g -c -o psavel.o psavel.c -qopenmp 
mpiicc -g -c -o euler.o euler.c -qopenmp 
mpiicc -g -c -o streamline.o streamline.c -qopenmp 
mpiicc -g -c -o speedmap.o speedmap.c -qopenmp 
mpiicc -g -o central central.o contours.o mymath.o vort.o direct.o a_liftarg.o psavel.o euler.o streamline.o speedmap.o /opt/intel/parallel_studio_xe_2017.2.050/compilers_and_libraries_2017/linux/mkl/lib/intel64/libmkl_scalapack_lp64.a -Wl,--start-group /opt/intel/parallel_studio_xe_2017.2.050/compilers_and_libraries_2017/linux/mkl/lib/intel64/libmkl_intel_lp64.a /opt/intel/parallel_studio_xe_2017.2.050/compilers_and_libraries_2017/linux/mkl/lib/intel64/libmkl_intel_thread.a /opt/intel/parallel_studio_xe_2017.2.050/compilers_and_libraries_2017/linux/mkl/lib/intel64/libmkl_core.a /opt/intel/parallel_studio_xe_2017.2.050/compilers_and_libraries_2017/linux/mkl/lib/intel64/libmkl_blacs_intelmpi_lp64.a -Wl,--end-group -liomp5 -lpthread -lm -ldl -qopenmp

2 个答案:

答案 0 :(得分:0)

尝试添加标志

-debug expr-source-pos

它应该添加行信息

https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-debug-linux-and-macos

答案 1 :(得分:0)

  

可能是问题

否:问题不在于(main中没有定义direct,也没有libc)。

这似乎是GDB中的错误:执行run之前,它清楚地知道地址0x40855d对应于direct.c, line 55

但是在run之后,它以某种方式忘记了它知道这一点。

您的GDB版本也已经9岁了。第一步,我建议构建一个当前版本(8.3 as of today)。