LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 943|回复: 5

请教各位:gdb中加-g了,还是找不到执行文件

[复制链接]
发表于 2007-5-29 18:12:09 | 显示全部楼层 |阅读模式
我的编译文件是

mpif77 -g mdrdipord.f -c
mpif77 -g libmd.f -c
mpif77 -g dceign.f -c
mpif77 -g mdrdipord.o libmd.o dceign.o -o mdord.exe

明明加 -g 了,为什么还是找不到呢?具体操作如下:

[hujinhe@console ~]$ ./mdord.exe <in.dip> out.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source            
mdord.exe          000000000041E998  Unknown               Unknown  Unknown
mdord.exe          0000000000405C6A  Unknown               Unknown  Unknown
mdord.exe          0000000000403074  Unknown               Unknown  Unknown
mdord.exe          000000000040302A  Unknown               Unknown  Unknown
libc.so.6          000000378851C4BB  Unknown               Unknown  Unknown
mdord.exe          0000000000402F6A  Unknown               Unknown  Unknown

[h@console ~]$ gdb
GNU gdb Red Hat Linux (6.3.0.0-1.96rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
(gdb) run ./mdord.exe <in.dip> out.out
Starting program:  ./mdord.exe <in.dip> out.out
No executable file specified.
Use the "file" or "exec-file" command.
(gdb) q


前两天,我调试过一次,还好好的,昨天不知道为什么就找不到了。很郁闷啊
 楼主| 发表于 2007-5-29 18:14:52 | 显示全部楼层
我看过这个论坛上很多关于gdb的帖子,也加过-ggdb之类的,也把生成的.o的文件删除过,都没有用,谁能帮帮我?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-29 18:18:40 | 显示全部楼层
上面这个
[hujinhe@console ~]$ ./mdord.exe <in.dip> out.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
mdord.exe 000000000041E998 Unknown Unknown Unknown
mdord.exe 0000000000405C6A Unknown Unknown Unknown
mdord.exe 0000000000403074 Unknown Unknown Unknown
mdord.exe 000000000040302A Unknown Unknown Unknown
libc.so.6 000000378851C4BB Unknown Unknown Unknown
mdord.exe 0000000000402F6A Unknown Unknown Unknown
算不算运行起来了?
回复 支持 反对

使用道具 举报

发表于 2007-5-29 19:27:56 | 显示全部楼层
manl了一把gdb,发现run不能这样用,下面是run的解析:
       run [arglist]
              Start your program (with arglist, if specified).
上面可以看到,run后面只是带参数,不能带可执行文件路径的,可执行文件需要在gdb启动参数中指出:
       You can run gdb with no arguments or options; but the most usual way to
       start GDB is with one argument or two, specifying an executable program
       as the argument:

       gdb program

       You  can  also  start  with  both an executable program and a core file
       specified:

       gdb program core

       You can, instead, specify a process ID as a  second  argument,  if  you
       want to debug a running process:

       gdb program 1234

       would  attach  GDB  to  process 1234 (unless you also have a file named
       ‘1234’; GDB does check for a core file first).

你这种情况请试试:
$ gdb ./mdord.exe
启动gdb
然后执行 run <in.dip > out.out
回复 支持 反对

使用道具 举报

发表于 2007-5-29 22:13:53 | 显示全部楼层
your can try gdb program
or try to attach process
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-5-30 10:55:08 | 显示全部楼层
谢谢pandazxx,谢谢版主,你们说得对,是我没把gdb的一些规则弄明白,刚刚接触,有些迷糊,像你们说得那样问题就解决了,谢谢!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表