Commit Graph

112480 Commits

Author SHA1 Message Date
Tom Tromey
83d3152401 Fix parameter-less template regression in new DWARF reader
PR c++/29896 points out a regression in the new DWARF reader.  It does
not properly handle a case like "break fn", where "fn" is a template
function.

This happens because the new index uses strncasecmp to compare.
However, to make this work correctly, we need a custom function that
ignores template parameters.

This patch adds a custom comparison function and fixes the bug.  A new
test case is included.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29896

(cherry picked from commit ac37b79cc4)
2023-01-17 07:07:00 -07:00
Tom Tromey
947b698401 Move hash_entry and eq_entry into cooked_index::do_finalize
I was briefly confused by the hash_entry and eq_entry functions in the
cooked index.  They are only needed in a single method, and that
method already has a couple of local lambdas for a different hash
table.  So, it seemed cleaner to move these there as well.

(cherry picked from commit 5a89072f36)
2023-01-17 07:06:58 -07:00
Tom Tromey
6107546876 Avoid submitting empty tasks in parallel_for_each
I found that parallel_for_each would submit empty tasks to the thread
pool.  For example, this can happen if the number of tasks is smaller
than the number of available threads.  In the DWARF reader, this
resulted in the cooked index containing empty sub-indices.  This patch
arranges to instead shrink the result vector and process the trailing
entries in the calling thread.

(cherry picked from commit 63078a0498)
2023-01-17 07:06:56 -07:00
GDB Administrator
2ec9694617 Automatic date update in version.in 2023-01-17 00:01:16 +00:00
GDB Administrator
5d53fb99d5 Automatic date update in version.in 2023-01-16 00:01:01 +00:00
GDB Administrator
e6a3c6ab33 Automatic date update in version.in 2023-01-15 00:01:00 +00:00
GDB Administrator
b6762b3d7c Automatic date update in version.in 2023-01-14 00:00:38 +00:00
GDB Administrator
d54a65f427 Automatic date update in version.in 2023-01-13 00:01:01 +00:00
Tom Tromey
3cc048fc6b Set _WIN32_WINNT in common.m4 configure check
GCC recently added support for the Windows thread model, enabling
libstdc++ to support Windows natively.  However, this supporrt
requires a version of Windows later than the minimum version that is
supported by GDB.

PR build/29966 points out that the GDB configure test for std::thread
does not work in this situation, because _WIN32_WINNT is not defined
in test program, and so <thread> seems to be fine.

This patch is an attempt to fix the problem, by using the same setting
for _WIN32_WINNT at configure time as is used at build time.

I don't have access to one of the older systems so I don't think I can
truly test this.  I did do a mingw cross build, though.  I'm going to
ask the bug reporter to test it.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29966

(cherry picked from commit 2124b2de4b)
2023-01-12 07:20:46 -07:00
GDB Administrator
86ac3f1401 Automatic date update in version.in 2023-01-12 00:01:26 +00:00
GDB Administrator
95d3c7776d Automatic date update in version.in 2023-01-11 00:00:47 +00:00
GDB Administrator
5fcfbade4e Automatic date update in version.in 2023-01-10 00:01:20 +00:00
GDB Administrator
02ccd8cfbc Automatic date update in version.in 2023-01-09 00:01:22 +00:00
GDB Administrator
15c994179b Automatic date update in version.in 2023-01-08 00:01:06 +00:00
GDB Administrator
82a83b0f41 Automatic date update in version.in 2023-01-07 00:00:53 +00:00
GDB Administrator
514dead4d8 Automatic date update in version.in 2023-01-06 00:01:12 +00:00
GDB Administrator
01b95e43f8 Automatic date update in version.in 2023-01-05 00:01:00 +00:00
GDB Administrator
8c189ebcd2 Automatic date update in version.in 2023-01-04 00:00:49 +00:00
Andrew Burgess
322fde46dc [gdb] Fix segfault during inferior call to ifunc
With a simple test-case:
...
$ cat test.c
char *p = "a";
int main (void) {
  return strlen (p);
}
$ gcc -g test.c
...
we run into this segfault:
...
$ gdb -q -batch a.out -ex start -ex "p strlen (p)"
Temporary breakpoint 1 at 0x1151: file test.c, line 4.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, main () at test.c:4
4	  return strlen (p);

