ghidra
ghidra copied to clipboard
Continuing from a breakpoint in GDB 9.2 fails.
Describe the bug
Following on from #6656, when using the gdb debugger profile with GDB 9.2, on continue from a breakpoint the python hook on_stop
fails with the following error:
Traceback (most recent call last):
File "/home/forky2/ghidra_11.1.1_PUBLIC/Ghidra/Debug/Debugger-agent-gdb/pypkg/src/ghidragdb/hooks.py", line 161, in _func
return func(*args, **kwargs)
File "/home/forky2/ghidra_11.1.1_PUBLIC/Ghidra/Debug/Debugger-agent-gdb/pypkg/src/ghidragdb/hooks.py", line 311, in on_stop
state.record("Stopped")
File "/home/forky2/ghidra_11.1.1_PUBLIC/Ghidra/Debug/Debugger-agent-gdb/pypkg/src/ghidragdb/hooks.py", line 89, in record
commands.put_frames()
File "/home/forky2/ghidra_11.1.1_PUBLIC/Ghidra/Debug/Debugger-agent-gdb/pypkg/src/ghidragdb/commands.py", line 1400, in put_frames
f = newest_frame(gdb.selected_frame())
gdb.error: No frame is currently selected.
Python Exception <class 'gdb.error'> No frame is currently selected.:
To Reproduce Steps to reproduce the behavior:
- Create an x86_64 helloworld:
gcc -x c -o helloworld - <<EOF #include <stdio.h> int main(int argc, char *argv[]) { printf("Hello, world!\n"); return 0; } EOF
- Run Ghidra 11.1.1 with the python patch from #6656 applied.
- Import helloworld to Ghidra project
- Start a gdb debugger session with the default parameters
- GDB breaks on _start()
- Press F5 or enter
continue
into GDB Terminal - Exception as above is thrown
Expected behavior Program should run to termination with no exception.
Environment (please complete the following information):
- OS: Ubuntu 20.04.3
- Java Version: OpenJDK 21.0.3
- Ghidra Version: 11.1.1
- Ghidra Origin: official GitHub distro
- GDB Version: GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.2) 9.2
Additional context Apologies for raising multiple issues that affect an older version of GDB. No offense will be taken if you decide that GDB 9.2 is too old. I'm mainly raising because I like Ghidra and many people's initial experience of the debugger will be using it against these older versions due to them being the default in LTS releases of certain distros.
So far I have confirmed that the issue doesn't occur in GDB 13.2 which I built for testing. I think GDB 9.2 is erroneously calling the on_stop
hook.