convert to_auxv_parse
authorTom Tromey <tromey@redhat.com>
Thu, 19 Dec 2013 14:56:20 +0000 (07:56 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 19 Feb 2014 14:48:33 +0000 (07:48 -0700)
2014-02-19  Tom Tromey  <tromey@redhat.com>

* auxv.c (default_auxv_parse): No longer static.
(target_auxv_parse): Unconditionally delegate.
* auxv.h (default_auxv_parse): Declare.
* target-delegates.c: Rebuild.
* target.c: Include auxv.h.
* target.h (struct target_ops) <to_auxv_parse>: Use
TARGET_DEFAULT_FUNC.

gdb/ChangeLog
gdb/auxv.c
gdb/auxv.h
gdb/target-delegates.c
gdb/target.c
gdb/target.h

index c174974593dd6231f11c7bbcb295558632fe336d..9c485b7c58302c65e73a455a75000697973e237f 100644 (file)
@@ -1,3 +1,13 @@
+2014-02-19  Tom Tromey  <tromey@redhat.com>
+
+       * auxv.c (default_auxv_parse): No longer static.
+       (target_auxv_parse): Unconditionally delegate.
+       * auxv.h (default_auxv_parse): Declare.
+       * target-delegates.c: Rebuild.
+       * target.c: Include auxv.h.
+       * target.h (struct target_ops) <to_auxv_parse>: Use
+       TARGET_DEFAULT_FUNC.
+
 2014-02-19  Tom Tromey  <tromey@redhat.com>
 
        * target-delegates.c: Rebuild.
index 2f4acf3da30d2a0c855db61fa8574a98a8ca00f4..ee47446560adc1f66fc2d05467faaa6c87acbd9c 100644 (file)
@@ -254,7 +254,7 @@ memory_xfer_auxv (struct target_ops *ops,
    Return 0 if *READPTR is already at the end of the buffer.
    Return -1 if there is insufficient buffer for a whole entry.
    Return 1 if an entry was read into *TYPEP and *VALP.  */
-static int
+int
 default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
                   gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
 {
@@ -286,13 +286,8 @@ int
 target_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
                   gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
 {
-  struct target_ops *t;
-
-  for (t = ops; t != NULL; t = t->beneath)
-    if (t->to_auxv_parse != NULL)
-      return t->to_auxv_parse (t, readptr, endptr, typep, valp);
-  
-  return default_auxv_parse (ops, readptr, endptr, typep, valp);
+  return current_target.to_auxv_parse (&current_target, readptr, endptr,
+                                      typep, valp);
 }
 
 
index c3f2322fdd1861f1739ae9ad3f1be223a1e05bdf..ace6c0494f1fc89e7a843a17501b38e9efcae00e 100644 (file)
 
 /* See "include/elf/common.h" for the definition of valid AT_* values.  */
 
+/* The default implementation of to_auxv_parse, used by the target
+   stack.  */
+
+extern int default_auxv_parse (struct target_ops *ops, gdb_byte **readptr,
+                              gdb_byte *endptr, CORE_ADDR *typep,
+                              CORE_ADDR *valp);
+
 /* Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
    Return 0 if *READPTR is already at the end of the buffer.
    Return -1 if there is insufficient buffer for a whole entry.
index 209ecb72c3f277c9303c2b28ac6e1d8aa898c6f2..cf5e2d3be956979d66621ff291ae737b7ffa3c36 100644 (file)
@@ -782,6 +782,13 @@ delegate_get_ada_task_ptid (struct target_ops *self, long arg1, long arg2)
   return self->to_get_ada_task_ptid (self, arg1, arg2);
 }
 
+static int
+delegate_auxv_parse (struct target_ops *self, gdb_byte **arg1, gdb_byte *arg2, CORE_ADDR *arg3, CORE_ADDR *arg4)
+{
+  self = self->beneath;
+  return self->to_auxv_parse (self, arg1, arg2, arg3, arg4);
+}
+
 static int
 delegate_can_execute_reverse (struct target_ops *self)
 {
@@ -1594,6 +1601,8 @@ install_delegators (struct target_ops *ops)
     ops->to_flash_done = delegate_flash_done;
   if (ops->to_get_ada_task_ptid == NULL)
     ops->to_get_ada_task_ptid = delegate_get_ada_task_ptid;
+  if (ops->to_auxv_parse == NULL)
+    ops->to_auxv_parse = delegate_auxv_parse;
   if (ops->to_can_execute_reverse == NULL)
     ops->to_can_execute_reverse = delegate_can_execute_reverse;
   if (ops->to_execution_direction == NULL)
@@ -1773,6 +1782,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_flash_erase = tdefault_flash_erase;
   ops->to_flash_done = tdefault_flash_done;
   ops->to_get_ada_task_ptid = default_get_ada_task_ptid;
+  ops->to_auxv_parse = default_auxv_parse;
   ops->to_can_execute_reverse = tdefault_can_execute_reverse;
   ops->to_execution_direction = default_execution_direction;
   ops->to_supports_multi_process = tdefault_supports_multi_process;
index 38012ccf4a7e2f8920ece585de90ae5a77d2212e..4b5ec43d113bdb1fde760da574ebfdb3cca1bf33 100644 (file)
@@ -44,6 +44,7 @@
 #include "tracepoint.h"
 #include "gdb/fileio.h"
 #include "agent.h"
+#include "auxv.h"
 
 static void target_info (char *, int);
 
index e6e78e17d8a7ddf8be64bbec893b10be0bbf3fdb..296ab109bf652b2e3b008f2032f4be740b6ac2ea 100644 (file)
@@ -706,7 +706,8 @@ struct target_ops
        Return -1 if there is insufficient buffer for a whole entry.
        Return 1 if an entry was read into *TYPEP and *VALP.  */
     int (*to_auxv_parse) (struct target_ops *ops, gdb_byte **readptr,
-                         gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp);
+                         gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp)
+      TARGET_DEFAULT_FUNC (default_auxv_parse);
 
     /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the
        sequence of bytes in PATTERN with length PATTERN_LEN.
This page took 0.042758 seconds and 4 git commands to generate.