From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 43C5B3851C1F; Sat, 2 Jan 2021 19:12:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 43C5B3851C1F From: "hi-angel at yandex dot ru" To: gdb-prs@sourceware.org Subject: [Bug python/27141] New: [RFE] Getting a python-call result is overly complicated Date: Sat, 02 Jan 2021 19:12:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: 10.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hi-angel at yandex dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2021 19:12:42 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D27141 Bug ID: 27141 Summary: [RFE] Getting a python-call result is overly complicated Product: gdb Version: 10.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: python Assignee: unassigned at sourceware dot org Reporter: hi-angel at yandex dot ru Target Milestone: --- Unless I'm missing something, the only way to get a return value from pytho= n is to write a whole separate class with two methods.=C2=B9 This is unwieldy an= d hinders quick scripting. For example, right now I want to set `commands` to a breakpoint so the debu= gee gets only paused when there's a certain string somewhere in the `bt` comman= d. Well, the check is really easy to script up: py 'my_string' in gdb.execute('bt', to_string=3DTrue) But then if I execute it as part of gdb "if" statement, I'll get No symbol "py" in current context. Having to write a whole "convenience" function means not only a redundant t= ext, but also a need to debug it. Also, if one has to debug it in the current session, my experience says that unless they already know how it works, they might screw up the current session (that's what happened to me back when I = was trying to make pretty-printers work with no experience on them) So, it would be really helpful to either teach `py` and/or `pi` calls to re= turn values, so they can be executed as part of any other GDB command chain, or = to introduce a new (a `p1`?) call for that purpose. 1: https://sourceware.org/gdb/current/onlinedocs/gdb/Functions-In-Python.ht= ml --=20 You are receiving this mail because: You are on the CC list for the bug.=