Go to file
Tom de Vries bcf43b33cf [gdb/testsuite] Drop -nostdlib in gdb.dwarf2/typeddwarf.exp
As reported in PR testsuite/30633, when running test-case
gdb.dwarf2/typeddwarf.exp with target board native-gdbserver on Ubuntu
22.04.2, we run into:
...
(gdb) continue^M
Continuing.^M
^M
Program received signal SIGSEGV, Segmentation fault.^M
0x0000000000000001 in ?? ()^M
(gdb) FAIL: gdb.dwarf2/typeddwarf.exp: runto: run to main
...

We run into the FAIL as follows:
- due to using gdbserver, we attach at the point of the first instruction, in
  _start
- we then set a breakpoint at main
- the test-case is a .s file, that has main renamed to _start in the assembly,
  but not in the debuginfo
- setting a breakpoint at main sets the breakpoint at the same instruction
  we're currently stopped at
- continue doesn't hit the breakpoint, and we return out of _start, which
  causes a sigsegv

Note that this is for the amd64 case (using gdb.dwarf2/typeddwarf-amd64.S).
For the i386 case (using gdb.dwarf2/typeddwarf.S), setting a breakpoint in
main sets it one insn after function entry, and consequently the problem does
not occur.

The FAIL is a regression since commit 90cce6c055 ("[gdb/testsuite] Add nopie
in a few test-cases").

Without nopie the executable is PIE, with nopie it's static instead.

In the PIE case, we attach at the point of _start in the dynamic linker, and
consequently we do not skip the breakpoint in main, and also don't run into
the FAIL.

Fix this by:
- removing the -nostdlib setting, and
- renaming _start to main in both .S files.

The change to use -nostdlib and rename main to _start was originally added
in commit 6edba76fe8 (submitted here:
https://sourceware.org/pipermail/gdb-patches/2011-May/082657.html ) , I assume
to fix the problem now fixed by using nopie.

Tested on x86_64-linux.

Reported-By: Simon Marchi <simon.marchi@efficios.com>
Tested-By: Simon Marchi <simon.marchi@efficios.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30633
2023-07-26 13:42:32 +02:00
bfd Automatic date update in version.in 2023-07-26 00:00:23 +00:00
binutils objcopy embeds the current time and ignores SOURCE_DATE_EPOCH making the output unreproducible. 2023-07-24 16:59:19 +01:00
config
contrib
cpu DesCGENization of the BPF binutils port 2023-07-21 12:20:40 +02:00
elfcpp Add markers for the 2.41 branch 2023-07-03 11:12:15 +01:00
etc
gas bpf: fix register NEG[32] instructions 2023-07-26 11:38:04 +02:00
gdb [gdb/testsuite] Drop -nostdlib in gdb.dwarf2/typeddwarf.exp 2023-07-26 13:42:32 +02:00
gdbserver gdbserver: handle all eval_result_type values in tracepoint.cc 2023-07-10 14:42:54 +01:00
gdbsupport Move unrelocated_addr to common-types.h 2023-06-05 09:59:18 -06:00
gnulib Add missing backslash to update-gnulib.sh 2023-06-21 08:47:05 -06:00
gold [GOLD] reporting local symbol names 2023-07-26 10:23:27 +09:30
gprof PR30657, gprof heap buffer overflow 2023-07-26 10:23:27 +09:30
gprofng gprofng: 30602 [2.41] gprofng test hangs on i686-linux-gnu 2023-07-13 21:53:36 -07:00
include bpf: Add atomic compare-and-exchange instructions 2023-07-25 13:40:06 -07:00
intl
ld objcopy embeds the current time and ignores SOURCE_DATE_EPOCH making the output unreproducible. 2023-07-24 16:59:19 +01:00
libbacktrace
libctf Add markers for the 2.41 branch 2023-07-03 11:12:15 +01:00
libdecnumber
libiberty Synchromize libiberty sources with master version in gcc repository 2023-06-26 15:47:15 +01:00
libsframe doc: sframe: update specification for SFRAME_VERSION_2 2023-06-29 16:32:26 -07:00
opcodes bpf: fix register NEG[32] instructions 2023-07-26 11:38:04 +02:00
readline [readline] Fix double free in _rl_scxt_dispose 2023-05-28 10:17:57 +02:00
sim bpf: fix neg and neg32 BPF instructions in simulator 2023-07-26 11:44:20 +02:00
texinfo
zlib
.cvsignore
.editorconfig
.gitattributes
.gitignore
ar-lib
ChangeLog Add markers for the 2.41 branch 2023-07-03 11:12:15 +01:00
compile
config-ml.in
config.guess Sync config.guess and config.sub with upstream master versions. 2023-06-26 14:11:30 +01:00
config.rpath
config.sub Sync config.guess and config.sub with upstream master versions. 2023-06-26 14:11:30 +01:00
configure
configure.ac
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
Makefile.in
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode
SECURITY.txt
setup.com
src-release.sh
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.