libbacktrace patch committed: Use __has_attribute for fallthrough

2024-07-18 Thread Ian Lance Taylor
This libbacktrace patch uses __has_attribute for fallthrough. It also fixes some FALLTHROUGH comments to use ATTRIBUTE_FALLTHROUGH. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian * internal.h: Use __has_attribute to check for fallthrough attribute. * elf.c

Re: libbacktrace patch committed: Better backtrace_print if no debug info

2024-07-17 Thread Ian Lance Taylor
On Wed, Jul 17, 2024 at 5:40 PM Ian Lance Taylor wrote: > > This libbacktrace patch improves backtrace_print when there is no > debug info. It falls back to calling backtrace_syminfo, and uses that > to print an offset from a symbol if it can. This is a partial fix for >

libbacktrace patch committed: Better backtrace_print if no debug info

2024-07-17 Thread Ian Lance Taylor
This libbacktrace patch improves backtrace_print when there is no debug info. It falls back to calling backtrace_syminfo, and uses that to print an offset from a symbol if it can. This is a partial fix for https://github.com/ianlancetaylor/libbacktrace/issues/59. Bootstrapped and ran

libbacktrace patch committed: Mention dl_iterate_phdr in README

2024-07-17 Thread Ian Lance Taylor
This patch adds some notes about dl_iterate_phdr to the libbacktrace README file. In general dl_iterate_phdr is not async-signal-safe and does call malloc, so programs that want to use libbacktrace functions from a signal handler or within malloc must make an initiali libbacktrace call in order

libbacktrace patch committed: Avoid infinite recursion

2024-07-11 Thread Ian Lance Taylor
libbacktrace could get an infinite recursion in an odd case in which a .gnu_debugdata section was added to a debug file, and mini_debuginfo was put into the debug file, and the debug file was put into a /usr/lib/debug directory to be found by build ID. This combination doesn't really make sense

libbacktrace patch committed: Don't fail if symbol size is unknown

2024-07-11 Thread Ian Lance Taylor
Mach-O and PE/COFF don't record symbol sizes in the symbol table. Adjust the libbacktrace testsuite so that it doesn't fail if the symbol size is unknown, only if it is incorrect. Ran libbacktrace tests on macOS on the compile farm and on x86_64-pc-linux-gnu. Committed to mainline. Ian

libbacktrace patch committed: Correctly gather Mach-O symbols

2024-07-11 Thread Ian Lance Taylor
The libbacktrace symbol table code was incorrectly discarding global Mach-O symbols. This patch fixes the problem. Tested on macOS on the compile farm, and also on x86_64-pc-linux-gnu. Committed to mainline. Ian For PR libbacktrace/97082 * macho.c (MACH_O_N_EXT): Don't

Re: libbacktrace patch committed: Add clang optnone attribute

2024-07-11 Thread Eric Gallager
On Thu, Jul 11, 2024 at 7:19 PM Andrew Pinski wrote: > > On Thu, Jul 11, 2024 at 4:14 PM Ian Lance Taylor wrote: > > > > The libbacktrace testsuite was not passing when run with current > > versions of clang. Add the optnone attribute to make it pass. Add > > -Wno-attributes and

Re: libbacktrace patch committed: Add clang optnone attribute

2024-07-11 Thread Ian Lance Taylor
On Thu, Jul 11, 2024 at 4:18 PM Andrew Pinski wrote: > > On Thu, Jul 11, 2024 at 4:14 PM Ian Lance Taylor wrote: > > > > The libbacktrace testsuite was not passing when run with current > > versions of clang. Add the optnone attribute to make it pass. Add > > -Wno-attributes and

Re: libbacktrace patch committed: Add clang optnone attribute

2024-07-11 Thread Andrew Pinski
On Thu, Jul 11, 2024 at 4:14 PM Ian Lance Taylor wrote: > > The libbacktrace testsuite was not passing when run with current > versions of clang. Add the optnone attribute to make it pass. Add > -Wno-attributes and -Wno-unknown-attributes to disable warnings about > unrecognized function

libbacktrace patch committed: Add clang optnone attribute

2024-07-11 Thread Ian Lance Taylor
The libbacktrace testsuite was not passing when run with current versions of clang. Add the optnone attribute to make it pass. Add -Wno-attributes and -Wno-unknown-attributes to disable warnings about unrecognized function attributes. Bootstrapped and ran libbacktrace testsuite on

libbacktrace patch committed: Suggest -g if no debug info

2024-07-11 Thread Ian Lance Taylor
This small libbacktrace patch suggests compiling with -g (and, on macOS, running dsymutil), if there is no debug info. Ran libbacktrace testsuite. Committed to mainline. Ian * elf.c (elf_nodebug): Suggest -g. * macho.c (macho_nodebug): Suggest -g and dsymutil.

