From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [pushed] [gdb/tui] Fix buglet in tui_update_variables
Date: Mon, 22 May 2023 16:47:50 +0200 [thread overview]
Message-ID: <fb58427d-8259-a17d-210e-13d23c1770a6@suse.de> (raw)
In-Reply-To: <20230508141036.22723-3-tdevries@suse.de>
[-- Attachment #1: Type: text/plain, Size: 806 bytes --]
[ was: Re: [PATCH 2/3] [gdb/tui] Fix buglet in set_border_kind_item ]
On 5/8/23 16:10, Tom de Vries via Gdb-patches wrote:
> While factoring out set_border_kind_item I noticed a buglet:
> ...
> struct tui_translate *entry = translate (key, dict);
>
> if (*lval != (chtype) entry->value)
> {
> *lval = (entry->value < 0) ? acs : entry->value;
> ...
>
> When assigning the new value to *lval, an entry->value of -1 is taken into
> account, but not when comparing to the current value of *lval.
>
> Fix this by introducing:
> ...
> int val = (entry->value < 0) ? acs : entry->value;
> ...
> and using this in both comparison and assignment.
>
I'm not sure if the enhancement "border-kind active-ascii" will make it,
so I've ported this fix to trunk and committed.
Thanks,
- Tom
[-- Attachment #2: 0001-gdb-tui-Fix-buglet-in-tui_update_variables.patch --]
[-- Type: text/x-patch, Size: 1731 bytes --]
From cd1ed1fd2e8ccec34008d03a9b25132f4eb3bf64 Mon Sep 17 00:00:00 2001
From: Tom de Vries <tdevries@suse.de>
Date: Mon, 8 May 2023 13:24:08 +0200
Subject: [pushed] [gdb/tui] Fix buglet in tui_update_variables
I noticed a buglet in tui_update_variables:
...
entry = translate (tui_border_kind, tui_border_kind_translate_lrcorner);
if (tui_border_lrcorner != (chtype) entry->value)
{
tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value;
...
When assigning the new value to tui_border_lrcorner, an entry->value of -1 is
taken into account, but not when comparing to the current value of
tui_border_lrcorner.
Fix this by introducing:
...
int val = (entry->value < 0) ? ACS_LRCORNER : entry->value;
...
and using this in both comparison and assignment.
Tested on x86_64-linux.
---
gdb/tui/tui-win.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 6710b3e17e5..7abd1e225b9 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -300,9 +300,10 @@ tui_update_variables ()
Only check the first one. The ACS characters are determined at
run time by curses terminal management. */
entry = translate (tui_border_kind, tui_border_kind_translate_lrcorner);
- if (tui_border_lrcorner != (chtype) entry->value)
+ int val = (entry->value < 0) ? ACS_LRCORNER : entry->value;
+ if (tui_border_lrcorner != (chtype) val)
{
- tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value;
+ tui_border_lrcorner = val;
need_redraw = true;
}
entry = translate (tui_border_kind, tui_border_kind_translate_llcorner);
base-commit: 7a8a6f57eced9a8c27a93cb5c5977a33be7b1f72
--
2.35.3
next prev parent reply other threads:[~2023-05-22 14:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-08 14:10 [PATCH 0/3] [gdb/tui] Add tui border-kind active-ascii Tom de Vries via Gdb-patches
2023-05-08 14:10 ` [PATCH 1/3] [gdb/tui] Make tui_update_variables more readable Tom de Vries via Gdb-patches
2023-12-15 19:48 ` Tom Tromey
2023-05-08 14:10 ` [PATCH 2/3] [gdb/tui] Fix buglet in set_border_kind_item Tom de Vries via Gdb-patches
2023-05-22 14:47 ` Tom de Vries via Gdb-patches [this message]
2023-05-08 14:10 ` [PATCH 3/3] [gdb/tui] Add tui border-kind active-ascii Tom de Vries via Gdb-patches
2023-12-15 19:50 ` Tom Tromey
2023-12-15 20:04 ` Eli Zaretskii
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=fb58427d-8259-a17d-210e-13d23c1770a6@suse.de \
--to=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
--cc=tom@tromey.com \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox