[RFC - Python Scripting] Add 'end' attribute to gdb.Symtab_and_line

Doug Evans dje@google.com
Wed Jun 13 17:08:00 GMT 2012


On Wed, Jun 13, 2012 at 6:29 AM, Siva Chandra <sivachandra@google.com> wrote:
> On Wed, Jun 13, 2012 at 12:10 AM, Siva Chandra <sivachandra@google.com> wrote:
>> I have changed the behavior to [pc, end_pc] as this (at least the
>> name) feels more meaningful to me. But, why was right open behavior
>> chosen for internal code? Even the two-argument flavor of the
>> 'disassemble' command has right open behavior.
>
> Actually, I would like to take this back. I think, wrt 'disassemble'
> command, it is essentially disassembling all instructions which fully
> fall in the range provided as argument. Wrt symtab_and_line.end, if we
> were to expose it as end_pc in the Python API, then I think it should
> correspond to the PC value for the last instruction of that line of
> source and not the last address in the range. And, if that were to be
> the case, I do not think it is very practical as it does not indicate
> where the next instruction starts. With the other choice, where in
> end_pc indicates the last address in the range, the name end_pc
> becomes a misnomer.
>
> From my personal point of view, I see two options:
>
> 1. Call this new attribute 'last' and let it indicate the last address
> in the range.
>   or
> 2. Call this new attribute 'next_start' and let it indicate the start
> PC of the next instruction after the last instruction of the current
> source line.
>
> Either of the above is good enough for the use case I have in mind.
>
> Thanks,
> Siva Chandra

I like "last".
So the range would be [pc,last]  ?



More information about the Gdb-patches mailing list