mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
users/nalcock/try-mdarray-big-corrupt-structs
Before GCC PR114186, all looked good in the land of multidimensional arrays: you wrote int a[5][10]; and ctf_type_aname() et al would print it as int [5][10] Unfortunately this was two bugs in one. GCC was emitting the array as if it were int a[10][5], i.e. as this: a -> [10] -> [5] -> int rather than a -> [5] -> [10] -> int as it should be. libctf was hiding this by printing them in the wrong order, concealing the bug from anyone using objdump --ctf or anything but actual type graph traversal. Once this was fixed for GCC, the bug was visible in libctf: multidimensional arrays were printed backwards! (But this is just a print-time bug: the underlying bug, that something traversing the type graph would see the array in backwards order, was fixed by the fix to GCC.) Fix this libctf bug, printing the arrays the right way round. In a possibly futile attempt to retain some vestige of backwards compatibility, introduce a new bug-compat flag CTF_F_ARRNELEMS, which, if on, indicates that PR114186 is fixed and GCC is emitting array elements the right way round. (Unfortunately, the fix went in without this flag, so some GCCs will still emit CTF that will cause libctf to print them wrong, even with this fix -- but it's no wronger than it was before, and new GCC and new binutils, as well as GCC older than any fix for PR114186 and new binutils, will print things properly. Someone traversing the type graph will see things right after the GCC fix, wrong before it, and there isn't really any reliable way to tell which you have, though if CTF_F_ARRNELEMS is set, you definitely have a fixed GCC. The test checks for this, but it's not something we expect actual users to ever do -- CTF dict flags are an internal implementation detail with no user-visible API for a reason.) [nca: log message, test compat with older compilers] include/ * ctf.h (CTF_F_ARRNELEMS): New bug-compat flag. (CTF_F_MAX): Adjust. libctf/ PR libctf/32161 * ctf-decl.c (ctf_decl_push): Prepend if this is an array and the bug-compat flag is set. * ctf-dump.c (ctf_dump_header): Dump the new bug-compat flag. * testsuite/libctf-lookup/multidim-array*: New test.
…
…
…
…
…
…
…
…
…
…
README for GNU development tools This directory contains various GNU compilers, assemblers, linkers, debuggers, etc., plus their support routines, definitions, and documentation. If you are receiving this as part of a GDB release, see the file gdb/README. If with a binutils release, see binutils/README, and so on. That'll give you info about this package -- supported targets, how to use it, how to report bugs, etc. It is now possible to automatically configure and build a variety of tools with one command. To build all of the tools contained herein, run the ``configure'' script here, e.g.: ./configure make To install them (by default in /usr/local/bin, /usr/local/lib, etc), then do: make install (If the configure script can't determine your type of computer, give it the name as an argument, for instance ``./configure sun4''. You can use the script ``config.sub'' to test whether a name is recognized; if it is, config.sub translates it to a triplet specifying CPU, vendor, and OS.) If you have more than one compiler on your system, it is often best to explicitly set CC in the environment before running configure, and to also set CC when running make. For example (assuming sh/bash/ksh): CC=gcc ./configure make A similar example using csh: setenv CC gcc ./configure make Much of the code and documentation enclosed is copyright by the Free Software Foundation, Inc. See the file COPYING or COPYING.LIB in the various directories, for a description of the GNU General Public License terms under which you can copy the files. REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info on where and how to report problems.
Description
Languages
C
50.5%
Makefile
22.7%
Assembly
13.2%
C++
5.9%
Roff
1.5%
Other
5.6%