From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by sourceware.org (Postfix) with ESMTPS id F0A753858D37 for ; Thu, 6 Oct 2022 19:12:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F0A753858D37 Received: by mail-il1-x136.google.com with SMTP id m14so1464184ilf.12 for ; Thu, 06 Oct 2022 12:12:19 -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:message-id :reply-to; bh=cdEpjpgLXn/KFOIgpz41OzZnk8OOrLoAGviuxCTYBv4=; b=HZsvnZmYP6dKG5VS7NOxsfhTJsuHtpn9DHLPmeY0kOxX+KX5DmmxfDYfUidI7lZVZe /RZqHsStQIdaLspWW0k8WlkO0Cmlhb8teYms1wQoLI/L94JeRT4JomxaF9Djos6M/HzW pK2pBKNKMABkv4zxqUF4PQcAyqu//7tf/1ktVG1sOUYVR8uk9jwZoZ6J3KnshYZIkUA4 RXi789gakXm/OyLv4dEQl9KGstWNRMKzS4PDafR0Q3zYqOYSG3/+mDDBHv4SCbCmn+V1 O+N/WQTlBGBWArUP/6dCqhMbrzp+eFf3IfSm+PRsWw/hxf6m2n1h2wXw7JCJEUHX5Nha OVug== X-Gm-Message-State: ACrzQf20l7QRJX/vEiCno6TWX4SLzXaHub86SHY6CqMx+H1i7+7h0UN4 jRrwXw8vS8gZbUdpXH/eNT0mb0jNEoZaIw== X-Google-Smtp-Source: AMsMyM5eomV+127SVG9NuwqcZlQZp+IbvHqY9NQHWsAJ3lohhlTMPDY5U3z3cM5Tha3QfF/6fHOZrg== X-Received: by 2002:a05:6e02:1bcf:b0:2f6:a41b:cc11 with SMTP id x15-20020a056e021bcf00b002f6a41bcc11mr549020ilv.103.1665083539115; Thu, 06 Oct 2022 12:12:19 -0700 (PDT) Received: from localhost.localdomain (71-211-160-49.hlrn.qwest.net. [71.211.160.49]) by smtp.gmail.com with ESMTPSA id c41-20020a02962c000000b003580ab611a2sm74518jai.93.2022.10.06.12.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 12:12:18 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed] Fix indentation in riscv-tdep.c Date: Thu, 6 Oct 2022 13:12:12 -0600 Message-Id: <20221006191212.1706949-1-tromey@adacore.com> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.2 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Oct 2022 19:12:22 -0000 This just fixes some indentation in riscv-tdep.c. --- gdb/riscv-tdep.c | 306 +++++++++++++++++++++++------------------------ 1 file changed, 153 insertions(+), 153 deletions(-) diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index 63ebed4ff19..feca17d9141 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -3241,173 +3241,173 @@ riscv_return_value (struct gdbarch *gdbarch, if (readbuf != nullptr || writebuf != nullptr) { - unsigned int arg_len; - struct value *abi_val; - gdb_byte *old_readbuf = nullptr; - int regnum; - - /* We only do one thing at a time. */ - gdb_assert (readbuf == nullptr || writebuf == nullptr); - - /* In some cases the argument is not returned as the declared type, - and we need to cast to or from the ABI type in order to - correctly access the argument. When writing to the machine we - do the cast here, when reading from the machine the cast occurs - later, after extracting the value. As the ABI type can be - larger than the declared type, then the read or write buffers - passed in might be too small. Here we ensure that we are using - buffers of sufficient size. */ - if (writebuf != nullptr) + unsigned int arg_len; + struct value *abi_val; + gdb_byte *old_readbuf = nullptr; + int regnum; + + /* We only do one thing at a time. */ + gdb_assert (readbuf == nullptr || writebuf == nullptr); + + /* In some cases the argument is not returned as the declared type, + and we need to cast to or from the ABI type in order to + correctly access the argument. When writing to the machine we + do the cast here, when reading from the machine the cast occurs + later, after extracting the value. As the ABI type can be + larger than the declared type, then the read or write buffers + passed in might be too small. Here we ensure that we are using + buffers of sufficient size. */ + if (writebuf != nullptr) + { + struct value *arg_val; + + if (is_fixed_point_type (arg_type)) + { + /* Convert the argument to the type used to pass + the return value, but being careful to preserve + the fact that the value needs to be returned + unscaled. */ + gdb_mpz unscaled; + + unscaled.read (gdb::make_array_view (writebuf, + arg_type->length ()), + type_byte_order (arg_type), + arg_type->is_unsigned ()); + abi_val = allocate_value (info.type); + unscaled.write (value_contents_raw (abi_val), + type_byte_order (info.type), + info.type->is_unsigned ()); + } + else + { + arg_val = value_from_contents (arg_type, writebuf); + abi_val = value_cast (info.type, arg_val); + } + writebuf = value_contents_raw (abi_val).data (); + } + else + { + abi_val = allocate_value (info.type); + old_readbuf = readbuf; + readbuf = value_contents_raw (abi_val).data (); + } + arg_len = info.type->length (); + + switch (info.argloc[0].loc_type) + { + /* Return value in register(s). */ + case riscv_arg_info::location::in_reg: { - struct value *arg_val; + regnum = info.argloc[0].loc_data.regno; + gdb_assert (info.argloc[0].c_length <= arg_len); + gdb_assert (info.argloc[0].c_length + <= register_size (gdbarch, regnum)); - if (is_fixed_point_type (arg_type)) + if (readbuf) { - /* Convert the argument to the type used to pass - the return value, but being careful to preserve - the fact that the value needs to be returned - unscaled. */ - gdb_mpz unscaled; - - unscaled.read (gdb::make_array_view (writebuf, - arg_type->length ()), - type_byte_order (arg_type), - arg_type->is_unsigned ()); - abi_val = allocate_value (info.type); - unscaled.write (value_contents_raw (abi_val), - type_byte_order (info.type), - info.type->is_unsigned ()); + gdb_byte *ptr = readbuf + info.argloc[0].c_offset; + regcache->cooked_read_part (regnum, 0, + info.argloc[0].c_length, + ptr); } - else + + if (writebuf) { - arg_val = value_from_contents (arg_type, writebuf); - abi_val = value_cast (info.type, arg_val); + const gdb_byte *ptr = writebuf + info.argloc[0].c_offset; + riscv_regcache_cooked_write (regnum, ptr, + info.argloc[0].c_length, + regcache, call_info.flen); + } + + /* A return value in register can have a second part in a + second register. */ + if (info.argloc[1].c_length > 0) + { + switch (info.argloc[1].loc_type) + { + case riscv_arg_info::location::in_reg: + regnum = info.argloc[1].loc_data.regno; + + gdb_assert ((info.argloc[0].c_length + + info.argloc[1].c_length) <= arg_len); + gdb_assert (info.argloc[1].c_length + <= register_size (gdbarch, regnum)); + + if (readbuf) + { + readbuf += info.argloc[1].c_offset; + regcache->cooked_read_part (regnum, 0, + info.argloc[1].c_length, + readbuf); + } + + if (writebuf) + { + const gdb_byte *ptr + = writebuf + info.argloc[1].c_offset; + riscv_regcache_cooked_write + (regnum, ptr, info.argloc[1].c_length, + regcache, call_info.flen); + } + break; + + case riscv_arg_info::location::by_ref: + case riscv_arg_info::location::on_stack: + default: + error (_("invalid argument location")); + break; + } } - writebuf = value_contents_raw (abi_val).data (); - } - else - { - abi_val = allocate_value (info.type); - old_readbuf = readbuf; - readbuf = value_contents_raw (abi_val).data (); } - arg_len = info.type->length (); + break; - switch (info.argloc[0].loc_type) + /* Return value by reference will have its address in A0. */ + case riscv_arg_info::location::by_ref: { - /* Return value in register(s). */ - case riscv_arg_info::location::in_reg: - { - regnum = info.argloc[0].loc_data.regno; - gdb_assert (info.argloc[0].c_length <= arg_len); - gdb_assert (info.argloc[0].c_length - <= register_size (gdbarch, regnum)); - - if (readbuf) - { - gdb_byte *ptr = readbuf + info.argloc[0].c_offset; - regcache->cooked_read_part (regnum, 0, - info.argloc[0].c_length, - ptr); - } + ULONGEST addr; + + regcache_cooked_read_unsigned (regcache, RISCV_A0_REGNUM, + &addr); + if (readbuf != nullptr) + read_memory (addr, readbuf, info.length); + if (writebuf != nullptr) + write_memory (addr, writebuf, info.length); + } + break; - if (writebuf) - { - const gdb_byte *ptr = writebuf + info.argloc[0].c_offset; - riscv_regcache_cooked_write (regnum, ptr, - info.argloc[0].c_length, - regcache, call_info.flen); - } + case riscv_arg_info::location::on_stack: + default: + error (_("invalid argument location")); + break; + } - /* A return value in register can have a second part in a - second register. */ - if (info.argloc[1].c_length > 0) - { - switch (info.argloc[1].loc_type) - { - case riscv_arg_info::location::in_reg: - regnum = info.argloc[1].loc_data.regno; - - gdb_assert ((info.argloc[0].c_length - + info.argloc[1].c_length) <= arg_len); - gdb_assert (info.argloc[1].c_length - <= register_size (gdbarch, regnum)); - - if (readbuf) - { - readbuf += info.argloc[1].c_offset; - regcache->cooked_read_part (regnum, 0, - info.argloc[1].c_length, - readbuf); - } - - if (writebuf) - { - const gdb_byte *ptr - = writebuf + info.argloc[1].c_offset; - riscv_regcache_cooked_write - (regnum, ptr, info.argloc[1].c_length, - regcache, call_info.flen); - } - break; - - case riscv_arg_info::location::by_ref: - case riscv_arg_info::location::on_stack: - default: - error (_("invalid argument location")); - break; - } - } - } - break; + /* This completes the cast from abi type back to the declared type + in the case that we are reading from the machine. See the + comment at the head of this block for more details. */ + if (readbuf != nullptr) + { + struct value *arg_val; - /* Return value by reference will have its address in A0. */ - case riscv_arg_info::location::by_ref: + if (is_fixed_point_type (arg_type)) { - ULONGEST addr; - - regcache_cooked_read_unsigned (regcache, RISCV_A0_REGNUM, - &addr); - if (readbuf != nullptr) - read_memory (addr, readbuf, info.length); - if (writebuf != nullptr) - write_memory (addr, writebuf, info.length); + /* Convert abi_val to the actual return type, but + being careful to preserve the fact that abi_val + is unscaled. */ + gdb_mpz unscaled; + + unscaled.read (value_contents (abi_val), + type_byte_order (info.type), + info.type->is_unsigned ()); + arg_val = allocate_value (arg_type); + unscaled.write (value_contents_raw (arg_val), + type_byte_order (arg_type), + arg_type->is_unsigned ()); } - break; - - case riscv_arg_info::location::on_stack: - default: - error (_("invalid argument location")); - break; - } - - /* This completes the cast from abi type back to the declared type - in the case that we are reading from the machine. See the - comment at the head of this block for more details. */ - if (readbuf != nullptr) - { - struct value *arg_val; - - if (is_fixed_point_type (arg_type)) - { - /* Convert abi_val to the actual return type, but - being careful to preserve the fact that abi_val - is unscaled. */ - gdb_mpz unscaled; - - unscaled.read (value_contents (abi_val), - type_byte_order (info.type), - info.type->is_unsigned ()); - arg_val = allocate_value (arg_type); - unscaled.write (value_contents_raw (arg_val), - type_byte_order (arg_type), - arg_type->is_unsigned ()); - } - else - arg_val = value_cast (arg_type, abi_val); - memcpy (old_readbuf, value_contents_raw (arg_val).data (), - arg_type->length ()); - } + else + arg_val = value_cast (arg_type, abi_val); + memcpy (old_readbuf, value_contents_raw (arg_val).data (), + arg_type->length ()); + } } switch (info.argloc[0].loc_type) -- 2.34.3