This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] [python] PR python/15461 (gate architecture calls)


>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:

Phil> This patch gates calls to architecture.name and
Phil> architecture.disassemble.  If the underlying GDB architecture is NULL,
Phil> calls to those Python functions will result in an assert call.

Thanks.

Phil> +/* Require a valid Architecture.  */
Phil> +#define ARCHPY_REQUIRE_VALID (arch_obj, arch)		\
Phil> +  do {							\
Phil> +    arch = arch_object_to_gdbarch (arch_obj);		\
Phil> +    if (arch == NULL)					\
Phil> +      error (_("Architecture is invalid."));		\
Phil> +  } while (0)

I think it would be simpler to either:

* Have this set the python exception and not call error, or
* Likewise but just have it be done in arch_object_to_gdbarch.

With the current approach you have to have a try/catch and then throw an
exception; but really all you want is to set the python exception --
which is cheaper to do directly.

Phil>  # You should have received a copy of the GNU General Public License
Phil>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
Phil> +load_lib gdb-python.exp

It would be handy to get this hunk in sooner.
It's obvious fwiw.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]