libbacktrace patch committed: Remove trailing whitespace

2024-07-11 Thread Ian Lance Taylor
This minor libbacktrace patch removes trailing whitespace. Ran libbacktrace tests. Committed to mainline. Ian * dwarf.c: Remove trailing whitespace. * macho.c: Likewise. 3f660179d6a0ebcd83d6a546f48a163d1a685f72 diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c index

libbacktrace patch committed: OK if zero backward bits

2024-06-16 Thread Ian Lance Taylor
I've committed this libbacktrace patch to not fail on the case where there are no bits available when looking backward. This can happen at the very end of the frame if no bits are actually required. The test case is long and may be proprietary, so not including it. Bootstrapped and ran

Re: libbacktrace patch committed: Don't assume compressed section aligned

2024-03-08 Thread H.J. Lu
On Fri, Mar 8, 2024 at 2:48 PM Fangrui Song wrote: > > On ELF64, it looks like BFD uses 8-byte alignment for compressed > `.debug_*` sections while gold/lld/mold use 1-byte alignment. I do not > know how the Solaris linker sets the alignment. > > The specification's wording makes me confused

Re: libbacktrace patch committed: Don't assume compressed section aligned

2024-03-08 Thread Fangrui Song
On ELF64, it looks like BFD uses 8-byte alignment for compressed `.debug_*` sections while gold/lld/mold use 1-byte alignment. I do not know how the Solaris linker sets the alignment. The specification's wording makes me confused whether it really requires 8-byte alignment, even if a non-packed

libbacktrace patch committed: Don't assume compressed section aligned

2024-03-08 Thread Ian Lance Taylor
Reportedly when lld compresses debug sections, it fails to set the alignment of the compressed section such that the compressed header can be read directly. To me this seems like a bug in lld. However, libbacktrace needs to work around it. This patch, originally by the GitHub user ubyte, does

libbacktrace patch committed: Link test programs with -no-install

2024-03-02 Thread Ian Lance Taylor
Some of the libbacktrace tests link a program and then modify the debug info in some way. When configured with --enable-shared the linking, using libtool, generates a shell script. That causes the tests to fail because they can't modify the debug info of a shell script. This patch, originally

libbacktrace patch committed: Skip all LZMA block header padding bytes

2024-03-02 Thread Ian Lance Taylor
This patch to libbacktrace corrects the LZMA block header parsing to skip all the padding bytes, verifying that they are zero. This fixes https://github.com/ianlancetaylor/libbacktrace/issues/118. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. I was able to verify that the

Re: libbacktrace patch committed: Read symbol table of debuginfo file

2024-03-01 Thread Ian Lance Taylor
On Thu, Feb 29, 2024 at 7:47 PM Ian Lance Taylor wrote: > > This patch to libbacktrace reads symbol tables from debuginfo files. > These become another symbol table to search. This is needed if people > use --strip-all rather than --strip-debug when adding a debuglink > section. This fixes >

libbacktrace patch committed: Read symbol table of debuginfo file

2024-02-29 Thread Ian Lance Taylor
This patch to libbacktrace reads symbol tables from debuginfo files. These become another symbol table to search. This is needed if people use --strip-all rather than --strip-debug when adding a debuglink section. This fixes https://github.com/ianlancetaylor/libbacktrace/issues/113. Bootstrapped

libbacktrace patch committed

2023-07-31 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch, based on one by Andres Freund, uses the _pgmptr variable declared on Windows to find the executable file name if none is specified. Bootstrapped and ran libbacktrace testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Patch from Andres Freund: * configure.ac:

libbacktrace patch committed: Tweaks to zstd decompression

2023-03-28 Thread Ian Lance Taylor via Gcc-patches
In looking over the recently committed support for zstd decompression in libbacktrace, I found a few minor cases that needed fixing. Bootstrapped and tested on x86_64-pc-linux-gnu. Committed to mainline. Ian * elf.c (elf_zstd_read_fse): Call elf_fetch_bits after reading bits, not before. Add

libbacktrace patch committed: Only test --build-id if supported

2023-01-06 Thread Ian Lance Taylor via Gcc-patches
PR 108297 points out that there are systems that use ELF but for which the linker does not support the --build-id option. This libbacktrace patch skips --build-id tests when it doesn't work. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian PR

libbacktrace patch committed: Check for sys/link.h

2022-07-08 Thread Ian Lance Taylor via Gcc-patches
Apparently QNX declares dl_iterate_phdr and friends in sys/link.h rather than link.h. This patch updates libbacktrace to check there. This fixes https://github.com/ianlancetaylor/libbacktrace/issues/86. Bootstrapped and ran libbacktrace testsuite on x86_64-pc-linux-gnu. Committed to mainline.

