I'm trying to debug binaries of a a firmware running Linux with no ASLR, binaries are not compiled with PIE either so I have no issue getting the memory locations.
So after including gdbserver in the firmware and running, I connect to it from my machine and insert the breakpoint, the breakpoint is inserted successfully (sometimes gdb adjust the breakpoint location), and I continue the execution, and when the breakpoint is hit, I get the following in gdbserver:
I know that memory locations are correct by comparing bytes at location in gdb when debugging, and in Ghidra and they are identical.
This a mips architecture, and I compiled the gdbserver based on it, here is the file command result:
gdbserver: ELF 32-bit MSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked, with debug_info, not stripped
I even tried to debug directly through gdb from the emulator, I failed to compile 7.7, 8.1 and 9.1, successfully compiled 7.9 but it crashes right after running, but I'm more interested in running gdb in the host machine, so I'm not really tried to fix this one.
Edit:
Following @Mega instructions and compiling gdb for target="mips-linux-gnu" instead of just using gdb-multiarch in host, I'm getting this error when a breakpoint is hit:
And on the host it says:
Program terminated with signal SIGTRAP, Trace/breakpoint trap. The program no longer exists.