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