From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125447 invoked by alias); 16 Oct 2018 12:04:01 -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 125364 invoked by uid 89); 16 Oct 2018 12:04:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:alternative, sincerely, Sincerely 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; Tue, 16 Oct 2018 12:03:58 +0000 Received: by mail-qt1-f194.google.com with SMTP id u34-v6so25270918qth.3 for ; Tue, 16 Oct 2018 05:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=664/3foyaXKzp+O5T0Y2tvSHKFl2JUe9zafQZxwTXrk=; b=Afn6LfgBWqAF6XIfS6IUtkSZ6GXo6e1xNDQlUcF++OXEhoWe42Qn65SdML7ZFPSpww a4BCGHRauhy3cpt7wCAkrjp/yTvVrCo5D/GxjQZiTRXC32w3Q5UXaIX2dnKllIbdHFWx PkJ+UCCunpXt9ig9+ExdZUbGfNzQ5FZsvazw71+z+zB0HIj9+EsTqXf1pd+po7Gz0ReL RWWn6rtMV4vM+2V6Lj7k28HkFr0hxnCczStKWphTelEvC82tTeLVEU/CBZqu2GA+MH31 uZkQuuxR/5KL46XSrG/X4wZIapUqDd+wRoi776+YJer4dpOh0KIv39PI7xVDhMwlTXoE FmSQ== MIME-Version: 1.0 From: Denis Dmitriev Date: Tue, 16 Oct 2018 12:04:00 -0000 Message-ID: Subject: [PATCH] Fix target architecture address size inside gdbarch structure To: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2018-10/txt/msg00342.txt.bz2 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). diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index e2abf26..9d130a8 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -542,7 +542,12 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of floatformat_for_type, invalid_p == 0 */ /* Skip verify of ptr_bit, invalid_p == 0 */ if (gdbarch->addr_bit == 0) - gdbarch->addr_bit = gdbarch_ptr_bit (gdbarch); + { + if (gdbarch->bfd_arch_info) + gdbarch->addr_bit = gdbarch->bfd_arch_info->bits_per_address; + else + gdbarch->addr_bit = gdbarch_ptr_bit(gdbarch); + } if (gdbarch->dwarf2_addr_size == 0) gdbarch->dwarf2_addr_size = gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT; if (gdbarch->char_signed == -1) -- Sincerely, Denis Dmitriev.