1

I've followed the guide from Cross debugging for MIPS ELF with QEMU/toolchain to cross compile a simple hello world application, but for some reason I get a segmentation fault when opening it with gdb-multiarch.

Exact steps I followed from the guide

$ sudo apt-get install libc6-mipsel-cross      # For MIPS-EL
$ sudo apt-get install gcc-mipsel-linux-gnu     # For MIPS-EL on Ubuntu 16.04
$ sudo mkdir /etc/qemu-binfmt
$ sudo ln -s /usr/mipsel-linux-gnu /etc/qemu-binfmt/mipsel # MIPSEL
$ mipsel-linux-gnu-gcc -xc -static -o mipsel-test hello.c
$ gdb-multiarch mipsel-test

Running file

mipsel-test: ELF 32-bit LSB executable, MIPS, MIPS-II version 1 (SYSV), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=27b56a9e12c8e083759f25699b624a87e8c3d86a, not stripped

Output running gdb-multiarch

$ gdb-multiarch ./mipsel-test 
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./mipsel-test...Segmentation fault (core dumped)

Output running gdb

$ gdb mipsel-test 
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from mipsel-test...(no debugging symbols found)...done.
4
  • segmentation fault in the program or gdb itself? show us how you run it and the ouput.
    – Igor Skochinsky
    Sep 2, 2017 at 18:01
  • P.S. is the result different for gdb-multiarch ./mipsel-test?
    – Igor Skochinsky
    Sep 2, 2017 at 18:03
  • hi, thanks fore the response. The ouputs when I run gdb vs gdb-multiarch were different and I've edited the above post
    – HKC
    Sep 3, 2017 at 19:21
  • it looks like gdb-multiarch crashes when reading symbols from that file. possibly it has been modified to hinder analysis.
    – Igor Skochinsky
    Sep 3, 2017 at 19:23

1 Answer 1

1

It seems there is some bug in gdb causing it to crash when reading symbols from your file. You can try to debug the crash(e.g. gdb --args gdb-multiarch ./mipsel-test), but this is more of a programming issue than RE, so I suggest you to use GDB support channels for this or at least ask on SO instead of here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.