Subject: bug#22287: 25.1.50; Sudden jumping point in buffer

From: "Stefan-W. Hahn" <[email-masked]>
Date: Tue, 5 Jan 2016 20:51:30 +0100

Mail von Eli Zaretskii, Tue, 05 Jan 2016 at 18:27:22 +0200:

Hello,

> > Date: Tue, 5 Jan 2016 16:01:22 +0100
> > From: "Stefan-W. Hahn" <[email-masked]>
> > Cc: [email-masked], [email-masked]
> > 
> > Thanks for this hint. I wasn't aware of this, after reading the good
> > documentation etc/DEBUG, great possibilities.
> > 
> > I've sat it up and am able to define a watchpoint which calls xbacktrace. I
> > have to play around with it a little, because in this straight forward
> > atempt, it is to slow. There is no possibility to do any real keystrokes in
> > the debuged emacs.
> 
> Probably because you defined the watchpoint so that GDB was forced to
> use software watchpoints, rather than hardware-assisted watchpoints.
> The latter doesn't slow down Emacs.

I tried watch and awatch:

,----
| (gdb) info watch
| Num     Type           Disp Enb Address            What
| 3       hw watchpoint  keep n                      current_buffer->pt
|         xbacktrace
|         continue
| 4       acc watchpoint keep y                      current_buffer->pt
|         xbacktrace
|         continue
| (gdb) c
| Continuing.
| Hardware access (read/write) watchpoint 4: current_buffer->pt
| 
| Value = 4827705
| Hardware access (read/write) watchpoint 4: current_buffer->pt
| 
| Value = 4827705
| 0x000000000057fb40 in fix_start_end_in_overlays (start=4827705, end=4827706) at buffer.c:3580
| 3580      for (parent = NULL, tail = current_buffer->overlays_before; tail;)
| "message" (0xffffc790)
| 0x1c7c530 PVEC_COMPILED
| "mapc" (0xffffce60)
| "semanticdb-save-all-db-idle" (0xffffd3b0)
| Hardware access (read/write) watchpoint 4: current_buffer->pt
| 
| Value = 4827705
| Hardware access (read/write) watchpoint 4: current_buffer->pt
`----

and before watch 3:

,----
| Old value = 2008
| New value = 49503
| set_buffer_internal_1 (b=0x1a968c0) at buffer.c:2040
| 2040      last_known_column_point = -1;   /* Invalidate indentation cache.  */
| "message" (0xffffc790)
| 0x1db1838 PVEC_COMPILED
| "mapc" (0xffffce60)
| "semanticdb-save-all-db-idle" (0xffffd3b0)
| Hardware watchpoint 3: current_buffer->pt
`----

and both showed up as HW-Watchpoint.

But with each of these the execution of emacs, mainly the xbacktrace, was so
slow, that no further action in emacs is possible.

I started emacs in src/ via:

- gdb emacs
- run -Q
- I loaded the intervals.c file (my playground).
- in intervals.c buffer I call M-x xx

,----
|   (defun xx ()
|     (interactive)
|     (setq-default message-log-max 64000)
|     (setq auto-save-interval 20)
|     (setq load-prefer-newer t)
|     (abbrev-mode -1)
|     (transient-mark-mode -1)
|     (line-number-mode -1)
|     (auto-compression-mode -1)
|     (auto-encryption-mode -1)
|     (auto-composition-mode -1)
|     (blink-cursor-mode -1)
|     (font-lock-mode -1)
|     (global-font-lock-mode -1)
|     (file-name-shadow-mode -1)
|     ;; menu-bar-mode
|     (tool-bar-mode -1)
|     (mouse-wheel-mode -1)
|     (electric-indent-mode -1)
|     (global-eldoc-mode -1)
|     (tooltip-mode -1)
|
|     (add-to-list 'load-path "/usr/src/emacs/emacs.git/lisp/cedet/")
|     (add-to-list 'load-path "/usr/src/emacs/emacs.git/lisp/cedet/semantic/")
|     (semantic-mode)
|     (semantic-idle-scheduler-mode)
|     (global-semantic-idle-scheduler-mode)
|     (global-semanticdb-minor-mode)
|     (diff-auto-refine-mode -1)
|     (global-semantic-decoration-mode)
|     (semantic-decoration-mode)
|     (setq semantic-idle-scheduler-verbose-flag t)
|     )
`----

 to shut down all unnecessary minor-modes.
- added the watch point together with the xbacktrace, continue command

Together with the watch point no further keyboard input was possible in
emacs.

> If you tell how you defined the watchpoint, I might be able to help
> you redefine it so that hardware-assisted watchpoints are used by GDB.

Any hint welcome.

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.