I am using GUD for debugging C code. Because many of the lines and variables have been optimized away, it is necessary to follow the C source and the corresponding disassembly simultaneously. I want the current line in the disassembler window to be highlighted each time I "step instruction." Right now the cursor moves automatically, in the disassembler window, but hl-line-mode
does not highlight the line that the cursor moved to. If I switch to that window, the new line gets highlighted, and remains highlighted when I move away from that window again. But each time I step, the highlighting from hl-line-mode
disappears in the inactive window.
How can I get a good visual indication of the "current line" in the disassembler window? The tiny triangle in the fringe is not enough, because the lines are quite long, and it is difficult to tell at a glance which instruction will be executed next.
gud-overlay-arrow-position (make-marker) ... set-marker
, you can put something after that location using(marker-position gud-overlay-arrow-position)
as the point at which to update hl-line-mode or other gizmo that suits your needs. I see two (2) locations in the version I am using:gud-display-line
andgdb-frame-handler
. However, I have limited experience using gdb and am unfamiliar with terms such as disassembler and step instruction ... Therefore, I am unable to write up an answer because I cannot test it myself.gud-overlay-arrow-position
is different from thegdb-disassembly-position
overlay. Interestingly thegud-display-line
function already has special handling forhl-line-mode
, so regular source buffers already work as expected withhl-line-mode
, even when the source buffer is not the active window. (re-reading this comment right after typing it, I realize that it might be more confusing than anything.)