]> git.ipfire.org Git - thirdparty/elfutils.git/commit
lib: Add eu_tsearch, eu_tfind, eu_tdelete and eu_tdestroy
authorHeather McIntyre <hsm2@rice.edu>
Fri, 12 Jul 2024 22:23:56 +0000 (18:23 -0400)
committerAaron Merey <amerey@redhat.com>
Wed, 21 Aug 2024 00:18:58 +0000 (20:18 -0400)
commitd6443d1a4df6057f9012d105037f52daaca911f1
tree269565f0ad6ee1d385db09279ce5e0e4021b7491
parent97b72c00603d1221c69ed22a8345817dde1685f3
lib: Add eu_tsearch, eu_tfind, eu_tdelete and eu_tdestroy

Add struct search_tree to hold tree root and lock.  Add new eu_t*
functions for ensuring synchronized tree access.

Replace tsearch, tfind, etc with eu_t* equivalents.

lib:
* Makefile.am (libeu_a_SOURCES): Add eu-search.c.
(noinst_HEADERS): Add eu-search.h and locks.h.
* eu-config.h: Move rwlock macros to locks.h.
* eu-search.c: New file containing tree search functions with
  locking.
* eu-search.h: New file.
* locks.h: New file containing rwlock macros previously in
  eu-config.h.
libdw:
* cfi.h (struct Dwarf_CFI_s): Change type of search tree members
  from void * to search_tree.
* cie.c: Replace tree search functions with eu-search equivalents.
* dwarf_begin_elf.c (valid_p): Initialize search trees.
* dwarf_end.c (cu_free): Replace tree search functions
  with eu-search equivalents.
* dwarf_getcfi.c (dwarf_getcfi): Initialize search trees.
* dwarf_getlocations.c: Replace search tree functions with
  eu-search equivalents.
  (__libdw_intern_expression): Change type of cache parameter to
  search_tree *.
* dwarf_getmacros.c: Replace tree search functions with
  eu-search equivalents.
* dwarf_getsrclines.c: Ditto.
* fde.c: Ditto.
* frame-cache.c (__libdw_destroy_frame_cache): Initialize search
  trees.
* libdwP.h (struct Dwarf): Change type of search tree members
  from void * to search_tree.
  (struct Dwarf_CU): Ditto.
  (__libdw_intern_expression): Change type of cache parameter to
  search_tree *.
* libdw_find_split_unit.c: Replace tree search functions with
  eu-search equivalents.
* libdw_findcu.c: Ditto.
libdwfl:
* cu.c: Ditto.
* libdwflP.h (struct Dwfl_Module): Replace void *lazy_cu_root
  with search_tree lazy_cu_tree.
libelf:
* elf_begin.c (file_read_elf): Initialize rawchunck_tree.
* elf_end.c (elf_end): Replace tree search function with
  eu-search equivalent.
* elf_getdata_rawchunck.c: Ditto.
* libelfP.h (struct Elf): Replace void * rawchuncks member with
search_tree rawchunk_tree.

Signed-off-by: Heather S. McIntyre <hsm2@rice.edu>
Signed-off-by: Aaron Merey <amerey@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
25 files changed:
lib/Makefile.am
lib/eu-config.h
lib/eu-search.c [new file with mode: 0644]
lib/eu-search.h [new file with mode: 0644]
lib/locks.h [new file with mode: 0644]
libdw/cfi.h
libdw/cie.c
libdw/dwarf_begin_elf.c
libdw/dwarf_end.c
libdw/dwarf_getcfi.c
libdw/dwarf_getlocation.c
libdw/dwarf_getmacros.c
libdw/dwarf_getsrclines.c
libdw/fde.c
libdw/frame-cache.c
libdw/libdwP.h
libdw/libdw_find_split_unit.c
libdw/libdw_findcu.c
libdwfl/cu.c
libdwfl/dwfl_module.c
libdwfl/libdwflP.h
libelf/elf_begin.c
libelf/elf_end.c
libelf/elf_getdata_rawchunk.c
libelf/libelfP.h