From patchwork Sat Sep 8 21:55:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Brobecker X-Patchwork-Id: 29262 Received: (qmail 55902 invoked by alias); 8 Sep 2018 21:56:10 -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 55766 invoked by uid 89); 8 Sep 2018 21:56:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=strip, demonstrate, consequences, encoded X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 08 Sep 2018 21:56:08 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1B96611610A; Sat, 8 Sep 2018 17:56:07 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id CUYO0Q-DwdRx; Sat, 8 Sep 2018 17:56:07 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id 0BB85116106; Sat, 8 Sep 2018 17:56:07 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4233) id 0AA73489; Sat, 8 Sep 2018 17:56:07 -0400 (EDT) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Jerome Guitton Subject: [PATCH 4/8] Handle PPC64 function descriptor in Ada decoding Date: Sat, 8 Sep 2018 17:55:56 -0400 Message-Id: <1536443760-78016-5-git-send-email-brobecker@adacore.com> In-Reply-To: <1536443760-78016-1-git-send-email-brobecker@adacore.com> References: <1536443760-78016-1-git-send-email-brobecker@adacore.com> From: Jerome Guitton On PPC64, the entry point of the function "FN" is ".FN" when a function descriptor is used. One of the consequences of this is that GDB then presents the name of the function to the user (eg: in backtraces) with the leading dot, which is a low-level internal detail that the user should not be seeing. The Ada decoding should strip it. gdb/ChangeLog: * ada-lang.c (ada_decode): strip dot prefix in symbol name. No testcase added, as a number of existing testcases should already demonstrate that problem. --- gdb/ChangeLog | 4 ++++ gdb/ada-lang.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4aeb0ba..41b1ad4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2018-09-08 Jerome Guitton + + * ada-lang.c (ada_decode): strip dot prefix in symbol name. + 2018-09-08 Joel Brobecker * ada-lang.c (ada_exception_sal): Replace gdb_assert calls diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index c5cddd0..16c7c51 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1164,6 +1164,11 @@ ada_decode (const char *encoded) static char *decoding_buffer = NULL; static size_t decoding_buffer_size = 0; + /* With function descriptors on PPC64, the value of a symbol named + ".FN", if it exists, is the entry point of the function "FN". */ + if (encoded[0] == '.') + encoded += 1; + /* The name of the Ada main procedure starts with "_ada_". This prefix is not part of the decoded name, so skip this part if we see this prefix. */