From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41718 invoked by alias); 17 Oct 2018 11:33:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 41709 invoked by uid 89); 17 Oct 2018 11:33:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=U*simon.marchi, sk:simon.m, sk:simonm, D*ca X-HELO: mail-qt1-f194.google.com Received: from mail-qt1-f194.google.com (HELO mail-qt1-f194.google.com) (209.85.160.194) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Oct 2018 11:33:44 +0000 Received: by mail-qt1-f194.google.com with SMTP id q41-v6so29478752qtq.10 for ; Wed, 17 Oct 2018 04:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DFGSZUdXXIuaPkMrdwzCvHiIxujcAKbLnOrM8pSi6W0=; b=WisJfCJtkfWX9C1wG2ALC+BmMdSu5fQ30N307cn2XTtav7EteXlmgOjGB5GqeQ/iun obgr3RskL4iiL/clc+pKFasXdzToLMYbDla7AJxXB7PU353xBTaY9eTlq30qEmYOu4by +OwKKOzRNQDDbevr/n6zPCXrlu/UllCu2yCxOpRV/MWcmaL37XvoaxwKqHBVSlZ0Wme1 ur+e7KrZe/kLbWW+mkDw9e2DeMcM5b8JEREiUrqV9CPwg45v3WwdUQSSRMaYMSC3/bDn GL+jJECPcFP4Q6WQc5l6IEKaDh1rKrtmKymOTOPe+1nGtoapQCnQWuogdMPsJKzdKnuC Xakw== MIME-Version: 1.0 References: <63523264fb0856e46a4846517945b6e4@polymtl.ca> In-Reply-To: <63523264fb0856e46a4846517945b6e4@polymtl.ca> From: Denis Dmitriev Date: Wed, 17 Oct 2018 11:33:00 -0000 Message-ID: Subject: Re: [PATCH] Fix target architecture address size inside gdbarch structure To: simon.marchi@polymtl.ca Cc: gdb-patches@sourceware.org, =?UTF-8?B?0J/QsNCy0LXQuyDQnNC40YXQsNC40LvQvtCy0LjRhyDQlNC+0LLQs9Cw0LvRjtC6?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2018-10/txt/msg00363.txt.bz2 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=3Dx86_64-linux --target=3Dmips64-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: =3D> 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)), =D1=81=D1=80, 17 =D0=BE=D0=BA=D1=82. 2018 =D0=B3. =D0=B2 0:13, Simon Marchi= : > 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 =3D 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 > --=20 Sincerely, Denis Dmitriev.