libctf: add hash traversal helpers
[external/binutils.git] / libctf / ChangeLog
1 2019-06-28  Nick Alcock <nick.alcock@oracle.com>
2
3         * ctf-impl.h (ctf_hash_iter_f): New.
4         (ctf_dynhash_iter): New declaration.
5         (ctf_dynhash_iter_remove): New declaration.
6         * ctf-hash.c (ctf_dynhash_iter): Define.
7         (ctf_dynhash_iter_remove): Likewise.
8         (ctf_hashtab_traverse): New.
9         (ctf_hashtab_traverse_remove): Likewise.
10         (struct ctf_traverse_cb_arg): Likewise.
11         (struct ctf_traverse_remove_cb_arg): Likewise.
12
13 2019-06-28  Nick Alcock <nick.alcock@oracle.com>
14
15         * ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element.
16
17 2019-06-28  Nick Alcock <nick.alcock@oracle.com>
18
19         * ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x.
20         (ctf_dump_funcs): Likewise.
21
22 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
23
24         * ctf-open-bfd.c: Add swap.h and ctf-endian.h.
25         (ctf_fdopen): Check for endian-swapped raw CTF magic, and
26         little-endian CTF archive magic.  Do not check the CTF version:
27         ctf_simple_open does that in endian-safe ways.  Do not dereference
28         null pointers on open failure.
29
30 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
31
32         * ctf-open.c (get_vbytes_common): Return the new slice size.
33         (ctf_bufopen): Flip the endianness of the CTF-section header copy.
34         Remember to copy in the CTF data when opening an uncompressed
35         foreign-endian CTF file.  Prune useless variable manipulation.
36
37 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
38
39         * ctf-open.c (ctf_types): Fail when unidentified type kinds are
40         seen.
41
42 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
43
44         * ctf-open.c (ctf_bufopen): Dump header offsets into the debugging
45         output.
46
47 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
48
49         * ctf-subr.c (_PAGESIZE): Remove.
50         (ctf_data_alloc): Likewise.
51         (ctf_data_free): Likewise.
52         (ctf_data_protect): Likewise.
53         * ctf-impl.h: Remove declarations.
54         * ctf-create.c (ctf_update): No longer call ctf_data_protect: use
55         ctf_free, not ctf_data_free.
56         (ctf_compress_write): Use ctf_data_alloc, not ctf_alloc.  Free
57         the buffer again on compression error.
58         * ctf-open.c (ctf_set_base): No longer track the size: call
59         ctf_free, not ctf_data_free.
60         (upgrade_types): Likewise.  Call ctf_alloc, not ctf_data_alloc.
61         (ctf_bufopen): Likewise.  No longer call ctf_data_protect.
62
63 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
64
65         * ctf-create.c (ctf_dtd_insert): Pass on error returns from
66         ctf_dynhash_insert.
67         (ctf_dvd_insert): Likewise.
68         (ctf_add_generic): Likewise.
69         (ctf_add_variable): Likewise.
70         * ctf-impl.h: Adjust declarations.
71
72 2019-06-14  Alan Modra  <amodra@gmail.com>
73
74         * configure: Regenerate.
75
76 2019-06-06  Nick Alcock  <nick.alcock@oracle.com>
77
78         * ctf-decls.h: Include <libiberty.h>.
79         * ctf-lookup.c (ctf_lookup_by_name): Call xstrndup(), not strndup().
80
81 2019-06-06  Nick Alcock  <nick.alcock@oracle.com>
82
83         * ctf-dump.c (ctf_dump_format_type): Cast size_t's used in printf()s.
84         (ctf_dump_objts): Likewise.
85         (ctf_dump_funcs): Likewise.
86         (ctf_dump_member): Likewise.
87         (ctf_dump_str): Likewise.
88
89 2019-06-06  Nick Alcock  <nick.alcock@oracle.com>
90
91         * ctf-archive.c (arc_mmap_header): Mark fd as potentially unused.
92         * ctf-subr.c (ctf_data_protect): Mark both args as potentially unused.
93
94 2019-06-05  Nick Alcock  <nick.alcock@oracle.com>
95
96         * ctf-archive.c (ctf_arc_write): Eschew %zi format specifier.
97         (ctf_arc_open_by_offset): Likewise.
98         * ctf-create.c (ctf_add_type): Likewise.
99
100 2019-06-04  Tom Tromey  <tromey@adacore.com>
101
102         * ctf-create.c (ctf_add_encoded, ctf_add_slice)
103         (ctf_add_member_offset): Use CHAR_BIT, not NBBY.
104
105 2019-06-04  Nick Alcock  <nick.alcock@oracle.com>
106
107         * configure.ac: Check for O_CLOEXEC.
108         * ctf-decls.h (O_CLOEXEC): Define (to 0), if need be.
109         * config.h.in: Regenerate.
110         * configure: Likewise.
111
112 2019-06-04  Nick Alcock  <nick.alcock@oracle.com>
113
114         * qsort_r.c: Rename to...
115         * ctf-qsort_r.c: ... this.
116         (_quicksort): Define to ctf_qsort_r.
117         * ctf-decls.h (qsort_r): Remove.
118         (ctf_qsort_r): Add.
119         (struct ctf_qsort_arg): New, transport the real ARG and COMPAR.
120         (ctf_qsort_compar_thunk): Rearrange the arguments to COMPAR.
121         * Makefile.am (libctf_a_LIBADD): Remove.
122         (libctf_a_SOURCES): New, add ctf-qsort_r.c.
123         * ctf-archive.c (ctf_arc_write): Call ctf_qsort_r, not qsort_r.
124         * ctf-create.c (ctf_update): Likewise.
125         * configure.ac: Check for BSD versus GNU qsort_r signature.
126         * Makefile.in: Regenerate.
127         * config.h.in: Likewise.
128         * configure: Likewise.
129
130 2019-06-03  Nick Alcock  <nick.alcock@oracle.com>
131
132         * ctf-dump.c (ctf_dump_funcs): Free in the right place.
133
134 2019-05-29  Nick Alcock  <nick.alcock@oracle.com>
135
136         * Makefile.am (ZLIB): New.
137         (ZLIBINC): Likewise.
138         (AM_CFLAGS): Use them.
139         (libctf_a_LIBADD): New, for LIBOBJS.
140         * configure.ac: Check for zlib, endian.h, and qsort_r.
141         * ctf-endian.h: New, providing htole64 and le64toh.
142         * swap.h: Code style fixes.
143         (bswap_identity_64): New.
144         * qsort_r.c: New, from gnulib (with one added #include).
145         * ctf-decls.h: New, providing a conditional qsort_r declaration,
146         and unconditional definitions of MIN and MAX.
147         * ctf-impl.h: Use it.  Do not use <sys/errno.h>.
148         (ctf_set_errno): Now returns unsigned long.
149         * ctf-util.c (ctf_set_errno): Adjust here too.
150         * ctf-archive.c: Use ctf-endian.h.
151         (ctf_arc_open_by_offset): Use memset, not bzero.  Drop cts_type,
152         cts_flags and cts_offset.
153         (ctf_arc_write): Drop debugging dependent on the size of off_t.
154         * ctf-create.c: Provide a definition of roundup if not defined.
155         (ctf_create): Drop cts_type, cts_flags and cts_offset.
156         (ctf_add_reftype): Do not check if type IDs are below zero.
157         (ctf_add_slice): Likewise.
158         (ctf_add_typedef): Likewise.
159         (ctf_add_member_offset): Cast error-returning ssize_t's to size_t
160         when known error-free.  Drop CTF_ERR usage for functions returning
161         int.
162         (ctf_add_member_encoded): Drop CTF_ERR usage for functions returning
163         int.
164         (ctf_add_variable): Likewise.
165         (enumcmp): Likewise.
166         (enumadd): Likewise.
167         (membcmp): Likewise.
168         (ctf_add_type): Likewise.  Cast error-returning ssize_t's to size_t
169         when known error-free.
170         * ctf-dump.c (ctf_is_slice): Drop CTF_ERR usage for functions
171         returning int: use CTF_ERR for functions returning ctf_type_id.
172         (ctf_dump_label): Likewise.
173         (ctf_dump_objts): Likewise.
174         * ctf-labels.c (ctf_label_topmost): Likewise.
175         (ctf_label_iter): Likewise.
176         (ctf_label_info): Likewise.
177         * ctf-lookup.c (ctf_func_args): Likewise.
178         * ctf-open.c (upgrade_types): Cast to size_t where appropriate.
179         (ctf_bufopen): Likewise.  Use zlib types as needed.
180         * ctf-types.c (ctf_member_iter): Drop CTF_ERR usage for functions
181         returning int.
182         (ctf_enum_iter): Likewise.
183         (ctf_type_size): Likewise.
184         (ctf_type_align): Likewise.  Cast to size_t where appropriate.
185         (ctf_type_kind_unsliced): Likewise.
186         (ctf_type_kind): Likewise.
187         (ctf_type_encoding): Likewise.
188         (ctf_member_info): Likewise.
189         (ctf_array_info): Likewise.
190         (ctf_enum_value): Likewise.
191         (ctf_type_rvisit): Likewise.
192         * ctf-open-bfd.c (ctf_bfdopen): Drop cts_type, cts_flags and
193         cts_offset.
194         (ctf_simple_open): Likewise.
195         (ctf_bfdopen_ctfsect): Likewise.  Set cts_size properly.
196         * Makefile.in: Regenerate.
197         * aclocal.m4: Likewise.
198         * config.h: Likewise.
199         * configure: Likewise.
200
201 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
202
203         * configure.in: Check for bfd_section_from_elf_index.
204         * configure: Regenerate.
205         * config.h.in [HAVE_BFD_ELF]: Likewise.
206         * libctf/ctf_open_bfd (ctf_bfdopen_ctfsect): Use it.
207         abfd is potentially unused now.
208
209 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
210
211         * Makefile.am: New.
212         * Makefile.in: Regenerated.
213         * config.h.in: Likewise.
214         * aclocal.m4: Likewise.
215         * configure: Likewise.
216
217 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
218
219         * ctf-dump.c: New.
220
221 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
222
223         * ctf-labels.c: New.
224
225 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
226
227         * ctf-impl.h (_libctf_version): New declaration.
228         * ctf-subr.c (_libctf_version): Define it.
229         (ctf_version): New.
230
231 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
232
233         * ctf-create.c (enumcmp): New.
234         (enumadd): Likewise.
235         (membcmp): Likewise.
236         (membadd): Likewise.
237         (ctf_add_type): Likewise.
238
239 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
240
241         * ctf-lookup.c (isqualifier): New.
242         (ctf_lookup_by_name): Likewise.
243         (struct ctf_lookup_var_key): Likewise.
244         (ctf_lookup_var): Likewise.
245         (ctf_lookup_variable): Likewise.
246         (ctf_lookup_symbol_name): Likewise.
247         (ctf_lookup_by_symbol): Likewise.
248         (ctf_func_info): Likewise.
249         (ctf_func_args): Likewise.
250
251 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
252
253         * ctf-decl.c: New file.
254         * ctf-types.c: Likewise.
255         * ctf-impl.h: New declarations.
256
257 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
258
259         * ctf-open-bfd.c: New file.
260         * ctf-open.c (ctf_close): New.
261         * ctf-impl.h: Include bfd.h.
262         (ctf_file): New members ctf_data_mmapped, ctf_data_mmapped_len.
263         (ctf_archive_internal): New members ctfi_abfd, ctfi_data,
264         ctfi_bfd_close.
265         (ctf_bfdopen_ctfsect): New declaration.
266         (_CTF_SECTION): likewise.
267
268 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
269
270         * ctf-archive.c: New.
271         * ctf-impl.h (ctf_archive_internal): New type.
272         (ctf_arc_open_internal): New declaration.
273         (ctf_arc_bufopen): Likewise.
274         (ctf_arc_close_internal): Likewise.
275
276 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
277
278         * ctf-open.c: New file.
279         * swap.h: Likewise.
280
281 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
282
283         * ctf-create.c: New file.
284         * ctf-lookup.c: New file.
285
286 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
287
288         * ctf-impl.h: New definitions and declarations for type creation
289         and lookup.
290
291 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
292
293         * ctf-hash.c: New file.
294         * ctf-impl.h: New declarations.
295
296 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
297
298         * ctf-error.c: New file.
299
300 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
301
302         * ctf-util.c: New file.
303         * elf.h: Likewise.
304         * ctf-impl.h: Include it, and add declarations.
305
306 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
307
308         * ctf-impl.h: New file.
309         * ctf-subr.c: New file.
310
311 \f
312 Local Variables:
313 mode: change-log
314 left-margin: 8
315 fill-column: 76
316 version-control: never
317 End: