您的位置:首页 > 运维架构 > Linux

Linux gdb的安装

2010-11-01 00:15 176 查看
GDB是一款bug调试工具,下载地址为

http://ftp.gnu.org/gnu/gdb/

安装的平台为ppc64 ppc64 ppc64 GNU/Linux,系统为Red Hat Enterprise Linux Server release 5.1 (Tikanga);

之前安装正常,但是使用后,发现不能识别core文件,看了README之后,发现首先需要让GDB识别机器。

解压gdb-6.5.tar.gz,cd gdb-6.5,首先建议查看下readme的内容

README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers,
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README; if with a libg++ release,
see libg++/README, etc. That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command. To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

./configure
make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''. You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make. For example (assuming sh/bash/ksh):

CC=gcc ./configure
make

A similar example using csh:

setenv CC gcc
./configure
make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc. See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.

现在查看下gdb/configure.tgt内容,查找你的机器对应的target选项,例如cpu,系统的标识

我这台服务器是ppc64的,安装了redhatLinux,所以对应powerpc64-*-linux*) gdb_target=linux这条。

现在进行编译前的准备,回到gdb-6.5的目录

运行./config.sub powerpc64-redhat-linux,如果一切正常的话,会返回下面这样的结果

powerpc64-redhat-linux-gnu

现在,可以进行安装步骤了。

首先,编译

./configure ppc64-redhat-linux

不过官方推荐的编译器是gcc,所以上面的命令改成这样

CC=gcc ./configure ppc64-redhat-linux

接下来,就是很make和make install了,一切正常的话,那么GDB就安装完成了。

GDB的使用,命令

gdb 参数 core文件

针对我的程序,那么是这样

gdb owccm core.XXXXX

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: