From patchwork Sat Jul 7 15:10:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 28274 Received: (qmail 54693 invoked by alias); 7 Jul 2018 15:10:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 54670 invoked by uid 89); 7 Jul 2018 15:10:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=layers, inferiorh, inferior.h, UD:inferior.h X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 07 Jul 2018 15:10:51 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 0A4E01E48F; Sat, 7 Jul 2018 11:10:50 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1530976250; bh=R5gC/H9a7NOmydUHPDqA1pOJWjGlJ30cQxYrmP3IKbE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=ltaYrvUT0Wm4KFYOgjLm1XfWZZY7xM9qpm8PZToWKUCsaqFUYszEzoGDioO/BiYoy /Won7YRSf1W8LcTnyztfFffJhg9I8PkBGtMe25fJHpStIa+eEO5tsWNBbdJMWU3uzx xk0EsPWGc957KeR4MvAG5YE1iu57D097cWyQ0h1w= Subject: Re: [PATCH] Make target_read_alloc & al return vectors To: Andreas Schwab , Simon Marchi Cc: gdb-patches@sourceware.org References: <1521691401-21512-1-git-send-email-simon.marchi@ericsson.com> From: Simon Marchi Message-ID: <5ead66c6-e0cb-c9b6-b882-79c232cc389c@simark.ca> Date: Sat, 7 Jul 2018 11:10:49 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: On 2018-07-07 04:54 AM, Andreas Schwab wrote: > ../../gdb/ia64-tdep.c: In function ‘LONGEST getunwind_table(gdb_byte**)’: > ../../gdb/ia64-tdep.c:2664:16: error: too many arguments to function ‘gdb::optional > > > target_read_alloc(target_ops*, target_object, const char*)’ > NULL, buf_p); > ^ > In file included from ../../gdb/inferior.h:41:0, > from ../../gdb/ia64-tdep.c:21: > ../../gdb/target.h:341:40: note: declared here > extern gdb::optional target_read_alloc > ^ > ../../gdb/ia64-tdep.c:2663:5: error: cannot convert ‘gdb::optional > > >’ to ‘LONGEST {aka long int}’ in assignment > x = target_read_alloc (current_top_target (), TARGET_OBJECT_UNWIND_TABLE, > ^ > > Andreas. > Hi Andreas, I have been unable to build libunwind for ia64 before (using the 1.2 branch), that's why I missed it. Now I tried to build the 1.1 and it works fine. I fixed up the call to target_read_alloc to the best of my knowledge, with as little changes to the code as possible. However, I can't test the result more than build it. Can you please review the patch below? Just to confirm, do you also see errors later in the build, like: In file included from /home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:39: /home/simark/src/binutils-gdb/gdb/ia64-libunwind-tdep.c:114:1: error: ISO C++ forbids converting a string constant to ‘char*’ [-Werror=write-strings] static char *get_reg_name = STRINGIFY(UNW_OBJ(get_reg)); ^~~~~~~~~~~~~~ /home/simark/src/binutils-gdb/gdb/common/preprocessor.h:28:25: note: in definition of macro ‘STRINGIFY_1’ #define STRINGIFY_1(x) #x ^ ? ---- From efd663c4d54b64f394d51faabc74f249d0bf32a7 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 7 Jul 2018 10:55:14 -0400 Subject: [PATCH] Fix compilation error in ia64-tdep.c with libunwind-ia64 Commit 9018be22e022 ("Make target_read_alloc & al return vectors") failed to update the code in ia64-tdep.c, for HAVE_LIBUNWIND_IA64_H. This patch fixes that. gdb/ChangeLog: * ia64-tdep.c (ktab_buf): New global. (getunwind_table): Return a gdb::optional. (get_kernel_table): Adjust. --- gdb/ia64-tdep.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c index 0df62e26ab39..2fab60c1d01e 100644 --- a/gdb/ia64-tdep.c +++ b/gdb/ia64-tdep.c @@ -69,6 +69,7 @@ struct ia64_table_entry }; static struct ia64_table_entry *ktab = NULL; +static gdb::optional ktab_buf; #endif @@ -2647,11 +2648,9 @@ ia64_access_mem (unw_addr_space_t as, } /* Call low-level function to access the kernel unwind table. */ -static LONGEST -getunwind_table (gdb_byte **buf_p) +static gdb::optional +getunwind_table () { - LONGEST x; - /* FIXME drow/2005-09-10: This code used to call ia64_linux_xfer_unwind_table directly to fetch the unwind table for the currently running ia64-linux kernel. That data should @@ -2660,10 +2659,8 @@ getunwind_table (gdb_byte **buf_p) we should find a way to override the corefile layer's xfer_partial method. */ - x = target_read_alloc (current_top_target (), TARGET_OBJECT_UNWIND_TABLE, - NULL, buf_p); - - return x; + return target_read_alloc (current_top_target (), TARGET_OBJECT_UNWIND_TABLE, + NULL); } /* Get the kernel unwind table. */ @@ -2674,15 +2671,12 @@ get_kernel_table (unw_word_t ip, unw_dyn_info_t *di) if (!ktab) { - gdb_byte *ktab_buf; - LONGEST size; - - size = getunwind_table (&ktab_buf); - if (size <= 0) + ktab_buf = getunwind_table (); + if (!ktab_buf) return -UNW_ENOINFO; - ktab = (struct ia64_table_entry *) ktab_buf; - ktab_size = size; + ktab = (struct ia64_table_entry *) ktab_buf->data (); + ktab_size = ktab_buf->size (); for (etab = ktab; etab->start_offset; ++etab) etab->info_offset += KERNEL_START;