libbacktrace patch committed: Don't exit Mach-O dyld loop on failure

2022-07-07 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch changes the loop over dynamic libraries on Mach-O to keep going if we fail to find the debug info for a particular library. We can still pick up debug info for other libraries even if one fails. Tested on x86_64-pc-linux-gnu which admittedly does little, but others have

libbacktrace patch committed: Don't let "make clean" remove allocfail.sh

2022-07-07 Thread Ian Lance Taylor via Gcc-patches
The script allocfail.sh was being incorrectly removed by "make clean". This patch fixes the problem. This fixes https://github.com/ianlancetaylor/libbacktrace/issues/81. Ran libbacktrace "make check" and "make clean" on x86_64-pc-linux-gnu. Committed to mainline. Ian For

libbacktrace patch committed: Update README

2022-05-28 Thread Ian Lance Taylor via Gcc-patches
This patch updates the libbacktrace README to a near copy of the one from github.com/ianlancetaylor/libbacktrace. Committed to mainline. This fixes GCC PR 105721. Ian * README: Update. 6cf19361732bd7f8b41716ef9f4b5c205a3193b8 diff --git a/libbacktrace/README b/libbacktrace/README index

libbacktrace patch committed: don't skip aligned byte

2022-04-05 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch by Rui Ueyama fixes handling an uncompressed block that starts at an aligned byte. If the bits before the uncompressed block ended at a byte boundary, libbacktrace accidentally skipped the next byte, which is the first byte of the length of the block. Bootstrapped and ran

libbacktrace patch committed: Handle skeleton units

2022-02-16 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch handles DWARF 5 skeleton units, which are used when part of the DWARF information is stored in a separate file. This doesn't actually look in the separate file, as the line number information, which is all that we care about, is normally kept in the main executable because

libbacktrace patch committed: Initialize DWARF 5 fields of unit

2022-02-16 Thread Ian Lance Taylor via Gcc-patches
When I added the DWARF 5 support to libbacktrace in 2019-12-13 I forgot to initialize the new fields of the unit data structure. Whoops. Fixed with this patch. Bootstrapped and ran libbacktrace and Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian * dwarf.c (build_address_map):

libbacktrace patch committed: Don't special case file 0

2021-03-02 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch stops special casing file 0. It's no longer necessary as for DWARF 5 support we now set up filename 0 in all cases. Bootstrapped and ran libbacktrace and Go tests on x86_64-pc-linux-gnu. Committed to mainline. Ian * dwarf.c (read_line_program): Don't special case file

libbacktrace patch committed: Pass -1 to error callback for unknown DWARF

2021-03-02 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch passes -1 to the error callback function for unknown DWARF versions. This makes users of libbacktrace treat DWARF versions that libbacktrace does not support as though no debug information were available. This fixes PR 98818. Bootstrapped and ran libbacktrace tests on

libbacktrace patch committed: Use objcopy --help to check for option

2021-02-11 Thread Ian Lance Taylor via Gcc-patches
This patch changes the libbacktrace configure script to check for whether objcopy supports --add-gnu-debuglink (a test that only affects the libbacktrace testsuite) to look at the objcopy --help option rather than trying to apply --add-gnu-debuglink to /bin/ls. The latter can trigger a warning if

libbacktrace patch committed: Don't fail tests if dwz fails

2021-01-18 Thread Ian Lance Taylor via Gcc-patches
On my system the current version of dwz fails on some DWARF 5 input. This is reportedly fixed by https://sourceware.org/pipermail/dwz/2021q1/000775.html, but in the meantime there is no reason for the libbacktrace testsuite to fail just because dwz fails. This patch changes the Makefile so that

libbacktrace patch committed: Use correct DWARF-5 filename index

2021-01-18 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch uses the correct directory and filename index for DWARF 5. For DWARF 4 and before, the zero entry for the directory and filename information stored in the line program came from the compilation unit. Because of that, the old code used to handle zero specially, and

libbacktrace patch committed: permit values at end of buffer

2020-12-02 Thread Ian Lance Taylor via Gcc-patches
A couple of buffer overflow checks in libbacktrace incorrectly used >= when comparing the end of the value with the end of the buffer. It is of course OK if the value ends at the very end of the buffer. This patch corrects those cases to use > instead. Bootstrapped and ran libbacktrace and Go

libbacktrace patch committed: Use __attribute__((__fallthrough__))

2020-10-20 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch uses __attribute__((__fallthrough__)) rather than relying on a /*fallthrough*/ comment. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian * internal.h (ATTRIBUTE_FALLTHROUGH): Define. * elf.c (elf_zlib_inflate): Use

