From patchwork Tue Aug 27 09:42:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 96545 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 84F75385E45F for ; Tue, 27 Aug 2024 09:42:10 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2a07:de40:b251:101:10:150:64:1]) by sourceware.org (Postfix) with ESMTPS id 4B672385DDF2 for ; Tue, 27 Aug 2024 09:41:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B672385DDF2 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4B672385DDF2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724751699; cv=none; b=eGj6FrjXnq17qtpgQntDAi05ayoTMu3ssVfVXvvuQiclADGwrKgWmn4zSmYFT6l6X0wquFCt4hhBQoKQ5urcDaQ1YeycUIDlOopCr4cvsb2x0kAED2bHCxhECpb6GC4wrSaOJ+mEWQ3zGWVNL4OR//TBy78hGzpbQbDpgj3aV2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724751699; c=relaxed/simple; bh=OWjFJcmb338su2RMlFHtmr3LrvPvCEwjZ8JMGFRu2jc=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=AfT9sWU5LF+31SQMu/atdLbJdG2mTULupX9R2ETjkENNw8FnKip6VDz5DMZLEwpsUmhmFqmQxi2qxkxJs7kLqsjMd1aU1COTJC03j71nVvjoIHRIxdfqV5JaYFtuq1HFO8d2mymkVZAuw35I3qs7x4ccKAeSNqVr+KdWnSm1olc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5817621B07 for ; Tue, 27 Aug 2024 09:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724751687; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ebFFGSqQXVGLtG2GPBwRuY2I3NaWP2Bu39Ub9MdCTik=; b=WpkW8wd9xqPJb+ehsu7k7MklAmuPt9KJtfVI4DjzL8/9z8nNlZXV/GCdnaWVsLyxN24ZWs MEa/4dGrMYK1s09wyRvdGItwMEOgRIa9Oign8nvW+pDOF5MFF8bHTOkDs4rXsbasBqQKNw CsVpUYUwBm1/HBfKB4CX53yb+Q0VElo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724751687; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ebFFGSqQXVGLtG2GPBwRuY2I3NaWP2Bu39Ub9MdCTik=; b=KT7bDLR+igG3OZCF+/aLD1VtokcRJMSM8kUBWzB5A9y2tPWl/nq0Z8wbjqy6f5bAWqZsyn FHoWwIgYq1PNyRAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1724751687; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ebFFGSqQXVGLtG2GPBwRuY2I3NaWP2Bu39Ub9MdCTik=; b=WpkW8wd9xqPJb+ehsu7k7MklAmuPt9KJtfVI4DjzL8/9z8nNlZXV/GCdnaWVsLyxN24ZWs MEa/4dGrMYK1s09wyRvdGItwMEOgRIa9Oign8nvW+pDOF5MFF8bHTOkDs4rXsbasBqQKNw CsVpUYUwBm1/HBfKB4CX53yb+Q0VElo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1724751687; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ebFFGSqQXVGLtG2GPBwRuY2I3NaWP2Bu39Ub9MdCTik=; b=KT7bDLR+igG3OZCF+/aLD1VtokcRJMSM8kUBWzB5A9y2tPWl/nq0Z8wbjqy6f5bAWqZsyn FHoWwIgYq1PNyRAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3FCB013A44 for ; Tue, 27 Aug 2024 09:41:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id kFFWDkefzWbIKQAAD6G6ig (envelope-from ) for ; Tue, 27 Aug 2024 09:41:27 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 3/4] [gdb/python] Eliminate GDB_PY_HANDLE_EXCEPTION Date: Tue, 27 Aug 2024 11:42:29 +0200 Message-Id: <20240827094230.14969-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240827094230.14969-1-tdevries@suse.de> References: <20240827094230.14969-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org Result of: ... $ search="GDB_PY_HANDLE_EXCEPTION" $ replace="return gdbpy_handle_gdb_exception" $ sed -i \ "s/$search/$replace/" \ gdb/python/*.c ... Also remove the now unused GDB_PY_HANDLE_EXCEPTION. No functional changes. Tested on x86_64-linux. --- gdb/python/py-arch.c | 2 +- gdb/python/py-breakpoint.c | 4 +-- gdb/python/py-connection.c | 2 +- gdb/python/py-disasm.c | 6 ++-- gdb/python/py-frame.c | 42 ++++++++++++------------ gdb/python/py-gdb-readline.c | 2 +- gdb/python/py-inferior.c | 10 +++--- gdb/python/py-infthread.c | 8 ++--- gdb/python/py-lazy-string.c | 4 +-- gdb/python/py-linetable.c | 2 +- gdb/python/py-mi.c | 2 +- gdb/python/py-objfile.c | 8 ++--- gdb/python/py-progspace.c | 4 +-- gdb/python/py-record-btrace.c | 8 ++--- gdb/python/py-record.c | 4 +-- gdb/python/py-stopevent.c | 2 +- gdb/python/py-symbol.c | 14 ++++---- gdb/python/py-tui.c | 2 +- gdb/python/py-type.c | 40 +++++++++++------------ gdb/python/py-unwind.c | 22 ++++++------- gdb/python/py-value.c | 60 +++++++++++++++++------------------ gdb/python/python-internal.h | 7 ---- gdb/python/python.c | 10 +++--- 23 files changed, 129 insertions(+), 136 deletions(-) diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c index 178efab4cee..cb7dd8af8aa 100644 --- a/gdb/python/py-arch.c +++ b/gdb/python/py-arch.c @@ -199,7 +199,7 @@ archpy_disassemble (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } gdbpy_ref<> pc_obj = gdb_py_object_from_ulongest (pc); diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index e4f43e930d8..b93eaa48f2d 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -443,7 +443,7 @@ bppy_delete_breakpoint (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; @@ -640,7 +640,7 @@ bppy_get_commands (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return host_string_to_python_string (stb.c_str ()).release (); diff --git a/gdb/python/py-connection.c b/gdb/python/py-connection.c index 79e27677442..11e868c59e3 100644 --- a/gdb/python/py-connection.c +++ b/gdb/python/py-connection.c @@ -431,7 +431,7 @@ connpy_send_packet (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } } diff --git a/gdb/python/py-disasm.c b/gdb/python/py-disasm.c index 9b9b509748d..6697fd2b00b 100644 --- a/gdb/python/py-disasm.c +++ b/gdb/python/py-disasm.c @@ -595,7 +595,7 @@ disasmpy_builtin_disassemble (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (!str.empty ()) PyErr_SetString (gdbpy_gdberror_exc, str.c_str ()); @@ -933,7 +933,7 @@ disasmpy_result_str (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return PyUnicode_Decode (str.c_str (), str.size (), @@ -1512,7 +1512,7 @@ disasmpy_addr_part_str (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return PyUnicode_Decode (str.c_str (), str.size (), diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 7f617fa5cea..d5664fd51fc 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -115,7 +115,7 @@ frapy_is_valid (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (frame == NULL) @@ -143,7 +143,7 @@ frapy_name (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (name) @@ -177,7 +177,7 @@ frapy_type (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return gdb_py_object_from_longest (type).release (); @@ -198,7 +198,7 @@ frapy_arch (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return gdbarch_to_arch_object (obj->gdbarch); @@ -219,7 +219,7 @@ frapy_unwind_stop_reason (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } stop_reason = get_frame_unwind_stop_reason (frame); @@ -244,7 +244,7 @@ frapy_pc (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return gdb_py_object_from_ulongest (pc).release (); @@ -286,7 +286,7 @@ frapy_read_register (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -308,7 +308,7 @@ frapy_block (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } for (fn_block = block; @@ -347,7 +347,7 @@ frapy_function (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (sym) @@ -389,7 +389,7 @@ frame_info_to_frame_object (const frame_info_ptr &frame) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return (PyObject *) frame_obj.release (); @@ -413,7 +413,7 @@ frapy_older (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (prev) @@ -445,7 +445,7 @@ frapy_newer (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (next) @@ -477,7 +477,7 @@ frapy_find_sal (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return sal_obj; @@ -537,7 +537,7 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (!var) @@ -567,7 +567,7 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -588,7 +588,7 @@ frapy_select (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; @@ -609,7 +609,7 @@ frapy_level (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; @@ -632,7 +632,7 @@ frapy_language (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; @@ -653,7 +653,7 @@ frapy_static_link (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (link == nullptr) @@ -676,7 +676,7 @@ gdbpy_newest_frame (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return frame_info_to_frame_object (frame); @@ -696,7 +696,7 @@ gdbpy_selected_frame (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return frame_info_to_frame_object (frame); diff --git a/gdb/python/py-gdb-readline.c b/gdb/python/py-gdb-readline.c index 14a76b4fa13..ba5f74c1e99 100644 --- a/gdb/python/py-gdb-readline.c +++ b/gdb/python/py-gdb-readline.c @@ -59,7 +59,7 @@ gdbpy_readline_wrapper (FILE *sys_stdin, FILE *sys_stdout, /* This readline callback is called without the GIL held. */ gdbpy_gil gil; - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } /* Detect EOF (Ctrl-D). */ diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index ccc3e881702..6d838aefab2 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -412,7 +412,7 @@ infpy_threads (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } tuple = PyTuple_New (inf_obj->threads->size ()); @@ -578,7 +578,7 @@ infpy_read_memory (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } @@ -633,7 +633,7 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &ex) { - GDB_PY_HANDLE_EXCEPTION (ex); + return gdbpy_handle_gdb_exception (ex); } Py_RETURN_NONE; @@ -707,7 +707,7 @@ infpy_search_memory (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &ex) { - GDB_PY_HANDLE_EXCEPTION (ex); + return gdbpy_handle_gdb_exception (ex); } if (found) @@ -783,7 +783,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c index a17f25ed498..dd5241d4550 100644 --- a/gdb/python/py-infthread.c +++ b/gdb/python/py-infthread.c @@ -104,7 +104,7 @@ thpy_get_details (PyObject *self, void *ignore) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (extra_info == nullptr) Py_RETURN_NONE; @@ -212,7 +212,7 @@ thpy_get_ptid_string (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } } @@ -245,7 +245,7 @@ thpy_switch (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; @@ -330,7 +330,7 @@ thpy_thread_handle (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (hv.size () == 0) diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c index 8779716c4b9..a43398df4b8 100644 --- a/gdb/python/py-lazy-string.c +++ b/gdb/python/py-lazy-string.c @@ -148,7 +148,7 @@ stpy_convert_to_value (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -315,7 +315,7 @@ stpy_str (PyObject *self) } catch (const gdb_exception &exc) { - GDB_PY_HANDLE_EXCEPTION (exc); + return gdbpy_handle_gdb_exception (exc); } return host_string_to_python_string (stream.c_str ()).release (); diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c index e3e71f9e436..1bda5b92181 100644 --- a/gdb/python/py-linetable.c +++ b/gdb/python/py-linetable.c @@ -169,7 +169,7 @@ ltpy_get_pcs_for_line (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return build_line_table_tuple_from_pcs (py_line, pcs); diff --git a/gdb/python/py-mi.c b/gdb/python/py-mi.c index 0a636543f9a..3f6436f34d8 100644 --- a/gdb/python/py-mi.c +++ b/gdb/python/py-mi.c @@ -168,7 +168,7 @@ gdbpy_execute_mi_command (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return uiout.result ().release (); diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c index 6e8d5b57692..2d46c808d5e 100644 --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c @@ -162,7 +162,7 @@ objfpy_get_build_id (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (build_id != NULL) @@ -453,7 +453,7 @@ objfpy_add_separate_debug_file (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; @@ -488,7 +488,7 @@ objfpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; @@ -523,7 +523,7 @@ objfpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c index 5bc0015d728..8f150e59e8b 100644 --- a/gdb/python/py-progspace.c +++ b/gdb/python/py-progspace.c @@ -522,7 +522,7 @@ pspy_block_for_pc (PyObject *o, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (cust == NULL || cust->objfile () == NULL) @@ -564,7 +564,7 @@ pspy_find_pc_line (PyObject *o, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; diff --git a/gdb/python/py-record-btrace.c b/gdb/python/py-record-btrace.c index 30d0e8305db..6313110842d 100644 --- a/gdb/python/py-record-btrace.c +++ b/gdb/python/py-record-btrace.c @@ -217,7 +217,7 @@ recpy_bt_insn_sal (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -288,7 +288,7 @@ recpy_bt_insn_data (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } object = PyBytes_FromStringAndSize ((const char *) buffer.data (), @@ -318,7 +318,7 @@ recpy_bt_insn_decoded (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return PyBytes_FromString (strfile.string ().c_str ()); @@ -943,7 +943,7 @@ recpy_bt_goto (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; diff --git a/gdb/python/py-record.c b/gdb/python/py-record.c index 759bf3049cb..644dd509c57 100644 --- a/gdb/python/py-record.c +++ b/gdb/python/py-record.c @@ -681,7 +681,7 @@ gdbpy_start_recording (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } } @@ -713,7 +713,7 @@ gdbpy_stop_recording (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; diff --git a/gdb/python/py-stopevent.c b/gdb/python/py-stopevent.c index 47f81bd6c9a..faa20b20f62 100644 --- a/gdb/python/py-stopevent.c +++ b/gdb/python/py-stopevent.c @@ -74,7 +74,7 @@ py_print_bpstat (bpstat *bs, enum gdb_signal stop_signal) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } gdbpy_ref<> dict = uiout.result (); diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index 754420f3b56..64b1bc70630 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -222,7 +222,7 @@ sympy_needs_frame (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (result) @@ -307,7 +307,7 @@ sympy_value (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -425,7 +425,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } } @@ -436,7 +436,7 @@ gdbpy_lookup_symbol (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } gdbpy_ref<> ret_tuple (PyTuple_New (2)); @@ -485,7 +485,7 @@ gdbpy_lookup_global_symbol (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (symbol) @@ -553,7 +553,7 @@ gdbpy_lookup_static_symbol (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (symbol) @@ -631,7 +631,7 @@ gdbpy_lookup_static_symbols (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return return_list.release (); diff --git a/gdb/python/py-tui.c b/gdb/python/py-tui.c index 3bcd02da387..2a37762c63f 100644 --- a/gdb/python/py-tui.c +++ b/gdb/python/py-tui.c @@ -415,7 +415,7 @@ gdbpy_register_tui_window (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index c13b8610d37..8b544e72746 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -292,7 +292,7 @@ typy_fields_items (PyObject *self, enum gdbpy_iter_kind kind) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } gdbpy_ref<> type_holder; @@ -456,7 +456,7 @@ typy_is_array_like (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (result) @@ -480,7 +480,7 @@ typy_is_string_like (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (result) @@ -501,7 +501,7 @@ typy_strip_typedefs (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return type_to_type_object (type); @@ -522,7 +522,7 @@ typy_get_composite (struct type *type) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (!type->is_pointer_or_reference ()) @@ -592,7 +592,7 @@ typy_array_1 (PyObject *self, PyObject *args, int is_vector) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return type_to_type_object (array); @@ -626,7 +626,7 @@ typy_pointer (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return type_to_type_object (type); @@ -698,7 +698,7 @@ typy_reference (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return type_to_type_object (type); @@ -732,7 +732,7 @@ typy_const (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return type_to_type_object (type); @@ -750,7 +750,7 @@ typy_volatile (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return type_to_type_object (type); @@ -768,7 +768,7 @@ typy_unqualified (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return type_to_type_object (type); @@ -859,7 +859,7 @@ typy_lookup_typename (const char *type_name, const struct block *block) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return type; @@ -913,7 +913,7 @@ typy_lookup_type (struct demangle_component *demangled, } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } } @@ -955,7 +955,7 @@ typy_legacy_template_argument (struct type *type, const struct block *block, } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (! info) @@ -1034,7 +1034,7 @@ typy_template_argument (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } /* We might not have DW_TAG_template_*, so try to parse the type's @@ -1069,7 +1069,7 @@ typy_template_argument (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -1093,7 +1093,7 @@ typy_repr (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } auto py_typename = PyUnicode_Decode (type_name.c_str (), type_name.size (), host_charset (), NULL); @@ -1115,7 +1115,7 @@ typy_str (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return PyUnicode_Decode (thetype.c_str (), thetype.size (), @@ -1151,7 +1151,7 @@ typy_richcompare (PyObject *self, PyObject *other, int op) { /* If there is a GDB exception, a comparison is not capable (or trusted), so exit. */ - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } } @@ -1471,7 +1471,7 @@ type_to_type_object (struct type *type) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } type_obj = PyObject_New (type_object, &type_object_type); diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index e36768ecd12..720906fa384 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -228,7 +228,7 @@ unwind_infopy_str (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } } else @@ -378,7 +378,7 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } gdbpy_ref<> new_value = gdbpy_ref<>::new_reference (pyo_reg_value); @@ -429,7 +429,7 @@ pending_framepy_str (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return PyUnicode_FromFormat ("SP=%s,PC=%s", sp_str, pc_str); @@ -456,7 +456,7 @@ pending_framepy_repr (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return PyUnicode_FromFormat ("<%s level=%d, sp=%s, pc=%s>", @@ -505,7 +505,7 @@ pending_framepy_read_register (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -546,7 +546,7 @@ pending_framepy_name (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (name != nullptr) @@ -574,7 +574,7 @@ pending_framepy_pc (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return gdb_py_object_from_ulongest (pc).release (); @@ -601,7 +601,7 @@ pending_framepy_language (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; @@ -628,7 +628,7 @@ pending_framepy_find_sal (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return sal_obj; @@ -653,7 +653,7 @@ pending_framepy_block (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } for (fn_block = block; @@ -696,7 +696,7 @@ pending_framepy_function (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (sym != nullptr) diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index e9f151bfa7c..f64b004273f 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -257,7 +257,7 @@ valpy_dereference (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -300,7 +300,7 @@ valpy_referenced_value (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -323,7 +323,7 @@ valpy_reference_value (PyObject *self, PyObject *args, enum type_code refcode) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -369,7 +369,7 @@ valpy_to_array (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -393,7 +393,7 @@ valpy_const_value (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -499,7 +499,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (type == NULL) @@ -605,7 +605,7 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return str_obj; @@ -640,7 +640,7 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding; @@ -824,7 +824,7 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return PyUnicode_Decode (stb.c_str (), stb.size (), host_charset (), NULL); @@ -869,7 +869,7 @@ valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -1180,7 +1180,7 @@ valpy_getitem (PyObject *self, PyObject *key) } catch (const gdb_exception &ex) { - GDB_PY_HANDLE_EXCEPTION (ex); + return gdbpy_handle_gdb_exception (ex); } return result; @@ -1211,7 +1211,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (ftype->code () != TYPE_CODE_FUNC && ftype->code () != TYPE_CODE_METHOD @@ -1268,7 +1268,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -1293,7 +1293,7 @@ valpy_str (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return PyUnicode_Decode (stb.c_str (), stb.size (), host_charset (), NULL); @@ -1312,7 +1312,7 @@ valpy_get_is_optimized_out (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (opt) @@ -1334,7 +1334,7 @@ valpy_get_is_lazy (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (opt) @@ -1364,7 +1364,7 @@ valpy_get_bytes (PyObject *self, void *closure) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } value_obj->content_bytes @@ -1408,7 +1408,7 @@ valpy_fetch_lazy (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; @@ -1579,7 +1579,7 @@ valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -1647,7 +1647,7 @@ valpy_negative (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -1674,7 +1674,7 @@ valpy_absolute (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (isabs) @@ -1729,7 +1729,7 @@ valpy_invert (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -1856,7 +1856,7 @@ valpy_richcompare (PyObject *self, PyObject *other, int op) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } /* In this case, the Python exception has already been set. */ @@ -1895,7 +1895,7 @@ valpy_long (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (type->is_unsigned ()) @@ -1930,7 +1930,7 @@ valpy_float (PyObject *self) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return PyFloat_FromDouble (d); @@ -2056,7 +2056,7 @@ convert_value_from_python (PyObject *obj) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return value; @@ -2080,7 +2080,7 @@ gdbpy_history (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -2107,7 +2107,7 @@ gdbpy_add_history (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return nullptr; @@ -2152,7 +2152,7 @@ gdbpy_convenience_variable (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (result == nullptr && !found) @@ -2198,7 +2198,7 @@ gdbpy_set_convenience_variable (PyObject *self, PyObject *args) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE; diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index d3077713ca2..c62ba0ad66e 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -932,13 +932,6 @@ class gdbpy_gil PyGILState_STATE m_state; }; -/* Use this in a 'catch' block to convert the exception to a Python - exception and return nullptr. */ -#define GDB_PY_HANDLE_EXCEPTION(Exception) \ - do { \ - return gdbpy_handle_gdb_exception (Exception); \ - } while (0) - int gdbpy_print_python_errors_p (void); void gdbpy_print_stack (void); void gdbpy_print_stack_or_quit (); diff --git a/gdb/python/python.c b/gdb/python/python.c index a2ce1f6545a..0a0c0c5e196 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -593,7 +593,7 @@ gdbpy_parameter (PyObject *self, PyObject *args) } catch (const gdb_exception &ex) { - GDB_PY_HANDLE_EXCEPTION (ex); + return gdbpy_handle_gdb_exception (ex); } if (cmd == CMD_LIST_AMBIGUOUS) @@ -756,7 +756,7 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) convert the exception and continue back in Python, we should re-enable stdin here. */ async_enable_stdin (); - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } if (to_string) @@ -972,7 +972,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args) catch (const gdb_exception &ex) { /* We know this will always throw. */ - GDB_PY_HANDLE_EXCEPTION (ex); + return gdbpy_handle_gdb_exception (ex); } if (!sals.empty ()) @@ -1053,7 +1053,7 @@ gdbpy_parse_and_eval (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } return result; @@ -1538,7 +1538,7 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw) } catch (const gdb_exception &except) { - GDB_PY_HANDLE_EXCEPTION (except); + return gdbpy_handle_gdb_exception (except); } Py_RETURN_NONE;