Describe the bug
Same as #505. When opening an existing Ghidra program, cursor starts at top and the decompiler window is empty. Ghidra won't ask to save the program if I close code browser after moving the cursor without changing anything. This is listed in the official bugfix list, but is still happening.
To Reproduce
Steps to reproduce the behavior:
Open a program of an active project, a PE executable for example.
Move the cursor to a random function by double clicking the function name of a call.
Change the name of current function
Save the program and exit code browser
Open the program again, and the cursor is at top of disassembly window (just before PE header section).
Expected behavior
The cursor should be at the last position of previous running.
Environment (please complete the following information):
Oddly enough it seems that ghidra will restore the cursor if you don't close the code browser before closing ghidra. If you leave the code browser open, close and relaunch ghidra it will restore it. It will also automatically restore the code browser and python window too which I'm personally not fond of since you can't do anything while the python environment is loading.
Oddly enough it seems that ghidra will restore the cursor if you don't close the code browser before closing ghidra. If you leave the code browser open, close and relaunch ghidra it will restore it. It will also automatically restore the code browser and python window too which I'm personally not fond of since you can't do anything while the python environment is loading.
Wow it works . Thank you. I too think it's counterintuitive, and I wonder why aren't many people complaining about it here.
Oddly enough it seems that ghidra will restore the cursor if you don't close the code browser before closing ghidra. If you leave the code browser open, close and relaunch ghidra it will restore it. It will also automatically restore the code browser and python window too which I'm personally not fond of since you can't do anything while the python environment is loading.
Wow it works . Thank you. I too think it's counterintuitive, and I wonder why aren't many people complaining about it here.
Yes, but I think you may be correct in reporting this as a bug. It probably should restore the cursor position if you close and reopen the code browser.
This should be considered a feature request, not a bug. For better or worse, this is how the tool is currently designed. Some observations:
The reasoning behind the way it works is that we cannot simply save the cursor position in the Code Browser tool, since it only saves program-agnostic settings. In other words, if you save a cursor position, it is relative to an address in a program. If you open a new program, then the cursor location will not make sense for the new program. On the other hand, saving the location to the project settings makes sense because the projects settings save not only the tool settings, but also the active program and any related information.
I think that it make sense to change how this works so that it behaves as you expected in this case.
Most helpful comment
This should be considered a feature request, not a bug. For better or worse, this is how the tool is currently designed. Some observations:
The reasoning behind the way it works is that we cannot simply save the cursor position in the Code Browser tool, since it only saves program-agnostic settings. In other words, if you save a cursor position, it is relative to an address in a program. If you open a new program, then the cursor location will not make sense for the new program. On the other hand, saving the location to the project settings makes sense because the projects settings save not only the tool settings, but also the active program and any related information.
I think that it make sense to change how this works so that it behaves as you expected in this case.