Re: [PING][RFC][PATCH v2] Python API: add gdb.stack_may_be_invalid

Martin Galvan
2014-11-07T17:37:01Z

On Fri, Nov 7, 2014 at 2:27 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Martin Galvan wrote:
>
>> +stack_is_destroyed (gdb_py_ulongest pc)
>> +{
>> + return gdbarch_in_function_epilogue_p (python_gdbarch, pc);
>> +}
>
> Just one comment here: python_gdbarch isn't really correct here.
> If you have a platform that supports multiple architectures, then
> you really should use the appropriate gdbarch for PC.

Agreed. I used python_gdbarch because it's used all over the API, so I
thought I could use it in here.

> Ideally, the Python interface should carry enough information to
> determine the appropriate gdbarch, e.g. by operating on a Frame
> instead of a plain PC value.

If I understand correctly, using a Frame would require the program to
be already running by the time we call the API function, which isn't
really what we want.

> If that isn't possible, one fall-back might be to look up the
> symbol table from the PC, and use the associated objfile arch.

I'll look into this. Thanks a lot!

--

Martín Galván

Software Engineer

Taller Technologies Argentina

San Lorenzo 47, 3rd Floor, Office 5

Córdoba, Argentina

Phone: 54 351 4217888 / +54 351 4218211