95dc426b64ef147c0679d74965bdafa698052872
[platform/upstream/elfutils.git] / libdwfl / ChangeLog
1 2019-02-24  Mark Wielaard  <mark@klomp.org>
2
3         * linux-kernel-modules.c (intuit_kernel_bounds): Init *notes before
4         fopen.
5         (dwfl_linux_kernel_report_kernel): Remove fake note init empty asm.
6
7 2019-01-25  Yonghong Song  <yhs@fb.com>
8
9         * linux-proc-maps.c (proc_maps_report): Use PRIu64, not PRIi64, to
10         read the inode number.
11
12 2019-01-20  Mark Wielaard  <mark@klomp.org>
13
14         * dwfl_segment_report_module.c (dwfl_segment_report_module): Check
15         dyn_filesz vs dyn_data_size after read_portion call.
16
17 2019-01-16  Mark Wielaard  <mark@klomp.org>
18
19         * linux-core-attach.c (core_next_thread): Pass desc to ebl_core_note.
20         (core_set_initial_registers): Likewise.
21
22 2018-10-23  Mark Wielaard  <mark@klomp.org>
23
24         * relocate.c (relocate_section): Only sanity check mmapped Elf files
25         for overlap. Don't error when section data was malloced, not mmapped.
26
27 2018-10-20  Mark Wielaard  <mark@klomp.org>
28
29         * libdwflP.h (__libdw_open_elf): New internal function declaration.
30         * open.c (what_kind): Rename close_fd to may_close_fd.
31         (__libdw_open_file): Replaced (and renamed) by a call to ...
32         (libdw_open_elf): this. And add never_close_fd argument.
33         (__libdw_open_elf): New function that calls libdw_open_elf.
34
35 2018-10-18  Mark Wielaard  <mark@klomp.org>
36
37         * dwfl_segment_report_module.c (consider_note): Take align as new
38         argument.  Use align to set d_type and calculate padding.
39         (dwfl_segment_report_module): Pass align to consider_notes.
40         * core-file.c (dwfl_core_file_report): Check p_align to set ELF
41         type.
42         * linux-kernel-modules.c (check_notes): Check name and type of note
43         to determine padding.
44
45 2018-10-19  Mark Wielaard  <mark@klomp.org>
46
47         * dwfl_module_getdwarf.c (find_aux_sym): Check sh_entsize is not zero.
48
49 2018-10-14  Mark Wielaard  <mark@klomp.org>
50
51         * dwfl_segment_report_module.c (read_portion): Check requested
52         filesz isn't larger than buffer_available.
53         (dwfl_segment_report_module): Check data_size vs filesz after
54         read_portion call.
55
56 2018-10-02  Andreas Schwab  <schwab@suse.de>
57
58         * relocate.c (relocate): Handle ADD/SUB relocations.
59
60 2018-09-13  Mark Wielaard  <mark@klomp.org>
61
62         * dwfl_segment_report_module.c (dwfl_segment_report_module):
63         Document why we use e_shnum directly.
64         * elf-from-memory.c (elf_from_remote_memory): Likewise.
65
66 2018-07-17  Ulf Hermann  <ulf.hermann@qt.io>
67
68         * linux-pid-attach.c: Include sys/uio.h only on linux.
69
70 2018-06-04  Mark Wielaard  <mark@klomp.org>
71
72         * libdwflP.h (__libdwfl_addrsym): Remove function declaration.
73         * dwfl_module_addrsym.c (__libdwfl_addrsym): Make a static function.
74
75 2018-05-27  Mark Wielaard  <mark@klomp.org>
76
77         * relocate.c (__libdwfl_relocate): Always call relocate_section with
78         partial true.
79
80 2018-05-17  Mark Wielaard  <mark@klomp.org>
81
82         * dwfl_module (__libdwfl_module_free): Free elfdir.
83         * dwfl_module_getdwarf.c (load_dw): Close file descriptors after
84         dwarf_begin_elf call. Set Dwarf debugdir if it is NULL, this is the
85         main module file and we recorded the elfdir.
86         * libdwflP.h (struct Dwfl_Module): Add elfdir field.
87         * offline.c (process_elf): Record the elfdir before we close the
88         main ELF file descriptor.
89
90 2018-04-10  Mark Wielaard  <mark@klomp.org>
91
92         * frame_unwind.c (unwind): If __libdwfl_frame_reg_get fails for
93         the return address either set an error or mark the pc undefined.
94
95 2018-03-17  Mark Wielaard  <mark@klomp.org>
96
97         * libdwflP.h (struct __libdwfl_remote_mem_cache): New.
98         (struct __libdwfl_pid_arg): Add mem_cache field.
99         * linux-pid-attach.c (read_cached_memory): New function.
100         (clear_cached_memory): Likewise.
101         (pid_memory_read): Call read_cached_memory.
102         (pid_detach): Free mem_cache.
103         (pid_thread_detach): Call clear_cached_memory.
104         (dwfl_linux_proc_attach): Initialize mem_cache to NULL.
105
106 2018-03-05  Mark Wielaard  <mark@klomp.org>
107
108         * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Use
109         realpath (name, NULL) instead of canonicalize_file_name (name).
110         * find-debuginfo.c (dwfl_standard_find_debuginfo): Likewise.
111
112 2018-01-29  Mark Wielaard  <mark@klomp.org>
113
114         * cu.c (cudie_offset): Use __libdw_first_die_off_from_cu instead of
115         DIE_OFFSET_FROM_CU_OFFSET.
116         (intern_cu): Simply use a copy of the given die CU as key instead of
117         trying to construct a dummy one by hand.
118
119 2018-02-15  Mark Wielaard  <mark@klomp.org>
120
121         * linux-pid-attach.c: Include sys/wait.h after sys/ptrace.h.
122
123 2018-02-09  Joshua Watt  <JPEWhacker@gmail.com>
124
125         * dwfl_report_elf.c (__libdwfl_elf_address_range): Use FALLTHROUGH
126         macro instead of comment.
127         * frame_unwind.c (expr_eval): Likewise.
128
129 2017-11-20  Mark Wielaard  <mark@klomp.org>
130
131         * link_map.c (do_check64): Take a char * and calculate type and val
132         offsets before reading, possibly unaligned, values.
133         (do_check32): Likewise.
134         (check64): Remove define.
135         (check32): Likewise.
136         (auxv_format_probe): Call do_check32 and do_check64 directly with
137         a, possibly unaligned, auxv entry pointer.
138         (dwfl_link_map_report): Redefine AUXV_SCAN to not dereference a
139         possibly unaligned auxv entry pointer.
140
141 2017-10-16  Mark Wielaard  <mark@klomp.org>
142
143         * argp-std.c (parse_opt): For -k call argp_failure not failure to
144         keep dwfl around.
145
146 2017-07-26  Yunlian Jiang  <yunlian@google.com>
147
148         * argp-std.c (failure): Move to file scope.
149         (fail): Likewise.
150
151 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
152             Mark Wielaard  <mark@klomp.org>
153
154         * derelocate.c (compare_secrefs): Compare by end address and then by
155         section number if addresses are equal.
156
157 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
158             Mark Wielaard  <mark@klomp.org>
159
160         * linux-kernel-modules.c: Always return NULL from kernel_release() on
161         non-linux systems and set errno to ENOTSUP.
162
163 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
164
165         * libdwflP.h: Don't include config.h.
166         * argp-std.c: Include config.h.
167         * cu.c: Likewise.
168         * derelocate.c: Likewise.
169         * dwfl_addrdie.c: Likewise.
170         * dwfl_addrdwarf.c: Likewise.
171         * dwfl_addrmodule.c: Likewise.
172         * dwfl_begin.c: Likewise.
173         * dwfl_build_id_find_debuginfo.c: Likewise.
174         * dwfl_build_id_find_elf.c: Likewise.
175         * dwfl_cumodule.c: Likewise.
176         * dwfl_dwarf_line.c: Likewise.
177         * dwfl_end.c: Likewise.
178         * dwfl_frame.c: Likewise.
179         * dwfl_frame_regs.c: Likewise.
180         * dwfl_getdwarf.c: Likewise.
181         * dwfl_getmodules.c: Likewise.
182         * dwfl_getsrc.c: Likewise.
183         * dwfl_getsrclines.c: Likewise.
184         * dwfl_line_comp_dir.c: Likewise.
185         * dwfl_linecu.c: Likewise.
186         * dwfl_lineinfo.c: Likewise.
187         * dwfl_linemodule.c: Likewise.
188         * dwfl_module.c: Likewise.
189         * dwfl_module_addrdie.c: Likewise.
190         * dwfl_module_addrname.c: Likewise.
191         * dwfl_module_addrsym.c: Likewise.
192         * dwfl_module_build_id.c: Likewise.
193         * dwfl_module_dwarf_cfi.c: Likewise.
194         * dwfl_module_eh_cfi.c: Likewise.
195         * dwfl_module_getdarf.c: Likewise.
196         * dwfl_module_getelf.c: Likewise.
197         * dwfl_module_getsrc.c: Likewise.
198         * dwfl_module_getsrc_file.c: Likewise.
199         * dwfl_module_getsym.c: Likewise.
200         * dwfl_module_info.c: Likewise.
201         * dwfl_module_nextcu.c: Likewise.
202         * dwfl_module_register_names.c: Likewise.
203         * dwfl_module_report_build_id.c: Likewise.
204         * dwfl_module_return_value_location.c: Likewise.
205         * dwfl_nextcu.c: Likewise.
206         * dwfl_onesrcline.c: Likewise.
207         * dwfl_report_elf.c: Likewise.
208         * dwfl_validate_address.c: Likewise.
209         * dwfl_version.c: Likewise.
210         * find-debuginfo.c: Likewise.
211         * gzip.c: Likewise.
212         * image-header.c: Likewise.
213         * lines.c: Likewise.
214         * linux-core-attach.c: Likewise.
215         * linux-pid-attach.c: Likewise.
216         * offline.c: Likewise.
217         * open.c: Likewise.
218         * relocate.c: Likewise.
219         * segment.c: Likewise.
220
221 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
222
223         * libdwfl.h: Use __const_attribute__.
224
225 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
226
227         * elf-from-memory.c: Explicitly cast phnum to size_t.
228
229 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
230
231         * dwfl_module_getdwarf.c: Check shnum for 0 before subtracting from
232         it.
233
234 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
235
236         * dwfl_frame.c: Drop unused sys/ptrace.h include.
237         * frame_unwind.c: Likewise.
238         * linux-pid-attach.c: Include sys/ptrace.h and sys/syscall.h only on
239         linux.
240
241 2017-04-20  Ulf Hermann <ulf.hermann@qt.io>
242
243         * linux-kernel-modules.c: Include sys/types.h before fts.h
244
245 2017-03-24  Mark Wielaard  <mark@klomp.org>
246
247         * linux-core-attach.c (core_next_thread): If n_namesz == 0 then
248         the note name data is the empty string.
249         (dwfl_core_file_attach): Likewise.
250
251 2017-02-15  Ulf Hermann  <ulf.hermann@qt.io>
252
253         * linux-kernel-modules.c: Include system.h.
254
255 2017-02-15  Ulf Hermann  <ulf.hermann@qt.io>
256
257         * linux-kernel-modules.c: Use sysconf(_SC_PAGESIZE) to get page size.
258         * linux-proc-maps.c: Likewise.
259
260 2016-12-29  Luiz Angelo Daros de Luca  <luizluca@gmail.com>
261
262         * dwfl_build_id_find_elf.c: Include system.h.
263         * dwfl_module_getdwarf.c: Likewise.
264         * libdwfl_crc32_file.c: Don't define LIB_SYSTEM_H.
265
266 2016-11-23  Mark Wielaard  <mjw@redhat.com>
267
268         * linux-kernel-modules.c: Only include fts.h early if BAD_FTS is
269         defined.
270
271 2016-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
272
273         * core-file.c: Remove sys/param.h.
274         * dwfl_segment_report_module.c: Likewise. Add system.h include.
275         (MAX): Remove definition.
276         * frame_unwind.c: Add system.h include.
277         (MAX): Remove definition.
278         * linux-core-attach.c (MIN): Remove definition.
279         * linux-pid-attach.c (MAX): Likewise.
280
281 2016-08-12  Mark Wielaard  <mjw@redhat.com>
282
283         * link_map.c (dwfl_link_map_report): Fix assert, set in.d_size.
284
285 2016-04-14  Mark Wielaard  <mjw@redhat.com>
286
287         * dwfl_module_getsrc_file.c (dwfl_module_getsrc_file): Free match
288         on invalid DWARF if we allocated it.
289
290 2016-04-14  Mark Wielaard  <mjw@redhat.com>
291
292         * linux-proc-maps.c (proc_maps_report): Free last_file on bad file
293         mapping.
294
295 2016-03-01  Steven Chamberlain  <steven@pyro.eu.org>
296
297         * linux-pid-attach.c: Removed unused pid_thread_callbacks,
298         pid_thread_detach, pid_detach, pid_set_initial_registers,
299         pid_memory_read, pid_getthread, pid_next_thread in #ifndef
300         __linux__ code.
301
302 2016-02-22  Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
303             Mark Wielaard  <mjw@redhat.com>
304
305         * find-debuginfo.c (find_debuginfo_in_path): Remember whether
306         debuglink_file is NULL. Try file basename (without .debug) ofr
307         absolute and relative path if debug_file was NULL.
308         * linux-kernel-modules.c (try_kernel_name): If try_debug is true call
309         dwfl_standard_find_debuginfo with NULL debuglink_file, otherwise with
310         basename of fname.
311
312 2016-02-13  Mark Wielaard  <mjw@redhat.com>
313
314         * linux-proc-maps.c (proc_maps_report): Free last_file when ENOEXEC.
315
316 2016-02-13  Mark Wielaard  <mjw@redhat.com>
317
318         * frame_unwind.c (new_unwound): Check and return unwound.
319         (handle_cfi): Check new_unwound was able to allocate new memory
320         before use. Return DWFL_E_NOMEM otherwise.
321
322 2016-02-11  Mark Wielaard  <mjw@redhat.com>
323
324         * relocate.c (relocate_section): Check result of all gelf_get* calls.
325         (__libdwfl_relocate): Likewise.
326         (__libdwfl_relocate_section): Likewise.
327
328 2016-02-11  Mark Wielaard  <mjw@redhat.com>
329
330         * relocate.c (relocate_section): Check result of gelf_update_* calls.
331
332 2016-01-08  Mark Wielaard  <mjw@redhat.com>
333
334         * libdwfl_a_SOURCES: Unconditionally add gzip.c.
335         * linux-kernel-modules.c (vmlinux_suffixes): We always have at least
336         .gz support.
337         (try_kernel_name): Likewise.
338         (check_suffix): Likewise.
339         * open.c (decompress): Likewise.
340
341 2015-12-18  Mark Wielaard  <mjw@redhat.com>
342
343         * dwfl_module_getdwarf.c (find_symtab): Uncompress symstr, xndx, sym
344         sections and aux_str, aux_xndx and aux_sym sections if necessary.
345         * relocate.c (relocate_getsym): Uncompress symtab and symtab_shndx
346         if necessary.
347         (resolve_symbol): Uncompress strtab section if necessary.
348         (relocate_section): Uncompress the section the relocations apply to
349         if necessary.
350
351 2015-11-18  Chih-Hung Hsieh <chh@google.com>
352
353         * linux-proc-maps.c (proc_maps_report): Move nested function
354         'report' to file scope.
355
356 2015-11-18  Chih-Hung Hsieh <chh@google.com>
357
358         * core-file.c (elf_begin_rand): Move nested function 'fail' to file
359         scope.
360         * core-file.c (dwfl_elf_phdr_memory_callback): Move nested functions
361         'update_end' and 'more' to file scope.
362
363 2015-11-17  Chih-Hung Hsieh <chh@google.com>
364
365         * link_map.c (auxv_format_probe): Move nested functions
366         check64 and check32 to file scope.
367
368 2015-12-08  Jose E. Marchesi  <jose.marchesi@oracle.com>
369
370         * dwfl_frame.c (state_fetch_pc): Add a backend-defined offset to
371         the value of the return address register as defined by the CFI
372         abi.
373         * frame_unwind.c (handle_cfi): Likewise.
374
375 2015-12-01  Mark Wielaard  <mjw@redhat.com>
376
377         * link_map.c (dwfl_link_map_report): Track whether in.d_buf comes
378         from exec or memory_callback, free as appropriate.
379
380 2015-12-01  Mark Wielaard  <mjw@redhat.com>
381
382         * libdwflP.h (struct Dwfl_User_Core): New.
383         (struct DWfl): Replace executable_for_core with user_core.
384         * argp-std.c (parse_opt): Store core and fd in Dwfl user_core.
385         * core-file.c (dwfl_core_file_report): Check and store
386         executable_for_core in Dwfl user_core.
387         * dwfl_build_id_find_elf.c (dwfl_build_id_find_elf): Check and use
388         executable_for_core in Dwfl user_core.
389         * dwfl_end.c (dwfl_end): Release resources held in Dwfl user_core.
390         * link-map.c (report_r_debug): Check executable_for_core in Dwfl
391         user_core.
392         (dwfl_link_map_report): Likewise.
393
394 2015-11-16  Chih-Hung Hsieh <chh@google.com>
395
396         * dwfl_module_getdwarf.c (find_prelink_address_sync): Move nested
397         function 'consider_shdr' to file scope.
398         * dwfl_module_getdwarf.c (find_dynsym): Move nested function
399         'translate_offs' to file scope.
400
401 2015-11-16  Chih-Hung Hsieh <chh@google.com>
402
403         * dwfl_module_addrsym.c (__libdwfl_addrsym): Move nested functions
404         'same_section', 'binding_value', 'try_sym_value', and 'search_table'
405         to file scope.
406
407 2015-11-19  Mark Wielaard  <mjw@redhat.com>
408
409         * dwfl_module.c (__libdwfl_module_free): Remove Dwfl_Module Ebl from
410         eh_cfi and dwarf_cfi cache if necessary before calling dwarf_end and
411         dwarf_cfi_end.
412
413 2015-11-13  Chih-Hung Hsieh <chh@google.com>
414
415         * gzip.c (unzip): Move nested functions to file scope.
416
417 2015-10-21  Chih-Hung Hsieh <chh@google.com>
418             Mark Wielaard  <mjw@redhat.com>
419
420         * dwfl_module_getsrc_file.c (dwfl_module_getsrc_file): Move nested
421         functions 'dwarf_line_file', 'dwfl_line', and 'dwfl_line_file' to
422         file scope. Rename dwarf_line_file to dwfl_dwarf_line_file. Don't
423         use INTUSE.
424
425 2015-10-21  Chih-Hung Hsieh <chh@google.com>
426
427         * frame_unwind.c (expr_eval): Move nested function 'push' and 'pop'
428         to file scope. Pass used local variables in struct eval_stack.
429
430 2015-10-21  Chih-Hung Hsieh <chh@google.com>
431
432         * dwfl_module.c (dwfl_report_module): Move nested function 'use' to
433         file scope.
434
435 2015-10-09  Josh Stone  <jistone@redhat.com>
436
437         * core-file.c (elf_begin_rand): Replace loff_t with off_t.
438         * open.c (decompress): Replace off64_t with off_t.
439         * gzip.c (unzip): Likewise.
440         * image-header.c (__libdw_image_header): Likewise.
441         * libdwflP.h: Likewise in function declarations.
442         * argp-std.c (parse_opt): Replace open64 with open.
443         * dwfl_build_id_find_elf.c (__libdwfl_open_mod_by_build_id,
444         dwfl_build_id_find_elf): Likewise.
445         * dwfl_module_getdwarf.c (open_elf_file): Likewise.
446         * dwfl_report_elf.c (dwfl_report_elf): Likewise.
447         * dwfl_segment_report_module.c (dwfl_segment_report_module): Likewise.
448         * link_map.c (report_r_debug): Likewise.
449         * offline.c (dwfl_report_offline): Likewise.
450         * linux-proc-maps.c (grovel_auxv, get_pid_class,
451         dwfl_linux_proc_find_elf): Likewise.
452         (read_proc_memory): Replace off64_t with off_t.
453         * find-debuginfo.c (find_debuginfo_in_path): Replace stat64 and
454         fstat64 with stat and fstat.
455         (try_open): Likewise, and replace open64 with open.
456         * linux-kernel-modules.c: Manually define open and fopen to open64 and
457         fopen64 when needed, since the early fts.h include breaks that.
458         (try_kernel_name): Replace open64 with open.
459         (check_notes): Likewise.
460
461 2015-10-09  Jose E. Marchesi  <jose.marchesi@oracle.com>
462
463         * linux-proc-maps.c (read_proc_memory): Use seek+read instead of
464         pread, as the later doesn't accept negative offsets.
465
466 2015-10-07  Mark Wielaard  <mjw@redhat.com>
467
468         * dwfl_module_getdwarf.c (MAX): Removed.
469         (find_prelink_address_sync): Allocate exact amount of bytes for
470         phdrs and shdrs.
471         * dwfl_segment_report_module.c (dwfl_segment_report_module):
472         Likewise for phdrs.
473         * elf-from-memory.c (MAX): Removed.
474         (elf_from_remote_memory): Allocate exact amount of bytes for phdrs.
475
476 2015-10-05  Chih-Hung Hsieh <chh@google.com>
477
478         * dwfl_module_getdwarf.c (find_prelink_address_sync): Do not use
479         union of variable length arrays.
480         * dwfl_segment_report_module.c (dwfl_segment_report_module): Likewise.
481         * elf-from-memory.c (elf_from_remote_memory): Likewise.
482         * link_map.c (auxv_format_probe): Likewise.
483         * link_map.c (report_r_debug): Likewise.
484         * link_map.c (dwfl_link_map_report): Likewise.
485
486 2015-09-18  Chih-Hung Hsieh  <chh@google.com>
487
488         * relocate.c (relocate_section): Move nested function "relocate"
489         to file scope, pass all used local variables as constants.
490         Move nested "check_badreltype" to file scope, pass addresses of
491         updated used local variables.
492         * linux-kernel-modules.c (intuit_kernel_bounds): Move nested function
493         "read_address" to file scope, pass all updated local variables in
494         a state structure.
495         * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): Move nested
496         function "subst_name" to file scope, pass all used local variables
497         as constants.
498         * linux-kernel-modules.c (dwfl_linux_kernel_report_kernel): Replace
499         simple nested function "report" with a macro. Work around gcc static
500         analysis error -Werror=maybe-uninitialized.
501
502 2015-09-22  Mark Wielaard  <mjw@redhat.com>
503
504         * core-file.c: Remove old-style function definitions.
505         * dwfl_error.c: Likewise.
506         * dwfl_module_dwarf_cfi.c: Likewise.
507         * dwfl_module_eh_cfi.c: Likewise.
508         * dwfl_module_register_names.c: Likewise.
509         * dwfl_module_return_value_location.c: Likewise.
510         * dwfl_version.c: Likewise.
511
512 2015-09-09  Chih-Hung Hsieh  <chh@google.com>
513             Mark Wielaard  <mjw@redhat.com>
514
515         * dwfl_frame.c (dwfl_attach_state): Remove redundant NULL tests
516         on parameters declared with __nonnull_attribute__.
517         * libdwfl.h (dwfl_module_getelf): Don't mark first argument as
518         nonnull.
519
520 2015-09-08  Mark Wielaard  <mjw@redhat.com>
521
522         * libdwflP.h (struct __libdwfl_pid_arg): Add elf and elf_fd.
523         * linux-pid-attach.c (pid_detach): Call elf_end and close.
524         (dwfl_linux_proc_attach): Open and save /proc/PID/exe.
525
526 2015-09-04  Chih-Hung Hsieh  <chh@google.com
527
528         * frame_unwind.c (expr_eval): Use llabs instead of abs.
529
530 2015-08-14  Dodji Seketeli  <dodji@seketeli.org>
531
532         * find-debuginfo.c (find_debuginfo_in_path): Try to locate the
533         debug info file named debuglink_file under
534         mod->dwfl->callbacks->debuginfo_path, by looking at
535         the set of sub-trees under mod->dwfl->callbacks->debuginfo_path
536         which is common to the set of non-absolute parent trees of
537         file_name.
538
539 2015-06-18  Mark Wielaard  <mjw@redhat.com>
540
541         * find-debuginfo.c (try_open): Free fname on all failure paths.
542
543 2015-06-18  Mark Wielaard  <mjw@redhat.com>
544
545         * dwfl_module_getdwarf.c (find_symtab): Check shdr is not NULL and
546         sh_entsize is not zero.
547
548 2015-06-06  Mark Wielaard  <mjw@redhat.com>
549
550         * find-debuginfo.c (find_debuginfo_in_path): Always free localpath,
551         localname and file_dirname.
552
553 2015-06-06  Mark Wielaard  <mjw@redhat.com>
554
555         * derelocate.c (cache_sections): Free sortrefs.
556
557 2015-06-05  Mark Wielaard  <mjw@redhat.com>
558
559         * dwfl_segment_report_module.c (dwfl_segment_report_module):
560         If the note_file exists, but the build_id doesn't match discard
561         the file and continue reporting.
562
563 2015-06-01  Mark Wielaard  <mjw@redhat.com>
564
565         * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Copy path
566         pointer before passing to strsep.
567
568 2015-05-30  Mark Wielaard  <mjw@redhat.com>
569
570         * link_map.c (check32): Use read_4ubyte_unaligned_noncvt to read
571         type and value.
572         (read_addrs): Use read_(4|8)ubyte_unaligned_noncvt or to read
573         adresses.
574
575 2015-05-30  Mark Wielaard  <mjw@redhat.com>
576
577         * find-debuginfo.c (dwfl_standard_find_debuginfo): Check file_name is
578         not NULL before calling canonicalize_file_name.
579
580 2015-05-24  Mark Wielaard  <mjw@redhat.com>
581
582         * derelocate.c (check_module): Check mod is not NULL.
583
584 2015-05-22  Mark Wielaard  <mjw@redhat.com>
585
586         * link_map.c (dwfl_link_map_report): Allocate phdrs and dyn with
587         malloc instead of stack allocating. Call free when done with data.
588
589 2015-05-22  Mark Wielaard  <mjw@redhat.com>
590
591         * dwfl_segment_report_module.c (dwfl_segment_report_module):
592         Allocate phdrs with malloc, not on stack. free in finish.
593         Allocate dyn with malloc, not on stack, free after use.
594
595 2015-05-22  Mark Wielaard  <mjw@redhat.com>
596
597         * find-debuginfo.c (find_debuginfo_in_path): malloc or strdup,
598         instead of alloca or strdupa, local strings of unknown size.
599         Call free before return.
600
601 2015-05-22  Mark Wielaard  <mjw@redhat.com>
602
603         * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Return
604         error when id_len too small or too large. strdup, not strdupa,
605         and free path when done.
606
607 2015-05-19  Mark Wielaard  <mjw@redhat.com>
608
609         * elf-from-memory.c (elf_from_remote_memory): Don't allocate all
610         phdrs on the stack. Allocate with malloc and free when done.
611
612 2015-05-19  Mark Wielaard  <mjw@redhat.com>
613
614         * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): malloc and
615         free alternate_name.
616
617 2015-05-19  Mark Wielaard  <mjw@redhat.com>
618
619         * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Don't
620         stack allocate name. Only change chars up to suffix.
621
622 2015-05-18  Mark Wielaard  <mjw@redhat.com>
623
624         * dwfl_module_getdwarf.c (find_prelink_address_sync): Allocate
625         phdrs and shdrs unions with malloc, not alloca. Free after use.
626
627 2015-05-18  Mark Wielaard  <mjw@redhat.com>
628
629         * derelocate.c (cache_sections): Allocate temporary newrefs and
630         sortrefs with malloc, not alloca. Always free them on return.
631
632 2015-05-07  Mark Wielaard  <mjw@redhat.com>
633
634         * cu.c (intern_cu): Check for EOF and check cuoff points to a real
635         Dwarf_Die before interning. Explicitly check EOF is expected.
636
637 2015-05-05  Mark Wielaard  <mjw@redhat.com>
638
639         * dwfl_lineinfo.c (dwfl_lineinfo): Check info->file is valid.
640
641 2015-05-06  Roland McGrath  <roland@hack.frob.com>
642
643         * dwfl_error.c (struct msgtable): Break type definition out of
644         the 'msgtable' initializer.
645         (msgtable): Make it a union of struct msgtable and a char array.
646         (msgstr): Use the full-table char array rather than the msg_0 entry.
647
648 2015-04-23  Max Filippov  <jcmvbkbc@gmail.com>
649
650         * core-file.c (_compat_without_executable_dwfl_core_file_report):
651         Guard with SYMBOL_VERSIONING.
652         * dwfl_module_build_id.c (_compat_vaddr_at_end_dwfl_module_build_id):
653         Likewise.
654         * dwfl_report_elf.c (_compat_without_add_p_vaddr_dwfl_report_elf):
655         Likewise.
656
657 2015-04-02  Mark Wielaard  <mjw@redhat.com>
658
659         * segment.c (insert): Check correct number of lookup_elts.
660
661 2015-03-31  Mark Wielaard  <mjw@redhat.com>
662
663         * core-file.c (core_file_read_eagerly): Special case small images.
664
665 2015-01-26  Mark Wielaard  <mjw@redhat.com>
666
667         * dwfl_module_getdwarf.c (find_symtab): Explicitly clear symdata,
668         syments and first_global on elferr before calling find_dynsym.
669
670 2014-12-27  Mark Wielaard  <mjw@redhat.com>
671
672         * dwfl_module_getsrc.c (dwfl_module_getsrc): Never match a line that
673         has end_sequence set.
674
675 2015-01-04  Mark Wielaard  <mjw@redhat.com>
676
677         * cu.c (intern_cu): Store result and return directly when finding
678         EOF marker.
679         (__libdwfl_nextcu): Check *nextp as returned by intern_cu isn't -1.
680
681 2014-12-19  Mark Wielaard  <mjw@redhat.com>
682
683         * dwfl_module_getdwarf.c (find_symtab): Always try find_dynsym last.
684
685 2014-12-19  Mark Wielaard  <mjw@redhat.com>
686
687         * elf-from-memory.c (handle_segment): Remove palign sanity check.
688
689 2014-12-18  Mark Wielaard  <mjw@redhat.com>
690
691         * relocate.c (resolve_symbol): Make sure symstrdata->d_buf != NULL.
692
693 2014-12-13  Mark Wielaard  <mjw@redhat.com>
694
695         * dwfl_module_getdwarf.c (find_dynsym): elf_getdata_rawchunk takes
696         a size_t, make sure it doesn't overflow.
697
698 2014-12-13  Mark Wielaard  <mjw@redhat.com>
699
700         * cu.c (cudie_offset): Make sure Dwarf_Off difference doesn't
701         wrap around before returning as int.
702
703 2014-12-11  Josh Stone  <jistone@redhat.com>
704
705         * dwfl_module_getsrc.c (dwfl_module_getsrc): Return the *last* line
706         record <= addr, rather than returning immediately on matches.
707
708 2014-12-09  Mark Wielaard  <mjw@redhat.com>
709
710         * dwfl_segment_report_module.c (handle_file_note): Check count doesn't
711         overflow.
712
713 2014-12-07  Mark Wielaard  <mjw@redhat.com>
714
715         * relocate.c (relocate_section): Sanity check section overlap against
716         actually used ehsize, shentsize and phentsize.
717
718 2014-12-07  Mark Wielaard  <mjw@redhat.com>
719
720         * offline.c (dwfl_offline_section_address): Assert shndx is not zero.
721         * relocate.c (__libdwfl_relocate_value): Don't relocate against
722         section zero.
723
724 2014-11-29  Mark Wielaard  <mjw@redhat.com>
725
726         * relocate.c (relocate_section): Check relocation section and target
727         section data don't overlap any of the ELF headers.
728         (relocate): Check for offset + size overflow.
729
730 2014-11-22  Mark Wielaard  <mjw@redhat.com>
731
732         * link_map.c (consider_executable): Use elf_getphdrnum.
733         (dwfl_link_map_report): Likewise.
734
735 2014-11-18  Mark Wielaard  <mjw@redhat.com>
736
737         * dwfl_module_getdwarf.c (find_symtab): Sanity check the data buffer,
738         number of symbols and first_global before use.
739
740 2014-11-14  Mark Wielaard  <mjw@redhat.com>
741
742         * dwfl_module_getdwarf.c (load_symtab): Don't use tables which have
743         a zero sh_entsize.
744
745 2014-11-10  Mark Wielaard  <mjw@redhat.com>
746
747         * dwfl_module_getdwarf.c (find_dynsym): New inner function
748         translate_offs that takes an adjust argument. Try finding
749         the symbol table with and without adjusting to main_bias.
750
751 2014-09-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
752
753         Support NT_FILE for locating files.
754         * core-file.c (dwfl_core_file_report): New variables note_file and
755         note_file_size, set them and pass them to dwfl_segment_report_module.
756         * dwfl_segment_report_module.c: Include common.h and fcntl.h.
757         (buf_has_data, buf_read_ulong, handle_file_note): New functions.
758         (invalid_elf): New function from code of dwfl_segment_report_module.
759         (dwfl_segment_report_module): Add parameters note_file and
760         note_file_size.  New variables elf and fd, clean them up in finish.
761         Move some code to invalid_elf.  Call handle_file_note, if it found
762         a name verify the file by invalid_elf.  Protect elf and fd against
763         cleanup by finish if we found the file for new Dwfl_Module.
764         * libdwflP.h (dwfl_segment_report_module): Add parameters note_file and
765         note_file_size.
766
767 2014-09-23  Mark Wielaard  <mjw@redhat.com>
768
769         * dwfl_segment_report_module.c (dwfl_segment_report_module):
770         Extract ei_class, ei_data and e_type early and use the result.
771
772 2014-09-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
773
774         * dwfl_build_id_find_elf.c (dwfl_build_id_find_elf): Use IS_EXECUTABLE.
775         * dwfl_segment_report_module.c (dwfl_segment_report_module): Set
776         IS_EXECUTABLE.
777         * libdwflP.h (struct Dwfl_Module): New field is_executable.
778
779 2014-08-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
780
781         * dwfl_module_getdwarf.c (find_offsets): Add parameter main_bias, use
782         it.
783         (find_dynsym): Pass the new parameter main_bias.
784
785 2014-08-14  Mark Wielaard  <mjw@redhat.com>
786
787         * linux-kernel-modules.c (check-suffix): Also TRY .ko.xz.
788
789 2014-07-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
790
791         Fix report_r_debug for prelinked libraries.
792         * link_map.c (report_r_debug): Comment out variable l_addr.
793         Use instead new variable base recalculated from l_ld.
794
795 2014-06-24  Kurt Roeckx  <kurt@roeckx.be>
796
797         * linux-pid-attach.c: Make it build on non linux hosts.
798
799 2014-06-17  Mark Wielaard  <mjw@redhat.com>
800
801         * frame_unwind.c (handle_cfi): Use ebl_func_addr_mask.
802         * dwfl_module_getsym.c (__libdwfl_getsym): Likewise.
803
804 2014-06-15  Mark Wielaard  <mjw@redhat.com>
805
806         * linux-core-attach.c (core_memory_read): Use libdw/memory-access.h
807         macros read_4ubyte_unaligned_noncvt and read_8ubyte_unaligned_noncvt
808         to read possibly unaligned data.
809         (core_next_thread): Likewise.
810         (core_set_initial_registers): Likewise.
811         (dwfl_core_file_attach): Likewise.
812
813 2014-06-11  Mark Wielaard  <mjw@redhat.com>
814
815         * dwfl_frame.c (__libdwfl_process_free): Reset dwfl->attacherr.
816         (dwfl_attach_state): Set dwfl->attacherr.
817         (dwfl_pid): Check and return dwfl->attacherr if set.
818         (dwfl_getthreads): Likewise.
819         (getthread): Likewise.
820         * libdwflP.h: Add DWFL_E_NO_CORE_FILE.
821         (struct Dwfl): Add attacherr field.
822         * linux-core-attach.c (dwfl_core_file_attach): Set dwfl->attacherr.
823         Don't assert if ELF file is not ET_CORE, just return error.
824         * linux-pid-attach.c (dwfl_linux_proc_attach): Set dwfl->attacherr.
825
826 2014-06-10  Mark Wielaard  <mjw@redhat.com>
827
828         * argp-std.c (parse_opt): Ignore errors from dwfl_core_file_attach
829         or dwfl_linux_proc_attach.
830
831 2014-05-15  Mark Wielaard  <mjw@redhat.com>
832
833         * linux-proc-maps.c (grovel_auxv): Close fd on error.
834
835 2014-05-02  Mark Wielaard  <mjw@redhat.com>
836
837         * dwfl_module_getdwarf: Remove ENABLE_DWZ ifdefs so find_debug_altlink
838         is always called.
839
840 2014-05-01  Mark Wielaard  <mjw@redhat.com>
841
842         * libdwflP.h (struct Dwfl_Module): Add alt, alt_fd and alt_elf fields.
843         (__libdwfl_open_mod_by_build_id): Renamed __libdwfl_open_by_build_id.
844         (__libdwfl_open_by_build_id): New declaration that takes an explicit
845         build-id.
846         * dwfl_build_id_find_debuginfo.c (dwfl_build_id_find_debuginfo): If
847         we already have the Dwarf then look for the alt dwz multi file by
848         build-id.
849         * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Add the
850         build-id we are looking for as argument.
851         (__libdwfl_open_mod_by_build_id): New function, calls
852         __libdwfl_open_by_build_id.
853         (dwfl_build_id_find_elf): Call __libdwfl_open_mod_by_build_id.
854         * dwfl_module.c (__libdwfl_module_free): Release alt, alt_elf and
855         close alt_fd if necessary.
856         * dwfl_module_getdwarf.c (__check_build_id): Removed.
857         (try_debugaltlink): Removed.
858         (open_debugaltlink): Removed.
859         (open_elf_file): First half of open_elf that just opens the elf
860         file but doesn't setup the load address.
861         (open_elf): Call open_elf_file.
862         (find_debug_altlink): New function.
863         (load_dw): Remove loading of dwz multifile.
864         (find_dw): Call find_debug_altlink.
865         * find-debuginfo.c (validate): Handle alt debug case using
866         dwelf_dwarf_gnu_debugaltlink and mod->alt_elf.
867         (find_debuginfo_in_path): Handle alt debug files possibly in .dwz
868         subdirs.
869         * linux-kernel-modules.c (try_kernel_name): Use fakemod.debug.name
870         to store name to find by dwfl_standard_find_debuginfo instead of
871         allocating an extra variable on stack.
872
873 2014-04-30  Mark Wielaard  <mjw@redhat.com>
874
875         * dwfl_module_build_id.c (__libdwfl_find_elf_build_id): Moved to
876         dwelf_elf_gnu_build_id.c.
877         (__libdwfl_find_build_id): Add assert to make sure mod is never NULL.
878         * dwfl_segment_report_module.c (dwfl_segment_report_module): Call
879         dwelf_elf_gnu_build_id directly instead of __libdwfl_find_build_id.
880         * dwfl_module_getdwarf.c (__check_build_id): Implement using
881         dwelf_elf_gnu_build_id.
882
883 2014-04-15  Florian Weimer  <fweimer@redhat.com>
884
885         * dwfl_module_getdwarf.c (__check_build_id): Moved from libdw.
886         (try_debugaltlink): Likewise.
887         (open_debugaltlink): Likewise.
888         (load_dw): Locate alternate debug information using
889         dwelf_dwarf_gnu_debugaltlink and call open_debugaltlink.
890
891 2014-04-11  Mark Wielaard  <mjw@redhat.com>
892
893         * Makefile.am (AM_CPPFLAGS): Add libdwelf.
894         * libdwflP.h: Include libdwelfP.h.
895         * dwfl_module_getdwarf.c (find_debuglink): Moved to libdwelf.
896         (find_debuginfo): Use dwelf_elf_gnu_debuglink.
897
898 2014-04-22  Mark Wielaard  <mjw@redhat.com>
899
900         * frame_unwind.c (__libdwfl_frame_reg_get): Use uint64_t when
901         checking bits.
902         (__libdwfl_frame_reg_set): Likewise.
903
904 2014-04-22  Kurt Roeckx  <kurt@roeckx.be>
905
906         * linux-pid-attach.c: Make linux only.
907
908 2014-03-14  Mark Wielaard  <mjw@redhat.com>
909
910         * Makefile.am: Remove !MUDFLAP and MUDFLAP conditions.
911         Remove libelf and libdw definitions when MUDFLAP is defined.
912         * argp-std.c (__libdwfl_argp_mudflap_options): Removed.
913
914 2014-03-03  Mark Wielaard  <mjw@redhat.com>
915
916         * elf-from-memory.c (elf_from_remote_memory): Keep track of
917         segments_end_mem. Pass memsz to first handle_segment pass. Only
918         extend contents_size and use shdrs if only file bits are in
919         segment.
920
921 2014-03-11  Josh Stone  <jistone@redhat.com>
922
923         * dwfl_module_getdwarf.c (open_elf): Only explicitly set
924         mod->e_type when processing the main ELF file.
925
926 2014-03-04  Mark Wielaard  <mjw@redhat.com>
927
928         * libdwflP.h (struct __libdwfl_pid_arg): Moved here and renamed from
929         linux-pid-attach.c (struct pid_arg).
930         (__libdwfl_get_pid_arg): New internal function declaration.
931         (__libdwfl_ptrace_attach): Likewise.
932         (__libdwfl_ptrace_detach): Likewise.
933         * dwfl_frame.c (dwfl_attach_state): Add "(deleted)" files to the
934         special exception modules that cannot be checked at this point.
935         * linux-pid-attach.c (struct pid_arg): Moved to libdwflP.h
936         (ptrace_attach): Renamed to...
937         (__libdwfl_ptrace_attach): New internal function.
938         (__libdwfl_ptrace_detach): Likewise. Extracted from ...
939         (pid_thread_detach): Call __libdwfl_ptrace_detach now.
940         (__libdwfl_get_pid_arg): New internal function.
941         * linux-proc-maps.c (dwfl_linux_proc_find_elf): Check if special
942         module name contains "(deleted)" and dwfl_pid gives an attached
943         pid. If pid is set and try to (re)use ptrace attach state of
944         process before reading memory.
945
946 2014-03-03  Mark Wielaard  <mjw@redhat.com>
947
948         * elf-from-memory.c (elf_from_remote_memory): Take pagesize as
949         argument. Free buffer when detecting bad elf. Check PT_LOAD
950         alignment requirements on first handle_segment pass. Calculate
951         loadbase, start and end of segment using pagesize, not p_align.
952         * linux-proc-maps.c (dwfl_linux_proc_find_elf): Provide pagesize
953         to elf_from_remote_memory.
954
955 2014-02-26  Mark Wielaard  <mjw@redhat.com>
956
957         * linux-proc-maps.c (proc_maps_report): Don't assert on bad input.
958
959 2014-02-26  Mark Wielaard  <mjw@redhat.com>
960
961         * elf-from-memory.c (elf_from_remote_memory): Check against p64
962         p_type in case ELFCLASS64, not against p32 p_type.
963
964 2014-01-17  Petr Machata  <pmachata@redhat.com>
965
966         * relocate.c (relocate_section): Use gelf_fsize instead of relying
967         on shdr->sh_entsize.
968
969 2014-01-05  Mark Wielaard  <mjw@redhat.com>
970
971         * frame_unwind.c (handle_cfi): Only skip resetting return register
972         if the regno is not the actual CIE return address register.
973
974 2014-01-02  Mark Wielaard  <mjw@redhat.com>
975
976         * linux-pid-attach.c (dwfl_linux_proc_attach): Use strtol, not atoi.
977
978 2013-12-30  Mark Wielaard  <mjw@redhat.com>
979
980         * argp-std.c (parse_opt): Call dwfl_linux_proc_attach and
981         dwfl_core_file_attach explicitly.
982         * core-file.c (dwfl_core_file_report): Don't call
983         __libdwfl_attach_state_for_core implicitly.
984         * dwfl_begin.c (dwfl_begin): Remove setting of process_attach_error.
985         * dwfl_frame.c (dwfl_pid): Set errno to DWFL_E_NO_ATTACH_STATE, not
986         process_attach_error.
987         (dwfl_getthreads): Likewise.
988         (getthread): Likewise.
989         * libdwfl.h (dwfl_core_file_report): Update documentation.
990         (dwfl_linux_proc_report): Likewise.
991         (dwfl_core_file_attach): New function declaration.
992         (dwfl_linux_proc_attach): Likewise.
993         * libdwflP.h (struct Dwfl): Remove process_attach_error.
994         (__libdwfl_attach_state_for_pid): Removed declaration.
995         (__libdwfl_attach_state_for_core): Likewise.
996         (dwfl_core_file_attach): New internal declaration.
997         (dwfl_linux_proc_attach): Likewise.
998         (attach_state_for_core): Renamed to...
999         (dwfl_core_file_attach): ...this. Change return type.
1000         (__libdwfl_attach_state_for_core): Removed.
1001         * linux-pid-attach.c (struct pid_arg): Add assume_ptrace_stopped.
1002         (pid_set_initial_registers): Check assume_ptrace_stopped before
1003         calling ptrace.
1004         (pid_thread_detach): Likewise.
1005         (__libdwfl_attach_state_for_pid): Renamed to...
1006         (dwfl_linux_proc_attach): ...this. Adjust return type.
1007         * linux-proc-maps.c (dwfl_linux_proc_report): Don't call
1008         __libdwfl_attach_state_for_pid implicitly.
1009
1010 2013-12-28  Mark Wielaard  <mjw@redhat.com>
1011
1012         * linux-proc-maps.c (dwfl_linux_proc_find_elf): Don't return special
1013         character device files, only regular files.
1014
1015 2013-12-24  Mark Wielaard  <mjw@redhat.com>
1016
1017         * linux-core-attach.c (core_next_thread): Check whether thread_argp
1018         is NULL. Reset core_arg->thread_note_offset and malloc a thread_arg
1019         in that case. Free thread_arg if there are no more threads.
1020
1021 2013-12-23  Mark Wielaard  <mjw@redhat.com>
1022
1023         * dwfl_segment_report_module.c (dwfl_segment_report_module): Free
1024         build_id before returning early.
1025
1026 2013-12-23  Mark Wielaard  <mjw@redhat.com>
1027
1028         * linux-pid-attach.c (__libdwfl_attach_state_for_pid): Report actual
1029         pid (thread group leader) to dwfl_attach_state.
1030
1031 2013-12-21  Mark Wielaard  <mjw@redhat.com>
1032
1033         * frame_unwind.c (handle_cfi): Track whether the return register
1034         has been set and only allow it to be set once.
1035
1036 2013-12-20  Mark Wielaard  <mjw@redhat.com>
1037
1038         * dwfl_frame.c (one_arg): New struct.
1039         (get_one_thread_cb): New function.
1040         (dwfl_getthread): Likewise.
1041         (one_thread): New struct.
1042         (get_one_thread_frames_cb): New function.
1043         (dwfl_getthread_frames): Likewise.
1044         * libdwfl.h (Dwfl_Thread_Callbacks): Add get_thread function.
1045         (dwfl_getthread_frames): Likewise.
1046         * libdwflP.h (dwfl_getthread_frames): New internal function declaration.
1047         * linux-core-attach.c (core_thread_callbacks): Initialize get_thread
1048         to NULL.
1049         * linux-pid-attach.c (pid_getthread): New function.
1050         (pid_thread_callbacks): Initialize get_thread to pid_getthread.
1051
1052 2013-12-20  Mark Wielaard  <mjw@redhat.com>
1053
1054         * linux-kernel-modules.c (report_kernel_archive): Correct nested
1055         asprintf result check for debug.a.
1056
1057 2013-12-18  Mark Wielaard  <mjw@redhat.com>
1058
1059         * derelocate.c (__libdwfl_find_section_ndx): New internal function.
1060         * dwfl_module_addrname.c (dwfl_module_addrname): Use
1061         dwfl_module_addrinfo.
1062         * dwfl_module_addrsym.c (dwfl_module_addrsym_elf): Replace with...
1063         (__libdwfl_addrsym): ...this. Use __libdwfl_getsym, use value
1064         for comparisons, not st_value. Fill in off. Search for both value
1065         and the (adjusted) sym.st_value when different.
1066         (dwfl_module_addrsym): Implement using __libdwfl_addrsym.
1067         (dwfl_module_addrinfo): New function.
1068         * dwfl_module_getsym.c (dwfl_module_getsym_elf): Replace with...
1069         (__libdwfl_getsym): ...this. Use ebl_resolve_sym_value if requested
1070         and possible. Adjust sym->st_value only when requested. Fill in addr
1071         if available.
1072         (dwfl_module_getsym_info): New function.
1073         (dwfl_module_getsym): Use __libdwfl_getsym.
1074         * libdwfl.h (dwfl_module_getsym_elf): Removed.
1075         (dwfl_module_getsym_info): New function declaration.
1076         (dwfl_module_addrinfo): Likewise.
1077         (dwfl_module_addrsym): Add documentation describing differences
1078         with addrinfo variants.
1079         (dwfl_module_addrsym_elf): Removed.
1080         * libdwflP.h (__libdwfl_getsym): New internal function declaration.
1081         (__libdwfl_addrsym): Likewise.
1082         (__libdwfl_find_section_ndx): Likewise.
1083         (dwfl_module_addrinfo): New internal declaration.
1084         (dwfl_module_getsym_info): Likewise.
1085         (dwfl_module_addrsym_elf): Removed.
1086         (dwfl_module_getsym_elf): Likewise.
1087
1088 2013-12-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
1089
1090         * argp-std.c (offline_find_elf): Remove.
1091         (offline_callbacks): Use dwfl_build_id_find_elf instead.
1092         * dwfl_build_id_find_elf.c (dwfl_build_id_find_elf): Move here the code
1093         removed above.
1094
1095 2013-12-18  Jan Kratochvil  <jan.kratochvil@redhat.com>
1096
1097         unwinder: s390 and s390x
1098         * dwfl_frame_pc.c (dwfl_frame_pc): Call ebl_normalize_pc.
1099         * frame_unwind.c (new_unwound): New function from ...
1100         (handle_cfi): ... here.  Call it.
1101         (setfunc, getfunc, readfunc): New functions.
1102         (__libdwfl_frame_unwind): Call ebl_unwind with those functions.
1103         * linux-core-attach.c (core_set_initial_registers): Always iterate
1104         through the Ebl_Register_Location loop.  Call
1105         dwfl_thread_state_register_pc there.
1106
1107 2013-12-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
1108
1109         * frame_unwind.c (handle_cfi): Call ebl_dwarf_to_regno for RA.
1110
1111 2013-12-17  Mark Wielaard  <mjw@redhat.com>
1112
1113         * linux-pid-attach.c (pid_next_thread): Call rewinddir on first
1114         traversal.
1115
1116 2013-12-16  Mark Wielaard  <mjw@redhat.com>
1117
1118         * libdwfl.h (dwfl_module_getsymtab_first_global): New function
1119         definition.
1120         * dwfl_module_getdwarf.c (dwfl_module_getsymtab_first_global): New
1121         function.
1122         * libdwflP.h (dwfl_module_getsymtab_first_global): New internal
1123         function definition.
1124         * dwfl_module_addrsym.c (dwfl_module_addrsym_elf): Use new function.
1125
1126 2013-12-14  Mark Wielaard  <mjw@redhat.com>
1127
1128         * dwfl_module.c (__libdwfl_module_free): Free mod->reloc_info if
1129         allocated. Call dwarf_cfi_end on mod->eh_cfi if necessary.
1130         * frame_unwind.c (handle_cfi): Free frame result from
1131         dwarf_cfi_addrframe when done.
1132
1133 2013-12-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
1134
1135         unwinder: ppc and ppc64
1136         * frame_unwind.c (__libdwfl_frame_reg_get, __libdwfl_frame_reg_set):
1137         Call ebl_dwarf_to_regno.
1138         * linux-core-attach.c (core_set_initial_registers): Implement
1139         pc_register support.
1140         * linux-pid-attach.c (pid_thread_state_registers_cb): Implement
1141         FIRSTREG -1.
1142
1143 2013-11-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
1144
1145         Introduce process_attach_error.
1146         * dwfl_begin.c (dwfl_begin): Initialize process_attach_error.
1147         * dwfl_frame.c (dwfl_pid, dwfl_getthreads): Use PROCESS_ATTACH_ERROR if
1148         PROCESS is NULL.
1149         * libdwflP.h (struct Dwfl): New field process_attach_error.
1150         * linux-core-attach.c (__libdwfl_attach_state_for_core): Rename to ...
1151         (attach_state_for_core): ... here, make it static, change return type,
1152         no longer use __libdwfl_seterrno.
1153         (__libdwfl_attach_state_for_core): New wrapper for it.
1154
1155 2013-11-27  Mark Wielaard  <mjw@redhat.com>
1156
1157         * dwfl_module_addrsym.c (dwfl_module_addrsym): Rename to and call...
1158         (dwfl_module_addrsym_elf): this. Add elfp and biasp arguments,
1159         keep track of symelf, addr_symelf, closest_elf and sizeless_elf
1160         instead of tracking dwfl_files.
1161         * dwfl_module_getsym.c (__libdwfl_module_getsym): Renamed to...
1162         (dwfl_module_getsym_elf): ...this. Remove dwfl_file argument, add
1163         new elfp and biasp arguments. Track elf instead of file.
1164         (dwfl_module_getsym): Call dwfl_module_getsym_elf.
1165         dwfl_module_info.c (dwfl_module_info): Pass elf to
1166         dwfl_adjusted_st_value.
1167         * libdwfl.h (dwfl_module_getsym): Document limitations of shndx.
1168         (dwfl_module_getsym_elf): New function declaration.
1169         (dwfl_module_addrsym_elf): Likewise.
1170         * libdwflP.h (dwfl_module_addrsym_elf): INTDECL.
1171         (dwfl_module_getsym_elf): Likewise.
1172         (dwfl_adjusted_st_value): Take and check elf not dwfl_file.
1173         (dwfl_deadjust_st_value): Likewise.
1174         (__libdwfl_module_getsym): Removed.
1175         * relocate.c (resolve_symbol): Pass elf to dwfl_adjusted_st_value.
1176
1177 2013-11-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
1178
1179         Fix non-build-id core files on build-id system.
1180         * link_map.c (report_r_debug): Remove valid clearing if build-id cannot
1181         be read from memory.
1182
1183 2013-11-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
1184
1185         * dwfl_segment_report_module.c (dwfl_segment_report_module): New
1186         variable close_elf.  Call __libdwfl_find_elf_build_id and compare the
1187         content, if possible.
1188
1189 2013-11-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
1190
1191         link_map: Use proper bias, not l_addr.
1192         * core-file.c (dynamic_vaddr_get): Rename to ...
1193         (__libdwfl_dynamic_vaddr_get): ... here, make it global,
1194         internal_function.
1195         (dwfl_core_file_report): Update name in the caller.
1196         * libdwflP.h (__libdwfl_dynamic_vaddr_get): New declaration.
1197         * link_map.c (report_r_debug): New variable elf_dynamic_vaddr.  Call
1198         __libdwfl_dynamic_vaddr_get for it.  Remove L_ADDR FIXME comment.
1199         Use ELF_DYNAMIC_VADDR instead of L_ADDR.
1200
1201 2013-11-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
1202
1203         Compatibility with older kernels such as RHEL-6.
1204         * linux-pid-attach.c (struct pid_arg): New field tid_was_stopped.
1205         (ptrace_attach): New parameter tid_was_stoppedp.  Set it.
1206         (pid_set_initial_registers): Pass tid_was_stopped.
1207         (pid_thread_detach): Use tid_was_stopped.
1208
1209 2013-11-18  Josh Stone  <jistone@redhat.com>
1210
1211         * dwfl_module_getdwarf.c (find_aux_address_sync): New function.
1212         (find_aux_sym): Use it.
1213
1214 2013-11-14  Jan Kratochvil  <jan.kratochvil@redhat.com>
1215
1216         Code cleanup: Remove const in prototype
1217         * dwfl_frame_regs.c (dwfl_thread_state_registers): Remove const from
1218         firstreg.
1219         * libdwfl.h (dwfl_thread_state_registers): Likewise.
1220         * linux-pid-attach.c (pid_thread_state_registers_cb): Likewise.
1221
1222 2013-11-14  Jan Kratochvil  <jan.kratochvil@redhat.com>
1223
1224         Fix dwfl_attach_state machine->elf.
1225         * dwfl_frame.c (dwfl_attach_state): Change parameter machine to elf.
1226         Call ebl_openbackend instead of ebl_openbackend_machine.
1227         * libdwfl.h (dwfl_attach_state): Change parameter machine to elf.
1228         Update the function description.
1229         * linux-core-attach.c (__libdwfl_attach_state_for_core): Pass CORE to
1230         dwfl_attach_state.
1231         * linux-pid-attach.c (__libdwfl_attach_state_for_pid): Pass NULL to
1232         dwfl_attach_state.
1233
1234 2013-11-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
1235
1236         Provide __libdwfl_module_getsym to get dwfl_file *.
1237         * dwfl_module_addrsym.c (dwfl_module_addrsym) (i_to_symfile): Remove.
1238         (dwfl_module_addrsym) (search_table): New variable file.  Use
1239         __libdwfl_module_getsym.  Use file.
1240         * dwfl_module_getsym.c (dwfl_module_getsym): Rename to ...
1241         (__libdwfl_module_getsym): ... here.  Add parameter filep.  Set it.
1242         (dwfl_module_getsym): New wrapper.
1243         * libdwflP.h (__libdwfl_module_getsym): New declaration.
1244
1245 2013-11-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
1246
1247         Fix dwfl_module_addrsym for minidebuginfo.
1248         * dwfl_module_addrsym.c (dwfl_module_addrsym): New variable
1249         addr_symfile.
1250         (dwfl_module_addrsym) (same_section): Use it.
1251         (dwfl_module_addrsym) (i_to_symfile): New function.
1252         (dwfl_module_addrsym) (search_table): Use it.
1253
1254 2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
1255             Mark Wielaard  <mjw@redhat.com>
1256
1257         * Makefile.am (libdwfl_a_SOURCES): Add dwfl_frame.c, frame_unwind.c,
1258         dwfl_frame_pc.c, linux-pid-attach.c, linux-core-attach.c and
1259         dwfl_frame_regs.c.
1260         * core-file.c (dwfl_core_file_report): Call
1261         __libdwfl_attach_state_for_core.
1262         * dwfl_end.c (dwfl_end): Call __libdwfl_process_free.
1263         * dwfl_frame.c: New file.
1264         * frame_unwind.c: New file.
1265         * dwfl_frame_pc.c: New file.
1266         * linux-pid-attach.c: New file.
1267         * linux-core-attach.c: New file.
1268         * dwfl_frame_regs.c: New file.
1269         * libdwfl.h (Dwfl_Thread, Dwfl_Frame): New typedefs.
1270         (dwfl_core_file_report, dwfl_linux_proc_report): Extend comments.
1271         (Dwfl_Thread_Callbacks): New definition.
1272         (struct ebl, dwfl_attach_state, dwfl_pid, dwfl_thread_dwfl)
1273         (dwfl_thread_tid, dwfl_frame_thread, dwfl_thread_state_registers)
1274         (dwfl_thread_state_register_pc, dwfl_getthreads, dwfl_thread_getframes)
1275         (dwfl_frame_pc): New declarations.
1276         * libdwflP.h (Dwfl_Process): New typedef.
1277         (LIBEBL_BAD, CORE_MISSING, INVALID_REGISTER, PROCESS_MEMORY_READ)
1278         (PROCESS_NO_ARCH, PARSE_PROC, INVALID_DWARF, UNSUPPORTED_DWARF)
1279         (NEXT_THREAD_FAIL, ATTACH_STATE_CONFLICT, NO_ATTACH_STATE, NO_UNWIND)
1280         (INVALID_ARGUMENT): New DWFL_ERROR entries.
1281         (struct Dwfl): New entry process.
1282         (struct Dwfl_Process, struct Dwfl_Thread, struct Dwfl_Frame)
1283         (__libdwfl_frame_reg_get, __libdwfl_frame_reg_set)
1284         (__libdwfl_process_free, __libdwfl_frame_unwind)
1285         (__libdwfl_attach_state_for_pid, __libdwfl_attach_state_for_core)
1286         (__libdwfl_segment_start, __libdwfl_segment_end): New declarations.
1287         (dwfl_attach_state, dwfl_pid, dwfl_thread_dwfl, dwfl_thread_tid)
1288         (dwfl_frame_thread, dwfl_thread_state_registers)
1289         (dwfl_thread_state_register_pc, dwfl_getthreads, dwfl_thread_getframes)
1290         (dwfl_frame_pc): New INTDECL entries.
1291         * linux-proc-maps.c (dwfl_linux_proc_report): Call
1292         __libdwfl_attach_state_for_pid.
1293         * segment.c (segment_start): Rename to ...
1294         (__libdwfl_segment_start): ... here and make it internal_function.
1295         (segment_end): Rename to ...
1296         (__libdwfl_segment_end): ... here and make it internal_function.
1297         (reify_segments, dwfl_report_segment): Rename them at the callers.
1298
1299 2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
1300
1301         * core-file.c (dwfl_core_file_report): Remove the use of MAX.
1302
1303 2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
1304
1305         * core-file.c (dwfl_core_file_report): Replaced variable sniffed by
1306         retval.  Fix one forgotten LISTED increase.
1307
1308 2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
1309
1310         Fix core files for re-prelink-ed files.
1311         * core-file.c (dynamic_vaddr_get): New function.
1312         (dwfl_core_file_report): New variable file_dynamic_vaddr.  Call
1313         dynamic_vaddr_get instead of using L_ADDR.
1314         * libdwflP.h (struct r_debug_info_module): Remove field l_addr.
1315         * link_map.c (report_r_debug): Do not initialize l_addr.
1316
1317 2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
1318
1319         Code cleanup.
1320         * core-file.c (dwfl_core_file_report): Reindent block of code by
1321         continue keyword.
1322
1323 2013-10-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
1324
1325         * argp-std.c (parse_opt): Use executable parameter of
1326         dwfl_core_file_report.
1327         * core-file.c (dwfl_core_file_report): Add parameter executable.  Set
1328         it to DWFL.  Add NEW_VERSION for it.
1329         (_compat_without_executable_dwfl_core_file_report): New.  Twice.
1330         * libdwfl.h (dwfl_core_file_report): Add parameter executable, update
1331         the function comment.
1332
1333 2013-10-15  Mark Wielaard  <mjw@redhat.com>
1334
1335         * linux-proc-maps.c (proc_maps_report): Ignore non-absolute file
1336         mappings.
1337         (dwfl_linux_proc_find_elf): Don't abort, just return failure.
1338
1339 2013-09-12  Mark Wielaard  <mjw@redhat.com>
1340
1341         * cu.c (intern_cu): If dwarf_offdie fails free cu.
1342
1343 2013-09-12  Mark Wielaard  <mjw@redhat.com>
1344
1345         * linux-proc-maps.c (proc_maps_report): Don't fclose FILE in
1346         bad_report.
1347
1348 2013-09-12  Mark Wielaard  <mjw@redhat.com>
1349
1350         * dwfl_module_getdwarf.c (find_symtab): Call elf_getdata with
1351         aux_xndxscn, not xndxscn, for aux_symxndxdata.
1352
1353 2013-08-25  Mark Wielaard  <mjw@redhat.com>
1354
1355         * linux-kernel-modules.c (report_kernel): Pass add_p_vaddr as true
1356         to dwfl_report_elf.
1357
1358 2013-07-25  Jan Kratochvil  <jan.kratochvil@redhat.com>
1359
1360         * dwfl_segment_report_module.c (dwfl_segment_report_module): Check for
1361         conflicts all the modules, not just the first one.  Compare L_LD if it
1362         is equal, not if it is in a module address range.
1363
1364 2013-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
1365
1366         * libdwflP.h (__libdwfl_elf_address_range): Add internal_function.
1367
1368 2013-07-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
1369
1370         * core-file.c (clear_r_debug_info): Close also ELF and FD.
1371         (dwfl_core_file_report): Call __libdwfl_report_elf for
1372         R_DEBUG_INFO.MODULE.
1373         * dwfl_report_elf.c (__libdwfl_elf_address_range): New function from
1374         code of ...
1375         (__libdwfl_report_elf): ... this function.  Call it.
1376         * dwfl_segment_report_module.c: Include unistd.h.
1377         (dwfl_segment_report_module): Use basename for MODULE->NAME.
1378         Clear MODULE if it has no build-id and we have segment with build-id.
1379         Ignore this segment only if MODULE still contains valid ELF.
1380         * libdwflP.h (__libdwfl_elf_address_range): New declaration.
1381         (struct r_debug_info_module): New fields fd, elf, l_addr, start, end
1382         and disk_file_has_build_id.
1383         (dwfl_link_map_report): Extend the comment.
1384         * link_map.c (report_r_debug): Extend the comment.  Always fill in new
1385         r_debug_info_module.  Initialize also the new r_debug_info_module
1386         fields.  Remove one FIXME comment.  Call __libdwfl_elf_address_range
1387         instead of __libdwfl_report_elf when R_DEBUG_INFO is not NULL.
1388
1389 2013-07-19  Jan Kratochvil  <jan.kratochvil@redhat.com>
1390
1391         * libdwflP.h (__libdwfl_find_elf_build_id): Add internal_function.
1392
1393 2013-07-02  Mark Wielaard  <mjw@redhat.com>
1394
1395         * relocate.c (__libdwfl_relocate_value): Remove mod->e_type assert.
1396
1397 2013-06-05  Mark Wielaard  <mjw@redhat.com>
1398
1399         * link_map.c (report_r_debug): Always call release_buffer after
1400         memory_callback succeeded reading build_id.
1401
1402 2013-05-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
1403
1404         * argp-std.c (parse_opt) <ARGP_KEY_SUCCESS> <opt->core> <opt->e>: Set
1405         executable_for_core before calling dwfl_core_file_report.
1406         * core-file.c (clear_r_debug_info): New function.
1407         (dwfl_core_file_report): Move raw segments reporting lower.  New
1408         variable r_debug_info, pass it to dwfl_segment_report_module.  Call
1409         clear_r_debug_info in the end.  Return sum of LISTED and SNIFFED.
1410         * dwfl_module_build_id.c (check_notes): Move into
1411         __libdwfl_find_elf_build_id.
1412         (__libdwfl_find_build_id): Rename to ...
1413         (__libdwfl_find_elf_build_id): ... here.  Add parameters build_id_bits,
1414         build_id_elfaddr and build_id_len.  Verify MOD vs. ELF.
1415         (__libdwfl_find_elf_build_id) (check_notes): Remove parameters mod and
1416         set, rename data_vaddr to data_elfaddr.  Do not call found_build_id.
1417         (__libdwfl_find_elf_build_id): Update the check_notes caller, do not
1418         adjust its data_elfaddr parameter.
1419         (__libdwfl_find_build_id): New wrapper of __libdwfl_find_elf_build_id.
1420         * dwfl_segment_report_module.c (dwfl_segment_report_module): New
1421         parameter r_debug_info.  New variable name_is_final.  Adjust addresses
1422         according to R_DEBUG_INFO->MODULE.  Check conflicts against DWFL.
1423         Do not overwrite NAME by SONAME if NAME_IS_FINAL.
1424         * libdwflP.h (__libdwfl_find_elf_build_id): New declaration.
1425         (struct r_debug_info_module, struct r_debug_info): New definitions.
1426         (dwfl_segment_report_module, dwfl_link_map_report): Add parameter
1427         r_debug_info.
1428         * link_map.c: Include fcntl.h.
1429         (report_r_debug): Add parameter r_debug_info, describe it in the
1430         function comment.  Delete dwfl_addrmodule call and its dependent code.
1431         Verify build-id before calling dwfl_report_elf, also supply
1432         executable_for_core to it.  Store r_debug_info->module info when
1433         appropriate.
1434         (dwfl_link_map_report): Add parameter r_debug_info.  New variable
1435         in_ok.  Try to read IN from EXECUTABLE_FOR_CORE.  Update report_r_debug
1436         caller parameters.
1437
1438 2013-04-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
1439
1440         * dwfl_report_elf.c (__libdwfl_report_elf): Add parameter add_p_vaddr.
1441         Set it to true for ET_EXEC and ET_CORE.  Provide alternative
1442         setup of START and BIAS if !ADD_P_VADDR.  Set END from BIAS, not BASE.
1443         (dwfl_report_elf): Add parameter add_p_vaddr.  Pass it down.  Add
1444         NEW_VERSION.
1445         (_compat_without_add_p_vaddr_dwfl_report_elf) <SHARED>: New, with
1446         COMPAT_VERSION.
1447         * libdwfl.h (dwfl_report_elf): Add parameter add_p_vaddr.  Describe it.
1448         * libdwflP.h (__libdwfl_report_elf): Add parameter add_p_vaddr.
1449         * link_map.c (report_r_debug): Use true add_p_vaddr for dwfl_report_elf.
1450         * linux-kernel-modules.c (report_kernel): Use false add_p_vaddr for
1451         dwfl_report_elf.
1452         * offline.c (process_elf): Use true add_p_vaddr for dwfl_report_elf.
1453
1454 2013-04-27  Mark Wielaard  <mjw@redhat.com>
1455
1456         * link_map.c: #include system.h.
1457
1458 2013-04-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
1459
1460         * link_map.c (BE32, BE64, LE32, LE64): Delete the definitions, move
1461         them to lib/system.h.
1462
1463 2013-04-24  Mark Wielaard  <mjw@redhat.com>
1464
1465         * Makefile.am: Use AM_CPPFLAGS instead of INCLUDES.
1466
1467 2013-03-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
1468
1469         * dwfl_report_elf.c (__libdwfl_report_elf): Remove BASE aligning.
1470
1471 2013-03-12  Mark Wielaard  <mjw@redhat.com>
1472
1473         * dwfl_getsrclines.c (dwfl_getsrclines): Return 0 on success.
1474
1475 2013-02-22  Mark Wielaard  <mjw@redhat.com>
1476
1477         * open.c (__libdw_gunzip,__libdw_bunzip2,__libdw_unlzma): Define
1478         as DWFL_E_BADELF when not used.
1479
1480 2013-02-10  Mark Wielaard  <mjw@redhat.com>
1481
1482         * argp-std.c (parse_opt): Use opt->core and opt->e explicitly in
1483         failure messages When handling ARGP_KEY_SUCCESS because arg will
1484         not have been set.
1485
1486 2013-01-30  Jan Kratochvil  <jan.kratochvil@redhat.com>
1487
1488         * linux-proc-maps.c: Include system.h.
1489         (PROCEXEFMT, get_pid_class): New.
1490         (grovel_auxv): Detect 32-bit vs. 64-bit auxv, possibly call
1491         get_pid_class.
1492
1493 2013-01-23  Mark Wielaard  <mjw@redhat.com>
1494
1495         * dwfl_module_getdwarf.c (find_aux_sym): Don't substract one
1496         from aux_syments by default.
1497         (find_symtab): Also succeed when only aux_symdata is found.
1498         When no symtab is found always try to load auxiliary table.
1499         (dwfl_module_getsymtab): Substract one from result when both
1500         tables have symbols.
1501         * dwfl_module_getsym.c (dwfl_module_getsym): Only skip auxiliary
1502         zero entry when both tables have symbols.
1503         * dwfl_module_addrsym.c (dwfl_module_addrsym): Only substract
1504         one from first_global when both tables have symbols.
1505
1506 2013-01-16  Mark Wielaard  <mjw@redhat.com>
1507
1508         * libdwflP.h (struct Dwfl_Module): Add aux_sym, aux_symdata,
1509         aux_syments, aux_symstrdata, aux_symxndxdata and aux_first_global.
1510         (dwfl_adjusted_aux_sym_addr): New function.
1511         (dwfl_deadjust_aux_sym_addr): Likewise.
1512         (dwfl_adjusted_st_value): Take and check symfile argument.
1513         (dwfl_deadjust_st_value): Likewise.
1514         * dwfl_module_getdwarf.c (find_prelink_address_sync): Take and
1515         use dwfl_file as argument to set address_sync.
1516         (find_debuginfo): Call find_prelink_address_sync with debug file.
1517         (find_aux_sym): New function.
1518         (find_symtab): Use find_aux_sym if all we have is the dynsym table
1519         and fill in aux DwflModule fields.
1520         (dwfl_module_getsymtab): Return syments plus aux_syments.
1521         (load_symtab): Always set first_global.
1522         * dwfl_module_addrsym.c (dwfl_module_addrsym): Check symfile
1523         when using same_section. Calculate first_global based on both
1524         mod->first_global and mod->aux_first_global.
1525         * dwfl_module.c (__libdwfl_module_free): Free aux_sym.
1526         * dwfl_module_getsym.c (dwfl_module_getsym): Use auxsym table
1527         to retrieve symbol and name if necessary, making sure all locals
1528         from any table come before any globals.
1529         * dwfl_module_info.c (dwfl_module_info): Call dwfl_adjusted_st_value
1530         with symfile.
1531         * relocate.c (resolve_symbol): Likewise.
1532
1533 2013-01-07  Roland McGrath  <roland@hack.frob.com>
1534
1535         * link_map.c (auxv_format_probe): Handle unaligned 64-bit data, but
1536         still assume the data is at least 32-bit aligned anyway.
1537         (dwfl_link_map_report): Handle unaligned auxv data.
1538
1539 2012-12-11  Mark Wielaard  <mjw@redhat.com>
1540
1541         * linux-kernel-modules.c (report_kernel): Only free fname if
1542         find_kernel_elf succeeds and allocates it.
1543         (report_kernel_archive): Fix brackets around unlikely expression.
1544
1545 2012-11-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
1546
1547         * argp-std.c: Update Copyright year.
1548         (offline_find_elf): New function.
1549         (offline_callbacks): Use it for find_elf.
1550         (struct parse_opt): New.
1551         (parse_opt): New key ARGP_KEY_INIT.  In other make hook struct
1552         parse_opt pointer from former Dwfl pointer.  Delay 'e and OPT_COREFILE
1553         processing till ARGP_KEY_SUCCESS.  Initialize state->input already from
1554         ARGP_KEY_SUCCESS.  Modify the cleanup in ARGP_KEY_ERROR.  Make the
1555         final state->input initialization optional.
1556         * dwfl_end.c: Update Copyright year.
1557         (dwfl_end): Free executable_for_core.
1558         * libdwflP.h: Update Copyright year.
1559         (struct Dwfl): New field executable_for_core.
1560
1561 2012-11-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
1562
1563         * dwfl_report_elf.c (__libdwfl_report_elf): Simplify START and BIAS
1564         calculation.
1565
1566 2012-10-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
1567
1568         * dwfl_module_getdwarf.c (mod_verify_build_id): New function with code
1569         from ...
1570         (__libdwfl_getelf): ... here.  Call it.
1571
1572 2012-10-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
1573
1574         * libdwfl.h (dwfl_module_getelf): Add __nonnull_attribute__.
1575
1576 2012-10-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
1577
1578         * dwfl_segment_report_module.c (dwfl_segment_report_module):
1579         Initialize mod->MAIN_BIAS.
1580
1581 2012-10-10  Jan Kratochvil  <jan.kratochvil@redhat.com>
1582
1583         * dwfl_module_addrsym.c (dwfl_module_addrsym): New function
1584         binding_value.  Use it for both zero and non-zero size symbols
1585         comparisons.
1586
1587 2012-10-01  Mark Wielaard  <mjw@redhat.com>
1588
1589         * cu.c (cudie_offset): Don't use type_sig8, it might not be
1590         initialized and these are always real CUs, never TUs.
1591
1592 2012-10-01  Mark Wielaard  <mjw@redhat.com>
1593
1594         * derelocate.c (find_section): Check next section exists before
1595         accessing it.
1596
1597 2012-08-01  Petr Machata  <pmachata@redhat.com>
1598
1599         * offline.c (process_archive_member): Ignore entry "/SYM64/".
1600
1601 2012-03-28  Roland McGrath  <roland@hack.frob.com>
1602
1603         * dwfl_segment_report_module.c
1604         (dwfl_segment_report_module: read_portion): Don't use existing buffer
1605         when FILESZ is zero (string mode) and available portion doesn't hold
1606         a terminated string.
1607
1608 2011-12-02  Roland McGrath  <roland@hack.frob.com>
1609
1610         * elf-from-memory.c (elf_from_remote_memory): Fix ELFCLASS64 case
1611         to use elf64_xlatetom and PHDRS.p64.
1612         Reported by Serge Pavlov <serge.pavlov.at.gnu@gmail.com>.
1613
1614 2011-11-31  Mark Wielaard  <mjw@redhat.com>
1615
1616         * dwfl_module_addrsym.c (dwfl_module_addrsym): First search all
1617         global symbols. Then only when that doesn't provide a match search
1618         all local symbols too.
1619         * dwfl_module_getdwarf.c (load_symtab): Take first_global int arg
1620         and fill it in.
1621         (find_symtab): Initialize mod->first_global and pass it to load_symtab.
1622         * libdwfl/libdwflP.h (Dwfl_Module): Add first_global field.
1623
1624 2011-11-31  Mark Wielaard  <mjw@redhat.com>
1625
1626         * dwfl_module_addrsym.c (dwfl_module_addrsym): Only update
1627         sizeless_sym if needed and closer to desired addr.
1628
1629 2011-10-20  Mark Wielaard  <mjw@redhat.com>
1630
1631         * derelocate.c (cache_sections): Intern mod->reloc_info check.
1632         (dwfl_module_relocations): Don't check mod->reloc_info.
1633         (dwfl_module_relocation_info): Likewise.
1634         (find_section): Likewise.
1635
1636 2011-07-09  Roland McGrath  <roland@hack.frob.com>
1637
1638         * image-header.c (LE32): Macro removed (now in lib/system.h).
1639
1640 2011-04-11  Mark Wielaard  <mjw@redhat.com>
1641
1642         * linux-kernel-modules.c (vmlinux_suffixes): Guard definition
1643         by check for zlib, bzlib or lzma defines to check it isn't empty.
1644         (try_kernel_name): Use same guard for use of vmlinux_suffixes.
1645
1646 2011-03-08  Roland McGrath  <roland@redhat.com>
1647
1648         * dwfl_module_getdwarf.c (open_elf): Clear errno before CBFAIL.
1649         Reported by Kurt Roeckx <kurt@roeckx.be>.
1650
1651 2011-02-11  Roland McGrath  <roland@redhat.com>
1652
1653         * linux-kernel-modules.c (try_kernel_name): Try .gz, .bz2, .xz
1654         suffixes if corresponding decompression support is enabled.
1655
1656 2011-02-01  Roland McGrath  <roland@redhat.com>
1657
1658         * dwfl_module_getdwarf.c (find_prelink_address_sync): Use the
1659         section-end address as the synchronization point, rather than sh_addr.
1660
1661         * dwfl_module_getdwarf.c (find_prelink_address_sync): Discover
1662         PT_INTERP p_vaddr separately from main phdrs and undo phdrs.
1663
1664         * dwfl_module_getdwarf.c (find_prelink_address_sync): Fix pasto in
1665         last change, so we recognize PT_INTERP in ELFCLASS64 correctly.
1666
1667 2011-01-11  Roland McGrath  <roland@redhat.com>
1668
1669         * dwfl_module_getdwarf.c (open_elf): Remove section-based
1670         address_sync fixup from here.
1671         (find_prelink_address_sync): New function.
1672         (find_debuginfo): Call it.
1673         * libdwflP.h (DWFL_ERRORS): Add BAD_PRELINK error.
1674
1675 2011-01-04  Roland McGrath  <roland@redhat.com>
1676
1677         * dwfl_module_getdwarf.c (open_elf): Enhance address_sync calculation
1678         logic to consider section addresses, the better to survive all the
1679         possible prelink machinations.
1680         * libdwflP.h (struct dwfl_file): Comment change.
1681
1682 2010-11-30  Roland McGrath  <roland@redhat.com>
1683
1684         * derelocate.c (dwfl_module_relocations): Remove over-eager assert.
1685
1686 2010-11-12  Roland McGrath  <roland@redhat.com>
1687
1688         * libdwflP.h (struct Dwfl_Module): New member main_bias.
1689         (dwfl_adjusted_address, dwfl_deadjust_address): Use it.
1690         * dwfl_module_getdwarf.c (__libdwfl_getelf): Initialize it.
1691
1692         * libdwflP.h (dwfl_deadjust_address): New function.
1693         (dwfl_deadjust_dwarf_addr, dwfl_deadjust_st_value): New functions.
1694         * cu.c (addrarange): Use dwfl_deadjust_dwarf_addr.
1695         * dwfl_module_addrsym.c: Use dwfl_deadjust_st_value.
1696
1697 2010-11-11  Roland McGrath  <roland@redhat.com>
1698
1699         * libdwflP.h (struct dwfl_file): Remove bias member.
1700         Add vaddr and address_sync members instead.
1701         (dwfl_adjusted_address): Calculate using vaddr.
1702         (dwfl_adjusted_dwarf_addr): Calculate using address_sync and call that.
1703         (dwfl_adjusted_st_value): Use one of those calls.
1704         * dwfl_module_getdwarf.c (open_elf): Initialize vaddr and address_sync.
1705         * dwfl_segment_report_module.c (dwfl_segment_report_module): Likewise.
1706         * derelocate.c (dwfl_module_relocations): Update ET_EXEC assertions.
1707         * link_map.c (consider_executable): Adjust only MOD->low_addr for
1708         detected PIE bias change.
1709
1710         * libdwflP.h (dwfl_adjusted_dwarf_addr): New function.
1711         * dwfl_module_info.c: Use it.
1712         * cu.c (addrarange): Likewise.
1713         * dwfl_dwarf_line.c: Likewise.
1714         * dwfl_module_dwarf_cfi.c: Likewise.
1715         * dwfl_lineinfo.c: Likewise.
1716         * dwfl_nextcu.c: Likewise.
1717         * dwfl_module_getdwarf.c (dwfl_module_getdwarf): Likewise.
1718
1719         * libdwflP.h (dwfl_adjusted_st_value): New function.
1720         * relocate.c (resolve_symbol): Use it.
1721         * dwfl_module_getsym.c: Likewise.
1722         * dwfl_module_addrsym.c: Likewise.
1723         * dwfl_module_info.c: Likewise.
1724
1725         * libdwflP.h (dwfl_adjusted_address): New function.
1726         * dwfl_module_build_id.c (__libdwfl_find_build_id): Use it.
1727         * relocate.c (__libdwfl_relocate_value): Likewise.
1728         * derelocate.c (cache_sections): Likewise.
1729         (dwfl_module_address_section): Likewise.
1730         * dwfl_module_getelf.c: Likewise.
1731         * dwfl_module_eh_cfi.c: Likewise.
1732         * link_map.c (consider_executable): Likewise.
1733
1734 2010-08-24  Roland McGrath  <roland@redhat.com>
1735
1736         * dwfl_dwarf_line.c: New file.
1737         * Makefile.am (libdwfl_a_SOURCES): Add it.
1738
1739 2010-08-18  Roland McGrath  <roland@redhat.com>
1740
1741         * link_map.c (report_r_debug): Use found name if we have no name,
1742         even if we already have an Elf handle.
1743
1744 2010-06-30  Roland McGrath  <roland@redhat.com>
1745
1746         * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): Don't be
1747         confused by -1 return from dwfl_build_id_find_elf after it opened
1748         the Elf handle.
1749         * find-debuginfo.c (dwfl_standard_find_debuginfo): Likewise for
1750         dwfl_build_id_find_debuginfo.
1751
1752 2010-06-16  Roland McGrath  <roland@redhat.com>
1753
1754         * cu.c (cudie_offset): Use DIE_OFFSET_FROM_CU_OFFSET macro.
1755
1756 2010-06-14  Roland McGrath  <roland@redhat.com>
1757
1758         * find-debuginfo.c (try_open): Take new arg MAIN_STAT.  Compare
1759         candidate file to that st_dev/st_ino and pretend it didn't exist
1760         if they match.
1761         (find_debuginfo_in_path): Update caller, pass main file's info.
1762
1763 2010-05-20  Roland McGrath  <roland@redhat.com>
1764
1765         * linux-proc-maps.c (find_sysinfo_ehdr): Renamed to ...
1766         (grovel_auxv): ... this.  Take DWFL argument.
1767         (dwfl_linux_proc_report): Update caller.
1768
1769         * dwfl_module_getdwarf.c (open_elf): Calculate alignment for bias
1770         based on dwfl->segment_align or manifest alignment of MOD->low_addr.
1771
1772 2010-05-19  Roland McGrath  <roland@redhat.com>
1773
1774         * linux-kernel-modules.c (intuit_kernel_bounds): Rewritten.
1775
1776 2010-05-06  Roland McGrath  <roland@redhat.com>
1777
1778         * segment.c (insert): Clear inserted elements of DWFL->lookup_module.
1779
1780         * libdwflP.h (DWFL_ERRORS): Add WRONG_ID_ELF.
1781         * dwfl_build_id_find_elf.c: Set MOD->main.valid when there is a build
1782         ID but we didn't find a file.
1783         * dwfl_module_getdwarf.c (__libdwfl_getelf): When that's set, check
1784         and refuse any fallback file-by-name if it lacks the matching ID.
1785
1786         * dwfl_error.c (dwfl_errno): Add INTDEF.
1787         * libdwflP.h: Add INTDECL.
1788
1789         * dwfl_module_getdwarf.c (open_elf): Do elf_end and clear FILE->elf in
1790         failure cases.
1791
1792 2010-05-04  Roland McGrath  <roland@redhat.com>
1793
1794         * dwfl_segment_report_module.c: Use "[pie]" rather than "[dso]" for an
1795         ET_DYN that has a DT_DEBUG.
1796
1797         * dwfl_segment_report_module.c: Fix jump-start of NDX-finding loop.
1798
1799         * segment.c (insert): Fix moving of values following insertion.
1800         (reify_segments): Fix up MOD->segment backpointer indices after
1801         later insertions in the main loop invalidate them.
1802
1803         * link_map.c (dwfl_link_map_report): Detect bias of embedded phdrs and
1804         apply it to PT_DYNAMIC p_vaddr so we handle a PIE correctly.
1805
1806         * core-file.c (dwfl_core_file_report): Return any nonzero count of
1807         modules reported, even if link_map grovelling failed and only sniffing
1808         found anything.
1809
1810 2010-04-26  Roland McGrath  <roland@redhat.com>
1811
1812         * relocate.c (relocate_section): Treat R_*_NONE reloc as no reloc.
1813         Works around probably-wrong ld -r behavior for case of a DWARF address
1814         constant that refers to a discarded SHF_ALLOC section.
1815
1816 2010-04-14  Roland McGrath  <roland@redhat.com>
1817
1818         * link_map.c (report_r_debug): Limit iterations on the l_next chain to
1819         an upper bound on sane possible number of elements.
1820
1821 2010-03-11  Roland McGrath  <roland@redhat.com>
1822
1823         * link_map.c (auxv_format_probe): Fix scanning loop, so we really scan
1824         the second half for 32-bit matches.
1825
1826 2010-03-10  Roland McGrath  <roland@redhat.com>
1827
1828         * core-file.c (dwfl_core_file_report): Punt EHDR argument.
1829         * argp-std.c (parse_opt): Update caller.
1830         * libdwfl.h: Declare dwfl_core_file_report.
1831         * libdwflP.h: Don't.
1832
1833 2010-02-17  Roland McGrath  <roland@redhat.com>
1834
1835         * dwfl_segment_report_module.c (addr_segndx): Take new flag argument.
1836         If set, find the first index not below ADDR.
1837         (dwfl_segment_report_module): Update callers.
1838         Pass true when calculating return value.
1839
1840 2010-02-15  Roland McGrath  <roland@redhat.com>
1841
1842         * Makefile.am: Use config/eu.am for common stuff.
1843
1844         * find-debuginfo.c (find_debuginfo_in_path): Fix uninitialized
1845         variable in failure path.
1846
1847 2010-02-02  Mark Wielaard  <mjw@redhat.com>
1848
1849         * dwfl_module_dwarf_cfi.c (dwfl_module_dwarf_cfi): Always set bias.
1850         * dwfl_module_eh_cfi.c (dwfl_module_eh_cfi): Likewise
1851
1852 2010-01-07  Roland McGrath  <roland@redhat.com>
1853
1854         * core-file.c (dwfl_core_file_report): Use elf_getphdrnum.
1855         * dwfl_module_build_id.c (__libdwfl_find_build_id): Likewise.
1856         * dwfl_module_getdwarf.c (open_elf, find_dynsym): Likewise.
1857         * dwfl_report_elf.c (__libdwfl_report_elf): Likewise.
1858
1859 2010-01-06  Roland McGrath  <roland@redhat.com>
1860
1861         * relocate.c (relocate_getsym): For SHN_COMMON, zero st_value.
1862         (relocate_section): Let unresolved SHN_COMMON symbol stay 0.
1863
1864 2009-11-16  Roland McGrath  <roland@redhat.com>
1865
1866         * relocate.c (relocate_section): Skip SHT_NOBITS or empty target scn.
1867
1868 2009-11-12  Petr Machata  <pmachata@redhat.com>
1869
1870         * core-file.c (dwfl_elf_phdr_memory_callback): Only load ahead if
1871         the chunk is both offset-contiguous and vaddr-contiguous.
1872
1873 2009-11-05  Roland McGrath  <roland@redhat.com>
1874
1875         * link_map.c (report_r_debug): Skip entries with l_ld==0.
1876         Use dwfl_addrmodule for l_ld lookup, don't bail on lookup failure.
1877
1878 2009-09-04  Roland McGrath  <roland@redhat.com>
1879
1880         * image-header.c (__libdw_image_header): Fix tranposed comparison.
1881
1882 2009-08-27  Roland McGrath  <roland@redhat.com>
1883
1884         * image-header.c: New file.
1885         * Makefile.am (libdwfl_a_SOURCES): Add it.
1886         * libdwflP.h: Declare __libdw_image_header.
1887         * open.c (decompress): Don't consume ELF on failure.
1888         (what_kind): New function, broken out of ...
1889         (__libdw_open_file): ... here.  Call it.
1890         If it fails, try __libdw_image_header and then try what_kind again.
1891
1892         * gzip.c (unzip): Reuse *WHOLE as first INPUT_BUFFER,
1893         leave it behind for next decompressor.
1894         * open.c (decompress): Free BUFFER on failure.
1895
1896 2009-08-26  Roland McGrath  <roland@redhat.com>
1897
1898         * gzip.c (find_zImage_payload): New function, broken out of ...
1899         (mapped_zImage): ... here.  Call it.
1900         (find_zImage_payload) [LZMA]: Match LZMA-compressed kernels with
1901         stupid method of just trying the decoder.
1902
1903         * open.c [USE_LZMA]: Try __libdw_unlzma.
1904         * libdwflP.h: Declare it.
1905         (DWFL_ERRORS): Add DWFL_E_LZMA.
1906         * gzip.c [LZMA]: Implement liblzma version for XZ file format.
1907         * lzma.c: New file.
1908         * Makefile.am [LZMA] (libdwfl_a_SOURCES): Add it.
1909
1910         * gzip.c (mapped_zImage): Limit scan to 32kb.
1911         Make this unconditional, support bzip2 kernel images too.
1912         (unzip): Use direct inflate method for non-mmap case too.
1913         Only zlib uses the stream method.
1914
1915 2009-08-09  Roland McGrath  <roland@redhat.com>
1916
1917         * dwfl_module_build_id.c: Use new macros for versioned definitions.
1918
1919 2009-07-08  Roland McGrath  <roland@redhat.com>
1920
1921         * dwfl_module_dwarf_cfi.c: New file.
1922         * dwfl_module_eh_cfi.c: New file.
1923         * Makefile.am (libdwfl_a_SOURCES): Add them.
1924         * libdwflP.h (struct Dwfl_Module): New members `dwarf_cfi', `eh_cfi.
1925         Add INTDECL for dwfl_module_eh_cfi, dwfl_module_dwarf_cfi.
1926
1927 2009-07-08  Roland McGrath  <roland@redhat.com>
1928
1929         * libdwflP.h (struct Dwfl_Module): Reorder members to pack better.
1930
1931 2009-06-18  Mark Wielaard  <mjw@redhat.com>
1932
1933         * dwfl_report_elf.c (__libdwfl_report_elf): Return NULL on overlap.
1934
1935 2009-06-13  Ulrich Drepper  <drepper@redhat.com>
1936
1937         * derelocate.c: Don't use deprecated libelf functions.
1938         * dwfl_module_getdwarf.c: Likewise.
1939         * relocate.c: Likewise.
1940
1941 2009-04-23  Ulrich Drepper  <drepper@redhat.com>
1942
1943         * dwfl_module_build_id.c: Define versioned symbols only if SHARED is
1944         defined.  Otherwise just define the latest version.
1945
1946 2009-04-22  Roland McGrath  <roland@redhat.com>
1947
1948         * relocate.c (resolve_symbol): Apply correct bias to st_value found in
1949         a non-ET_REL module.
1950
1951         * dwfl_module_build_id.c (__libdwfl_find_build_id): Fix last change to
1952         adjust properly for non-ET_REL.
1953
1954 2009-04-21  Roland McGrath  <roland@redhat.com>
1955
1956         * dwfl_module_getsym.c: Apply non-ET_REL bias only if SHF_ALLOC.
1957
1958         * relocate.c (__libdwfl_relocate_value): Assert that MOD is ET_REL.
1959         * derelocate.c (cache_sections): Call __libdwfl_relocate_value only
1960         for ET_REL.
1961         * dwfl_module_build_id.c (__libdwfl_find_build_id): Likewise.
1962
1963 2009-04-20  Roland McGrath  <roland@redhat.com>
1964
1965         * dwfl_module_getdwarf.c (__libdwfl_getelf): Add internal_function.
1966
1967 2009-04-19  Roland McGrath  <roland@redhat.com>
1968
1969         * dwfl_module_getdwarf.c (find_file): Renamed to ...
1970         (__libdwfl_getelf): ... this.  Make it global.
1971         (find_symtab, find_dw): Update callers.
1972         (dwfl_module_getelf): Functions moved ...
1973         * dwfl_module_getelf.c: ... here, new file.
1974         * Makefile.am (libdwfl_a_SOURCES): Add it.
1975         * libdwflP.h: Declare __libdwfl_getelf.
1976
1977 2009-04-14  Roland McGrath  <roland@redhat.com>
1978
1979         * dwfl_segment_report_module.c: Handle DT_STRTAB value being either
1980         absolute (already adjusted in place) or needing load bias adjustment.
1981
1982         * core-file.c (dwfl_elf_phdr_memory_callback): Fix return value for
1983         gelf_getphdr failure.  Fix file size limit checks.
1984
1985         * dwfl_segment_report_module.c: Fix underflow in DYNSTRSZ check.
1986
1987 2009-04-08  Roland McGrath  <roland@redhat.com>
1988
1989         * dwfl_module_getsym.c: Don't adjust for bias again after
1990         __libdwfl_relocate_value.
1991
1992         * relocate.c (__libdwfl_relocate_value): Don't adjust a value from
1993         a non-SHF_ALLOC section.
1994         (relocate_getsym): Test st_shndx for SHN_* values, not *SHNDX.
1995         * dwfl_module_getsym.c (dwfl_module_getsym): Likewise.
1996
1997 2009-03-09  Roland McGrath  <roland@redhat.com>
1998
1999         * dwfl_module_build_id.c (__libdwfl_find_build_id): Move SHSTRNDX
2000         variable to outer scope, so we cache it for the loop.
2001
2002         * relocate.c (__libdwfl_relocate_value): Add MOD->main.bias to sh_addr.
2003
2004 2009-02-12  Roland McGrath  <roland@redhat.com>
2005
2006         * dwfl_module_build_id.c (__libdwfl_find_build_id): Use
2007         __libdwfl_relocate_value to find correct sh_addr value.
2008
2009 2009-02-10  Roland McGrath  <roland@redhat.com>
2010
2011         * dwfl_report_elf.c (__libdwfl_report_elf): Take new arg SANITY.
2012         If false, don't fail for NO_PHDR.
2013         (dwfl_report_elf): Update caller.
2014         * libdwflP.h: Update decl.
2015         * offline.c (process_elf): Call it with false, so we don't refuse
2016         dubiously-formed objects here.
2017
2018         * link_map.c (consider_executable): Don't assert dwfl_addrsegment
2019         finds our module.  We shouldn't crash when we confuse some guesses.
2020
2021 2009-02-10  Ulrich Drepper  <drepper@redhat.com>
2022
2023         * open.c (decompress): Avoid crash with empty input file.
2024
2025 2009-01-27  Roland McGrath  <roland@redhat.com>
2026
2027         * dwfl_report_elf.c (__libdwfl_report_elf): Ignore trailing PT_LOAD
2028         with zero vaddr and memsz.
2029
2030 2009-01-22  Roland McGrath  <roland@redhat.com>
2031
2032         * open.c (decompress): Move BUFFER, SIZE decls outside #if.
2033
2034         * dwfl_segment_report_module.c (addr_segndx): Remove bogus adjustments
2035         after address-matching loop.
2036
2037         * segment.c (lookup): Fix fencepost in checking for HINT match.
2038
2039 2009-01-14  Roland McGrath  <roland@redhat.com>
2040
2041         * gzip.c [!BZLIB] (mapped_zImage): New function.
2042         (unzip) [!BZLIB]: Grok Linux kernel zImage format.
2043
2044 2009-01-10  Ulrich Drepper  <drepper@redhat.com>
2045
2046         * dwfl_error.c: Always use __thread.  Remove all !USE_TLS code.
2047
2048 2009-01-08  Roland McGrath  <roland@redhat.com>
2049
2050         * linux-kernel-modules.c (dwfl_linux_kernel_report_offline):
2051         Skip subdirectory named "source".
2052         (dwfl_linux_kernel_find_elf): Likewise.
2053
2054 2009-01-06  Roland McGrath  <roland@redhat.com>
2055
2056         * linux-kernel-modules.c (check_suffix): New function.
2057         Match ".ko", ".ko.gz", and ".ko.bz2" suffixes.
2058         (dwfl_linux_kernel_report_offline): Use it.
2059         (dwfl_linux_kernel_find_elf): Likewise.
2060
2061 2009-01-05  Roland McGrath  <roland@redhat.com>
2062
2063         * argp-std.c (parse_opt): Use __libdw_open_file for core file.
2064         * dwfl_build_id_find_debuginfo.c: Use it to open the file.
2065         * dwfl_build_id_find_elf.c: Likewise.
2066         * dwfl_module_getdwarf.c (open_elf): Likewise.
2067         * dwfl_report_elf.c: Likewise.
2068         * find-debuginfo.c (validate): Likewise.
2069         * offline.c (__libdwfl_report_offline): Likewise.
2070
2071         * libdwflP.h: Declare __libdw_open_file.
2072         * open.c: New file.
2073         * Makefile.am (libdwfl_a_SOURCES): Add it.
2074
2075         * gzip.c: New file.
2076         * Makefile.am [ZLIB] (libdwfl_a_SOURCES): Add it.
2077         * bzip2.c: New file.
2078         * Makefile.am [BZLIB] (libdwfl_a_SOURCES): Add it.
2079         * libdwflP.h: Declare __libdw_gunzip, __libdw_bunzip2.
2080
2081 2008-12-16  Roland McGrath  <roland@redhat.com>
2082
2083         * dwfl_module_build_id.c (dwfl_module_build_id): Define with alias and
2084         symver magic to bind to ELFUTILS_0.138.
2085         (_BUG_COMPAT_dwfl_module_build_id): New function, bug compatible
2086         wrapper for ELFUTILS_0.130 version set.
2087
2088 2008-12-18  Roland McGrath  <roland@redhat.com>
2089
2090         * derelocate.c (dwfl_module_relocate_address): Fix last fix: ET_DYN
2091         addresses are taken as relative to MOD->low_addr.
2092
2093 2008-12-15  Roland McGrath  <roland@redhat.com>
2094
2095         * derelocate.c (dwfl_module_relocate_address): Apply main.bias, not
2096         debug.bias.
2097
2098 2008-12-11  Roland McGrath  <roland@redhat.com>
2099
2100         * offline.c (process_archive): Don't call elf_end and close if
2101         returning NULL.  Check first elf_begin call and set error code
2102         specially for empty archive.
2103         Fixes RHBZ#465878.
2104
2105 2008-12-02  Roland McGrath  <roland@redhat.com>
2106
2107         * dwfl_getmodules.c (dwfl_getmodules): Typo fix in last change.
2108
2109 2008-11-26  Roland McGrath  <roland@redhat.com>
2110
2111         * dwfl_getmodules.c (dwfl_getmodules): Encode iteration style in
2112         return value, and interpret encoded OFFSET argument.
2113
2114 2008-10-07  Roland McGrath  <roland@redhat.com>
2115
2116         * dwfl_module_build_id.c (check_notes): Fix typo in vaddr calculation.
2117
2118 2008-09-29  Roland McGrath  <roland@redhat.com>
2119
2120         * segment.c (insert): Must realloc DWFL->lookup_module here too.
2121         (dwfl_report_segment): Clear DWFL->lookup_module before insert calls.
2122
2123 2008-08-28  Roland McGrath  <roland@redhat.com>
2124
2125         * segment.c (reify_segments): Fix last change.
2126
2127 2008-08-27  Roland McGrath  <roland@redhat.com>
2128
2129         * linux-proc-maps.c (read_proc_memory): Return 0 for EINVAL or EPERM
2130         failure from pread64.
2131
2132 2008-08-26  Roland McGrath  <roland@redhat.com>
2133
2134         * segment.c (reify_segments): Insert a trailing segment for a module
2135         end that is above the highest current segment.
2136
2137 2008-08-25  Roland McGrath  <roland@redhat.com>
2138
2139         * dwfl_module_getdwarf.c (open_elf): Extract elf_errno () for
2140         coded return value, not plain DWFL_E_LIBELF.  Return DWFL_E_BADELF
2141         if FILE->elf is not ELF_K_ELF.
2142
2143         * dwfl_segment_report_module.c: Add a cast.
2144
2145 2008-08-21  Denys Vlasenko  <dvlasenk@redhat.com>
2146
2147         * dwfl_module_addrsym.c (dwfl_module_addrsym): Improve logic
2148         which decides which symbol is "closest" to a given address.
2149
2150 2008-08-15  Roland McGrath  <roland@redhat.com>
2151
2152         * argp-std.c (offline_callbacks): Use dwfl_build_id_find_elf.
2153         (options, parse_opt): Handle --core.
2154
2155         * core-file.c: New file.
2156         * Makefile.am (libdwfl_a_SOURCES): Add it.
2157         * libdwflP.h (dwfl_core_file_report): Declare it.
2158
2159         * link_map.c: New file.
2160         * Makefile.am (libdwfl_a_SOURCES): Add it.
2161         * libdwflP.h (dwfl_link_map_report): Declare it.
2162
2163         * libdwflP.h (MIN, MAX): New macros.
2164         (Dwfl_Memory_Callback): New typedef.
2165         (Dwfl_Module_Callback): New typedef.
2166         (dwfl_segment_report_module): Declare it.
2167         * dwfl_segment_report_module.c: New file.
2168         * Makefile.am (libdwfl_a_SOURCES): Add it.
2169
2170         * derelocate.c (dwfl_module_address_section): Add INTDEF.
2171         * libdwflP.h: Add INTDECL.
2172
2173         * segment.c: New file.
2174         * Makefile.am (libdwfl_a_SOURCES): Add it.
2175         * libdwfl.h: Declare dwfl_addrsegment, dwfl_report_segment.
2176         * libdwflP.h (struct Dwfl): New members lookup_elts, lookup_alloc,
2177         lookup_addr, lookup_module, lookup_segndx, replace removed members
2178         modules, nmodules.
2179         (struct Dwfl_Module): New member segment.
2180         * dwfl_end.c (dwfl_end): Free the new ones.  Iterate via modulelist
2181         to each free module.
2182         * dwfl_module.c (dwfl_report_begin_add): Do nothing.
2183         (dwfl_report_begin): Don't call it.  Truncate the segment table instead.
2184         (dwfl_report_module): Don't touch DWFL->nmodules.
2185         (dwfl_report_end): Don't touch DWFL->modules and DWFL->nmodules.
2186         (compare_modules): Function removed.
2187         * dwfl_getmodules.c: Rewritten.
2188         Add INTDEF.
2189         * libdwflP.h: Add INTDECLs.
2190         * dwfl_getdwarf.c: Rewritten to call dwfl_getmodules.
2191         * dwfl_addrmodule.c: Rewritten to just call dwfl_addrsegment.
2192
2193 2008-08-03  Roland McGrath  <roland@redhat.com>
2194
2195         * linux-kernel-modules.c: Include <fts.h> before <config.h>.
2196
2197 2008-07-17  Roland McGrath  <roland@redhat.com>
2198
2199         * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Set errno to
2200         zero if the failure was only ENOENT.
2201
2202 2008-06-03  Roland McGrath  <roland@redhat.com>
2203
2204         * dwfl_module_addrsym.c (dwfl_module_addrsym): Exclude undefined
2205         symbols.
2206
2207 2008-05-22  Petr Machata  <pmachata@redhat.com>
2208
2209         * dwfl_module_getdwarf.c (open_elf): Bias of ET_EXEC files is always 0.
2210
2211 2008-05-06  Roland McGrath  <roland@frob.com>
2212
2213         * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Use
2214         FTS_LOGICAL here too.
2215         (dwfl_linux_kernel_find_elf): Likewise.
2216
2217 2008-04-29  Roland McGrath  <roland@redhat.com>
2218
2219         * find-debuginfo.c (dwfl_standard_find_debuginfo): Try path search
2220         based on canonicalize_file_name if it differs from the supplied name.
2221
2222         * linux-kernel-modules.c (check_module_notes): Use FTS_LOGICAL so
2223         we accept symlinks.
2224
2225 2008-04-27  Roland McGrath  <roland@redhat.com>
2226
2227         * linux-kernel-modules.c (report_kernel): Fix crash when
2228         dwfl_report_elf fails.
2229
2230 2008-04-05  Roland McGrath  <roland@redhat.com>
2231
2232         * linux-proc-maps.c (proc_maps_report): Don't leak LAST_FILE.
2233
2234         * dwfl_module_getdwarf.c (find_file): Always free build_id_bits.
2235         Clear it after freeing.
2236         * dwfl_module_report_build_id.c (dwfl_module_report_build_id): Likewise.
2237
2238 2008-03-26  Roland McGrath  <roland@redhat.com>
2239
2240         * dwfl_module_getdwarf.c (load_symtab): Don't return success for
2241         SHT_DYNSYM, just set *SYMSCN like the comment says.
2242
2243         * dwfl_end.c (dwfl_end): Iterate on modulelist chain, not modules array.
2244
2245         * argp-std.c (parse_opt): On failure, call dwfl_end before argp_failure.
2246
2247 2008-03-19  Roland McGrath  <roland@redhat.com>
2248
2249         * dwfl_module_getsrc.c: Adjust address for module bias before search.
2250
2251 2008-03-01  Roland McGrath  <roland@redhat.com>
2252
2253         * libdwflP.h (__libdwfl_seterrno): Remove parameter name from
2254         prototype to avoid older compiler's complaint about reuse of the name.
2255         (__libdwfl_canon_error): Likewise.
2256
2257 2008-02-19  Roland McGrath  <roland@redhat.com>
2258
2259         * relocate.c (relocate_section): Check for an unhandled relocation
2260         type before resolving a reloc's symbol.  Lift DWFL_E_BADRELTYPE ->
2261         DWFL_E_UNKNOWN_MACHINE check out of loops.
2262
2263         * dwfl_module_getdwarf.c (load_dw): Skip relocation if
2264         DEBUGFILE->relocated is already set.
2265
2266 2008-01-26  Roland McGrath  <roland@redhat.com>
2267
2268         * dwfl_module_getdwarf.c (open_elf): Open FILE->name if it's non-null.
2269
2270         * dwfl_build_id_find_elf.c (__libdwfl_open_by_build_id): Don't clear
2271         incoming *FILE_NAME at the start.
2272
2273 2008-01-08  Roland McGrath  <roland@redhat.com>
2274
2275         * Makefile.am (euinclude): Variable removed.
2276         (pkginclude_HEADERS): Set this instead of euinclude_HEADERS.
2277
2278 2007-10-23  Roland McGrath  <roland@redhat.com>
2279
2280         * linux-kernel-modules.c (report_kernel_archive): Reorder the kernel
2281         module to appear first.
2282
2283 2007-10-20  Roland McGrath  <roland@redhat.com>
2284
2285         * offline.c (process_archive_member): Take FD argument, pass it down
2286         to process_file.  Return Elf_Cmd, not bool.
2287         Call elf_next here, always before elf_end.
2288         (process_archive): Update caller.  Don't close FD here unless there
2289         are no member refs.
2290
2291         * dwfl_module.c (free_file): Close fd only when elf_end returns zero.
2292
2293         * libdwflP.h (struct dwfl_file): New bool member `relocated'.
2294         * dwfl_module_getdwarf.c (dwfl_module_getelf): For ET_REL, apply
2295         partial relocation to one or both files.
2296         (dwfl_module_getdwarf): For ET_REL, make sure extra sections'
2297         relocations have been applied to the debug file if dwfl_module_getelf
2298         has been used before.
2299
2300         * relocate.c (resolve_symbol): New function.
2301         (relocate_section): Call it.
2302
2303         * relocate.c (relocate_getsym): Handle null MOD->symfile.
2304         (relocate_section): Take new bool arg, PARTIAL.  If true,
2305         no error for BADRELTYPE/RELUNDEF, instead just skip them
2306         and leave only those skipped relocs behind the reloc section.
2307         (__libdwfl_relocate_section): Take new arg, pass it down.
2308         (__libdwfl_relocate): Take new bool arg, DEBUG.  If false,
2309         do partial relocation on all sections.
2310         * dwfl_module_getdwarf.c (load_dw): Update caller.
2311         * libdwflP.h: Update decls.
2312         * derelocate.c (dwfl_module_address_section): Pass new argument
2313         to __libdwfl_relocate_section, true.
2314
2315         * derelocate.c (cache_sections): Don't cache reloc sections when
2316         section_address callback is null.
2317
2318 2007-10-19  Roland McGrath  <roland@redhat.com>
2319
2320         * relocate.c (relocate_section): Fix fencepost error in r_offset check.
2321
2322         * derelocate.c (struct dwfl_relocation): Add member `relocs'.
2323         (struct secref): Likewise.
2324         (cache_sections): Cache the relocation section referring to each
2325         section we cache, if any.
2326         (dwfl_module_address_section): Use __libdwfl_relocate_section as
2327         necessary.
2328
2329         * relocate.c (struct reloc_symtab_cache): New type.
2330         (relocate_getsym): Use it instead of four arguments.
2331         (__libdwfl_relocate): Update caller.
2332         (relocate_section): New function, broken out of ...
2333         (__libdwfl_relocate): ... here.
2334         (__libdwfl_relocate_section): New function.
2335         * libdwflP.h: Declare it.
2336
2337 2007-10-17  Roland McGrath  <roland@redhat.com>
2338
2339         * dwfl_module_getsym.c (dwfl_module_getsym): Apply MOD->symfile->bias
2340         to relocated st_value.
2341
2342         * dwfl_report_elf.c (__libdwfl_report_elf): Align initial BASE for
2343         ET_REL to 0x100.
2344
2345 2007-10-16  Roland McGrath  <roland@redhat.com>
2346
2347         * dwfl_report_elf.c (__libdwfl_report_elf): Readjust BASE when a later
2348         section has larger alignment requirements not met by the original BASE,
2349         rather than padding more between sections.
2350
2351         * dwfl_report_elf.c (__libdwfl_report_elf): Fix bias calculation.
2352
2353         * dwfl_module_build_id.c (__libdwfl_find_build_id): Apply module bias
2354         to sh_addr value.
2355
2356         * dwfl_report_elf.c (__libdwfl_report_elf): Don't be confused by BASE
2357         at zero in ET_REL case.  Adjust BASE to necessary alignment.
2358
2359         * dwfl_module_build_id.c (check_notes): Take -1, not 0, as stub value
2360         for DATA_VADDR.
2361         (__libdwfl_find_build_id): Update caller.
2362
2363         * relocate.c (__libdwfl_relocate_value): Don't use sh_offset.
2364         * dwfl_report_elf.c (__libdwfl_report_elf): Likewise.
2365         * offline.c (dwfl_offline_section_address): Bail early if there is
2366         separate debug file.
2367
2368         * relocate.c (__libdwfl_relocate): Don't return DWFL_E_NO_DWARF.
2369
2370 2007-10-09  Roland McGrath  <roland@redhat.com>
2371
2372         * dwfl_report_elf.c (__libdwfl_report_elf): Clear SHDR->sh_offset when
2373         caching SHDR->sh_addr = 0.
2374         * offline.c (dwfl_offline_section_address): Never called for sh_addr
2375         really at 0, don't check for it.  Use MOD->debug directly, not symfile.
2376
2377         * dwfl_module_getdwarf.c (load_symtab): Return success properly when
2378         we've found SHT_SYMTAB.
2379
2380         * relocate.c (relocate_getsym): New function.
2381         (__libdwfl_relocate): Use it.
2382         (__libdwfl_relocate_value): Take new Elf * argument.  Make SYMSHSTRNDX
2383         be a pointer instead of value; cache getshstrndx result there.
2384         * libdwflP.h: Update decl.
2385         * derelocate.c (cache_sections): Update caller.
2386         Always work on the main file, not the symfile.
2387         (dwfl_module_address_section): Likewise.
2388         * dwfl_module_getsym.c (dwfl_module_getsym): Update caller.
2389
2390 2007-10-07  Roland McGrath  <roland@redhat.com>
2391
2392         * offline.c (process_archive): Initialize MOD.
2393
2394         * linux-kernel-modules.c (get_release): New function, broken out of ...
2395         (report_kernel): ... here.  Call it.
2396         (try_kernel_name): Take new arg TRY_DEBUG, only try ".debug" if set.
2397         (find_kernel_elf): Update caller.
2398         (report_kernel_archive): New function.
2399         (dwfl_linux_kernel_report_offline): Call it.
2400
2401         * offline.c (process_file): Take new arg PREDICATE, pass it down.
2402         (process_archive): Likewise.
2403         (process_archive_member): Likewise.  When nonnull, let the predicate
2404         decide whether to use this member.
2405         (__libdwfl_report_offline): New function, broken out of ...
2406         (dwfl_report_offline): ... here.  Call it.
2407         * libdwflP.h: Declare it.
2408
2409         * offline.c (process_archive, process_archive_member): New functions.
2410         (process_elf, process_file): New functions, broken out of ...
2411         (dwfl_report_offline): ... here.  Call process_file, which recurses on
2412         ELF_K_AR files.
2413
2414         * dwfl_report_elf.c (__libdwfl_report_elf): New, broken out of ...
2415         (dwfl_report_elf): ... here.  Call it.
2416         * libdwflP.h: Declare it.
2417
2418 2007-10-06  Roland McGrath  <roland@redhat.com>
2419
2420         * derelocate.c (dwfl_module_relocations): Don't call
2421         dwfl_module_getdwarf.
2422
2423         * derelocate.c (find_section): Use __libdwfl_seterrno, not
2424         __libdw_seterrno.
2425
2426         * relocate.c (__libdwfl_relocate_value): Abuse sh_offset, not
2427         SHF_ALLOC, to cache sh_addr resolved to 0.
2428
2429         * dwfl_report_elf.c (dwfl_report_elf): When an ET_REL file has sh_addr
2430         values nonzero already, just use its existing layout.
2431
2432         * relocate.c (__libdwfl_relocate): Clear size of reloc section in its
2433         in-core shdr after applying it.
2434
2435 2007-10-04  Ulrich Drepper  <drepper@redhat.com>
2436
2437         * linux-kernel-modules.c (dwfl_linux_kernel_report_kernel): Fake
2438         initialization of notes variable.
2439
2440 2007-10-04  Roland McGrath  <roland@redhat.com>
2441
2442         * linux-kernel-modules.c (intuit_kernel_bounds): Take new arg NOTES,
2443         fill in with vaddr of "__start_notes" symbol if found.
2444         (check_notes): New function.
2445         (check_kernel_notes): New function.
2446         (dwfl_linux_kernel_report_kernel): Call it.
2447         (check_module_notes): New function.
2448         (dwfl_linux_kernel_report_modules): Call it.
2449
2450         * linux-kernel-modules.c (dwfl_linux_kernel_find_elf):
2451         Try dwfl_build_id_find_elf first.
2452
2453         * linux-kernel-modules.c (report_kernel): Don't leak FD if !REPORT.
2454         Set kernel module e_type to ET_DYN.
2455
2456 2007-10-03  Roland McGrath  <roland@redhat.com>
2457
2458         * find-debuginfo.c (validate): New function, broken out of ...
2459         (find_debuginfo_in_path): ... here.  New function, broken out of ...
2460         (dwfl_standard_find_debuginfo): ... here.  Call it, after trying
2461         dwfl_build_id_find_debuginfo first.
2462
2463         * dwfl_build_id_find_elf.c: New file.
2464         * dwfl_build_id_find_debuginfo.c: New file.
2465         * Makefile.am (libdwfl_a_SOURCES): Add them.
2466         * libdwfl.h: Declare them.
2467         * libdwflP.h: Add INTDECLs.
2468
2469         * dwfl_module_build_id.c: New file.
2470         * dwfl_module_report_build_id.c: New file.
2471         * Makefile.am (libdwfl_a_SOURCES): Add them.
2472         * libdwfl.h: Declare them.
2473         * libdwflP.h (struct Dwfl_Module): New members build_id_bits,
2474         build_id_len, build_id_vaddr.  Declare __libdwfl_find_build_id.
2475         * dwfl_module.c (__libdwfl_module_free): Free MOD->build_id_bits.
2476
2477         * dwfl_module_getdwarf.c (find_offsets): New function.
2478         (find_dynsym): New function, calls that.
2479         (find_symtab): Call it.
2480
2481 2007-09-11  Roland McGrath  <roland@redhat.com>
2482
2483         * dwfl_module_addrsym.c: Prefer a later global symbol at the same
2484         address if its st_size is smaller.
2485
2486 2007-08-13  Roland McGrath  <roland@redhat.com>
2487
2488         * dwfl_module_addrsym.c: Add dead initializer for stupid compiler.
2489
2490 2007-08-12  Roland McGrath  <roland@redhat.com>
2491
2492         * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Don't use
2493         FTS_LOGICAL.
2494
2495         * elf-from-memory.c (elf_from_remote_memory): Don't reset LOADBASE on
2496         a second phdr if it happens to match EHDR_VMA exactly.
2497
2498 2007-08-08  Roland McGrath  <roland@redhat.com>
2499
2500         * dwfl_module_addrsym.c: Don't use STT_SECTION, STT_FILE symbols and
2501         those with no names.  Rewrite best symbol algorithm not to assume a
2502         sorted table and to be smarter handling sizeless symbols.
2503
2504 2007-07-16  Roland McGrath  <roland@redhat.com>
2505
2506         * dwfl_module.c (dwfl_report_module): Increment DWFL->nmodules when
2507         reviving an existing module.
2508
2509 2007-06-08  Roland McGrath  <roland@redhat.com>
2510
2511         * libdwflP.h: Fix #ifndef for config.h to use PACKAGE_NAME.
2512
2513 2007-05-17  Roland McGrath  <roland@redhat.com>
2514
2515         * linux-kernel-modules.c (dwfl_linux_kernel_report_offline): Look at
2516         whole /lib/modules/VERSION tree, not just /lib/modules/VERSION/kernel.
2517         (dwfl_linux_kernel_find_elf): Likewise.
2518
2519         * linux-kernel-modules.c (dwfl_linux_kernel_report_modules): Use
2520         getline and sscanf instead of fscanf.
2521
2522 2007-05-08  Roland McGrath  <roland@redhat.com>
2523
2524         * offline.c (dwfl_offline_section_address): Don't assume section
2525         numbers match between stripped and debuginfo files.  Instead, assume
2526         only that the ordering among SHF_ALLOC sections matches.
2527
2528         * linux-kernel-modules.c (report_kernel): Change RELEASE argument to
2529         pointer to string.
2530         (dwfl_linux_kernel_report_offline): Update caller.
2531         (dwfl_linux_kernel_report_kernel): Likewise.
2532
2533 2007-04-23  Roland McGrath  <roland@redhat.com>
2534
2535         * argp-std.c (options): Fix group title string.
2536
2537         * argp-std.c (parse_opt): Handle ARGP_KEY_ERROR, free the Dwfl.
2538         Update via STATE->input every time we set STATE->hook, not only at
2539         ARGP_KEY_SUCCESS.
2540
2541         * dwfl_module.c (free_file): Free FILE->name.
2542
2543 2007-04-16  Roland McGrath  <roland@redhat.com>
2544
2545         * derelocate.c (cache_sections): Apply bias to sh_addr.
2546         (compare_secrefs): Fix address comparison to avoid signed overflow.
2547         (find_section): New function, broken out of ...
2548         (dwfl_module_relocate_address): ... here, call it.
2549         (check_module): New function, broken out of ...
2550         (dwfl_module_relocate_address): ... here, call it.
2551         (dwfl_module_address_section): New function.
2552         * libdwfl.h: Declare it.
2553
2554 2007-03-26  Roland McGrath  <roland@redhat.com>
2555
2556         * dwfl_module.c (__libdwfl_module_free): Free MOD itself.
2557
2558 2007-03-18  Roland McGrath  <roland@redhat.com>
2559
2560         * dwfl_module_getdwarf.c (find_debuglink): New function, broken out of
2561         (find_debuginfo): ... here.  Call it.
2562         Don't return error for libelf errors finding .gnu_debuglink section.
2563
2564 2007-03-12  Roland McGrath  <roland@redhat.com>
2565
2566         * dwfl_module.c (dwfl_report_begin_add): New function broken out of ...
2567         (dwfl_report_begin): ... here.  Call it.
2568         * libdwfl.h: Declare it.
2569         * libdwflP.h: Add INTDECL.
2570
2571         * elf-from-memory.c (elf_from_remote_memory): Fix 32/64 typo.
2572
2573         * offline.c: Comment typo fix.
2574
2575 2007-03-04  Roland McGrath  <roland@redhat.com>
2576
2577         * linux-kernel-modules.c (KERNEL_MODNAME): New macro for "kernel".
2578         (find_kernel_elf): New function, broken out of ...
2579         (report_kernel): ... here.  Call it.
2580         (dwfl_linux_kernel_find_elf): Use it for module named KERNEL_MODNAME.
2581         (intuit_kernel_bounds): New function, grovel /proc/kallsyms to guess
2582         virtual address bounds of kernel from symbols rounded to page size.
2583         (dwfl_linux_kernel_report_kernel): Use that if it works, before
2584         resorting to report_kernel.
2585
2586         * dwfl_module_getdwarf.c (open_elf): Set MOD->e_type to ET_DYN for an
2587         ET_EXEC file with nonzero bias.
2588
2589         * dwfl_module_addrname.c (dwfl_module_addrname): Just call
2590         dwfl_module_addrsym.  Guts moved to ...
2591         * dwfl_module_addrsym.c: ... here; new file.
2592         * Makefile.am (libdwfl_a_SOURCES): Add it.
2593         * libdwfl.h: Declare dwfl_module_addrsym.
2594         * libdwflP.h: Add INTDECL.
2595
2596 2007-03-03  Roland McGrath  <roland@redhat.com>
2597
2598         * dwfl_module.c (free_file): New function, broken out of ...
2599         (__libdwfl_module_free): ... here.  In it, close fd after elf_end.
2600
2601         * dwfl_module_getdwarf.c (open_elf): Close fd and reset to -1
2602         on libelf failure.
2603
2604 2007-03-02  Roland McGrath  <roland@redhat.com>
2605
2606         * linux-kernel-modules.c: Fix bogus error test for asprintf call.
2607
2608 2007-02-02  Roland McGrath  <roland@redhat.com>
2609
2610         * dwfl_addrmodule.c (dwfl_addrmodule): Match a module's high boundary
2611         address exactly if it's no other module's low boundary.
2612
2613         * dwfl_module_addrname.c (dwfl_module_addrname): If no symbol's value
2614         and size cover the address, select the closest symbol with st_size==0
2615         that lies in the same section.
2616
2617 2007-01-29  Roland McGrath  <roland@redhat.com>
2618
2619         * dwfl_version.c (dwfl_version): Return PACKAGE_VERSION,
2620         not PACKAGE_STRING.
2621
2622 2007-01-20  Roland McGrath  <roland@redhat.com>
2623
2624         * relocate.c (__libdwfl_relocate_value): Treat section_address of -1
2625         as omitted, not 0.
2626         * libdwfl.h (Dwfl_Callbacks): Update comment.
2627         * derelocate.c (cache_sections): Don't ignore sh_addr == 0 sections.
2628         * linux-kernel-modules.c (dwfl_linux_kernel_module_section_address):
2629         For ignored missing section, use -1 instead of 0.
2630         * offline.c (dwfl_offline_section_address): Expect a call for 0.
2631
2632 2007-01-19  Roland McGrath  <roland@redhat.com>
2633
2634         * argp-std.c (parse_opt): For -e, reset DWFL->offline_next_address to
2635         zero so a lone -e foo.so is shown without address bias.
2636
2637 2007-01-10  Roland McGrath  <roland@redhat.com>
2638
2639         * linux-kernel-modules.c (report_kernel): Check asprintf return value
2640         directly instead of via side effect, to silence warn_unused_result.
2641         (dwfl_linux_kernel_report_offline): Likewise.
2642         (dwfl_linux_kernel_find_elf): Likewise.
2643         (dwfl_linux_kernel_module_section_address): Likewise.
2644         * find-debuginfo.c (try_open): Likewise.
2645         * linux-proc-maps.c (find_sysinfo_ehdr): Likewise.
2646         (dwfl_linux_proc_report): Likewise.
2647
2648         * libdwfl.h (dwfl_begin): Require nonnull argument.
2649
2650 2006-12-27  Roland McGrath  <roland@redhat.com>
2651
2652         * dwfl_module.c (compare_modules): Fix address comparison to avoid
2653         signed overflow.  Patch by Frank Ch. Eigler <fche@redhat.com>.
2654
2655 2006-10-30  Roland McGrath  <roland@redhat.com>
2656
2657         * dwfl_module.c (dwfl_report_module): Comment typo fix.
2658
2659 2006-09-05  Roland McGrath  <roland@redhat.com>
2660
2661         * derelocate.c (cache_sections): Use alloca instead of variable-sized
2662         auto array, in function already using alloca.
2663
2664 2006-08-14  Roland McGrath  <roland@redhat.com>
2665
2666         * linux-kernel-modules.c (try_kernel_name): If the call to
2667         dwfl_standard_find_debuginfo produces no results, try it again
2668         with NULL as DEBUGLINK_FILE to try *FNAME with .debug suffix.
2669
2670         * find-debuginfo.c (DEFAULT_DEBUGINFO_PATH): Macro moved ...
2671         * libdwflP.h: ... to here.
2672         * linux-kernel-modules.c (try_kernel_name): Skip manual open if it
2673         repeats the first thing dwfl_standard_find_debuginfo will try.
2674
2675         * linux-kernel-modules.c (MODULE_SECT_NAME_LEN): New macro.
2676         (dwfl_linux_kernel_module_section_address): If a /sys file is missing
2677         and the section name is >= MODULE_SECT_NAME_LEN, try truncating the
2678         section name.
2679
2680 2006-07-12  Ulrich Drepper  <drepper@redhat.com>
2681
2682         * cu.c: Adjust for internal_function_def removal.
2683         * dwfl_error.c: Likewise.
2684         * dwfl_module.c: Likewise.
2685         * dwfl_module_getdwarf.c: Likewise.
2686         * lines.c: Likewise.
2687         * relocate.c: Likewise.
2688
2689 2006-07-11  Ulrich Drepper  <drepper@redhat.com>
2690
2691         * dwfl_module.c (compare_modules): Don't return GElf_Sxword value,
2692         it can overflow the return value type.
2693         Patch by Tim Moore <timoore@redhat.com>.
2694
2695 2006-06-28  Roland McGrath  <roland@redhat.com>
2696
2697         * libdwfl.h: Cosmetic changes.
2698
2699         * dwfl_line_comp_dir.c: New file.
2700         * Makefile.am (libdwfl_a_SOURCES): Add it.
2701         * libdwfl.h: Declare dwfl_line_comp_dir.
2702
2703         * dwfl_lineinfo.c (dwfl_lineinfo): Remove stray extern in defn.
2704
2705         * dwfl_linecu.c: New file.
2706         * Makefile.am (libdwfl_a_SOURCES): Add it.
2707         * libdwfl.h: Declare dwfl_linecu.
2708
2709         * libdwflP.h (dwfl_linecu_inline): Function renamed from dwfl_linecu.
2710         (dwfl_linecu): Define as macro.
2711
2712         * relocate.c (__libdwfl_relocate): Use dwfl_module_getsym.
2713
2714         * dwfl_module_getdwarf.c (dwfl_module_getsymtab): New function.
2715         (dwfl_module_addrname): Function moved ...
2716         * dwfl_module_addrname.c: ... here, new file.
2717         * dwfl_module_getsym.c: New file.
2718         * Makefile.am (libdwfl_a_SOURCES): Add them.
2719         * libdwfl.h: Declare dwfl_module_getsymtab, dwfl_module_getsym.
2720         * libdwflP.h: Add INTDECLs.
2721
2722 2006-06-27  Roland McGrath  <roland@redhat.com>
2723
2724         * dwfl_module.c (dwfl_report_end): Whitespace fix.
2725
2726 2006-06-13  Roland McGrath  <roland@redhat.com>
2727
2728         * elf-from-memory.c (elf_from_remote_memory): Fix 32/64 typo.
2729         Use __libdwfl_seterrno for elf_memory failure.
2730
2731 2006-05-22  Roland McGrath  <roland@redhat.com>
2732
2733         * dwfl_module_return_value_location.c
2734         (dwfl_module_return_value_location): Use __libdwfl_module_getebl.
2735
2736 2006-05-27  Ulrich Drepper  <drepper@redhat.com>
2737
2738         * libdwfl.h: Add extern "C".
2739
2740 2006-05-22  Ulrich Drepper  <drepper@redhat.com>
2741
2742         * cu.c (addrarange): Handle files without aranges information.
2743
2744 2006-05-16  Ulrich Drepper  <drepper@redhat.com>
2745
2746         * dwfl_addrmodule.c (dwfl_addrmodule): Also return NULL of
2747         ->modules is NULL.
2748
2749 2006-02-26  Roland McGrath  <roland@redhat.com>
2750
2751         * dwfl_version.c: New file.
2752         * Makefile.am (libdwfl_a_SOURCES): Add it.
2753         * libdwfl.h: Declare dwfl_version.
2754
2755         * offline.c (dwfl_report_offline): Account for dwfl_report_elf having
2756         aligned up from DWFL->offline_next_address when checking for overlap.
2757
2758 2005-12-22  Roland McGrath  <roland@redhat.com>
2759
2760         * argp-std.c (parse_opt): Call dwfl_end in failure cases.
2761
2762         * linux-proc-maps.c (proc_maps_report): New function, broken out of ...
2763         (dwfl_linux_proc_report): ... here.  Call it.
2764         (dwfl_linux_proc_maps_report): New function.
2765         * libdwfl.h: Declare it.
2766         * libdwflP.h: Add INTDECL.
2767         * argp-std.c (options, parse_opt): Grok -M/--linux-process-map.
2768
2769         * dwfl_nextcu.c (dwfl_nextcu): Don't fail when dwfl_module_getdwarf
2770         failed with DWFL_E_NO_DWARF.
2771
2772 2005-11-26  Roland McGrath  <roland@redhat.com>
2773
2774         * dwfl_end.c (dwfl_end): Free the DWFL itself.
2775
2776 2005-11-25  Roland McGrath  <roland@redhat.com>
2777
2778         * dwfl_module_getdwarf.c (__libdwfl_module_getebl): New function.
2779         (load_dw): Use it.
2780         * dwfl_module_register_names.c (dwfl_module_register_names): Likewise.
2781         * libdwflP.h: Declare it.
2782
2783         * dwfl_module_register_names.c: New file.
2784         * Makefile.am (libdwfl_a_SOURCES): Add it.
2785         * libdwfl.h: Declare dwfl_module_register_names.
2786
2787 2005-11-21  Roland McGrath  <roland@redhat.com>
2788
2789         * linux-kernel-modules.c (dwfl_linux_kernel_module_section_address):
2790         Don't leak malloc'd file name.
2791         If a /sys/.../sections file is missing and starts with ".init",
2792         try the variant with "_init" too; catches PPC64 kernel braindamage.
2793
2794 2005-11-15  Roland McGrath  <roland@redhat.com>
2795
2796         * libdwfl.h: Comment fixes.
2797
2798         * dwfl_module_return_value_location.c: Add unlikely for error case.
2799
2800 2005-11-13  Roland McGrath  <roland@redhat.com>
2801
2802         * dwfl_return_value_location.c: New file.
2803         * Makefile.am (libdwfl_a_SOURCES): Add it.
2804         * libdwfl.h: Declare dwfl_module_return_value_location.
2805         * libdwflP.h (DWFL_ERRORS): Add DWFL_E_WEIRD_TYPE.
2806
2807 2005-10-20  Roland McGrath  <roland@redhat.com>
2808
2809         * libdwflP.h (DWFL_ERRORS): New error UNKNOWN_MACHINE.
2810         * relocate.c (__libdwfl_relocate): Return DWFL_E_UNKNOWN_MACHINE
2811         instead of DWFL_E_BADRELTYPE if ebl_get_elfmachine yields EM_NONE.
2812
2813 2005-10-01  Roland McGrath  <roland@redhat.com>
2814
2815         * linux-kernel-modules.c (report_kernel): Return ENOENT if we fail
2816         with errno 0.
2817
2818 2005-09-19  Roland McGrath  <roland@redhat.com>
2819
2820         * linux-kernel-modules.c (dwfl_linux_kernel_report_modules): Use
2821         PRIx64 instead of PRIi64, lest addresses with high bits set overflow
2822         the signed integer reading; they will just have to be in hexadecimal.
2823         (dwfl_linux_kernel_module_section_address): Likewise.
2824
2825 2005-08-28  Ulrich Drepper  <drepper@redhat.com>
2826
2827         * Makefile.am (%.os): Use COMPILE.os.
2828         (COMPILE.os): Filter out gconv options.
2829
2830 2005-08-25  Roland McGrath  <roland@redhat.com>
2831
2832         * cu.c (__libdwfl_nextcu): Return success when dwarf_nextcu hits end.
2833         * dwfl_nextcu.c (dwfl_nextcu): Skip modules with no dwarf info.
2834
2835 2005-08-24  Roland McGrath  <roland@redhat.com>
2836
2837         * dwfl_lineinfo.c (dwfl_lineinfo): Add bias, don't subtract it.
2838
2839         * argp-std.c [_MUDFLAP] (__libdwfl_argp_mudflap_options): New function,
2840         magic initializer to set -heur-stack-bound option.
2841
2842 2005-08-22  Roland McGrath  <roland@redhat.com>
2843
2844         * dwfl_validate_address.c: New file.
2845         * Makefile.am (libdwfl_a_SOURCES): Add it.
2846         * libdwfl.h: Declare dwfl_validate_address.
2847
2848         * derelocate.c (dwfl_module_relocate_address): Add INTDEF.
2849         * libdwflP.h: Add INTDECL.
2850
2851         * dwfl_module_getdwarf.c (find_symtab): Use elf_getdata instead of
2852         elf_rawdata for symbol-related sections.
2853
2854         * offline.c (dwfl_report_offline): Move offline_next_address outside
2855         module's range, in case it's an ET_EXEC using fixed segment locations.
2856         * libdwfl.h: Update comment.
2857
2858         * dwfl_report_elf.c (dwfl_report_elf): Align BASE to first segment's
2859         required alignment.
2860
2861 2005-08-20  Roland McGrath  <roland@redhat.com>
2862
2863         * linux-kernel-modules.c (report_kernel): Take new argument PREDICATE,
2864         function to choose whether to report.
2865         (dwfl_linux_kernel_report_offline): Likewise.
2866         * libdwfl.h: Update decl.
2867         * argp-std.c (parse_opt): Update caller.
2868
2869         * dwfl_getsrclines.c: New file.
2870         * dwfl_onesrcline.c: New file.
2871         * Makefile.am (libdwfl_a_SOURCES): Add them.
2872         * libdwfl.h: Declare dwfl_getsrclines, dwfl_onesrcline.
2873
2874         * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): Don't leak
2875         MODULESDIR[0].  Call fts_close on failure.
2876
2877         * dwfl_module_getdwarf.c (load_dw): Take dwfl_file * instead of Elf *.
2878         Close ET_REL file descriptors after relocation.
2879         (find_dw): Update caller.
2880         * offline.c (dwfl_report_offline): Get the file into memory and close
2881         the file descriptor.
2882
2883         * dwfl_module_getdwarf.c (find_debuginfo): Do nothing when
2884         MOD->debug.elf is already set.
2885
2886         * find-debuginfo.c (try_open): Use TEMP_FAILURE_RETRY.
2887         (dwfl_standard_find_debuginfo): Fail on errors not ENOENT or ENOTDIR.
2888
2889         * argp-std.c (options, parse_opt): Grok -K/--offline-kernel, use
2890         dwfl_linux_kernel_report_offline with offline_callbacks.
2891
2892         * linux-kernel-modules.c (report_kernel): New function, broken out of
2893         ...
2894         (dwfl_linux_kernel_report_kernel): ... here.  Use it.
2895         (dwfl_linux_kernel_report_offline): New function.
2896         * libdwfl.h: Declare it.
2897         * libdwflP.h: Add INTDECL.
2898
2899 2005-08-19  Roland McGrath  <roland@redhat.com>
2900
2901         Use standard debuginfo search path to look for vmlinux.
2902         * find-debuginfo.c (dwfl_standard_find_debuginfo): Don't check CRC if
2903         passed zero.
2904         * linux-kernel-modules.c (try_kernel_name): New function, broken out
2905         of ...
2906         (dwfl_linux_kernel_report_kernel): ... here.  Use it.
2907
2908         * argp-std.c (offline_callbacks): New variable.
2909         (parse_opt): Use it for -e.  Allow multiple -e options.
2910
2911         * offline.c: New file.
2912         * Makefile.am (libdwfl_a_SOURCES): Add it.
2913         * libdwfl.h: Declare dwfl_offline_section_address, dwfl_report_offline.
2914         * libdwflP.h: Add INTDECLs.
2915         (OFFLINE_REDZONE): New macro.
2916         (struct Dwfl): New member `offline_next_address'.
2917         * dwfl_begin.c (dwfl_begin): Initialize it.
2918         * dwfl_module.c (dwfl_report_begin): Likewise.
2919
2920         * dwfl_report_elf.c (dwfl_report_elf): Accept all types.  When ET_REL,
2921         do a nominal absolute section layout starting at BASE.
2922         * libdwfl.h: Update comment.
2923
2924 2005-08-18  Roland McGrath  <roland@redhat.com>
2925
2926         * dwfl_module_getsrc_file.c (dwfl_module_getsrc_file): Do
2927         dwfl_module_getdwarf if necessary.
2928
2929         * dwfl_report_elf.c (dwfl_report_elf): Permit ET_REL with BASE==0.
2930         * libdwfl.h: Update comment.
2931
2932         * derelocate.c: New file.
2933         * Makefile.am (libdwfl_a_SOURCES): Add it.
2934
2935         * libdwflP.h (struct Dwfl_Module): isrel -> e_type.
2936         * dwfl_report_elf.c (dwfl_report_elf): Initialize it.
2937         * dwfl_module_getdwarf.c (open_elf): Update initialization.
2938         (load_dw, dwfl_module_addrname): Update uses.
2939         * relocate.c (__libdwfl_relocate): Likewise.
2940
2941 2005-08-04  Roland McGrath  <roland@redhat.com>
2942
2943         * libdwfl.h (Dwfl_Callbacks.section_address): Take additional
2944         arguments SHNDX, SHDR.
2945         (dwfl_linux_kernel_module_section_address): Update prototype.
2946         * relocate.c (__libdwfl_relocate_value): Update caller.
2947         * linux-kernel-modules.c (dwfl_linux_kernel_module_section_address):
2948         Take the new arguments.
2949
2950 2005-08-10  Roland McGrath  <roland@redhat.com>
2951
2952         * relocate.c (__libdwfl_relocate): Take argument DEBUGFILE,
2953         use it instead of MOD->debug.file.
2954         * libdwflP.h: Update decl.
2955         * dwfl_module_getdwarf.c (load_dw): Update caller.
2956         Fixes bug #165598.
2957
2958 2005-08-09  Roland McGrath  <roland@redhat.com>
2959
2960         * libdwflP.h: Include ../libdw/libdwP.h for its INTDECLs.
2961         * cu.c: Use INTUSE on dwarf_* calls.
2962         * dwfl_error.c: Likewise.
2963         * dwfl_module.c: Likewise.
2964         * dwfl_module_getdwarf.c: Likewise.
2965         * dwfl_module_getsrc_file.c: Likewise.
2966         * lines.c: Likewise.
2967
2968 2005-08-07  Roland McGrath  <roland@redhat.com>
2969
2970         * linux-kernel-modules.c (dwfl_linux_kernel_find_elf): When module
2971         names contain '_' or '-', look for files named either "foo-bar.ko"
2972         or "foo_bar.ko".
2973
2974 2005-07-29  Roland McGrath  <roland@redhat.com>
2975
2976         * loc2c.c: File removed.
2977         * loc2c.h: File removed.
2978         * loc2c-runtime.h: File removed.
2979         * test2.c: File removed.
2980         * Makefile.am (EXTRA_DIST): Variable removed.
2981         (noinst_HEADERS): Remove loc2c.h from here.
2982
2983 2005-07-28  Ulrich Drepper  <drepper@redhat.com>
2984
2985         * libdwfl.h: Add a few missing extern for function prototypes.
2986
2987         * libdwfl_crc32.c: New file.
2988         * libdwfl_crc32_file.c: New file.
2989         * libdwflP.h: Declare the new functions.
2990         * Makefile.am (libdwfl_a_SOURCES): Add libdwfl_crc32.c and
2991         libdwfl_crc32_file.c.
2992         * libdwfl/find-debuginfo.c (check_crc): Use __libdwfl_crc32_file
2993         instead of crc32_file.
2994
2995 2005-07-28  Roland McGrath  <roland@redhat.com>
2996
2997         * ptest.c: Moved to ../tests/dwflmodtest.c.
2998
2999         * Makefile.am (noinst_PROGRAMS): Variable removed.
3000         (libdwfl_so_SOURCES, libdwfl_LIBS, libdwfl_so_LDADD): Likewise.
3001         (EXTRA_DIST, ptest_LDADD, test2_LDADD): Likewise.
3002         (libdwfl): Don't use libdwfl.so any more.
3003         (libdwfl.so, install, uninstall): Targets removed.
3004         (test2_SOURCES): Define EXTRA_DIST instead of this.
3005         * libdwfl.map: File removed.
3006
3007         * libdwfl.h: Use "" for libdw.h #include.
3008
3009 2005-07-27  Roland McGrath  <roland@redhat.com>
3010
3011         * libdwfl.map: Add dwfl_getmodules.
3012
3013 2005-07-23  Ulrich Drepper  <drepper@redhat.com>
3014
3015         * Makefile.am: Fix rules to allow building with mudflap.
3016
3017 2005-07-21  Roland McGrath  <roland@redhat.com>
3018
3019         * Makefile.am (noinst_HEADERS): Add loc2c.c.
3020
3021         * test2.c (main): Check sscanf result to quiet warning.
3022
3023 2005-07-20  Roland McGrath  <roland@redhat.com>
3024
3025         * libdwfl-branch merged, creating this direcotry.