This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 0/2] gdb/tui: Assembler window scrolling fixes
- From: Shahab Vahedi <Shahab dot Vahedi at synopsys dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: Pedro Alves <palves at redhat dot com>, Tom Tromey <tom at tromey dot com>, "Shahab Vahedi" <shahab dot vahedi at gmail dot com>
- Date: Tue, 14 Jan 2020 13:59:25 +0000
- Subject: Re: [PATCH 0/2] gdb/tui: Assembler window scrolling fixes
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NiazOUKTrh/h/Rp2p1BASvbFd9btJnJWUOixuTm0EUA=; b=cFmvpaf6lvMjWGCiOYsZhyAsous9ddtSmAbEdOTv1PsqIxGkfvIgrbFdOCobOLByZAQlC2pGhEpDTioEjjx3WrTpZ20cK7DVaz+HMwa8jFbdZR0MOcBTgochXAe/ADIKrw1uAZ0EE72JLWlDfZIbkosMq/AgpLBmAHprXAv1JlHvM2mVKyMWgtBcSVN/LpHmx+hhnGXq6Pox4aOf2ld01BFwzPH3bwJY34f9i6M+76K7/Ulm9RlgGMa26iSZ8NWMDE/huhNzzaP6WTmcULwxsVNwCc3beWrU1aRTjZADmn0d4d8eYxSlu0QRdmJSlYdYAKMtzxpeeqJWztAKnf1Cog==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E0iwahOWomK5Mv9kmxX81jFoixNqm0DKgZmSkCuOLQdGRT/FLkRUpAW+A6YPU5Rd1OziM8X3+dthU238BOdKGOXT9gGCjvfpNByxAvq0cKa1MU84myW6gsBlxroMRZxu0fVL5t71E4bChwTk72KN8rJaKgCsvICR90IGXvOWbT5gT+VyCDn5d4W/e/vbT9cWFsoMLDmc5ClAXNnlTLC9khWtZbUPf5sS7Vtw/TH7rRtSEaA792Y7fZzT/64s6Um/1SChTjwvopaZgzGCaAfurYXfukKpBJlslDM1JSvB5PTpe8FFpiJkYFlOTQjDNFrpH8GPzOHBt5iOo/UL+GxqFA==
- References: <20200110143056.GD3815@gmail.com>,<cover.1578948166.git.andrew.burgess@embecosm.com>
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