libbacktrace patch committed: Create mtest.dsym

2020-09-28 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch creates mtest.dsym when using dsymutil. This is for PR 97082, but it probably doesn't fix the PR. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian PR libbacktrace/97082 * Makefile.am (check_DATA): Add mtest.dSYM if

libbacktrace patch committed: Only use dsymutil with Mach-O

2020-09-28 Thread Ian Lance Taylor via Gcc-patches
This patch changes the libbacktrace tests to only run dsymutil when building for Mach-O. This should fix GCC PR 97227. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian PR libbacktrace/97227 * configure.ac (USE_DSYMUTIL): Define instead of

Re: libbacktrace patch committed: Avoid ambiguous binary search

2020-09-22 Thread Ian Lance Taylor via Gcc-patches
On Tue, Sep 8, 2020 at 6:22 PM Ian Lance Taylor wrote: > > This patch to libbacktrace avoids ambiguous binary searches. > Searching for a range match can cause the search order to not match > the sort order, which can cause libbacktrace to miss matching entries. > This patch allocates an extra

libbacktrace patch committed: Don't strip underscore on 64-bit PE

2020-09-08 Thread Ian Lance Taylor via Gcc-patches
This patch to libbacktrace avoids stripping a leading underscore from symbol names on 64-bit PE COFF. Bootstrapped and ran Go tests on x86_64-pc-linux-gnu. Committed to mainline. Ian * pecoff.c (coff_initialize_syminfo): Add is_64 parameter. (coff_add): Determine and pass is_64. diff --git

libbacktrace patch committed: Get executable name on macOS

2020-09-08 Thread Ian Lance Taylor via Gcc-patches
This patch to libbacktrace gets the executable name on macOS using _NSGetExecutablePath. This is another aspect of PR 96973. Tested basic functionality on macOS. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian * fileline.c

libbacktrace patch committed: Avoid ambiguous binary search

2020-09-08 Thread Ian Lance Taylor via Gcc-patches
This patch to libbacktrace avoids ambiguous binary searches. Searching for a range match can cause the search order to not match the sort order, which can cause libbacktrace to miss matching entries. This patch allocates an extra entry at the end of function_addrs and unit_addrs vectors, so that

libbacktrace patch committed: Correct tipo in comment

2020-09-08 Thread Ian Lance Taylor via Gcc-patches
This patch suggested by Ondřej Čertík fixes a typpo in a comment. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian * simple.c (simple_unwind): Correct comment spelling. diff --git a/libbacktrace/simple.c b/libbacktrace/simple.c index

libbacktrace patch committed: Correct Mach-O memory allocation

2020-09-08 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch corrects the amount of memory allocated when looking for the Mach-O dsym file. We weren't allocating space for the backslash. Thanks to Alex Crichton for noticing this. This also fixes the amount of space released when freeing diralc in the same function. Thanks to

libbacktrace patch committed: Correctly swap Mach-O fat 32-bit file offset

2020-09-08 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch correctly swaps the 32-bit file offset in a Mach-O fat file. This is based on a patch by Francois-Xavier Coudert , who analyzed the problem. This is for PR 96973. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian PR

libbacktrace patch committed: Only match magic number at start of file

2020-09-08 Thread Ian Lance Taylor via Gcc-patches
This patch fixes the libbacktrace file type detection, which is run at configure time, to only look for a magic number at the very start of the file. Otherwise we can get confused if the bytes happen to appear elsewhere on the first "line". This is for PR 96971. Bootstrapped and ran

libbacktrace patch committed: Add support for Mach-O 64-bit FAT files

