From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78220 invoked by alias); 5 Apr 2016 13:33:54 -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 78187 invoked by uid 89); 5 Apr 2016 13:33:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2469, agent X-HELO: xyzzy.0x04.net Received: from xyzzy.0x04.net (HELO xyzzy.0x04.net) (159.100.250.38) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Apr 2016 13:33:49 +0000 Received: from hogfather.0x04.net (89-65-66-135.dynamic.chello.pl [89.65.66.135]) by xyzzy.0x04.net (Postfix) with ESMTPS id 4723C1AA42; Tue, 5 Apr 2016 13:33:46 +0000 (UTC) Received: by hogfather.0x04.net (Postfix, from userid 1000) id 49938580115; Tue, 5 Apr 2016 15:33:46 +0200 (CEST) From: =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= To: uweigand@de.ibm.com Cc: gdb-patches@sourceware.org, =?UTF-8?q?Marcin=20Ko=C5=9Bcielnicki?= Subject: [PATCH] IPA: Move getauxval out of #ifndef IN_PROCESS_AGENT Date: Tue, 05 Apr 2016 13:33:00 -0000 Message-Id: <1459863226-5833-1-git-send-email-koriakin@0x04.net> In-Reply-To: <20160404144102.E702CCAA4@oc7340732750.ibm.com> References: <20160404144102.E702CCAA4@oc7340732750.ibm.com> X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00079.txt.bz2 The getauxval code was wrongly included in code area only compiled for gdbserver. Move it to a #ifdef IN_PROCESS_AGENT area that already contains lots of IPA-only code. gdb/gdbserver/ChangeLog: * tracepoint.c (getauxval): Move to #ifdef IN_PROCESS_AGENT. --- Ugh. I don't have a machine with sufficiently old glibc, so I tested my patch by manually removing HAVE_GETAUXVAL from config.h. Little did I know that it was always regenerated by the build process from config.status. Here's a fix, this time tested with HAVE_GETAUXVAL actually undefined on s390x. gdb/gdbserver/tracepoint.c | 56 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 8f71325..620b94f 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -216,34 +216,6 @@ static struct ipa_sym_addresses ipa_sym_addrs; static int read_inferior_integer (CORE_ADDR symaddr, int *val); -#if !defined HAVE_GETAUXVAL && defined IN_PROCESS_AGENT -/* Retrieve the value of TYPE from the auxiliary vector. If TYPE is not - found, 0 is returned. This function is provided if glibc is too old. */ - -unsigned long -getauxval (unsigned long type) -{ - unsigned long data[2]; - FILE *f = fopen ("/proc/self/auxv", "r"); - unsigned long value = 0; - - if (f == NULL) - return 0; - - while (fread (data, sizeof (data), 1, f) > 0) - { - if (data[0] == type) - { - value = data[1]; - break; - } - } - - fclose (f); - return value; -} -#endif - /* Returns true if both the in-process agent library and the static tracepoints libraries are loaded in the inferior, and agent has capability on static tracepoints. */ @@ -7395,6 +7367,34 @@ initialize_tracepoint_ftlib (void) gdb_agent_init (); } +#ifndef HAVE_GETAUXVAL +/* Retrieve the value of TYPE from the auxiliary vector. If TYPE is not + found, 0 is returned. This function is provided if glibc is too old. */ + +unsigned long +getauxval (unsigned long type) +{ + unsigned long data[2]; + FILE *f = fopen ("/proc/self/auxv", "r"); + unsigned long value = 0; + + if (f == NULL) + return 0; + + while (fread (data, sizeof (data), 1, f) > 0) + { + if (data[0] == type) + { + value = data[1]; + break; + } + } + + fclose (f); + return value; +} +#endif + #endif /* IN_PROCESS_AGENT */ /* Return a timestamp, expressed as microseconds of the usual Unix -- 2.8.0