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: Toshihito Kikuchi <k dot toshihito at yahoo dot de>
- To: Pedro Alves <palves at redhat dot com>, 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: Thu, 14 Apr 2016 17:29:00 -0700
- 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>
Hi Pedro,
We know we all are busy with our main work :).
I walked through all of your comments. Thank you for the thorough review.
Especially your suggestion for find_pc_sect_line gdb_insn_length is really
helpful. These functions are what I was looking for.
Well, I was not a patient person, so I've started a V2 thread two weeks ago.
(https://sourceware.org/ml/gdb-patches/2016-04/msg00023.html)
The difference between V1 and V2 was only NEWS file. Please ignore it. Once I
address all of the comments, I'll start a V3 thread.
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?
> Typo "previoius". Double-space after periods. This recursion sounds
> nasty -- sounds like if you request a high number of addresses, crossing
> many lines, we'll hit stack limits. Can we do without recursion?
Yeah, actually this was a painful part. Let me rethink a better algorithm
without using recursive calls (and VEC if possible).
>> + }
>> +
>> /* Print as many objects as specified in COUNT, at most maxelts per line,
>> with the address of the next one at the start of each line. */
>>
>> @@ -913,6 +1164,9 @@ do_examine (struct format_data fmt, struct gdbarch *gdbarch, CORE_ADDR addr)
>> printf_filtered ("\n");
>> gdb_flush (gdb_stdout);
>> }
>> +
>> + if (addr_rewound)
>
> addr_rewound != 0
>
> But actually, please make sure that "address == 0" is treated as a
> valid address (not just here, but in the whole patch), as it is valid
> on non-MMU machines. That may suggest using a separate boolean variable
> to represent "have address".
Thank you for the insightful comment! I never thought non-MMU architectures..
>> +
>> + const char TestStrings[] = {
>> + "ABCD"
>> + "EFGHIJKLMNOPQRSTUVWXYZ\0"
>> + "\0"
>> + "\0"
>> + "\u307B\u3052\u307B\u3052\0"
>> + "012345678901234567890123456789\0"
>> + "!!!!!!\0"
>> + };
>> +*/
>> +
>> +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?
Thanks,
Toshihito