Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Marcin Kościelnicki" <koriakin@0x04.net>
To: uweigand@de.ibm.com
Cc: gdb-patches@sourceware.org, "Marcin Kościelnicki" <koriakin@0x04.net>
Subject: [PATCH] IPA: Move getauxval out of #ifndef IN_PROCESS_AGENT
Date: Tue, 05 Apr 2016 13:33:00 -0000	[thread overview]
Message-ID: <1459863226-5833-1-git-send-email-koriakin@0x04.net> (raw)
In-Reply-To: <20160404144102.E702CCAA4@oc7340732750.ibm.com>

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


  reply	other threads:[~2016-04-05 13:33 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-13  2:31 [PATCH 0/3] gdbserver: Add powerpc fast tracepoint support Marcin Kościelnicki
2016-03-13  2:32 ` [PATCH 1/3] gdbserver/IPA: Export some functions via global function pointers Marcin Kościelnicki
2016-03-14 14:41   ` Ulrich Weigand
2016-03-14 14:53     ` Marcin Kościelnicki
2016-03-14 17:49       ` Ulrich Weigand
2016-03-22  9:19         ` Marcin Kościelnicki
2016-03-29 18:08           ` Ulrich Weigand
2016-03-29 21:51             ` Pedro Alves
2016-03-30 11:30               ` Ulrich Weigand
2016-03-29 21:52             ` Marcin Kościelnicki
2016-03-30 11:32               ` Ulrich Weigand
2016-03-30 22:02                 ` Marcin Kościelnicki
2016-03-31 18:22                   ` Sergio Durigan Junior
2016-03-31 21:42                     ` [PATCH obv] gdbserver: Fix C++ build errors in tracepoint.c Marcin Kościelnicki
2016-03-14 17:08     ` [PATCH 1/3] gdbserver/IPA: Export some functions via global function pointers Simon Marchi
2016-03-14 17:40       ` Ulrich Weigand
2016-03-13  2:32 ` [PATCH 3/3] gdbserver: Add powerpc fast tracepoint support Marcin Kościelnicki
2016-03-14 22:10   ` [PATCH 3/4 v2] " Marcin Kościelnicki
2016-03-16 16:58     ` Ulrich Weigand
2016-03-16 17:55       ` Marcin Kościelnicki
2016-03-17  6:30         ` Ulrich Weigand
2016-03-18 15:09           ` [PATCH v2 3/4] " Marcin Kościelnicki
2016-03-29 18:23             ` Ulrich Weigand
2016-03-30 14:52             ` Simon Marchi
2016-03-30 14:57               ` Ulrich Weigand
2016-03-30 15:24                 ` Simon Marchi
2016-03-30 15:28                   ` Simon Marchi
2016-03-30 15:35                     ` Ulrich Weigand
2016-03-31  1:31                       ` Marcin Kościelnicki
2016-03-31 11:39                         ` Ulrich Weigand
2016-03-31 13:45                           ` Marcin Kościelnicki
2016-03-13  2:32 ` [PATCH 2/3] IPA: Add alloc_jump_pad_buffer target hook Marcin Kościelnicki
2016-03-18 15:08   ` [PATCH 2/4 v2] " Marcin Kościelnicki
2016-03-29 18:18     ` Ulrich Weigand
2016-03-29 22:04       ` Marcin Kościelnicki
2016-03-30 11:38         ` Ulrich Weigand
2016-03-30 14:50           ` Yao Qi
2016-03-30 14:58             ` Ulrich Weigand
2016-03-31  7:34               ` Yao Qi
2016-03-31 11:37                 ` Ulrich Weigand
2016-03-31  1:16       ` [PATCH 2/4 v3] " Marcin Kościelnicki
2016-03-31 11:38         ` Ulrich Weigand
2016-03-31 13:42           ` Marcin Kościelnicki
2016-04-01 14:43         ` Ulrich Weigand
2016-04-03 12:31           ` [PATCH] IPA: Fix build problem on !HAVE_GETAUXVAL Marcin Kościelnicki
2016-04-03 16:26             ` Ulrich Weigand
2016-04-03 16:28               ` Marcin Kościelnicki
2016-04-04 14:41                 ` Ulrich Weigand
2016-04-05 13:33                   ` Marcin Kościelnicki [this message]
2016-04-05 15:04                     ` [PATCH] IPA: Move getauxval out of #ifndef IN_PROCESS_AGENT Ulrich Weigand
2016-04-05 16:55                       ` Marcin Kościelnicki
2016-03-14 22:25 ` [PATCH 4/4] gdbserver: Add emit_ops for powerpc Marcin Kościelnicki
2016-03-16 17:16   ` Ulrich Weigand
2016-03-18 15:10     ` [PATCH v2 " Marcin Kościelnicki
2016-03-29 18:25       ` Ulrich Weigand
2016-03-31 13:45         ` Marcin Kościelnicki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459863226-5833-1-git-send-email-koriakin@0x04.net \
    --to=koriakin@0x04.net \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox