From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Keith David Bershatsky Newsgroups: gmane.emacs.devel Subject: Debugging printing to stderr prior glyph row values .... Date: Wed, 22 May 2019 21:14:01 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="183600"; mail-complaints-to="usenet@blaine.gmane.org" To: Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 23 06:21:54 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hTfEm-000lZL-Iu for ged-emacs-devel@m.gmane.org; Thu, 23 May 2019 06:21:53 +0200 Original-Received: from localhost ([127.0.0.1]:57339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTfEl-0004Dn-IE for ged-emacs-devel@m.gmane.org; Thu, 23 May 2019 00:21:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTfDn-0004BW-9v for emacs-devel@gnu.org; Thu, 23 May 2019 00:20:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTf7V-0005gq-6F for emacs-devel@gnu.org; Thu, 23 May 2019 00:14:23 -0400 Original-Received: from gateway32.websitewelcome.com ([192.185.145.114]:35159) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTf7T-0005Rz-UR for emacs-devel@gnu.org; Thu, 23 May 2019 00:14:20 -0400 Original-Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway32.websitewelcome.com (Postfix) with ESMTP id E05BC63C69 for ; Wed, 22 May 2019 23:14:04 -0500 (CDT) Original-Received: from gator3053.hostgator.com ([50.87.144.69]) by cmsmtp with SMTP id Tf7Ehycdg90onTf7Eh2u9J; Wed, 22 May 2019 23:14:04 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lawlist.com ; s=default; h=Content-Type:MIME-Version:Subject:To:From:Message-ID:Date: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=x/clxJ4nN9Nt7QtUwJ3gXYeAQBi1l4f/9llcHZTfRw8=; b=PChyicD109LeCmKMcxFsQPkWn2 jI280B+X18lvalPS+M4ecXqNDUdsv0J9Wakp0tas0Z88JDtr6rVEAbdm1J/dLdmWAsPsnUpY5AcWV 0RZcA+MF0+N+b5BOwPhHbNLzLMM/s1yMyDGdUwjhdrdheFiQpJ9Wb1Mm61kOGZiMerlBg1s1kER5Z gjUqpP2fP3oMv+wD8rM7YyfUM7/94TTliQatl29rUbywh+hB68O8FalHWzQ9ZAP0n+uxVfoMLpQh2 6IVtCTLxB6NMJ2g0t+lELTIKaALErcmXNvdXQHY7R14NKpF4rYs2zey1VUXMe9cChQcBJEJN5Zcgt mQKAM3wQ==; Original-Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:54911 helo=server.local) by gator3053.hostgator.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.91) (envelope-from ) id 1hTf7E-0010Sm-67 for emacs-devel@gnu.org; Wed, 22 May 2019 23:14:04 -0500 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3053.hostgator.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lawlist.com X-BWhitelist: no X-Source-IP: 45.48.239.195 X-Source-L: No X-Exim-ID: 1hTf7E-0010Sm-67 X-Source-Sender: cpe-45-48-239-195.socal.res.rr.com (server.local) [45.48.239.195]:54911 X-Source-Auth: lawlist X-Email-Count: 1 X-Source-Cap: bGF3bGlzdDtsYXdsaXN0O2dhdG9yMzA1My5ob3N0Z2F0b3IuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.185.145.114 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236922 Archived-At: I am working on feature requests 22873 (multiple fake cursors) and 17684 (crosshairs that track the cursor position). I am having trouble preventing Emacs from occasionally crashing when printing messages to stderr while update_window is occurring, which makes debugging other issues more difficult than necessary. update_window processes one glyph row at a time using the w->desired_matrix; and, feature requests 22873/17684 use both the desired/current matrices. My best guess is that the problem lies here: (gdb) print previous_row__last_glyph $9 = (struct glyph *) 0x11f7fffb0 (gdb) print previous_row__last_glyph->charpos Cannot access memory at address 0x11f7fffd0 Some suggestions regarding how to prevent Emacs from crashing would be greatly appreciated. A full bt of frame 0 follows at the end of this post. struct glyph *previous_row__penultimate_glyph = (vpos == 0) ? NULL : (!(row - 1)->enabled_p) ? NULL : ((row - 1)->used[TEXT_AREA] > 1) ? (row - 1)->glyphs[TEXT_AREA] + (row - 1)->used[TEXT_AREA] - 2 : NULL; struct glyph *previous_row__last_glyph = (vpos == 0) ? NULL : (!(row - 1)->enabled_p) ? NULL : (row - 1)->glyphs[TEXT_AREA] + (row - 1)->used[TEXT_AREA] - 1; struct glyph *penultimate_glyph = (row->used[TEXT_AREA] < 1) ? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 2 : NULL; struct glyph *last_glyph = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1; fprintf (stderr, "\nA. vpos (%d) | glyph->charpos (%d) | posint (%d) | mc_zv (%d) | mc_zv_byte (%d)\n\ row - 1: penultimate_charpos (%d) | last_charpos (%d) | ends_at_zv_p (%s)\n\ row - 1: start/end_bytepos (%d/%d) | start/end_charpos (%d/%d)\n\ row_at_zv_p (%s) | row_beyond_zv_p (%s)\n\ row: penultimate_charpos (%d) | last_charpos (%d) | ends_at_zv_p (%s)\n\ row: start/end_bytepos (%d/%d) | start/end_charpos (%d/%d)\n", vpos, start->charpos, posint, mc_zv, mc_zv_byte, previous_row__penultimate_glyph != NULL ? previous_row__penultimate_glyph->charpos : -1, previous_row__last_glyph != NULL ? previous_row__last_glyph->charpos : -1, (row - 1)->ends_at_zv_p ? "y" : "n", MATRIX_ROW_START_BYTEPOS (row - 1), MATRIX_ROW_END_BYTEPOS (row - 1), MATRIX_ROW_START_CHARPOS (row - 1), MATRIX_ROW_END_CHARPOS (row - 1), row_at_zv_p ? "y" : "n", row_beyond_zv_p ? "y" : "n", penultimate_glyph != NULL ? penultimate_glyph->charpos : -1, last_glyph->charpos, row->ends_at_zv_p ? "y" : "n", MATRIX_ROW_START_BYTEPOS (row), MATRIX_ROW_END_BYTEPOS (row), MATRIX_ROW_START_CHARPOS (row), MATRIX_ROW_END_CHARPOS (row)); ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (gdb) print previous_row__penultimate_glyph $8 = (struct glyph *) 0x0 (gdb) print previous_row__last_glyph $9 = (struct glyph *) 0x11f7fffb0 (gdb) print previous_row__last_glyph->charpos Cannot access memory at address 0x11f7fffd0 (gdb) print *previous_row__last_glyph Cannot access memory at address 0x11f7fffb0 (gdb) print last_glyph $10 = (struct glyph *) 0x11fa46200 (gdb) print last_glyph->charpos $11 = -1 (gdb) print penultimate_glyph $12 = (struct glyph *) 0x0 (gdb) bt full #0 0x0000000100045d1b in mc_draw_row (w=0x1088ef048, matrix=0x106ddb0a0, row=0x11d1b2e00, start=0x11fa46200, x=0, hpos_length=1, vpos=8, bottom_vpos=113, active_p=true, cursor_matrix=0x106be6580, fc_x=770, ch_foreground=..., fc_foreground=..., mc_zv=16, mc_zv_byte=16, draw_p=true, from_where=SCRIBE_ONE) at xdisp.c:4604 hpos = 0 previous_glyph = 0x0 skip_p = false posint = -1 specs = { i = 0 } hpos_start = 0 window = { i = 4438552653 } f = 0x10388f1a0 buf = { i = 4354225669 } b = 0x103883600 opoint_fx = 1 opoint_fy = 143585352 opoint_wd = 1 opoint_h = 488320512 text_area_width = 975 header_line_format = 24 previous_row__penultimate_glyph = 0x0 previous_row__last_glyph = 0x11f7fffb0 penultimate_glyph = 0x0 last_glyph = 0x11fa46200 row_at_zv_p = false row_beyond_zv_p = true cursor_row = 0x11fa17100 cursor_glyph = 0x11fa236b0 cursor_at_fringe_p = false cursor_beyond_fringe_p = false bg_face_id = DEFAULT_FACE_ID cursor_bg = { red = 0, green = 0, blue = 0 } lisp_type = { i = 24336 } cursor_type = MC_HOLLOW_BOX cursor_width = -1 cursor_face_id = 36 cursor_face = 0x100f0fc30 cursor_color = { i = 4299532436 } cursor_fg = { red = 0, green = 1, blue = 1 } fill_column_trumps_p = false