From patchwork Tue May 5 18:22:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 6570 Received: (qmail 43618 invoked by alias); 5 May 2015 18:22:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 43583 invoked by uid 89); 5 May 2015 18:22:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 05 May 2015 18:22:42 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 638CC285AE for ; Tue, 5 May 2015 14:22:40 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id BZJbVr9UfQVr for ; Tue, 5 May 2015 14:22:40 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 3343B285AF for ; Tue, 5 May 2015 14:22:40 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 50B7440EAD; Tue, 5 May 2015 11:22:40 -0700 (PDT) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [pushed/Ada] Further document ada-lang.c::value_assign_to_component & fix whitespaces. Date: Tue, 5 May 2015 11:22:36 -0700 Message-Id: <1430850156-13216-1-git-send-email-brobecker@adacore.com> Hello, This patch improves the documentation of ada-lang.c's value_assign_to_component to publish the fact that it also works with not_lval values. And touching this area of the code showed that there were a number of whitespace issues, as well as a formatting issue of the main comment (no leading '*' on each line). This patch fixes those while at it. No functional change, however. gdb/ChangeLog: * ada-lang.c (value_assign_to_component): Reformat and improve documentation. Remove all trailing spaces. Tested on x86_64-linux (although obvious), and pushed. Thanks, diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f36a762..98558f7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2015-05-05 Joel Brobecker + * ada-lang.c (value_assign_to_component): Reformat and improve + documentation. Remove all trailing spaces. + +2015-05-05 Joel Brobecker + * inline-frame.c (inline_frame_sniffer, skip_inline_frames): Stop counting inlined frames as soon as an out-of-line function is found. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c56e8bb..7fe85c0 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2682,21 +2682,27 @@ ada_value_assign (struct value *toval, struct value *fromval) } -/* Given that COMPONENT is a memory lvalue that is part of the lvalue - * CONTAINER, assign the contents of VAL to COMPONENTS's place in - * CONTAINER. Modifies the VALUE_CONTENTS of CONTAINER only, not - * COMPONENT, and not the inferior's memory. The current contents - * of COMPONENT are ignored. */ +/* Given that COMPONENT is a memory lvalue that is part of the lvalue + CONTAINER, assign the contents of VAL to COMPONENTS's place in + CONTAINER. Modifies the VALUE_CONTENTS of CONTAINER only, not + COMPONENT, and not the inferior's memory. The current contents + of COMPONENT are ignored. + + Although not part of the initial design, this function also works + when CONTAINER and COMPONENT are not_lval's: it works as if CONTAINER + had a null address, and COMPONENT had an address which is equal to + its offset inside CONTAINER. */ + static void value_assign_to_component (struct value *container, struct value *component, struct value *val) { LONGEST offset_in_container = (LONGEST) (value_address (component) - value_address (container)); - int bit_offset_in_container = + int bit_offset_in_container = value_bitpos (component) - value_bitpos (container); int bits; - + val = value_cast (value_type (component), val); if (value_bitsize (component) == 0) @@ -2705,17 +2711,17 @@ value_assign_to_component (struct value *container, struct value *component, bits = value_bitsize (component); if (gdbarch_bits_big_endian (get_type_arch (value_type (container)))) - move_bits (value_contents_writeable (container) + offset_in_container, + move_bits (value_contents_writeable (container) + offset_in_container, value_bitpos (container) + bit_offset_in_container, value_contents (val), TYPE_LENGTH (value_type (component)) * TARGET_CHAR_BIT - bits, bits, 1); else - move_bits (value_contents_writeable (container) + offset_in_container, + move_bits (value_contents_writeable (container) + offset_in_container, value_bitpos (container) + bit_offset_in_container, value_contents (val), 0, bits, 0); -} - +} + /* The value of the element of array ARR at the ARITY indices given in IND. ARR may be either a simple array, GNAT array descriptor, or pointer thereto. */