Re: [PATCH 0/2] gdb/tui: Assembler window scrolling fixes

Shahab Vahedi
2020-01-14T13:59:54Z

Hello Andrew,

I have tested the patch series against the "hello world"
program that I have [1]. Here comes my observations:

1. As you can see in this gif file:
https://sourceware.org/bugzilla/attachment.cgi?id=12200
"Going up" sometimes does not work. In this case, it is
between "main" and "_start" (garbage?). Nevertheless, I
manged to have it working for me by:

@@ -161,7 +161,7 @@ tui_find_symbol_backward (CORE_ADDR addr)
{
struct bound_minimal_symbol msym;

- for (int offset = 1; offset <= 1024; offset *= 2)
+ for (int offset = 1; offset <= 1024; ++offset)
{
CORE_ADDR tmp = addr - offset;
msym = lookup_minimal_symbol_by_pc_section (tmp, 0);

2. I run into a problem that "page-up" does not work when we
reach the end of file:
https://sourceware.org/bugzilla/attachment.cgi?id=12201
The following fixes that, but breaks elsewhere (see 3):

@@ -232,14 +232,14 @@ tui_find_disassembly_address ...
/* Disassemble forward a few lines and see ...
next_addr = tui_disassemble (gdbarch, asm_lines, ...
last_addr = asm_lines.back ().addr;
- if (last_addr > pc && msymbol.minsym != nullptr
+ if (last_addr >= pc && msymbol.minsym != nullptr
&& asm_lines.size () >= max_lines)
{
/* This will do if we can't find anything... */
possible_new_low.found = true;
possible_new_low.new_low = new_low;
}
- } while (last_addr > pc && msymbol.minsym != nullptr);
+ } while (last_addr >= pc && msymbol.minsym != nullptr);

3. With the changes from above, "arrow up" stops working near
beginning of the file:
https://sourceware.org/bugzilla/attachment.cgi?id=12202

I can summarise what I have learned in the following table:

,-------------.----------.----------------------------------.
| usecase | action | condition that works |
|-------------+----------+----------------------------------|
| very bottom | page-up | as long as last_addr >= pc ..., |
| | | go higher (try reducing new_low) |
|-------------+----------+----------------------------------|
| second line | arrow up | as long as last_addr > pc ..., |
| | | go higher (try reducing new_low) |
`-------------^----------^----------------------------------'

This table portrays contradictory conditions for corner case
scenarios. I believe the real solution in the end should be
much simpler and ideally as such that it covers the corner
cases naturally. I will try to cook something up in my free
time.

I suggest that this patch series should be in along with
the changes proposed at point 1. So we only end-up with
none-working page-up at the end of assembly output.

Cheers,
Shahab

[1]
that x86_64 elf program is archived here:
https://sourceware.org/bugzilla/attachment.cgi?id=12199
From gdb-patches-return-163060-listarch-gdb-patches=sources.redhat.com@sourceware.org Tue Jan 14 14:19:09 2020
Return-Path: <gdb-patches-return-163060-listarch-gdb-patches=sources.redhat.com@sourceware.org>
Delivered-To: listarch-gdb-patches@sources.redhat.com
Received: (qmail 61439 invoked by alias); 14 Jan 2020 14:19:09 -0000
Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <gdb-patches.sourceware.org>
List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org>
List-Archive: <http://sourceware.org/ml/gdb-patches/>
List-Post: <mailto:gdb-patches@sourceware.org>
List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs>
Sender: gdb-patches-owner@sourceware.org
Delivered-To: mailing list gdb-patches@sourceware.org
Received: (qmail 61158 invoked by uid 89); 14 Jan 2020 14:19:08 -0000
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-14.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammyX-HELO: mail-qt1-f176.google.com
Received: from mail-qt1-f176.google.com (HELO mail-qt1-f176.google.com) (209.85.160.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 14 Jan 2020 14:18:58 +0000
Received: by mail-qt1-f176.google.com with SMTP id w30so12507346qtd.12 for <gdb-patches@sourceware.org>; Tue, 14 Jan 2020 06:18:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh0J67NEgBygQJZpX4yfKahwEK1/yD50zgZjthjYlcY=; b=rtxIv+GUvXN0evobHrrrShVjFryCge3vTA3teUue+qr1ru+romJ0DnuJGOdqj3kFLI /+uP+/E+Q77hFOByUhRGXeJCaRakrI/4NGs5mNP4EoCvEyK5k5Hu0fYbvp0p1B7HJFhD iDKF1Y+iV3kw4ClnycmScUUX4BJz3P52D9k0Gl/KoIacY0Eo4T8XTm1BASa4UnJRg8yR TM0QuwYuLL8p9DdTJhBg4uQegnjFK3kQjHpEOZtv8ePEN5NYDq2LUuIjciBnat/WcLPI dhyceCGn8pfpPXG8RmmTslMgo9Wu1CufpwVYSm/xsgyFK9SWyVaPjDdVJFHuszYcHBEg G8Dg=Return-Path: <luis.machado@linaro.org>
Received: from [192.168.0.185] ([179.177.239.131]) by smtp.gmail.com with ESMTPSA id m10sm6634948qki.74.2020.01.14.06.18.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits\x128/128); Tue, 14 Jan 2020 06:18:55 -0800 (PST)
Subject: Re: [PATCH, v2] Fix/Update misc comments
To: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
References: <20200106143620.2881-1-luis.machado@linaro.org> <20200109232626.13846-1-luis.machado@linaro.org> <b6a15032-3b8f-fc72-42f1-ba9b69315c06@redhat.com>
From: Luis Machado <luis.machado@linaro.org>
Message-ID: <833ff275-e299-4fe2-06d6-5f80a6554a67@linaro.org>
Date: Tue, 14 Jan 2020 15:22:00 -0000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2
MIME-Version: 1.0
In-Reply-To: <b6a15032-3b8f-fc72-42f1-ba9b69315c06@redhat.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
X-SW-Source: 2020-01/txt/msg00374.txt.bz2
Content-length: 322

On 1/13/20 4:44 PM, Pedro Alves wrote:
> On 1/9/20 11:26 PM, Luis Machado wrote:
>> v2: Updated comments based on review.
>
> Thanks.
>
>> How does it look?
>>
>
> OK.
>
>> * inf-ptrace.c (inf_ptrace_target::resume): Update comments
>
> Missing period.
>

Fixed and pushed now. Thanks!

> Thanks,
> Pedro Alves
>