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