Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error in pwndbg debug with mips64 #599

Closed
r00kie-0 opened this issue Mar 7, 2019 · 2 comments
Closed

error in pwndbg debug with mips64 #599

r00kie-0 opened this issue Mar 7, 2019 · 2 comments

Comments

@r00kie-0
Copy link

r00kie-0 commented Mar 7, 2019

when i debug with mips64, it goes wrong. file command check the file is:

./bin/busybox: ELF 64-bit MSB executable, MIPS, MIPS64 rel2 version 1 (SYSV), dynamically linked, interpreter /lib64/ld.so.1, for GNU/Linux 2.6.10, stripped

when debug with gdb, it reports:

pwndbg> target remote 127.0.0.1:1234
Remote debugging using 127.0.0.1:1234
warning: remote target does not support file transfer, attempting to access files from local filesystem.
Reading symbols from /home/r00kie/Desktop/_RV32X.bin.extracted/_6D0040.extracted/cpio-root/lib64/ld-2.9.so...(no debugging symbols found)...done.
0x0000004000802b70 in ?? () from /home/r00kie/Desktop/_RV32X.bin.extracted/_6D0040.extracted/cpio-root/lib64/ld-2.9.so
ERROR: Could not find ELF base!
'context': Print out the current register, instruction, and stack context.

    Accepts subcommands 'reg', 'disasm', 'code', 'stack', 'backtrace', and 'args'.
Exception occured: context: unsupported operand type(s) for +: 'NoneType' and 'int' (<class 'TypeError'>)
For more info invoke `set exception-verbose on` and rerun the command
or debug it by yourself with `set exception-debugger on

how can i do to solve the problem?

@disconnect3d
Copy link
Member

Hey,

are you debugging a linux ELF binary, or is it some kind of a system image? I assume the former as the binary is busybox but it's still good to ask.

Also, do you use gdb that supports target architecture? See show arch (and then set arch to a proper one). If your gdb doesn't have the one you need (mips64?) you might want to install gdb-multiarch (there should be such package on debian like systems) or compile gdb with all target supports (I'd recommend this way, as you would also get newer gdb):

wget https://ftp.gnu.org/gnu/gdb/gdb-8.2.1.tar.gz
tar -xvf gdb-8.2.1.tar.gz
cd gdb-8.2.1
mkdir build
cd build
../configure --prefix=/usr --disable-nls --disable-werror --with-system-readline --with-python=/usr/bin/python3.6 --with-system-gdbinit=/etc/gdb/gdbinit --enable-targets=all
make -j7
sudo make install

Note that you need to specify proper python3 path (I assumed python3.6) and need some libs installed here (e.g. readline) otherwise the configure or make will fail.

@disconnect3d
Copy link
Member

@r00kie-0 ping? I am closing this due to no activity here and not much information regarding the setup so it is not possible to reproduce this.

Please reopen and attach your binary along with your setup (e.g. output of version and bugreport commands).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants