This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add a new format letter to dump instructions backward
- From: Pedro Alves <palves at redhat dot com>
- To: Paul_Koning at Dell dot com, jhb at freebsd dot org
- Cc: gdb-patches at sourceware dot org, k dot toshihito at yahoo dot de
- Date: Mon, 25 Jan 2016 18:27:38 +0000
- Subject: Re: [PATCH] Add a new format letter to dump instructions backward
- Authentication-results: sourceware.org; auth=none
- References: <1827952218 dot 466587 dot 1453670934999 dot JavaMail dot yahoo dot ref at mail dot yahoo dot com> <1827952218 dot 466587 dot 1453670934999 dot JavaMail dot yahoo at mail dot yahoo dot com> <56A609E7 dot 6050903 at redhat dot com> <2015581 dot ugHgmqoO9R at ralph dot baldwin dot cx> <3F40FBEE-2395-4ECC-94A0-A395B35B788C at dell dot com>
On 01/25/2016 06:22 PM, Paul_Koning@Dell.com wrote:
>
>> On Jan 25, 2016, at 12:52 PM, John Baldwin <jhb@freebsd.org> wrote:
>>
>> On Monday, January 25, 2016 11:41:27 AM Pedro Alves wrote:
>>> On 01/24/2016 09:28 PM, Toshihito Kikuchi wrote:
>>> ...
>>> #3 - negative repeat counts ?
>>>
>>> (gdb) x /4i // next 4 instructions
>>> (gdb) x /-4i // previous 4 instructions
>>> ...
>>> #3 feels natural to me. What do you (and others) think?
>>
>> I think #3 is the most natural as well. I also think this is a
>> very useful feature.
>
> Yes, but how do you do instructions backwards if the instruction length is variable? It is entirely possible that there will be multiple possible answers, and no way to tell which one (if any) is "correct".
You disassemble forward starting from the previous known
instruction boundary, based on symbol/line info. I haven't looked
at the implementation in detail, but from the patch description, that's
what I assume the patch is doing.
Thanks,
Pedro Alves