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

Linux - mipsel/mips/arm/armeb - gdb compile

2016-08-22 17:24 2011 查看
If you don’t know what’s buildroot ?, please redirect to https://www.uclibc.org/

How to install buildroot

root@lab:~# uname -a
Linux lab 4.3.0-kali1-686-pae #1 SMP Debian 4.3.5-1kali1 (2016-02-11) i686 GNU/Linux
root@lab:~/Downloads# wget -c https://buildroot.uclibc.org/downloads/buildroot-snapshot.tar.bz2 root@lab:~/Downloads/buildroot# make menuconfig

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

root@lab:~/Downloads/buildroot# make












How to compile MIPSEL gdb

root@lab:~/Downloads# tar xvf gdb-7.11.tar.gz
root@lab:~/Downloads# cd gdb-7.11/
root@lab:~/Downloads/gdb-7.11# export PATH=$PATH:/root/Downloads/buildroot/output/host/usr/bin


root@lab:~/Downloads/gdb-7.11# ./configure --target=mipsel-linux --host=mipsel-linux --prefix=/root/Downloads/gdb-7.11/gdb_output --program-prefix=mips CC=/root/Downloads/buildroot/output/host/usr/bin/mipsel-linux-gcc CFLAGS="-g -O2 -static"


mips compile

$ ./configure --target=mips-linux --host=mips-linux --prefix=/tmp/gdb CC=/root/Downloads/buildroot/output/host/usr/bin/mips-linux-gcc CFLAGS="-g -O2 -static"


mipsel compile

$ ./configure --target=mipsel-linux --host=mipsel-linux --prefix=/tmp/gdb CC=/root/Downloads/buildroot/output/host/usr/bin/mipsel-linux-gcc CFLAGS="-g -O2 -static"


armel compile

$ ./configure --target=arm-linux --host=arm-linux --prefix=/tmp/gdb CC=/root/Downloads/buildroot/output/host/usr/bin/arm-linux-gcc CFLAGS="-g -O2 -static"


armeb compile

$ ./configure --target=armeb-linux --host=armeb-linux --prefix=/tmp/gdb CC=/root/Downloads/buildroot/output/host/usr/bin/armeb-linux-gcc CFLAGS="-g -O2 -static"


Run gdb in busybox

BusyBox v1.1.2 (2013.03.05-09:46+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# gdb --version
GNU gdb (GDB) 7.11
Copyright (C) 2016 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 "mipsel-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".


# gdbserver --version
GNU gdbserver (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
gdbserver is free software, covered by the GNU General Public License.
This gdbserver was configured as "mipsel-linux"

# gdbserver --help
Usage:  gdbserver [OPTIONS] COMM PROG [ARGS ...]
gdbserver [OPTIONS] --attach COMM PID
gdbserver [OPTIONS] --multi COMM

COMM may either be a tty device (for serial debugging),
HOST:PORT to listen for a TCP connection, or '-' or 'stdio' to use
stdin/stdout of gdbserver.
PROG is the executable program.  ARGS are arguments passed to inferior.
PID is the process ID to attach to, when --attach is specified.

Operating modes:

--attach              Attach to running process PID.
--multi               Start server without a specific program, and
only quit when explicitly commanded.
--once                Exit after the first connection has closed.
--help                Print this message and then exit.
--version             Display version information and exit.

Other options:

--wrapper WRAPPER --  Run WRAPPER to start new programs.
--disable-randomization
Run PROG with address space randomization disabled.
--no-disable-randomization
Don't disable address space randomization when
starting PROG.

Debug options:

--debug               Enable general debugging output.
--debug-format=opt1[,opt2,...]
Specify extra content in debugging output.
Options:
all
none
timestamp
--remote-debug        Enable remote protocol debugging output.
--disable-packet=opt1[,opt2,...]
Disable support for RSP packets or features.
Options:
vCont, Tthread, qC, qfThreadInfo and
threads (disable all threading packets).

For more information, consult the GDB manual (available as on-line
info or a printed manual).
Report bugs to "<http://www.gnu.org/software/gdb/bugs/>".


Compile Issues

configure: error: `CFLAGS’ has changed since the previous run….

The detail message shows:

./configure --target=mipsel-linux --host=mipsel-linux --prefix=/root/Downloads/gdb-7.11/gdb_output --program-prefix=mips CC=/root/Downloads/buildroot/output/host/usr/bin/mipsel-linux-gcc CFLAGS="-g -O2 -static"

=== configuring in build-gnulib (/root/Downloads/gdb-7.11/gdb/build-gnulib)
configure: running /bin/bash .././gnulib/configure --disable-option-checking '--prefix=/root/Downloads/gdb-7.11/gdb_output'  '--program-transform-name=s&^&mips&' '--build=i686-pc-linux-uclibc' '--host=mipsel-linux' '--target=mipsel-linux' 'build_alias=i686-pc-linux-uclibc' 'host_alias=mipsel-linux' 'target_alias=mipsel-linux' 'CC=/root/Downloads/buildroot/output/host/usr/bin/mipsel-linux-gcc' 'CFLAGS=-static' 'LDFLAGS=-static-libstdc++ -static-libgcc ' 'CXX=g++' 'CXXFLAGS=-static' 'MAKEINFO=makeinfo --split-size=5000000' 'YACC=bison -y' --cache-file=./config.cache --srcdir=.././gnulib
configure: loading cache ./config.cache
configure: error: `CFLAGS' has changed since the previous run:
configure:   former value:  `-g -O2'
configure:   current value: `-static'
configure: error: in `/root/Downloads/gdb-7.11/gdb/build-gnulib':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over
configure: error: .././gnulib/configure failed for build-gnulib
Makefile:9127: recipe for target 'configure-gdb' failed
make[1]: *** [configure-gdb] Error 1
make[1]: Leaving directory '/root/Downloads/gdb-7.11'
Makefile:847: recipe for target 'all' failed
make: *** [all] Error 2


Please try to compile a new extract copy from gdb-x.xx.tar.gz.

$ rm -rf gdb-7.11/
$ tar xvf gdb-7.11.tar.gz


References

https://www.uclibc.org/downloads/

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