all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72667: 31.0.50; gud-print moves the cursor after execution
@ 2024-08-16 11:38 TatriX
  2024-08-17 10:34 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: TatriX @ 2024-08-16 11:38 UTC (permalink / raw)
  To: 72667

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))





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#72667: 31.0.50; gud-print moves the cursor after execution
  2024-08-16 11:38 bug#72667: 31.0.50; gud-print moves the cursor after execution TatriX
@ 2024-08-17 10:34 ` Eli Zaretskii
       [not found]   ` <CAG7LdX7TYQRDag1Q4VPOLVGn5AsP8Y_OOvjp53Fssr19WjB-7g@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-08-17 10:34 UTC (permalink / raw)
  To: TatriX; +Cc: 72667

> From: TatriX <tatrics@gmail.com>
> 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'.

I think this is an intentional feature: after each GUD command Emacs
returns point to the current line as indicated by the debugger.  The
intent is to keep the current line always visible on display.  Since
Emacs doesn't really understand the effect of debugger commands, it
must restore point after each such command.

May I ask why you use gud-print and not gud-tooltip-mode?  The latter
will allow you to show values of variables without moving point.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#72667: 31.0.50; gud-print moves the cursor after execution
       [not found]   ` <CAG7LdX7TYQRDag1Q4VPOLVGn5AsP8Y_OOvjp53Fssr19WjB-7g@mail.gmail.com>
@ 2024-08-17 14:14     ` Eli Zaretskii
  2024-08-17 14:59       ` TatriX
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-08-17 14:14 UTC (permalink / raw)
  To: TatriX; +Cc: 72667

[Please use Reply All to reply, to keep the bug tracker CC'ed.]

> From: TatriX <tatrics@gmail.com>
> Date: Sat, 17 Aug 2024 15:41:54 +0200
> 
> > May I ask why you use gud-print and not gud-tooltip-mode?  The latter
> > will allow you to show values of variables without moving point.
> 
> I do use it sometimes. Most of the time I just switch to *gud* buffer
> and print the values manually, which requires quite some window
> switching.
> 
> I suppose what I would prefer is to be able to run something similar to
> gud-print which would ask me for an expression, defaulting to whatever
> is near the point. Still, moving the point is undesirable since it
> changes what is in focus.
> 
> I tried to change the behavior myself, but couldn't find what actually
> moves the point.

I think it happens in gud-refresh.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#72667: 31.0.50; gud-print moves the cursor after execution
  2024-08-17 14:14     ` Eli Zaretskii
@ 2024-08-17 14:59       ` TatriX
  0 siblings, 0 replies; 4+ messages in thread
From: TatriX @ 2024-08-17 14:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 72667

> I think it happens in gud-refresh.

I thought that too, but at least when I edebug-it, debugger doesn't stop
in it.

It looks like it happens during one of the invocations of gud-filter
after gud-call send the data to the gdb.

Point moves when gud-marker-filter which is set to
gud-gdbmi-marker-filter is called.  Which in turns call gdbmi-bnf-output
and it seems that the point moves in gdbmi-bnf-out-of-band-record.

The callstack is quite deep and there are a lot of loops, so I wasn't
able to pin point a specific piece of code that actually moves the point
yet.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-17 14:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16 11:38 bug#72667: 31.0.50; gud-print moves the cursor after execution TatriX
2024-08-17 10:34 ` Eli Zaretskii
     [not found]   ` <CAG7LdX7TYQRDag1Q4VPOLVGn5AsP8Y_OOvjp53Fssr19WjB-7g@mail.gmail.com>
2024-08-17 14:14     ` Eli Zaretskii
2024-08-17 14:59       ` TatriX

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.