aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/gdbserver/ChangeLog9
-rw-r--r--gdb/gdbserver/linux-low.c29
-rw-r--r--gdb/gdbserver/linux-low.h8
-rw-r--r--gdb/gdbserver/linux-ppc-low.c7
4 files changed, 41 insertions, 12 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index a1627ce..3871ca0 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,12 @@
+2019-04-05 Pedro Franco de Carvalho <pedromfc@linux.ibm.com>
+
+ * linux-low.c (linux_get_auxv): Remove static. Return auxv entry
+ value in argument pointer, return 1 if the entry is found and 0
+ otherwise. Move comment.
+ (linux_get_hwcap, linux_get_hwcap2): Use modified linux_get_auxv.
+ * linux-low.h (linux_get_auxv): Declare.
+ * linux-ppc-low.c (is_elfv2_inferior): Use linux_get_auxv.
+
2019-04-05 Tom Tromey <tromey@adacore.com>
* server.c (gdbserver_usage): Use upper-case for metasyntactic
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 265043f..65919c3 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -7427,11 +7427,10 @@ linux_get_pc_64bit (struct regcache *regcache)
return pc;
}
-/* Fetch the entry MATCH from the auxv vector, where entries are length
- WORDSIZE. If no entry was found, return zero. */
+/* See linux-low.h. */
-static CORE_ADDR
-linux_get_auxv (int wordsize, CORE_ADDR match)
+int
+linux_get_auxv (int wordsize, CORE_ADDR match, CORE_ADDR *valp)
{
gdb_byte *data = (gdb_byte *) alloca (2 * wordsize);
int offset = 0;
@@ -7442,15 +7441,21 @@ linux_get_auxv (int wordsize, CORE_ADDR match)
{
if (wordsize == 4)
{
- uint32_t *data_p = (uint32_t *)data;
+ uint32_t *data_p = (uint32_t *) data;
if (data_p[0] == match)
- return data_p[1];
+ {
+ *valp = data_p[1];
+ return 1;
+ }
}
else
{
- uint64_t *data_p = (uint64_t *)data;
+ uint64_t *data_p = (uint64_t *) data;
if (data_p[0] == match)
- return data_p[1];
+ {
+ *valp = data_p[1];
+ return 1;
+ }
}
offset += 2 * wordsize;
@@ -7464,7 +7469,9 @@ linux_get_auxv (int wordsize, CORE_ADDR match)
CORE_ADDR
linux_get_hwcap (int wordsize)
{
- return linux_get_auxv (wordsize, AT_HWCAP);
+ CORE_ADDR hwcap = 0;
+ linux_get_auxv (wordsize, AT_HWCAP, &hwcap);
+ return hwcap;
}
/* See linux-low.h. */
@@ -7472,7 +7479,9 @@ linux_get_hwcap (int wordsize)
CORE_ADDR
linux_get_hwcap2 (int wordsize)
{
- return linux_get_auxv (wordsize, AT_HWCAP2);
+ CORE_ADDR hwcap2 = 0;
+ linux_get_auxv (wordsize, AT_HWCAP2, &hwcap2);
+ return hwcap2;
}
static struct target_ops linux_target_ops = {
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index d825184..d5d074e 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -435,6 +435,14 @@ bool thread_db_thread_handle (ptid_t ptid, gdb_byte **handle, int *handle_len);
extern int have_ptrace_getregset;
+/* Search for the value with type MATCH in the auxv vector with
+ entries of length WORDSIZE bytes. If found, store the value in
+ *VALP and return 1. If not found or if there is an error, return
+ 0. */
+
+int linux_get_auxv (int wordsize, CORE_ADDR match,
+ CORE_ADDR *valp);
+
/* Fetch the AT_HWCAP entry from the auxv vector, where entries are length
WORDSIZE. If no entry was found, return zero. */
diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 8deb0ce..f17f05a 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -1107,10 +1107,13 @@ is_elfv2_inferior (void)
#else
const int def_res = 0;
#endif
- unsigned long phdr;
+ CORE_ADDR phdr;
Elf64_Ehdr ehdr;
- if (!ppc_get_auxv (AT_PHDR, &phdr))
+ const struct target_desc *tdesc = current_process ()->tdesc;
+ int wordsize = register_size (tdesc, 0);
+
+ if (!linux_get_auxv (wordsize, AT_PHDR, &phdr))
return def_res;
/* Assume ELF header is at the beginning of the page where program headers