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