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

Ulrich Weigand
2014-11-07T17:27:33Z

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.

(python_gdbarch is unfortunately one of those hacks; it would be
preferable if we didn't have it at all ...)

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 that isn't possible, one fall-back might be to look up the
symbol table from the PC, and use the associated objfile arch.

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com