aboutsummaryrefslogtreecommitdiff
path: root/gcc/btfout.cc
diff options
context:
space:
mode:
authorCupertino Miranda <cupertino.miranda@oracle.com>2024-02-12 17:36:21 +0000
committerCupertino Miranda <cupertino.miranda@oracle.com>2024-02-28 19:20:20 +0000
commit69a3ce49bda929e1ffbc1fc1123f5f2485ec944d (patch)
tree05da6f2f49755ab20b5414c5386155393eef446f /gcc/btfout.cc
parent0198cade5ac15c35ed3f5af54060d7bc6a39f326 (diff)
downloadgcc-69a3ce49bda929e1ffbc1fc1123f5f2485ec944d.zip
gcc-69a3ce49bda929e1ffbc1fc1123f5f2485ec944d.tar.gz
gcc-69a3ce49bda929e1ffbc1fc1123f5f2485ec944d.tar.bz2
btf: add BTF_KIND_FUNC traversal function.
The patch adds a traversal function to traverse all BTF_KIND_FUNC nodes with a callback function. Used for .BTF.ext section content creation. gcc/ChangeLog: * btfout.cc (output_btf_func_types): Use FOR_EACH_VEC_ELT. (traverse_btf_func_types): Define function. * ctfc.h (funcs_traverse_callback): Typedef for function prototype. (traverse_btf_func_types): Add prototype.
Diffstat (limited to 'gcc/btfout.cc')
-rw-r--r--gcc/btfout.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/gcc/btfout.cc b/gcc/btfout.cc
index 7e114e2..7aabd99 100644
--- a/gcc/btfout.cc
+++ b/gcc/btfout.cc
@@ -1276,8 +1276,10 @@ output_btf_types (ctf_container_ref ctfc)
static void
output_btf_func_types (ctf_container_ref ctfc)
{
- for (size_t i = 0; i < vec_safe_length (funcs); i++)
- btf_asm_func_type (ctfc, (*funcs)[i], i);
+ ctf_dtdef_ref ref;
+ unsigned i;
+ FOR_EACH_VEC_ELT (*funcs, i, ref)
+ btf_asm_func_type (ctfc, ref, i);
}
/* Output all BTF_KIND_DATASEC records. */
@@ -1452,4 +1454,20 @@ btf_finalize (void)
tu_ctfc = NULL;
}
+/* Traversal function for all BTF_KIND_FUNC type records. */
+
+bool
+traverse_btf_func_types (funcs_traverse_callback callback, void *data)
+{
+ ctf_dtdef_ref ref;
+ unsigned i;
+ FOR_EACH_VEC_ELT (*funcs, i, ref)
+ {
+ bool stop = callback (ref, data);
+ if (stop == true)
+ return true;
+ }
+ return false;
+}
+
#include "gt-btfout.h"