This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Negative repeat count for 'x' command
- From: Pedro Alves <palves at redhat dot com>
- To: Toshihito Kikuchi <k dot toshihito at yahoo dot de>, gdb-patches at sourceware dot org
- Cc: Paul_Koning at Dell dot com, andrew dot burgess at embecosm dot com, jhb at freebsd dot org
- Date: Mon, 18 Apr 2016 14:17:39 +0100
- Subject: Re: [PATCH] Negative repeat count for 'x' command
- Authentication-results: sourceware.org; auth=none
- References: <F83BD80E-E1AA-4C1E-86BB-9A995B831256 at dell dot com> <1095889805 dot 138513 dot 1453786618993 dot JavaMail dot yahoo at mail dot yahoo dot com> <20160127160420 dot GM3338 at embecosm dot com> <AF6EBE4A-8B9B-4AB4-80D2-A38662F36F4A at dell dot com> <56AA013F dot 8010601 at redhat dot com> <56B7D0E3 dot 8020402 at yahoo dot de> <570B95AE dot 80406 at redhat dot com> <571035CC dot 7060802 at yahoo dot de>
On 04/15/2016 01:29 AM, Toshihito Kikuchi wrote:
> Let me answer a couple of non-trivial questions. Otherwise fixes will be
> included in V3.
>
>>> +If a negative repeat count is specified for the formats @samp{s} or @samp{i},
>>> +the absolute value of the given number of null-terminated strings or
>>> +instructions before the address are displayed. For the @samp{i} format,
>>> +we use line number information in the debug info to resolve a correct frame
>>> +while dissasembling backward.
>>
>> What does "a correct frame" mean?
>
> It seems that I was using a wrong term. Instead of 'frame', does 'procedure
> boundary' make sense?
Yes, that'd make sense.
>>> +const char TestStrings[] = {
>>> + 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
>>
>> I wonder whether 'A', 'B', etc. would work?
>
> These test strings contain non-alphabetical characters shown as
> "\u307B\u3052\u307B\u3052\0" above, and that syntax is not allowed without C99.
> Also,
> I want to keep the same style for 1-byte, 2-bytes, and 4-bytes test strings.
> That's why I didn't use a character literals here.
...
> Do you have any thoughts?
Nope.
BTW, aren't these tests dependent on the host's charset? (show host-charset)
An idea to generalize the x/i tests to all archs would be to
let go of the asm, and instead write the test function in C. Then
you'd first use forward x/i to store a few line's instructions in
a list/array, and afterwards you'd disassemble backwards, comparing
with the expected instructions stored in the stored list/array.
I wonder whether that'd work.
Thanks,
Pedro Alves