Fatal signal: Segmentation fault
...

The strlen is an ifunc, and consequently during the call to
call_function_by_hand_dummy for "p strlen (p)" another call
to call_function_by_hand_dummy is used to resolve the ifunc.

This invalidates the get_current_frame () result in the outer call.

Fix this by using prepare_reinflate and reinflate.

Note that this series (
https://inbox.sourceware.org/gdb-patches/20221214033441.499512-1-simon.marchi@polymtl.ca/ )
should address this problem, but this patch is a simpler fix which is easy to
backport.

Tested on x86_64-linux.

Co-Authored-By: Tom de Vries <tdevries@suse.de>
PR gdb/29941
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29941
2023-01-03 11:53:09 +01:00
GDB Administrator
44916dc850 Automatic date update in version.in 2023-01-03 00:00:38 +00:00
Jonas Hoerberg
08bdba1418 Fix target remote pipe command for MinGW
The cced7cacec ("gdb: preserve `|` in connection details string")
commit added '|' detection and removal to ser-pipe.c, but missed to add it
to ser-mingw.c.

This results in the error message below for MinGW hosts:
error starting child process '| <executable> <args>': CreateProcess: No such file or directory

This commit add the missing '|' detection and removal to ser-mingw.c.

(cherry picked from commit c43d829bca)
2023-01-02 08:11:07 -07:00
GDB Administrator
33214e7a6d Automatic date update in version.in 2023-01-02 00:00:31 +00:00
Joel Brobecker
a943a2644d manual copyright year range of various GDB files to add 2023
This commit updates the following file...

   gdb/doc/gdb.texinfo
   gdb/doc/refcard.tex
   gdb/syscalls/update-netbsd.sh

... by hand as instructed by the gdb/copyright.py script.
The update by hand is needed because the copyright headers
to update are actually nested inside those files, rather
than located at the start of the file.

(cherry picked from commit 944bfb2ccb)
2023-01-01 17:07:44 +04:00
Joel Brobecker
a493ca9ec0 Update copyright year range in header of all files managed by GDB
This commit is the result of running the gdb/copyright.py script,
which automated the update of the copyright year range for all
source files managed by the GDB project to be updated to include
year 2023.
2023-01-01 17:07:37 +04:00
Joel Brobecker
1806fe04b0 gdb/copyright.py: Adjust following rename of sim/ppc/ppc-instructions...
... to sim/ppc/powerpc.igen

This file is in the NOT_FSF_LIST because this file has a copyright
which is not assigned to the FSF. Since the file got renamed,
the corresponding entry in NOT_FSF_LIST needs to be renamed as well.

(cherry picked from commit e4661570ea)
2023-01-01 17:07:32 +04:00
Joel Brobecker
47004354ff Update copyright year in help message of gdb, gdbserver, gdbreplay
This commit updates the copyright year displayed by gdb, gdbserver
and gdbreplay's help message from 2022 to 2023, as per our Start
of New Year procedure. The corresponding source files' copyright
header are also updated accordingly.

(cherry picked from commit e1ca55341c)
2023-01-01 17:07:20 +04:00
GDB Administrator
41be9b6a6d Automatic date update in version.in 2023-01-01 00:00:31 +00:00
GDB Administrator
4102b8f7a8 Automatic date update in version.in 2022-12-31 00:01:01 +00:00
GDB Administrator
c3f45d1e9a Automatic date update in version.in 2022-12-30 00:00:39 +00:00
GDB Administrator
04a82ddcb1 Automatic date update in version.in 2022-12-29 00:00:38 +00:00
Tom Tromey
ecb7214fc1 Fix "set debug timestamp"
PR cli/29945 points out that "set debug timestamp 1" stopped working
-- this is a regression due to commit b8043d27 ("Remove a ui-related
memory leak").

This patch fixes the bug and adds a regression test.

I think this should probably be backported to the gdb 13 branch.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29945

(cherry picked from commit a60535c39b)
2022-12-28 09:38:34 -07:00
GDB Administrator
bb9bdfb840 Automatic date update in version.in 2022-12-28 00:00:56 +00:00
GDB Administrator
e69618fb98 Automatic date update in version.in 2022-12-27 00:01:08 +00:00
GDB Administrator
aad9e4797f Automatic date update in version.in 2022-12-26 00:00:25 +00:00
GDB Administrator
204c8ed14d Automatic date update in version.in 2022-12-25 00:00:54 +00:00
GDB Administrator
661169d7b5 Automatic date update in version.in 2022-12-24 00:00:38 +00:00
GDB Administrator
08081297f6 Automatic date update in version.in 2022-12-23 00:02:38 +00:00
Eli Zaretskii
2d71df1e2f Fix MinGW build using mingw.org's MinGW
This allows to build GDB even though the default value of
_WIN32_WINNT is lower than the one needed to expose some
new APIs used here, and leave the test for their actual
support to run time.
* gdb/nat/windows-nat.c (EXTENDED_STARTUPINFO_PRESENT): Define if
not defined.
(create_process_wrapper): Use 'gdb_lpproc_thread_attribute_list'
instead of 'PPROC_THREAD_ATTRIBUTE_LIST' (which might not be defined
at compile time).  This fixes compilation error using mingw.org's
MinGW.
2022-12-22 12:42:24 +02:00
Alan Modra
cadab61a48 PR29915, bfdio.c does not compile with mingw.org's MinGW
PR 29915
	* configure.ac: Add AC_CHECK_DECLS test ___lc_codepage_func.
	* configure: Regenerate.
	* config.in: Regenerate.
	* bfdio.c (___lc_codepage_func): Move declaration to..
	(_bfd_real_fopen): ..here, and use !HAVE_DECL____LC_CODEPAGE_FUNC.

(cherry picked from commit 9d09914492)
2022-12-22 12:37:55 +02:00
GDB Administrator
4547ad37f8 Automatic date update in version.in 2022-12-22 00:01:48 +00:00
GDB Administrator
467cc79cd2 Automatic date update in version.in 2022-12-21 00:01:36 +00:00
Hannes Domani
a444d5309d Fix install-strip target
The libtool patch broke install-strip of gdb:

/bin/sh ../../gdb/../mkinstalldirs /src/gdb/inst/share/gdb/python/gdb
transformed_name=`t='s,y,y,'; \
                  echo gdb | sed -e "$t"` ; \
        if test "x$transformed_name" = x; then \
          transformed_name=gdb ; \
        else \
          true ; \
        fi ; \
        /bin/sh ../../gdb/../mkinstalldirs /src/gdb/inst/bin ; \
        /bin/sh ./libtool --mode=install STRIPPROG='strip' /bin/sh /src/gdb/gdb.git/install-sh -c -s \
                gdb \
                /src/gdb/inst/bin/$transformed_name ; \
        /bin/sh ../../gdb/../mkinstalldirs /src/gdb/inst/include/gdb ; \
        /usr/bin/install -c -m 644 jit-reader.h /src/gdb/inst/include/gdb/jit-reader.h
libtool: install: `/src/gdb/inst/bin/gdb' is not a directory
libtool: install: Try `libtool --help --mode=install' for more information.

Since INSTALL_PROGRAM_ENV is no longer at the beginning of the command, the
gdb executable is not installed with install-strip.
2022-12-20 20:43:26 +01:00
Jan Vrany
a47dacc45b gdb: fix command lookup in execute_command ()
Commit b5661ff2 ("gdb: fix possible use-after-free when
executing commands") used lookup_cmd_exact () to lookup
command again after its execution to avoid possible
use-after-free error.

However this change broke test gdb.base/define.exp which
defines a post-hook for subcommand ("target testsuite").
In this case,  lookup_cmd_exact () returned NULL because
there's no command 'testsuite' in top-level commands.

This commit fixes this case by looking up the command again
using the original command line via lookup_cmd ().

Approved-By: Simon Marchi <simon.marchi@efficios.com>
(cherry picked from commit 37e5833da5)
2022-12-20 12:02:02 -07:00
GDB Administrator
e110f63216 Automatic date update in version.in 2022-12-20 00:01:24 +00:00
GDB Administrator
8897f1690e Automatic date update in version.in 2022-12-19 00:01:54 +00:00
Joel Brobecker
006808a9a7 Set development mode to "off" by default.
This is done by setting the "development" variable to "false"
in bfd/development.sh.
2022-12-18 08:34:09 +04:00
Joel Brobecker
117d18d2fc Bump version to 13.0.90.DATE-git.
Now that the GDB 13 branch has been created,
this commit bumps the version number in gdb/version.in to
13.0.90.DATE-git

For the record, the GDB 13 branch was created
from commit 71c90666e6.
2022-12-18 08:33:54 +04:00
GDB Administrator
71c90666e6 Automatic date update in version.in gdb-13-branchpoint 2022-12-18 00:01:10 +00:00
Alan Modra
56ba7527d2 bfd_get_relocated_section_contents allow NULL data buffer
This patch removes the bfd_malloc in default_indirect_link_order and
bfd_simple_get_relocated_section_contents, pushing the allocation down
to bfd_get_relocated_section_contents.  The idea is to make use of the
allocation done with sanity checking in bfd_get_full_section_contents,
which is called by bfd_generic_get_relocated_section_contents.

Doing this exposed a bug in bfd_get_full_section_contents.  With
relaxation it is possible that an input section rawsize is different
to the section size.  In that case we want to use the larger of
rawsize (the on-disk size for input sections) and size.

	* reloc.c (bfd_generic_get_relocated_section_contents),
	* reloc16.c (bfd_coff_reloc16_get_relocated_section_contents),
	* coff-alpha.c (alpha_ecoff_get_relocated_section_contents),
	* coff-sh.c (sh_coff_get_relocated_section_contents),
	* elf-m10200.c (mn10200_elf_get_relocated_section_contents),
	* elf-m10300.c (mn10300_elf_get_relocated_section_contents),
	* elf32-avr.c (elf32_avr_get_relocated_section_contents),
	* elf32-cr16.c (elf32_cr16_get_relocated_section_contents),
	* elf32-crx.c (elf32_crx_get_relocated_section_contents),
	* elf32-h8300.c (elf32_h8_get_relocated_section_contents),
	* elf32-nds32.c (nds32_elf_get_relocated_section_contents),
	* elf32-sh.c (sh_elf_get_relocated_section_contents),
	* elfxx-mips.c (_bfd_elf_mips_get_relocated_section_contents):
	Handle NULL data buffer.
	* bfd.c (bfd_get_section_alloc_size): New function.
	* bfd-in2.h: Regenerate.
	* compress.c (bfd_get_full_section_contents): Correct section
	malloc size.
	* linker.c (default_indirect_link_order): Don't malloc memory
	here before calling bfd_get_relocated_section_contents.
	* simple.c (bfd_simple_get_relocated_section_contents): Likewise.
2022-12-17 18:44:42 +10:30
Alan Modra
6f00d50e2b asan: elf.c:12621:18: applying zero offset to null pointer
That's this line in elf_parse_notes:
  while (p < buf + size)

	* elf.c (_bfd_elf_make_section_from_shdr): Don't call
	elf_parse_notes when sh_size is zero.
2022-12-17 18:44:42 +10:30