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 670C36F3C8; Wed, 5 Oct 2022 17:43:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 670C36F3C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1664981019; bh=1QIUBuzYSkG9wcFJYlFqfriky/jVXTnv/Y7mBJXsCHk=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=JLOibQhWfVu/FJLGoQ/hy9ZdXlY2GPVg36vprR3rFkex4ViyH5Y625Z+Ng3siF96n ey7a+XdxuB1AQ9nS4lvtQBUGc3VsNUG4OV/k19RGu3Gpy4jRi6shtvB+mUxX/Avukk 3JQpmdOOo68l0iEYqNrhpGilNyYG1IMBeiN2Y26I= Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 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 7C00D6F3C8 for ; Wed, 5 Oct 2022 17:43:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7C00D6F3C8 Received: by mail-lf1-f47.google.com with SMTP id z4so25874947lft.2 for ; Wed, 05 Oct 2022 07:43:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=CSI77+LFEeMC7uoJNSfsAQMsGguBUVYhSRj7Ru4E+p4=; b=HBvwQMLSAmW7Jcy9FJ6QLLqtp3/kr/TkVd0FVdqV3mtESSseUgKdcCmPkndBFQwvsf BZYi0svTXYJyzqjx8MJF4suuuDEzLPOMxXjILQ7MU6pgjwCQ8ToNinOuwCmfF7skXD0r UzMYnQD9Hd6Bs90x3D2FAuaJm96Zm//3CnAOMU8QpmyuVfMrG/tM4ByHPJNCO3pmSRme DwFg4bOX9q+NiQWdiKPBkpYtMIfH/0LmMIzcTZW3767KEJtuBWJszefJT+mG/oomdL1r F05uxZoewQd4zioPbVAIMggH/QxQxJzeVpcWNFIIYb0Q+1whNzPHXYLSNeuocUuEUJFF VtXg== X-Gm-Message-State: ACrzQf0nOeLvvqw02CQur+cGpRoEDekUK4GozEtm7yTNvvDPNfEjhvMW MyH/LzNmzDNZSLkp3ZHIg/gFmR8+5+dQRZog X-Google-Smtp-Source: AMsMyM64xBC/jxuYuEQVqK8Rkf9YRxJ+1QdQS1QLuW/KPz4A73IsI97Ky4nh1JX8r9Z+27I9w5f/Vw== X-Received: by 2002:a05:6512:39c9:b0:4a2:6b19:426f with SMTP id k9-20020a05651239c900b004a26b19426fmr67457lfu.66.1664981015375; Wed, 05 Oct 2022 07:43:35 -0700 (PDT) Received: from localhost.localdomain (128-69-252-100.broadband.corbina.ru. [128.69.252.100]) by smtp.gmail.com with ESMTPSA id o4-20020a05651205c400b004a2588520f5sm676010lfo.166.2022.10.05.07.43.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 07:43:34 -0700 (PDT) X-Google-Original-From: Maxim Kokryashkin To: tarantool-patches@dev.tarantool.org, sergos@tarantool.org, skaplun@tarantool.org Date: Wed, 5 Oct 2022 17:43:31 +0300 Message-Id: <20221005144331.39666-1-m.kokryashkin@tarantool.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit] luajit-gdb: support full-range 64-bit lightud 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Following up the introduction of full-range 64-bit lightuserdata support in commit 2cacfa8 ("Add support for full-range 64 bit lightuserdata."), this patch modifies the corresponding dumper behavior for LJ_64 platforms in the luajit-gdb extension. Resolves tarantool/tarantool#6481 --- Branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-6481-luajit-gdb-light-ud Issue: https://github.com/tarantool/tarantool/issues/6481 src/luajit-gdb.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py index 6480d014..2993f2c1 100644 --- a/src/luajit-gdb.py +++ b/src/luajit-gdb.py @@ -166,6 +166,9 @@ LJ_GCVMASK = ((1 << 47) - 1) LJ_TISNUM = None PADDING = None +LJ_LIGHTUD_BITS_SEG = 8 +LJ_LIGHTUD_BITS_LO = 47 - LJ_LIGHTUD_BITS_SEG + # }}} def itype(o): @@ -315,6 +318,12 @@ def frames(L): break framelink = frame_prev(framelink) +def lightudseg(u): + return (u >> LJ_LIGHTUD_BITS_LO) & ((1 << LJ_LIGHTUD_BITS_SEG) - 1) + +def lightudlo(u): + return u & ((1 << LJ_LIGHTUD_BITS_LO) - 1) + # Dumpers {{{ def dump_lj_tnil(tv): @@ -327,7 +336,14 @@ def dump_lj_ttrue(tv): return 'true' def dump_lj_tlightud(tv): - return 'light userdata @ {}'.format(strx64(gcval(tv['gcr']))) + if LJ_64: + u = int(tv['u64']) + seg = lightudseg(u) + segmap = mref('uint32_t *', G(L(None))['gc']['lightudseg']) + addr = (int(segmap[seg]) << 32) | lightudlo(u) + else: + addr = gcval(tv['gcr']) + return 'light userdata @ {}'.format(strx64(addr)) def dump_lj_tstr(tv): return 'string {body} @ {address}'.format( -- 2.36.1