This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PING][RFC][PATCH v2] Python API: add gdb.stack_may_be_invalid
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: martin dot galvan at tallertechnologies dot com (Martin Galvan)
- Cc: gdb-patches at sourceware dot org, dje at google dot com (Doug Evans), eliz at gnu dot org (Eli Zaretskii), palves at redhat dot com (Pedro Alves), daniel dot gutson at tallertechnologies dot com (Daniel Gutson)
- Date: Fri, 7 Nov 2014 18:27:22 +0100 (CET)
- Subject: Re: [PING][RFC][PATCH v2] Python API: add gdb.stack_may_be_invalid
- Authentication-results: sourceware.org; auth=none
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