Subject: bug#72667: 31.0.50; gud-print moves the cursor after execution

From: TatriX <[email-masked]>
Date: Fri, 16 Aug 2024 13:38:26 +0200

When one runs `gud-print' with `C-x C-a C-p`, point moves to a line that
 is the debugger stopped at instead of staying where it was. I'm not
 sure if it is an intended behaviour. If it is, it would be very nice if
 one could override it, since I find that I want the point to keep it's
 position after I print a value. I can always run `C-x C-a C-l` to jump
 to the currently executing line.

Here's a an illustration. Suppose you have a program `test.c':

```
    int main() {
      int a = 42;
      int b = 13;
      int c = 69;
      return a + b + c;
    }
```

Which you can compile for example like this: `gcc -g -Wall -o test01 test.c'.
Now, if you stop execution at `int b', move the point to `int a' and run
`C-x C-a C-p' the point will jump back to `int b' instead of staying at
`int a'.

Thanks!

----------------------------------------------------------------------------

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.0) of 2024-07-29 built on twork
Repository revision: e4d22abcab60ead179e7d114faa4c2def559cfbb
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101013
System Description: Arch Linux

Configured using:
 'configure --with-native-compilation=yes --with-xinput2
 --with-sound=alsa --without-compress-install --with-x-toolkit=gtk3
 --without-xaw3d --without-gconf --prefix=/usr --sysconfdir=/etc
 --libexecdir=/usr/lib --localstatedir=/var --mandir=/usr/share/man
 --with-gameuser=:games --with-modules --without-libotf
 --without-m17n-flt'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: C/*l

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr comp-run comp-common rx emacsbug message mailcap
yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache
epa derived epg rfc6068 epg-config gnus-util time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils gdb-mi
bindat byte-opt gv bytecomp byte-compile cl-seq gud files-x shell
pcomplete compile text-property-search comint ansi-osc ansi-color ring
make-mode subr-x cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list
replace newcomment text-mode lisp-mode prog-mode register page tab-bar
menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse
jit-lock font-lock syntax font-core term/tty-colors frame minibuffer
nadvice seq simple cl-generic indonesian philippine cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 123043 18359) (symbols 48 10095 0) (strings 32 28762 1928)
 (string-bytes 1 1007754) (vectors 16 15974)
 (vector-slots 8 212618 5364) (floats 8 34 1) (intervals 56 498 8)
 (buffers 992 20))