all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ken Olum <kdo@cosmos.phy.tufts.edu>
Cc: 16433@debbugs.gnu.org
Subject: bug#16433: Test case for newline cache corruption
Date: Mon, 26 May 2014 22:28:22 +0300	[thread overview]
Message-ID: <83vbssibl5.fsf@gnu.org> (raw)
In-Reply-To: <q528upo36el.fsf@cosmos.phy.tufts.edu>

> From: Ken Olum <kdo@cosmos.phy.tufts.edu>
> Cc: 16433@debbugs.gnu.org
> Date: Mon, 26 May 2014 11:29:22 -0400
> 
>    Also, is your build optimized or not?  More generally, what are the
>    values of system-configuration and system-configuration-options in the
>    build where you reproduce this?  If your build options are different
>    from mine, especially the optimization switches, perhaps that is part
>    of the issue somehow.
> 
> All I did was to download the trunk distribution and say "make".

This means the build is optimized.  This might get in the way when we
will need to use GDB, but for now it's OK.

Below please find a simple patch that adds instrumentation to the
cache operations.  The trace goes to the *Messages* buffer.  Please
apply the patch, then run your recipe, and show the trace for it.  (It
is best to mark the place in *Messages* where you actually start and
end the recipe with some prominent string, because the newline cache
is consulted _a_lot_.)

Thanks.

=== modified file 'src/region-cache.c'
--- a/src/region-cache.c	2014-05-03 08:24:51 +0000
+++ b/src/region-cache.c	2014-05-26 19:26:53 +0000
@@ -459,6 +459,15 @@
 invalidate_region_cache (struct buffer *buf, struct region_cache *c,
 			 ptrdiff_t head, ptrdiff_t tail)
 {
+  char buff[1024];
+
+  if (c == buf->newline_cache)
+    {
+      sprintf (buff, "invalidate_region_cache (%s, %d, %d, %d)",
+	       SSDATA (BVAR (buf, name)),
+	       BUF_BEG (buf) + head, BUF_Z (buf) - tail, BUF_Z (buf));
+      message_dolog (buff, strlen (buff), false, true);
+    }
   /* Let chead = c->beg_unchanged, and
          ctail = c->end_unchanged.
      If z-tail < beg+chead by a large amount, or
@@ -474,8 +483,14 @@
        > PRESERVE_THRESHOLD)
       || ((BUF_BEG (buf) + head) - (BUF_Z (buf) - c->end_unchanged)
           > PRESERVE_THRESHOLD))
-    revalidate_region_cache (buf, c);
-
+    {
+      revalidate_region_cache (buf, c);
+      if (c == buf->newline_cache)
+	message_dolog (" (revalidated)\n", sizeof (" (revalidated)\n") - 1,
+		       false, true);
+    }
+  else if (c == buf->newline_cache)
+    message_dolog ("\n", 1, false, true);
 
   if (head < c->beg_unchanged)
     c->beg_unchanged = head;
@@ -666,6 +681,15 @@
 know_region_cache (struct buffer *buf, struct region_cache *c,
 		   ptrdiff_t start, ptrdiff_t end)
 {
+  char buff[1024];
+
+  if (c == buf->newline_cache)
+    {
+      sprintf (buff, "know_region_cache (%s, %d, %d, %d)\n",
+	       SSDATA (BVAR (buf, name)), start, end, BUF_Z (buf));
+      message_dolog (buff, strlen (buff), false, true);
+    }
+
   revalidate_region_cache (buf, c);
 
   set_cache_region (c, start, end, 1);






  reply	other threads:[~2014-05-26 19:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13 19:37 bug#16433: 24.3.50; find_newline screws up in Rmail buffers Richard Stallman
2014-01-13 20:31 ` Eli Zaretskii
2014-01-14 17:06   ` Richard Stallman
2014-01-14 17:36     ` Eli Zaretskii
2014-01-15 12:29       ` Richard Stallman
2014-01-15 15:52         ` Eli Zaretskii
2014-05-22 20:38 ` bug#16433: Test case for newline cache corruption Ken Olum
2014-05-23  5:50   ` Eli Zaretskii
2014-05-24  8:24   ` Eli Zaretskii
2014-05-26 15:29     ` Ken Olum
2014-05-26 19:28       ` Eli Zaretskii [this message]
2014-05-27 15:14         ` Ken Olum
2014-05-27 16:20         ` Ken Olum
2014-05-27 18:04           ` Eli Zaretskii
2014-05-31 10:13           ` Eli Zaretskii
2014-05-31 18:27             ` Eli Zaretskii
2014-06-01 22:30               ` Ken Olum
2014-06-02  2:44                 ` Eli Zaretskii
2014-06-05 16:57               ` Ken Olum
2014-06-05 17:31                 ` Eli Zaretskii
2014-06-06 15:07                   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83vbssibl5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=16433@debbugs.gnu.org \
    --cc=kdo@cosmos.phy.tufts.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.