From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Hui Li <lihui@loongson.cn>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb/testsuite: Skip dump ihex for 64-bit address in gdb.base/dump.exp
Date: Fri, 14 Apr 2023 20:11:24 +0800 [thread overview]
Message-ID: <8f371758-3130-1560-1f5d-5ed7b29f3935@loongson.cn> (raw)
In-Reply-To: <20230410015236.25639-1-lihui@loongson.cn>
On 4/10/23 09:52, Hui Li wrote:
> (1) Description of problem
>
> In the current code, when execute the following test on LoongArch:
>
> $make check-gdb TESTS="gdb.base/dump.exp"
> ```
> FAIL: gdb.base/dump.exp: dump array as value, intel hex
> FAIL: gdb.base/dump.exp: dump struct as value, intel hex
> FAIL: gdb.base/dump.exp: dump array as memory, ihex
> FAIL: gdb.base/dump.exp: dump struct as memory, ihex
>
> ```
> These tests passed on the X86_64,
>
> (2) Root cause
>
> On LoongArch, variable intarray address 0x120008068 out of range for IHEX,
> so dump ihex test failed.
>
> gdb.base/dump.exp has the following code to check 64-bit address
>
> ```
> # Check the address of a variable. If it is bigger than 32-bit,
> # assume our target has 64-bit addresses that are not supported by SREC,
> # IHEX and TEKHEX. We skip those tests then.
> set max_32bit_address "0xffffffff"
> set data_address [get_hexadecimal_valueof "&intarray" 0x100000000]
> if {${data_address} > ${max_32bit_address}} {
> set is64bitonly "yes"
> }
> ```
>
> We check the "&intarray" on different target as follow:
>
> ```
> $gdb gdb/testsuite/outputs/gdb.base/dump/dump
> ...
> (gdb) start
> ...
>
> On X86_64:
> (gdb) print /x &intarray
> $1 = 0x404060
>
> On LoongArch:
> (gdb) print /x &intarray
> $1 = 0x120008068
> ```
> The variable address difference here is due to the link script
> of linker.
>
> ```
> On X86_64:
> $ld --verbose
> ...
> PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000));
> . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;
>
> On LoongArch:
> $ld --verbose
> ...
> PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x120000000));
> . = SEGMENT_START("text-segment", 0x120000000) + SIZEOF_HEADERS;
>
> ```
>
> (3) How to fix
>
> Because 64-bit variable address out of range for IHEX, it's not an
> functional problem for LoongArch. Refer to the handling of 64-bit
> targets in this testsuite, use the "is64bitonly" flag to skip those
> tests for the target has 64-bit addresses.
>
> Signed-off-by: Hui Li <lihui@loongson.cn>
Tested on LoongArch, pushed.
Thanks,
Tiezhu
prev parent reply other threads:[~2023-04-14 12:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-10 1:52 Hui Li
2023-04-13 14:19 ` Tom Tromey
2023-04-14 12:11 ` Tiezhu Yang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8f371758-3130-1560-1f5d-5ed7b29f3935@loongson.cn \
--to=yangtiezhu@loongson.cn \
--cc=gdb-patches@sourceware.org \
--cc=lihui@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).