From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id F24016E233; Fri, 4 Dec 2026 23:04:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F24016E233 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1796414661; bh=Csc5sp+KE75e1Ix+BzDALbLWEBnKjS2pgkHuLgfNt0A=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=pQ7pPyH4Dwqj6SJsePd1bcEOph3Ea7uV8rCkSd7CQ9bVOEzea2C0OxX+xZaBmpaQE qfYuzZKi/Wr8Tw/hiZI6St8XQWuzWFE00xBDnrAWLC19ysSLiomvoRRi85mnnYEDUU 4+5Enyt4i9pXue2hYyIdlGos1T46ShX5IxYMlrlo= Received: from send220.i.mail.ru (send220.i.mail.ru [95.163.59.59]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 595736E233 for ; Fri, 4 Dec 2026 23:03:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 595736E233 Received: by exim-smtp-654cd6fddf-k5fh4 with esmtpa (envelope-from ) id 1xZZV2-00000000BLH-0cJm; Fri, 04 Dec 2026 23:03:20 +0300 To: Sergey Kaplun , Sergey Bronnikov , Evgeniy Temirgaleev Date: Fri, 4 Dec 2026 23:03:03 +0300 Message-ID: <77f932c9d36b9b0851c8ee5b0bca2d40bd7ab193.1796410322.git.m.elhimov@vk.team> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-618D5548: 40581BF15683D4E033594132A326AF8B0F5931021EA63B6F1F67736ADFEE08CC9A98F4635948EB89 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9113121072BE468A18A0B108C203DA102F449588B29A30520182A05F53808504023F48B285DCB79523DE06ABAFEAF670527B73E5EDC09D933D6A80CCE374E938ADB5804FDCCB62C7C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7544B1CCE26E01C74EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566DDB58AA132F92B63E85556002FF74F11A2A1BBC6BFCD7AB0A621DF38D8C173008EEF46B7454FC60B9742502CCDD46D0DD95D32202655EC45BA3038C0950A5D36D5E8D9A59859A8B6BE1D45F1093D070476E601842F6C81A1F004C906525384303E02D724532EE2C3F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A3920E30A4C9C8E338DA0804E548844CE55C43847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A554710B807644E5375002B1117B3ED696598BAF4297EF33EF33EE06AFCD964888C21EFC0AA0C58C2ABFBD89AD4F5B216C1E618B5D5F965AFDB38C3BEEFD24A062B2D1C9E48B6DC60AE2A7E19323554B12787CBDA4B9FA07ACF6AAE36F1AF2432B4EAF44D9B582CE87C8A4C02DF684249CC203C45FEA855C8F X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE1918E10F71CB4DF9F9677DD89D51EBB774225B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659F8B548A4076F1AAEE5BACB5DB49484060CC7570FB2498E9927A1DA27EBCA601CAFCEF2016F383E85B8341EE9D5BE9A0AE93C58BB7D3DB0FC3BD0C96F8DD5C34E119BCCFF33512F0D9350E1BD188BD56E4C41F94D744909CE9D6718F459EE2962AE54DA86D399E591103B389C0A9E82E8 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXOcIETfglQORZ0zpDET4Zrk3igikrdHlWMmolxgYeyMksl0Q2O/NArY= X-Mailru-Sender: 49D287FBCBBF3A5CED14BED3BAAFB6991669DDA9602C022FB951B70A5BD4BD8E2EC8419DD42E0F2A87D154BA7A9C8918EAA2F645D7D0C73F8B67290C0B8F2C0D12EEFBA914E8A1CE696B58449F085A8023028798991C5DA182F85D6DCAB44FBA5FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit v2 2/7] dbg: cleanup and unify `dbg.eval` X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mikhail Elhimov via Tarantool-patches Reply-To: Mikhail Elhimov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" * unified error handling (`lldv.eval` now throws an exception in case of evaluation failure) * in `gdb.eval` dropped check of the value returned by `gdb.parse_and_eval` as it would also fail for an expression like '0' (looks like a kind of experimental code that had been left by mistake) * `lldb.eval` is adjusted to return object of the same type as `lldb.cast` (this improves consistency as `gdb.eval` also returns the same type as `gdb.cast`) * renamed `dbg.eval` argument to reflect its meaning (it's an expression rather than a command) --- src/luajit_dbg.py | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/luajit_dbg.py b/src/luajit_dbg.py index f498ef3d..cfc3961c 100644 --- a/src/luajit_dbg.py +++ b/src/luajit_dbg.py @@ -150,8 +150,8 @@ class Debugger(object): pass @abc.abstractmethod - def eval(self, command): - '''Parse and evaluate the given debugger command.''' + def eval(self, expr): + '''Parse and evaluate the given debugger expression.''' pass @abc.abstractmethod @@ -272,14 +272,11 @@ class _GDBDebugger(Debugger): else: return None - def eval(self, command): - if not command: + def eval(self, expr): + if not expr: return None - ret = gdb.parse_and_eval(command) - if not ret: - raise gdb.GdbError('table argument empty') - return ret + return gdb.parse_and_eval(expr) def detect_arch(self): if hasattr(self, 'arch'): @@ -674,15 +671,29 @@ class _LLDBDebugger(Debugger): else: return None - def eval(self, command): - if not command: + def eval(self, expr): + if not expr: return None process = self.target.GetProcess() thread = process.GetSelectedThread() frame = thread.GetSelectedFrame() - ret = frame.EvaluateExpression(command) - return ret + val = frame.EvaluateExpression(expr) + # LLDB doesn't throw an exception if it fails to + # evaluate an expression. In order to simplify handling + # of `Debugger.eval()` it is convenient to make it work + # similar to GDB, i.e. throw an exception in case of + # failure. + # Be aware that SBValue.IsValid() is necessary, but not + # sufficient as it only indicates that the value object + # does contain the relevant data (including the potential + # error), so it is necessary to check the `error` property + # as well. + if not val.IsValid(): + raise self.error('{}: invalid expression'.format(expr)) + if val.error.fail: + raise self.error(val.error) + return lldb.value(val) def detect_arch(self): if hasattr(self, 'arch'): -- 2.55.0