From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by sourceware.org (Postfix) with ESMTPS id 51D1A3858C74 for ; Thu, 9 Mar 2023 17:51:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 51D1A3858C74 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-il1-x12c.google.com with SMTP id w4so1508732ilv.0 for ; Thu, 09 Mar 2023 09:51:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1678384275; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tlYvavASI9X5I5aHFhOUxljjSRmx8DAqoND/Kw/nB5Y=; b=B7dscLZ1+KsfJi3YSJ0nrVEoktXGMpoip3CVuxssqKvnCc354J0bHzAlYsdfmIpfi4 xjIw75UTc29yB0r60JWOv09VIi9UJMYp5US5xK6l75inY5X9Y/5IjKciUWxeSQHaNAU/ Z0veJ31QiAUowK+b5oL7+27K2ku8KZO21Zw+caeN8y5D/CdLTTvcqqeDsHG4i/WiTtb0 Sm6bm4dFCYpGnvhkslDbIuRXCMquKfmnQK8rXzFsn8lzQqzyYCyzeAC3AkUSvZNklQuD eKxdRWjuKpCuXBFrltKAWJlPNZ/NXQWM4rkHsP638Tw65F+gAtboWZrMu/onaPieLITz tOdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678384275; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tlYvavASI9X5I5aHFhOUxljjSRmx8DAqoND/Kw/nB5Y=; b=DcaAvKIQ3juMPBb3z0X5KKtSSmjkuMLypdX1GyOLrg2U4MHs6CRFI4Owl7z3+JGF7K KwKUo46YVR+nDG1pT0p3rvwLs5J8jxsQcqCFOpCiCGAlbtelDfT3o9rLN5XrafuidP35 PWy/4he0J2uaU7Bd4vdilrfNQuVSqV1kH3UemHTSRRc5r4qnS7DABe8iEqpwBhzvdx9m U7/wROGF+ogwYoR8Cba+9AumhldSTZsLmYvIfcNUHeKT5yLvRXIjsUOxLn98kShQfDuR Mh3d2ZslBCf0AB8/Pomsgjn9Ej7HUoV9g6vLTpiP9INv6hpD1+P+RBe5MeLcCdvmZumR k1ug== X-Gm-Message-State: AO0yUKXFMr5Dm6pw+hWTQ/CI8A+Vxcdz0sDl0rc9RIGgV5JYGLZDp+Xi r/z2LRy6mgnJMOVZHxj5K6c+WKWK4vnUe7CkpLs= X-Google-Smtp-Source: AK7set+OAgh2BQuulx4ygCCMwYkjGh0RFmGaYU+Yv6W9BPPGTKO7xgvSGVr/0mdgpCtHxFtR4l31Qw== X-Received: by 2002:a05:6e02:1b87:b0:313:c74c:725a with SMTP id h7-20020a056e021b8700b00313c74c725amr17195095ili.12.1678384275455; Thu, 09 Mar 2023 09:51:15 -0800 (PST) Received: from localhost.localdomain (71-211-185-113.hlrn.qwest.net. [71.211.185.113]) by smtp.gmail.com with ESMTPSA id j5-20020a056e020ee500b00315785bfabfsm5572276ilk.47.2023.03.09.09.51.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 09:51:15 -0800 (PST) From: Tom Tromey Date: Thu, 09 Mar 2023 10:50:56 -0700 Subject: [PATCH 2/3] Pass a frame to value_at_lazy and value_from_contents_and_address MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230309-submit-static-link-fix-v1-2-23af27781fd2@adacore.com> References: <20230309-submit-static-link-fix-v1-0-23af27781fd2@adacore.com> In-Reply-To: <20230309-submit-static-link-fix-v1-0-23af27781fd2@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This patch adds a 'frame' parameter to value_at_lazy and ensures that it is passed down to the call to resolve_dynamic_type. This required also adding a frame parameter to value_from_contents_and_address. Nothing passes this parameter to value_at_lazy yet, so this patch should have no visible effect. --- gdb/valops.c | 11 ++++++----- gdb/value.c | 6 ++++-- gdb/value.h | 14 ++++++++++---- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/gdb/valops.c b/gdb/valops.c index 3a1b14c3d44..e14c5d05c06 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -982,14 +982,15 @@ value_one (struct type *type) e.g. in case the type is a variable length array. */ static struct value * -get_value_at (struct type *type, CORE_ADDR addr, int lazy) +get_value_at (struct type *type, CORE_ADDR addr, frame_info_ptr frame, + int lazy) { struct value *val; if (check_typedef (type)->code () == TYPE_CODE_VOID) error (_("Attempt to dereference a generic pointer.")); - val = value_from_contents_and_address (type, NULL, addr); + val = value_from_contents_and_address (type, NULL, addr, frame); if (!lazy) val->fetch_lazy (); @@ -1015,7 +1016,7 @@ get_value_at (struct type *type, CORE_ADDR addr, int lazy) struct value * value_at (struct type *type, CORE_ADDR addr) { - return get_value_at (type, addr, 0); + return get_value_at (type, addr, nullptr, 0); } /* See value.h. */ @@ -1034,9 +1035,9 @@ value_at_non_lval (struct type *type, CORE_ADDR addr) e.g. in case the type is a variable length array. */ struct value * -value_at_lazy (struct type *type, CORE_ADDR addr) +value_at_lazy (struct type *type, CORE_ADDR addr, frame_info_ptr frame) { - return get_value_at (type, addr, 1); + return get_value_at (type, addr, frame, 1); } void diff --git a/gdb/value.c b/gdb/value.c index 7b4df338304..253ed3d596d 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3438,12 +3438,14 @@ value_from_contents_and_address_unresolved (struct type *type, struct value * value_from_contents_and_address (struct type *type, const gdb_byte *valaddr, - CORE_ADDR address) + CORE_ADDR address, + frame_info_ptr frame) { gdb::array_view view; if (valaddr != nullptr) view = gdb::make_array_view (valaddr, type->length ()); - struct type *resolved_type = resolve_dynamic_type (type, view, address); + struct type *resolved_type = resolve_dynamic_type (type, view, address, + &frame); struct type *resolved_type_no_typedef = check_typedef (resolved_type); struct value *v; diff --git a/gdb/value.h b/gdb/value.h index d83c4ab3674..02d66a80ef8 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -1077,7 +1077,13 @@ extern struct value *value_from_component (struct value *, struct type *, extern struct value *value_at (struct type *type, CORE_ADDR addr); -extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); + +/* Return a new value given a type and an address. The new value is + lazy. If FRAME is given, it is used when resolving dynamic + properties. */ + +extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr, + frame_info_ptr frame = nullptr); /* Like value_at, but ensures that the result is marked not_lval. This can be important if the memory is "volatile". */ @@ -1085,9 +1091,9 @@ extern struct value *value_at_non_lval (struct type *type, CORE_ADDR addr); extern struct value *value_from_contents_and_address_unresolved (struct type *, const gdb_byte *, CORE_ADDR); -extern struct value *value_from_contents_and_address (struct type *, - const gdb_byte *, - CORE_ADDR); +extern struct value *value_from_contents_and_address + (struct type *, const gdb_byte *, CORE_ADDR, + frame_info_ptr frame = nullptr); extern struct value *value_from_contents (struct type *, const gdb_byte *); extern struct value *default_value_from_register (struct gdbarch *gdbarch, -- 2.39.1