2020-08-24 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch adds support for Mach-O 64-bit FAT files. Bootstrapped and tested on x86_64-pc-linux-gnu. Committed to mainline. Ian libbacktrace/: * macho.c (MACH_O_MH_MAGIC_FAT_64): Define. (MACH_O_MH_CIGAM_FAT_64): Define. (struct

libbacktrace patch committed: Mark state unused in ztest.c test_large

2020-05-13 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch marks the state parameter of test_large in ztest.c as ATTRIBUTE_UNUSED. The parameter is not used if HAVE_ZLIB is not defined. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian 2020-05-13 Ian Lance Taylor * ztest.c

libbacktrace patch committed: Treat EACCES like ENOENT

2020-05-13 Thread Ian Lance Taylor via Gcc-patches
This patch to libbacktrace treats an EACCES error when opening a file like an ENOENT error. This case happens when running the libgo syscall tests as root, when testing various ways of restricting a child process. Bootstrapped and ran libbacktrace and Go tests on x86_64-pc-linux-gnu. Committed

libbacktrace patch committed: Declare getpagesize if necessary

2020-05-11 Thread Ian Lance Taylor via Gcc-patches
Reportedly mingw-w64-gcc has mmap and getpagesize but does not provide a declaration of getpagesize in any header files. Check for a getpagesize declaration, and declare it if necessary. This is for PR 95012. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to master.

libbacktrace patch committed: Don't crash if no section headers

2020-05-09 Thread Ian Lance Taylor via Gcc-patches
This patch to libbacktrace, by Roland McGrath, avoids crashing if an ELF file has no section headers. Bootstrapped and ran libbacktrace testsuite on x86_64-pc-linux-gnu. This fixes https://github.com/ianlancetaylor/libbacktrace/issues/41. Committed to master. Ian 2020-05-09 Roland McGrath

libbacktrace patch committed: Don't free strtab if error after reading symbols

2020-05-09 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch fixes the ELF support so that after reading symbol information we don't free the strtab, even if we encounter an error later while reading debug info. This fixes programs that try to get symbol information even if they can't get backtrace information. Bootstrapped and ran

libbacktrace patch committed: Add Mach-O support

2020-05-09 Thread Ian Lance Taylor via Gcc-patches
This patch to libbacktrace adds Mach-O support. Bootstrapped and tested on macOS. Most tests pass, but a couple still fail. This is for PR 88745. Committed to master. Ian 2020-05-09 Ian Lance Taylor PR libbacktrace/88745 * macho.c: New file. * filetype.awk: Recognize Mach-O files. *

libbacktrace patch committed: Support short reads

2020-05-09 Thread Ian Lance Taylor via Gcc-patches
This patch to libbacktrace handles short reads correctly. Short reads are unlikely, but they can reportedly happen when the debug sections are very large and we aren't using mmap. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian 2020-05-09 Ian Lance

libbacktrace patch committed: sometimes read debug sections individually

2020-05-09 Thread Ian Lance Taylor via Gcc-patches
This patch to libbacktrace changes it to read the debug sections as individual sections if they are very large or are far apart. This uses less memory in some cases, and fixes some cases on 32-bit systems. In particular this fixes one of the problems in

libbacktrace patch committed: get executable name on FreeBSD and NetBSD

2020-05-09 Thread Ian Lance Taylor via Gcc-patches
This libbacktrace patch adds the ability to fetch the executable name on FreeBSD and NetBSD using sysctl when /proc is not mounted. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian 2020-05-08 Ian Lance Taylor * fileline.c (sysctl_exec_name): New

libbacktrace patch committed: Update test file

2020-02-15 Thread Ian Lance Taylor
This libbacktrace patch updates the test file used for comparisons with zlib. The file that the test was previously using, from libgo, no longer exists. Use its replacement file instead. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian 2020-02-15

libbacktrace patch committed: Always build tests with -g

2020-02-03 Thread Ian Lance Taylor
This patch ensures that the libbacktrace tests are always built with -g. It also builds them with the default warning flags, so I had to add a few casts to ztest.c to get it pass without warnings. This should fix PR 90636. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu.

libbacktrace patch committed: Add DWARF 5 support

2019-12-13 Thread Ian Lance Taylor
This patch to libbacktrace adds DWARF 5 support. I tested this with GCC 8, GCC tip, and clang 8, using the -gdwarf-5 option. Bootstrapped and ran libbacktrace and libgo tests on x86_64-pc-linux-gnu. Committed to mainline. Ian 2019-12-13 Ian Lance Taylor Add DWARF 5 support. * dwarf.c

libbacktrace patch committed: Remove duplication of address handling

2019-12-09 Thread Ian Lance Taylor
Before this patch libbacktrace duplicated the handling of DW_AT_low_pc, DW_AT_high_pc, and DW_AT_ranges, once to build a mapping from addresses to compilation units, and then again to build a mapping from addresses to functions within a compilation unit. This patch removes the duplication into a

libbacktrace patch committed: Declare test1 in edtest.c with noclone

2019-12-04 Thread Ian Lance Taylor
This libbacktrace patch adds the noclone attribute to the version of test1 in edtest.c, to correspond to other versions of test1. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian 2019-12-04 Ian Lance Taylor * edtest.c (test1): Add noclone attribute.

libbacktrace patch committed: Simplify DWARF section handling

2019-12-04 Thread Ian Lance Taylor
This libbacktrace patch simplifies the DWARF section handling. This is in preparation for DWARF 5 support, as DWARF 5 requires us to read more sections. Bootstrapped and ran libbacktrace and Go tests on x86_64-pc-linux-gnu. Committed to mainline. Ian 2019-12-04 Ian Lance Taylor *

libbacktrace patch committed: Only run ztest if HAVE_ELF

2019-03-11 Thread Ian Lance Taylor
This libbacktrace patch only runs the two ztest tests if HAVE_ELF is true, since we only do uncompression on ELF. This should fix PR 89699. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian 2019-03-11 Ian Lance Taylor PR libbacktrace/89669 *

libbacktrace patch committed: backtrace_create_state should be called once

2018-10-05 Thread Ian Lance Taylor
This patch to libbacktrace expands the comment for backtrace_create_state to make clear that it should be called only once. There is no backtrace_free_state function. While it would be nice to have such a function, it's hard to write completely accurately as libbacktrace doesn't currently track

Re: libbacktrace patch committed: Call munmap after memory test

2018-04-17 Thread Ian Lance Taylor
On Tue, Apr 17, 2018 at 10:29 AM, Ian Lance Taylor wrote: > On Tue, Apr 17, 2018 at 10:21 AM, Tom de Vries wrote: >> On 04/17/2018 03:59 PM, Ian Lance Taylor wrote: >>> >>> The bug report https://github.com/ianlancetaylor/libbacktrace/issues/13 >>> points

Re: libbacktrace patch committed: Call munmap after memory test

2018-04-17 Thread Ian Lance Taylor
On Tue, Apr 17, 2018 at 10:21 AM, Tom de Vries wrote: > On 04/17/2018 03:59 PM, Ian Lance Taylor wrote: >> >> The bug report https://github.com/ianlancetaylor/libbacktrace/issues/13 >> points out that when backtrace_full checks whether memory is >> available, it doesn't

Re: libbacktrace patch committed: Call munmap after memory test

2018-04-17 Thread Tom de Vries
On 04/17/2018 03:59 PM, Ian Lance Taylor wrote: The bug report https://github.com/ianlancetaylor/libbacktrace/issues/13 points out that when backtrace_full checks whether memory is available, it doesn't necessarily release that memory. It will stay on the free list, so libbacktrace will use

libbacktrace patch committed: Call munmap after memory test

2018-04-17 Thread Ian Lance Taylor
The bug report https://github.com/ianlancetaylor/libbacktrace/issues/13 points out that when backtrace_full checks whether memory is available, it doesn't necessarily release that memory. It will stay on the free list, so libbacktrace will use more and more memory over time. This patch fixes

libbacktrace patch committed: Close debuginfo files

2018-01-31 Thread Ian Lance Taylor
This patch to libbacktrace closes any debuginfo files that we opened. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. This should fix https://golang.org/issue/23626. Committed to mainline. Ian 2018-01-31 Ian Lance Taylor * elf.c (elf_add): Close descriptor

libbacktrace patch committed: Only free sym_view if it is valid

2018-01-25 Thread Ian Lance Taylor
Another libbacktrace patch to avoid use of uninitialized memory: only free sym_view if it is valid. Committed to mainline. Ian 2018-01-25 Ian Lance Taylor * pecoff.c (coff_add): Only release syms_view if it is valid. Index: pecoff.c

libbacktrace patch committed: Another memcpy -> coff_read4 fix

2018-01-25 Thread Ian Lance Taylor
This libbacktrace patch fixes another cases where memcpy was used in a way that would leave some bytes uninitialized on a 64-bit system. Committed to mainline. Ian 2018-01-25 Ian Lance Taylor * pecoff.c (coff_add): Another memcpy -> coff_read4 fix. Index: pecoff.c

libbacktrace patch committed: Fix setting str_size on PE/COFF

2018-01-24 Thread Ian Lance Taylor
This libbacktrace patch fixes the setting of str_size on PE/COFF to not leave some bytes uninitialized on a 64-bit host. Committed to mainline. Ian 2018-01-24 Ian Lance Taylor * pecoff.c (coff_add): Use coff_read4, not memcpy. Index: pecoff.c

libbacktrace patch committed: Only keep 16 entries on free list

2018-01-24 Thread Ian Lance Taylor
PR 68239 points out that libbacktrace can sometimes take a long time scanning the list of free memory blocks looking for one that is large enough. Since the libbacktrace memory allocator does not have to be perfect in practice, only keep the 16 largest entries on the free list. Bootstrapped and

libbacktrace patch committed: Fix handling of inflate default dist table

2018-01-16 Thread Ian Lance Taylor
I misunderstood how the dist codes are handled in block type 1. I also think'od the length of the codes for the default table. This patch fixes these problems, along with a test case that exposes them. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu. Committed to mainline. Ian

Re: libbacktrace patch committed: Support compressed debug sections

2017-11-07 Thread Ian Lance Taylor
On Sat, Nov 4, 2017 at 3:07 AM, Gerald Pfeifer wrote: > On Fri, 6 Oct 2017, Ian Lance Taylor wrote: >> Thanks for the report. I committed this patch, which I hope will fix >> the problem. > >> * ztest.c (test_large): Pass unsigned long *, not size_t *, to >> zlib uncompress

Re: libbacktrace patch committed: Support compressed debug sections

2017-11-04 Thread Gerald Pfeifer
On Fri, 6 Oct 2017, Ian Lance Taylor wrote: > Thanks for the report. I committed this patch, which I hope will fix > the problem. > * ztest.c (test_large): Pass unsigned long *, not size_t *, to > zlib uncompress function. Thank you, yes it did. (Sorry, I thought I had responded back then,

Re: GCC 7 libbacktrace patch committed: Ignore compressed debug sections

2017-10-10 Thread Ian Lance Taylor
On Tue, Oct 10, 2017 at 12:47 PM, Paolo Carlini wrote: > > On 10/10/2017 18:55, Ian Lance Taylor wrote: >> >> Index: elf.c >> === >> --- elf.c (revision 253593) >> +++ elf.c (working copy) >> @@

Re: GCC 7 libbacktrace patch committed: Ignore compressed debug sections

2017-10-10 Thread Paolo Carlini
Hi, On 10/10/2017 18:55, Ian Lance Taylor wrote: Index: elf.c === --- elf.c (revision 253593) +++ elf.c (working copy) @@ -103,6 +103,7 @@ #undef SHT_SYMTAB #undef SHT_STRTAB #undef SHT_DYNSYM +#undef

GCC 7 libbacktrace patch committed: Ignore compressed debug sections

2017-10-10 Thread Ian Lance Taylor
This patch to the GCC 7 libbacktrace ignores compressed debug sections. If we don't, the DWARF reader reports an error. Since the GCC 7 libbacktrace does not support uncompressing the debug sections, ignoring them is the best approach (on trunk, we uncompress). This is for PR 80914.

Re: libbacktrace patch committed: Support compressed debug sections

2017-10-06 Thread Ian Lance Taylor
On Fri, Oct 6, 2017 at 3:22 AM, Gerald Pfeifer wrote: > On Thu, 28 Sep 2017, Ian Lance Taylor wrote: >> This patch to libbacktrace adds support for compressed debug sections. >> 2017-09-28 Ian Lance Taylor >> >> PR other/67165 >> * elf.c

Re: libbacktrace patch committed: Support compressed debug sections

2017-10-06 Thread Gerald Pfeifer
On Thu, 28 Sep 2017, Ian Lance Taylor wrote: > This patch to libbacktrace adds support for compressed debug sections. > 2017-09-28 Ian Lance Taylor > > PR other/67165 > * elf.c (__builtin_prefetch): Define if not __GNUC__. > (unlikely): Define. > (SHF_UNCOMPRESSED,

libbacktrace patch committed: Minor decompression improvement

2017-10-05 Thread Ian Lance Taylor
I've committed a patch to libbacktrace to speed up decompression a few percent by loading 32-bit values rather than 8-bit bytes. Bootstrapped and ran libbacktrace and Go tests on x86_64-pc-linux-gnu. Committed to mainline. Ian 2017-10-05 Ian Lance Taylor * elf.c

Re: libbacktrace patch committed: Support compressed debug sections

2017-10-02 Thread Ian Lance Taylor
Thanks for the fixes. I made some style tweaks, committed as follows after bootstrap and testing. Ian 2017-10-02 Ian Lance Taylor * ztest.c: #include . (TEST_TIMING): Don't define, don't test. (xclock_gettime, xclockid_t): Define if !HAVE_CLOCK_GETTIME. (clockid_t,

Re: libbacktrace patch committed: Support compressed debug sections

2017-10-02 Thread Thomas Schwinge
Hi! On Mon, 02 Oct 2017 14:00:36 +0200, I wrote: > On Thu, 28 Sep 2017 17:30:53 -0700, Ian Lance Taylor wrote: > > This patch to libbacktrace adds support for compressed debug sections. > > [...] > > > --- ztest.c (revision 0) > > +++ ztest.c (working copy) > > @@ -0,0 +1,446

Re: libbacktrace patch committed: Support compressed debug sections

2017-10-02 Thread Thomas Schwinge
Hi! On Thu, 28 Sep 2017 17:30:53 -0700, Ian Lance Taylor wrote: > This patch to libbacktrace adds support for compressed debug sections. > [...] > --- ztest.c (revision 0) > +++ ztest.c (working copy) > @@ -0,0 +1,446 @@ > +/* ztest.c -- Test for libbacktrace inflate code.

libbacktrace patch committed: Support compressed debug sections

2017-09-28 Thread Ian Lance Taylor
This patch to libbacktrace adds support for compressed debug sections. Rather than require all users of libbacktrace to link against -lz, I wrote new code in libbacktrace to inflate a zlib stream. Because the code does not have to be as flexible as zlib, and because it is only used to uncompress

libbacktrace patch committed: Replace lstat and readlink if not available

2017-09-22 Thread Ian Lance Taylor
This patch to libbacktrace provides dummy versions of lstat and readlink if they are not available on the system. Bootstrapped and ran libbacktrace tests on x86_64-pc-linux-gnu both normally and with a hand-edited config.h. Committed to mainline. Ian 2017-09-22 Ian Lance Taylor

libbacktrace patch committed: Fix uninitialized field

2017-09-21 Thread Ian Lance Taylor
I somehow failed to initialize the exe_filename field of phdr_data, which most likely led to PR 82284. Bootstrapped and ran libbacktrace tests for this obvious fix. Committed to mainline. Ian 2017-09-21 Ian Lance Taylor PR go/82284 * elf.c (backtrace_initialize): Set

libbacktrace patch committed: Fix race on parallel initialization

2017-06-11 Thread Ian Lance Taylor
The code in libbacktrace had a race when doing parallel initialization: if two threads start to initialize at the same time, and one completes first, the other, while running in backtrace_initialize, may see that the structure is initialized and thus not change *fileline_fn. The caller will then

libbacktrace patch committed: Update dependencies

2015-09-11 Thread Ian Lance Taylor
Although libbacktrace uses automake, it can't use automatic dependency tracking, because it breaks when using bootstrap-lean (PR 54732). The dependencies for sort.lo and stest.lo were never added to the list. Also, the dependencies for backtrace.lo were not updated for my recent change to that

libbacktrace patch committed: fix test for mmap failure

2015-09-08 Thread Ian Lance Taylor
PR 67457 points out a crash in libbacktrace when there is no memory available. This is because the code testing the mmap result for failure is broken. This patch fixes it. Bootstrapped and ran libbacktrace tests. Committed to mainline. Ian 2015-09-08 Ian Lance Taylor PR

Re: libbacktrace patch committed: Graceful fallback if out of memory

2015-09-08 Thread Hans-Peter Nilsson
> From: Ian Lance Taylor > Date: Tue, 8 Sep 2015 18:46:21 +0200 > PR other/67457 > * backtrace.c: #include "internal.h". > (struct backtrace_data): Add can_alloc field. > (unwind): If can_alloc is false, don't try to get file/line > information. > (backtrace_full): Set

Re: libbacktrace patch committed: Graceful fallback if out of memory

2015-09-08 Thread Ian Lance Taylor
On Tue, Sep 8, 2015 at 5:00 PM, Hans-Peter Nilsson wrote: > > I've committed the following as obvious, following the pattern > of the other files including internal.h, after observing > all-libbacktrace (i.e. built for the host) complete. > > libbacktrace: > *

libbacktrace patch committed: Graceful fallback if out of memory

2015-09-08 Thread Ian Lance Taylor
I've committed this libbacktrace patch to mainline to do a graceful fallback if no memory can be allocated. In that case we print out the PC addresses without trying to resolve file/line information. This is imperfect but better than the earlier behaviour of producing a series of error messages.

libbacktrace patch committed: Fix load_pointer if no atomic or sync functions

2014-10-23 Thread Ian Taylor
This patch to libbacktrace fixes the type returned by the backup definition of backtrace_atomic_load_pointer for the case where libbacktrace is compiled with neither the atomic nor the sync functions available. This case does not arise in general but could arise from other uses of the library, or

libbacktrace patch committed: Fixes for large binaries

2014-05-08 Thread Ian Lance Taylor
While testing on a large Google binary, I noticed that libbacktrace is allocating an inordinate amount of memory. The binary winds up with 377,944 entries in the unit_addrs vector. Each entry is 24 bytes, so this is 9,070,656 bytes, which is not too terrible. Unfortunately, for some reason I

libbacktrace patch committed: Speed up sort

2014-03-07 Thread Ian Lance Taylor
The new libbacktrace sort routine has, no doubt, many flaws, but one is quite significant. The backtrace data tends to be roughly sorted in practice (though unfortunately not perfectly sorted). By pivoting on the first element in the array, the sort routine was tending to maximize the number of

Re: libbacktrace patch committed (Was: Re: [jit] Update TODO.rst)

2013-10-18 Thread David Malcolm
On Thu, 2013-10-17 at 21:28 -0700, Ian Lance Taylor wrote: On Thu, Oct 17, 2013 at 8:54 PM, David Malcolm dmalc...@redhat.com wrote: +* segfault seen in libbacktrace, when an ICE occurs That reminded me to commit this libbacktrace patch I worked up a couple of weeks ago. Previously if

  1   2   >