From: Denis Dmitriev <zealot351@gmail.com>
To: simon.marchi@polymtl.ca
Cc: gdb-patches@sourceware.org,
"Павел Михаилович Довгалюк" <pavel.dovgaluk@ispras.ru>
Subject: Re: [PATCH] Fix target architecture address size inside gdbarch structure
Date: Wed, 17 Oct 2018 11:33:00 -0000 [thread overview]
Message-ID: <CAF3nGXcexeqnq=B7LzK6M5+HiaVdodM4eXVwqLYz1f-o0VUAdQ@mail.gmail.com> (raw)
In-Reply-To: <63523264fb0856e46a4846517945b6e4@polymtl.ca>
hi!
gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
uname -a
Linux heroboecPC 4.15.0-34-generic #37~16.04.1-Ubuntu SMP Tue Aug 28
10:44:06 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
I took gdb 8.2.50.20180906-git (hash:
739ab2e92e1840c9285f3cfce1f1236c0fa68730).
./configure --host=x86_64-linux --target=mips64-linux-uclibc
make
After that, I start the debugger, install the architecture for debugging.
set arch mips:octeon2
tar rem :1234 (i have qemu with mips to connect)
disas $pc, $pc+20
0xbfc00000 in ?? ()
(gdb) disas $pc, $pc+20
Dump of assembler code from 0xbfc00000 to 0xbfc00014:
=> 0xbfc00000: Cannot access memory at address 0xbfc00000
Address size is 32 bit instead of 64.
In the cpu-mips.c file says that the address should be 64 bit size.
160: N (64, 64, bfd_mach_mips_octeon2,"mips:octeon2", FALSE,
NN(I_mipsocteon2)),
ср, 17 окт. 2018 г. в 0:13, Simon Marchi <simon.marchi@polymtl.ca>:
> On 2018-10-16 08:03, Denis Dmitriev wrote:
> > Hi all,
> > GDB can't get information about instructions when debugging
> > mips:octeon2
> > architecture.
> > The problem is that the gdbarch structure contains the wrong address
> > size
> > for target architecture (gdbarch->addr_bit, 32).
> > However, in the same structure there is data settings for the target
> > architecture (mips:octeon2) which indicate the correct address size
> > (gdbarch->bfd_arch_info->bits_per_address, 64).
> > This patch fixes creation gdbarch structure. Now the address size is
> > taken
> > directly from the settings (gdbarch->bfd_arch_info).
>
> Hi Denis,
>
> This file (gdbarch.c) is generated from gdbarch.sh, so it can't be
> modified directly. What you see here:
>
> gdbarch->addr_bit = gdbarch_ptr_bit (gdbarch);
>
> is the result from the default value of the addr_bit property in
> gdbarch.sh:
>
> 402 v;int;addr_bit;;;8 * sizeof (void*);0;gdbarch_ptr_bit (gdbarch);
>
> So if any modification needs to be done here, it needs to be in
> gdbarch.sh.
>
> However, I tried generating an executable with:
>
> $ mips64el-linux-gnuabi64-gcc --versio
> mips64el-linux-gnuabi64-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0
> 20160609
> Copyright (C) 2015 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is
> NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
> $ mips64el-linux-gnuabi64-gcc test.c -o test
>
> And the resulting addr_bit and ptr_bit in gdb are both 64. From you
> explanations, I get that the value you get for ptr_bit is 32. Is this
> value the right one, or it should be 64?
>
> Could you share how you generate you executable, with what toolchain,
> etc?
>
> Simon
>
--
Sincerely, Denis Dmitriev.
next prev parent reply other threads:[~2018-10-17 11:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 12:04 Denis Dmitriev
2018-10-16 21:13 ` Simon Marchi
2018-10-17 11:33 ` Denis Dmitriev [this message]
2018-10-17 13:02 ` Simon Marchi
2018-10-17 14:35 ` Denis Dmitriev
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='CAF3nGXcexeqnq=B7LzK6M5+HiaVdodM4eXVwqLYz1f-o0VUAdQ@mail.gmail.com' \
--to=zealot351@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=pavel.dovgaluk@ispras.ru \
--cc=simon.marchi@polymtl.ca \
/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