Linux gdb的安裝

來源:互聯網
上載者:User

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.