Go to file
Andrew Burgess 9f50fe0835 gdb/testsuite: new test for recent dwarf reader issue
This commit provides a test for this commit:

  commit 55fc1623f9
  Date:   Thu Nov 3 13:49:17 2022 -0600

      Add name canonicalization for C

Which resolves PR gdb/29105.  My reason for writing this test was a
desire to better understand the above commit, my process was to study
the commit until I thought I understood it, then write a test to
expose the issue.  As the original commit didn't have a test, I
thought it wouldn't hurt to commit this upstream.

The problem tested for here is already described in the above commit,
but I'll give a brief description here.  This description describes
GDB prior to the above commit:

  - Builtin types are added to GDB using their canonical name,
    e.g. "short", not "signed short",

  - When the user does something like 'p sizeof(short)', then this is
    handled in c-exp.y, and results in a call to lookup_signed_type
    for the name "int".  The "int" here is actually being looked up as
    the type for the result of the 'sizeof' expression,

  - In lookup_signed_type GDB first adds a 'signed' and looks for that
    type, so in this case 'signed int', and, if that lookup fails, GDB
    then looks up 'int',

  - The problem is that 'signed int' is not the canonical name for a
    signed int, so no builtin type with that name will be found, GDB
    will then go to each object file in turn looking for a matching
    type,

  - When checking each object file, GDB will first check the partial
    symtab to see if the full symtab should be expanded or not.
    Remember, at this point GDB is looking for 'signed int', there
    will be no partial symbols with that name, so GDB will not expand
    anything,

  - However, GDB checks each partial symbol using multiple languages,
    not just the current language (C in this case), so, when GDB
    checks using the C++ language, the symbol name is first
    canonicalized (the code that does this can be found
    lookup_name_info::language_lookup_name).  As the canonical form of
    'signed int' is just 'int', GDB then looks for any symbols with
    the name 'int', most partial symtabs will contain such a symbol,
    so GDB ends up expanding pretty much every symtab.

The above commit fixes this by avoiding the use of non-canonical names
with C, now the initial builtin type lookup will succeed, and GDB
never even considers whether to expand any additional symtabs.

The test case creates a library that includes char, short, int, and
long types, and a test program that links against the library.

In the test script we start the inferior, but don't allow it to
progress far enough that the debug information for the library has
been fully expanded yet.

Then we evaluate some 'sizeof(TYPE)' expressions.

In the buggy version of GDB this would cause the debug information
for the library to be fully expanded, while in the fixed version of
GDB this will not be the case.

We use 'info sources' to determine if the debug information has been
fully expanded or not.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29105
2022-12-14 10:22:44 +00:00
bfd ld, gold: remove support for -z bndplt (MPX prefix) 2022-12-14 08:48:13 +01:00
binutils asan: signed integer overflow in display_debug_frames 2022-12-14 13:07:43 +10:30
config libsframe: add the SFrame library 2022-11-15 15:24:29 -08:00
contrib
cpu
elfcpp gold, dwp: support zstd compressed input debug sections [PR 29641] 2022-11-10 21:42:14 -08:00
etc
gas RISC-V: Add string length check for operands in AS 2022-12-14 17:23:12 +08:00
gdb gdb/testsuite: new test for recent dwarf reader issue 2022-12-14 10:22:44 +00:00
gdbserver [aarch64] Add TPIDR2 register support for Linux 2022-12-09 13:41:15 +00:00
gdbsupport fix leak in gdb_environ 2022-11-27 21:08:24 +01:00
gnulib [PR build/29791] gnulib: Disable _GL_ATTRIBUTE_DEALLOC on Solaris 2022-11-20 14:55:52 +01:00
gold ld, gold: remove support for -z bndplt (MPX prefix) 2022-12-14 08:48:13 +01:00
gprof Updated Hungarian translation for the gprof sub-directory. 2022-10-21 10:55:57 +01:00
gprofng gprofng: remove unused gprofng/src/DbeSession.cc.1 2022-11-28 20:52:10 -08:00
include libsframe: rename API sframe_fde_func_info to sframe_fde_create_func_info 2022-12-09 10:25:31 -08:00
intl egrep in binutils 2022-09-28 13:37:31 +09:30
ld ld, gold: remove support for -z bndplt (MPX prefix) 2022-12-14 08:48:13 +01:00
libbacktrace testsuite: support mold linker 2022-12-05 15:52:51 +01:00
libctf libctf: remove unnecessary zstd constructs 2022-12-12 10:53:39 -08:00
libdecnumber
libiberty Impport libiberty commit: 885b6660c17f from gcc mainline. Fix gas's acinclude.m4 to stop a potwntial configure time warning message. 2022-11-24 12:31:46 +00:00
libsframe libsframe: rename API sframe_fde_func_info to sframe_fde_create_func_info 2022-12-09 10:25:31 -08:00
opcodes x86: further re-work insn/suffix recognition to also cover MOVSX 2022-12-12 14:01:02 +01:00
readline
sim sim: pru: Fix behaviour when loop count is zero 2022-11-12 15:10:07 +02:00
texinfo
zlib
.cvsignore
.editorconfig
.gitattributes
.gitignore
ar-lib
ChangeLog Add ability to create reproducible source tarballs. 2022-10-10 11:28:45 +01:00
compile
config-ml.in
config.guess
config.rpath
config.sub
configure libsframe: add the SFrame library 2022-11-15 15:24:29 -08:00
configure.ac libsframe: add the SFrame library 2022-11-15 15:24:29 -08:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def bfd: linker: merge .sframe sections 2022-11-15 15:49:47 -08:00
Makefile.in bfd: linker: merge .sframe sections 2022-11-15 15:49:47 -08:00
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode Note that at least dejagnu version 1.5.3 is required in order to be ale to run the testsuites. 2022-10-04 10:54:19 +01:00
setup.com
src-release.sh src-release.sh: Fix gdb source tarball build failure due to libsframe 2022-11-30 07:32:58 +04:00
symlink-tree
test-driver
ylwrap

		   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;  if with a libg++ release,
see libg++/README, etc.  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.