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