Compare commits

...

238 Commits

Author SHA1 Message Date
GDB Administrator
fc94da0a25 Automatic date update in version.in 2019-12-11 00:01:00 +00:00
GDB Administrator
7ed1883ad1 Automatic date update in version.in 2019-12-10 00:00:59 +00:00
GDB Administrator
a8007c9971 Automatic date update in version.in 2019-12-09 00:01:14 +00:00
GDB Administrator
ef5d69a210 Automatic date update in version.in 2019-12-08 00:01:35 +00:00
GDB Administrator
4355c53218 Automatic date update in version.in 2019-12-07 00:01:03 +00:00
GDB Administrator
60f286edec Automatic date update in version.in 2019-12-06 00:01:56 +00:00
GDB Administrator
120fb67c88 Automatic date update in version.in 2019-12-05 00:01:22 +00:00
GDB Administrator
b71095d8f1 Automatic date update in version.in 2019-12-04 00:02:02 +00:00
GDB Administrator
50df9c6a11 Automatic date update in version.in 2019-12-03 00:01:19 +00:00
GDB Administrator
1bf239b0ea Automatic date update in version.in 2019-12-02 00:01:04 +00:00
GDB Administrator
c51067afea Automatic date update in version.in 2019-12-01 00:01:32 +00:00
GDB Administrator
08646845b0 Automatic date update in version.in 2019-11-30 00:00:54 +00:00
GDB Administrator
d5675a1e2e Automatic date update in version.in 2019-11-29 00:01:02 +00:00
GDB Administrator
ba4c45bf7a Automatic date update in version.in 2019-11-28 00:01:02 +00:00
GDB Administrator
4ae40bc0ea Automatic date update in version.in 2019-11-27 00:01:06 +00:00
GDB Administrator
ea8474c0f1 Automatic date update in version.in 2019-11-26 00:00:52 +00:00
GDB Administrator
21db675ab3 Automatic date update in version.in 2019-11-25 00:00:58 +00:00
GDB Administrator
287e441e15 Automatic date update in version.in 2019-11-24 00:01:32 +00:00
GDB Administrator
fabd5fb821 Automatic date update in version.in 2019-11-23 00:01:01 +00:00
GDB Administrator
66d93c7eb4 Automatic date update in version.in 2019-11-22 00:00:56 +00:00
GDB Administrator
417515b3e2 Automatic date update in version.in 2019-11-21 00:01:05 +00:00
GDB Administrator
0f8fe15459 Automatic date update in version.in 2019-11-20 00:01:16 +00:00
GDB Administrator
cd4a5d10e5 Automatic date update in version.in 2019-11-19 00:01:05 +00:00
GDB Administrator
abd3bb94ca Automatic date update in version.in 2019-11-18 00:00:58 +00:00
GDB Administrator
5f2dea656e Automatic date update in version.in 2019-11-17 00:01:40 +00:00
GDB Administrator
9a05bbad97 Automatic date update in version.in 2019-11-16 00:00:50 +00:00
GDB Administrator
b13401dd40 Automatic date update in version.in 2019-11-15 00:01:05 +00:00
GDB Administrator
e8da8ef63a Automatic date update in version.in 2019-11-14 00:00:51 +00:00
GDB Administrator
8c1e8c0360 Automatic date update in version.in 2019-11-13 00:00:59 +00:00
GDB Administrator
47f733a9f1 Automatic date update in version.in 2019-11-12 00:01:57 +00:00
GDB Administrator
2df1e3dfcb Automatic date update in version.in 2019-11-11 00:01:04 +00:00
GDB Administrator
a8efdc2ec5 Automatic date update in version.in 2019-11-10 00:01:52 +00:00
GDB Administrator
4613ca49bb Automatic date update in version.in 2019-11-09 00:01:10 +00:00
GDB Administrator
93301a10ac Automatic date update in version.in 2019-11-08 00:00:50 +00:00
GDB Administrator
1065c4de32 Automatic date update in version.in 2019-11-07 00:01:48 +00:00
GDB Administrator
81f1230246 Automatic date update in version.in 2019-11-06 00:01:09 +00:00
GDB Administrator
5e925a6e87 Automatic date update in version.in 2019-11-05 00:00:51 +00:00
GDB Administrator
87c1fa14eb Automatic date update in version.in 2019-11-04 00:00:55 +00:00
GDB Administrator
aa4104e0f9 Automatic date update in version.in 2019-11-03 00:01:41 +00:00
GDB Administrator
d5fce78761 Automatic date update in version.in 2019-11-02 00:00:53 +00:00
GDB Administrator
3804ff71bf Automatic date update in version.in 2019-11-01 00:00:59 +00:00
GDB Administrator
c498123357 Automatic date update in version.in 2019-10-31 00:01:13 +00:00
GDB Administrator
efbb46389a Automatic date update in version.in 2019-10-30 00:01:50 +00:00
GDB Administrator
db5835f96a Automatic date update in version.in 2019-10-29 00:02:00 +00:00
GDB Administrator
e80cb798bf Automatic date update in version.in 2019-10-28 00:01:41 +00:00
GDB Administrator
808c27fc49 Automatic date update in version.in 2019-10-27 00:02:36 +00:00
GDB Administrator
46164ec4aa Automatic date update in version.in 2019-10-26 00:01:37 +00:00
GDB Administrator
f3201992c7 Automatic date update in version.in 2019-10-25 00:02:06 +00:00
GDB Administrator
9252327808 Automatic date update in version.in 2019-10-24 00:00:52 +00:00
GDB Administrator
8dce53b05a Automatic date update in version.in 2019-10-23 00:00:56 +00:00
GDB Administrator
c53982ffc3 Automatic date update in version.in 2019-10-22 00:00:49 +00:00
GDB Administrator
2f6b39484c Automatic date update in version.in 2019-10-21 00:01:47 +00:00
GDB Administrator
c9acff8e6a Automatic date update in version.in 2019-10-20 00:02:48 +00:00
GDB Administrator
dd2d98d402 Automatic date update in version.in 2019-10-19 00:01:10 +00:00
GDB Administrator
19aa468087 Automatic date update in version.in 2019-10-18 00:01:03 +00:00
GDB Administrator
5f1e599af4 Automatic date update in version.in 2019-10-17 00:01:04 +00:00
GDB Administrator
43f1141d7f Automatic date update in version.in 2019-10-16 00:00:50 +00:00
GDB Administrator
160ba0b62f Automatic date update in version.in 2019-10-15 00:00:59 +00:00
GDB Administrator
f8e64107b2 Automatic date update in version.in 2019-10-14 00:01:13 +00:00
GDB Administrator
d2a47c3722 Automatic date update in version.in 2019-10-13 00:01:52 +00:00
GDB Administrator
687f95c492 Automatic date update in version.in 2019-10-12 00:01:03 +00:00
GDB Administrator
00dbea84e7 Automatic date update in version.in 2019-10-11 00:01:03 +00:00
GDB Administrator
a72c2b5a77 Automatic date update in version.in 2019-10-10 00:00:55 +00:00
GDB Administrator
46b1a2c87e Automatic date update in version.in 2019-10-09 00:00:59 +00:00
GDB Administrator
6ca99b9a11 Automatic date update in version.in 2019-10-08 00:01:50 +00:00
GDB Administrator
03bfe7cbe6 Automatic date update in version.in 2019-10-07 00:01:03 +00:00
GDB Administrator
2e24524f3f Automatic date update in version.in 2019-10-06 00:02:19 +00:00
GDB Administrator
83b3d37add Automatic date update in version.in 2019-10-05 00:00:54 +00:00
GDB Administrator
76dcaab2c0 Automatic date update in version.in 2019-10-04 00:01:03 +00:00
GDB Administrator
5c2921e7c9 Automatic date update in version.in 2019-10-03 00:01:05 +00:00
GDB Administrator
b24d807109 Automatic date update in version.in 2019-10-02 00:00:55 +00:00
GDB Administrator
9b9fcba315 Automatic date update in version.in 2019-10-01 00:01:10 +00:00
GDB Administrator
8bba2633e7 Automatic date update in version.in 2019-09-30 00:01:30 +00:00
GDB Administrator
be60a736df Automatic date update in version.in 2019-09-29 00:02:06 +00:00
GDB Administrator
bc2badcf28 Automatic date update in version.in 2019-09-28 00:00:59 +00:00
GDB Administrator
785cd98034 Automatic date update in version.in 2019-09-27 00:01:05 +00:00
GDB Administrator
e76145a7a0 Automatic date update in version.in 2019-09-26 00:01:13 +00:00
GDB Administrator
2622da262d Automatic date update in version.in 2019-09-25 00:01:29 +00:00
GDB Administrator
ae97057ac4 Automatic date update in version.in 2019-09-24 00:01:33 +00:00
GDB Administrator
6a44d8263d Automatic date update in version.in 2019-09-23 00:01:11 +00:00
GDB Administrator
55b7767a55 Automatic date update in version.in 2019-09-22 00:01:38 +00:00
GDB Administrator
438a11c8e2 Automatic date update in version.in 2019-09-21 00:01:10 +00:00
Joel Brobecker
4e7bcf12c8 Bump GDB version number to 8.3.1.DATE-git.
gdb/ChangeLog:

	* version.in: Set GDB version number to 8.3.1.DATE-git.
2019-09-20 15:25:09 -07:00
Joel Brobecker
0d30a7ee87 Document the GDB 8.3.1 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 8.3.1 released.
2019-09-20 15:20:28 -07:00
Joel Brobecker
ff51bf260c Set GDB version number to 8.3.1.
gdb/ChangeLog:

	* version.in: Set GDB version number to 8.3.1.
2019-09-20 15:04:42 -07:00
GDB Administrator
dee1672e4f Automatic date update in version.in 2019-09-20 00:01:01 +00:00
Tom Tromey
60cdff2f22 Add Rust support to source highlighting
[ Backport of master commit d806ea2d0e. ]

Currently, no release of GNU Source Highlight supports Rust.  However,
I've checked in a patch to do so there, and I plan to make a new
release sometime this summer.

This patch prepares gdb for that by adding support for Rust to the
source highlighting code.

Because Source Highlight will throw an exception if the language is
unrecognized, this also changes gdb to ignore exceptions here.  This
will cause gdb to fall back to un-highlighted source text.

This updates gdb's configure script to reject the combination of
Source Highlight and -static-libstdc++.  This is done because it's not
possible to use -static-libstdc++ and then catch exceptions from a
shared library.

Tested with the current and development versions of Source Highlight.

gdb/ChangeLog
2019-08-19  Tom Tromey  <tom@tromey.com>

	PR gdb/25009
	* configure: Rebuild.
	* configure.ac: Disallow the combination of -static-libstdc++ and
	source highlight.
	* source-cache.c (get_language_name): Handle rust.
	(source_cache::get_source_lines): Ignore highlighting exceptions.
2019-09-19 16:18:33 +02:00
Tom Tromey
ef93dd73bc Add --with-static-standard-libraries to the top level
[ Backport of master commit c1a5d03a89. ]

gdb should normally not be linked with -static-libstdc++.  Currently
this has not caused problems, but it's incompatible with catching an
exception thrown from a shared library -- and a subsequent patch
changes gdb to do just this.

This patch adds a new --with-static-standard-libraries flag to the
top-level configure.  It defaults to "auto", which means enabled if
gcc is being built, and disabled otherwise.

ChangeLog
2019-08-19  Tom Tromey  <tom@tromey.com>

	PR gdb/25009
	* configure: Rebuild.
	* configure.ac: Add --with-static-standard-libraries.
2019-09-19 16:18:33 +02:00
GDB Administrator
fe3e346568 Automatic date update in version.in 2019-09-19 00:01:13 +00:00
Tom de Vries
59047affb0 Update ChangeLog entry of commit 98c90f8028 and mention PR c++/20020 2019-09-18 22:53:21 +02:00
Tom de Vries
3d80b2e754 Update ChangeLog entry of commit 3b752ac2e6 and mention PR testsuite/25016 2019-09-18 22:48:57 +02:00
Tom de Vries
88f07f28d5 Update ChangeLog entry of commit 7e38ddcb2e and mention PR breakpoints/25011 2019-09-18 22:39:39 +02:00
Tom de Vries
5ca0b868fa Update ChangeLog entry of commit 8ac39635f6 and mention PR gdb/25010 2019-09-18 16:20:25 +02:00
GDB Administrator
2b0b07b8b6 Automatic date update in version.in 2019-09-18 00:01:02 +00:00
Tom de Vries
fafa92ec3c [gdb/testsuite] Fix regexp in skip_opencl_tests
[ Backport of master commit d2b584a55b. ]

When running gdb-caching-proc.exp, if skip_opencl_tests fails like this:
...
(gdb) run
Starting program: \
  build/gdb/testsuite/outputs/gdb.base/gdb-caching-proc/opencltest13530.x
CHK_ERR (clGetPlatformIDs (1, &platform, NULL), -1001)
src/gdb/testsuite/lib/opencl_hostapp.c:73 error: Unknown
[Inferior 1 (process 13600) exited with code 01]
(gdb)
skip_opencl_tests: OpenCL support not detected
...
then this regexp in skip_opencl_tests fails to match:
...
        -re ".*$inferior_exited_re code.*${gdb_prompt} $" {
...
so instead we hit the default clause after a 30 seconds timeout.  With the
iteration count set at 10, we end up taking 6 minutes to run this test-case.

Fix this by adding the missing "with" in the regexp, bring back the runtime to
half a minute.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-04-29  Tom de Vries  <tdevries@suse.de>

	PR testsuite/25005
	* lib/opencl.exp (skip_opencl_tests): Add missing "with" in regexp.
2019-09-17 13:57:09 +02:00
Sergio Durigan Junior
6f4f8f476a Update ChangeLog entry of commit e9224f6d80 and mention PR breakpoints/24541 2019-09-17 00:01:13 -04:00
GDB Administrator
74da864345 Automatic date update in version.in 2019-09-17 00:01:50 +00:00
GDB Administrator
1d5f98eac3 Automatic date update in version.in 2019-09-16 00:01:18 +00:00
GDB Administrator
c44adce9d5 Automatic date update in version.in 2019-09-15 00:01:39 +00:00
GDB Administrator
38abece621 Automatic date update in version.in 2019-09-14 00:01:04 +00:00
GDB Administrator
e0ef9fdab2 Automatic date update in version.in 2019-09-13 00:00:54 +00:00
GDB Administrator
2d21c7260d Automatic date update in version.in 2019-09-12 00:01:03 +00:00
Sergio Durigan Junior
3b0e664e2f Adjust i386 registers on SystemTap probes' arguments (PR breakpoints/24541)
[ Backport of master commit 7d7571f0c1. ]

This bug has been reported on PR breakpoints/24541, but it is possible
to reproduce it easily by running:

  make check-gdb TESTS=gdb.base/stap-probe.exp RUNTESTFLAGS='--target_board unix/-m32'

The underlying cause is kind of complex, and involves decisions made
by GCC and the sys/sdt.h header file about how to represent a probe
argument that lives in a register in 32-bit programs.  I'll use
Andrew's example on the bug to illustrate the problem.

libstdc++ has a probe named "throw" with two arguments.  On i386, the
probe is:

  stapsdt              0x00000028       NT_STAPSDT (SystemTap probe descriptors)
    Provider: libstdcxx
    Name: throw
    Location: 0x00072c96, Base: 0x00133d64, Semaphore: 0x00000000
    Arguments: 4@%si 4@%di

I.e., the first argument is an unsigned 32-bit value (represented by
the "4@") that lives on %si, and the second argument is an unsigned
32-bit value that lives on %di.  Note the discrepancy between the
argument size reported by the probe (32-bit) and the register size
being used to store the value (16-bit).

However, if you take a look at the disassemble of a program that uses
this probe, you will see:

    00072c80 <__cxa_throw@@CXXABI_1.3>:
       72c80:       57                      push   %edi
       72c81:       56                      push   %esi
       72c82:       53                      push   %ebx
       72c83:       8b 74 24 10             mov    0x10(%esp),%esi
       72c87:       e8 74 bf ff ff          call   6ec00 <__cxa_finalize@plt+0x980>
       72c8c:       81 c3 74 e3 10 00       add    $0x10e374,%ebx
       72c92:       8b 7c 24 14             mov    0x14(%esp),%edi
       72c96:       90                      nop                      <----------------- PROBE IS HERE
       72c97:       e8 d4 a2 ff ff          call   6cf70 <__cxa_get_globals@plt>
       72c9c:       83 40 04 01             addl   $0x1,0x4(%eax)
       72ca0:       83 ec 04                sub    $0x4,%esp
       72ca3:       ff 74 24 1c             pushl  0x1c(%esp)
       72ca7:       57                      push   %edi
       72ca8:       56                      push   %esi
       72ca9:       e8 62 a3 ff ff          call   6d010 <__cxa_init_primary_exception@plt>
       72cae:       8d 70 40                lea    0x40(%eax),%esi
       72cb1:       c7 00 01 00 00 00       movl   $0x1,(%eax)
       72cb7:       89 34 24                mov    %esi,(%esp)
       72cba:       e8 61 96 ff ff          call   6c320 <_Unwind_RaiseException@plt>
       72cbf:       89 34 24                mov    %esi,(%esp)
       72cc2:       e8 c9 84 ff ff          call   6b190 <__cxa_begin_catch@plt>
       72cc7:       e8 d4 b3 ff ff          call   6e0a0 <_ZSt9terminatev@plt>
       72ccc:       66 90                   xchg   %ax,%ax
       72cce:       66 90                   xchg   %ax,%ax

Note how the program is actually using %edi, and not %di, to store the
second argument.  This is the problem here.

GDB will basically read the probe argument, then read the contents of
%di, and then cast this value to uint32_t, which causes the wrong
value to be obtained.  In the gdb.base/stap-probe.exp case, this makes
GDB read the wrong memory location, and not be able to display a test
string.  In Andrew's example, this causes GDB to actually stop at a
"catch throw" when it should actually have *not* stopped.

After some discussion with Frank Eigler and Jakub Jelinek, it was
decided that this bug should be fixed on the client side (i.e., the
program that actually reads the probes), and this is why I'm proposing
this patch.

The idea is simple: we will have a gdbarch method, which, for now, is
only used by i386.  The generic code that deals with register operands
on gdb/stap-probe.c will call this method if it exists, passing the
current parse information, the register name and its number.

The i386 method will then verify if the register size is greater or
equal than the size reported by the stap probe (the "4@" part).  If it
is, we're fine.  Otherwise, it will check if we're dealing with any of
the "extendable" registers (like ax, bx, si, di, sp, etc.).  If we
are, it will change the register name to include the "e" prefix.

I have tested the patch here in many scenarios, and it fixes Andrew's
bug and also the regressions I mentioned before, on
gdb.base/stap-probe.exp.  No regressions where found on other tests.

Comments?

gdb/ChangeLog:
2019-06-27  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR breakpoints/24541
	* gdbarch.c: Regenerate.
	* gdbarch.h: Regenerate.
	* gdbarch.sh: Add 'stap_adjust_register'.
	* i386-tdep.c: Include '<unordered_set>'.
	(i386_stap_adjust_register): New function.
	(i386_elf_init_abi): Register 'i386_stap_adjust_register'.
	* stap-probe.c (stap_parse_register_operand): Call
	'gdbarch_stap_adjust_register'.
2019-09-11 22:03:40 +02:00
Sergio Durigan Junior
e9224f6d80 Make stap-probe.c:stap_parse_register_operand's "regname" an std::string
[ Backport of master commit 677052f2a5. ]

This patch simplifies the code of
stap-probe.c:stap_parse_register_operand by making "regname" an
std::string.  No functionality change.

I'm this code's maintainer, so I'm pushing this as it's a fairly
trivial patch.

gdb/ChangeLog:
2019-05-16  Sergio Durigan Junior  <sergiodj@redhat.com>

	* stap-probe.c (stap_parse_register_operand): Make "regname" an
	"std::string", simplifying the algorithm.
2019-09-11 22:03:40 +02:00
GDB Administrator
d98f1d629b Automatic date update in version.in 2019-09-11 00:00:44 +00:00
GDB Administrator
037b23d08d Automatic date update in version.in 2019-09-10 00:00:59 +00:00
GDB Administrator
ee3857f2e7 Automatic date update in version.in 2019-09-09 00:01:36 +00:00
GDB Administrator
450c4b5c2a Automatic date update in version.in 2019-09-08 00:01:49 +00:00
GDB Administrator
db4a63fe54 Automatic date update in version.in 2019-09-07 00:00:59 +00:00
GDB Administrator
e9ddef0e66 Automatic date update in version.in 2019-09-06 00:01:07 +00:00
GDB Administrator
30f2a435e5 Automatic date update in version.in 2019-09-05 00:01:35 +00:00
GDB Administrator
af6b62c780 Automatic date update in version.in 2019-09-04 00:01:39 +00:00
GDB Administrator
ed14c4a538 Automatic date update in version.in 2019-09-03 00:01:05 +00:00
GDB Administrator
33ffb2c1b5 Automatic date update in version.in 2019-09-02 00:01:01 +00:00
GDB Administrator
0a4c3bdb1a Automatic date update in version.in 2019-09-01 00:01:33 +00:00
GDB Administrator
790ea6e3b3 Automatic date update in version.in 2019-08-31 00:01:45 +00:00
GDB Administrator
188e561c21 Automatic date update in version.in 2019-08-30 00:01:10 +00:00
GDB Administrator
061ca9bbc1 Automatic date update in version.in 2019-08-29 00:00:59 +00:00
GDB Administrator
607a69b8b0 Automatic date update in version.in 2019-08-28 00:01:25 +00:00
GDB Administrator
4ee05fb967 Automatic date update in version.in 2019-08-27 00:01:31 +00:00
GDB Administrator
69e0be31ee Automatic date update in version.in 2019-08-26 00:01:39 +00:00
GDB Administrator
3b5beecae9 Automatic date update in version.in 2019-08-25 00:02:21 +00:00
GDB Administrator
11e76e8d01 Automatic date update in version.in 2019-08-24 00:01:41 +00:00
GDB Administrator
727aef8153 Automatic date update in version.in 2019-08-23 00:01:48 +00:00
GDB Administrator
cf1bc0cd80 Automatic date update in version.in 2019-08-22 00:01:18 +00:00
GDB Administrator
e967953e28 Automatic date update in version.in 2019-08-21 00:00:52 +00:00
GDB Administrator
908db690e8 Automatic date update in version.in 2019-08-20 00:01:01 +00:00
GDB Administrator
e13a1a16d5 Automatic date update in version.in 2019-08-19 00:01:58 +00:00
GDB Administrator
f36c866169 Automatic date update in version.in 2019-08-18 00:02:23 +00:00
GDB Administrator
e853d5bce5 Automatic date update in version.in 2019-08-17 00:01:01 +00:00
GDB Administrator
55f04e741e Automatic date update in version.in 2019-08-16 00:00:56 +00:00
Tom de Vries
ee479c89ed [gdb] Handle vfork in thread with follow-fork-mode child
[ Backport of master commit b73715df01. ]

When debugging any of the testcases added by this commit, which do a
vfork in a thread with "set follow-fork-mode child" + "set
detach-on-fork on", we run into this assertion:

...
src/gdb/nat/x86-linux-dregs.c:146: internal-error: \
  void x86_linux_update_debug_registers(lwp_info*): \
  Assertion `lwp_is_stopped (lwp)' failed.
...

The assert is caused by the following: the vfork-child exit or exec
event is handled by handle_vfork_child_exec_or_exit, which calls
target_detach to detach from the vfork parent.  During target_detach
we call linux_nat_target::detach, which:

However, during the second step we run into this code in
stop_wait_callback:

...
  /* If this is a vfork parent, bail out, it is not going to report
     any SIGSTOP until the vfork is done with.  */
  if (inf->vfork_child != NULL)
    return 0;
...

and we don't wait for the threads to be stopped, which results in this
assert in x86_linux_update_debug_registers triggering during the third
step:

...
  gdb_assert (lwp_is_stopped (lwp));
...

The fix is to reset the vfork parent's vfork_child field before
calling target_detach in handle_vfork_child_exec_or_exit.  There's
already similar code for the other paths handled by
handle_vfork_child_exec_or_exit, so this commit refactors the code a
bit so that all paths share the same code.

The new tests cover both a vfork child exiting, and a vfork child
execing, since both cases would trigger the assertion.

The new testcases also exercise following the vfork children with "set
detach-on-fork off", since it doesn't seem to be tested anywhere.

Tested on x86_64-linux, using native and native-gdbserver.

gdb/ChangeLog:
2019-04-18  Tom de Vries  <tdevries@suse.de>
	    Pedro Alves  <palves@redhat.com>

	PR gdb/24454
	* infrun.c (handle_vfork_child_exec_or_exit): Reset vfork parent's
	vfork_child field before calling target_detach.

gdb/testsuite/ChangeLog:
2019-04-18  Tom de Vries  <tdevries@suse.de>
	    Pedro Alves  <palves@redhat.com>

	PR gdb/24454
	* gdb.threads/vfork-follow-child-exec.c: New file.
	* gdb.threads/vfork-follow-child-exec.exp: New file.
	* gdb.threads/vfork-follow-child-exit.c: New file.
	* gdb.threads/vfork-follow-child-exit.exp: New file.
2019-08-16 00:31:48 +02:00
GDB Administrator
cfa3fa0f41 Automatic date update in version.in 2019-08-15 00:01:13 +00:00
GDB Administrator
5302b8b344 Automatic date update in version.in 2019-08-14 00:01:04 +00:00
GDB Administrator
0a04b387e6 Automatic date update in version.in 2019-08-13 00:01:06 +00:00
GDB Administrator
8d597d0217 Automatic date update in version.in 2019-08-12 00:00:59 +00:00
GDB Administrator
15a7492a25 Automatic date update in version.in 2019-08-11 00:01:39 +00:00
GDB Administrator
5a627de47b Automatic date update in version.in 2019-08-10 00:00:58 +00:00
GDB Administrator
e80cd22e7e Automatic date update in version.in 2019-08-09 00:00:56 +00:00
GDB Administrator
d8a5975817 Automatic date update in version.in 2019-08-08 00:01:41 +00:00
Alan Hayward
8ac39635f6 Suppress SIGTTOU when handling errors
[ Backport of commit 766f883622. ]

Calls to error () can cause SIGTTOU to send gdb to the background.

For example, on an Arm build:
  (gdb) b main
  Breakpoint 1 at 0x10774: file /build/gdb/testsuite/../../../src/binutils-gdb/gdb/testsuite/gdb.base/watchpoint.c, line 174.
  (gdb) r
  Starting program: /build/gdb/testsuite/outputs/gdb.base/watchpoint/watchpoint

  [1]+  Stopped                 ../gdb ./outputs/gdb.base/watchpoint/watchpoint
  localhost$ fg
  ../gdb ./outputs/gdb.base/watchpoint/watchpoint
  Cannot parse expression `.L1199 4@r4'.
  warning: Probes-based dynamic linker interface failed.
  Reverting to original interface.

The SIGTTOU is raised whilst inside a syscall during the call to tcdrain.
Fix is to use scoped_ignore_sigttou to ensure SIGTTOU is blocked.

In addition fix include comments - job_control is not included via terminal.h

gdb/ChangeLog:

	* event-top.c: Remove include comment.
	* inflow.c (class scoped_ignore_sigttou): Move from here...
	* inflow.h (class scoped_ignore_sigttou): ...to here.
	* ser-unix.c (hardwire_drain_output): Block SIGTTOU during drain.
	* top.c:  Remove include comment.
2019-08-07 18:23:49 +02:00
Alan Hayward
7e38ddcb2e Fix breakpoints on file reloads for PIE binaries
[ Backport of master commit ea142fbfc9. ]

When a binary is built using PIE, reloading the file will cause GDB to error
on restart.  For example:
gdb ./a.out
(gdb) break main
(gdb) run
(gdb) file ./a.out
(gdb) continue

Will cause GDB to error with:
Continuing.
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x9e0
Command aborted.

This is due to the symbol offsets not being relocated after reloading the file.

Fix is to ensure solib_create_inferior_hook is called, in the same manner as
infrun.c:follow_exec().

Expand the idempotent test to cover PIE scenarios.

gdb/ChangeLog:

	* symfile.c (symbol_file_command): Call solib_create_inferior_hook.

gdb/testsuite/ChangeLog:

	* gdb.base/break-idempotent.exp: Test both PIE and non PIE.
2019-08-07 18:23:49 +02:00
Alan Hayward
3b752ac2e6 Testsuite: Ensure pie is disabled on some tests
[ Backport of master commit 968aa7ae38. ]

Recent versions of Ubuntu and Debian default GCC to enable pie.

In dump.exp, pie will causes addresses to be out of range for IHEX.

In break-interp.exp, pie is explicitly set for some tests and assumed
to be disabled for the remainder.

Ensure pie is disabled for these tests when required.

In addition, add a pie option to gdb_compile to match the nopie option
and simplify use.

gdb/testsuite/ChangeLog:

	* README: Add pie options.
	* gdb.base/break-interp.exp: Ensure pie is disabled.
	* gdb.base/dump.exp: Likewise.
	* lib/gdb.exp (gdb_compile): Add pie option.
2019-08-07 18:23:49 +02:00
GDB Administrator
dc5626e838 Automatic date update in version.in 2019-08-07 00:02:26 +00:00
GDB Administrator
40bfdfcd1a Automatic date update in version.in 2019-08-06 00:01:00 +00:00
GDB Administrator
b05a7d75b2 Automatic date update in version.in 2019-08-05 00:00:56 +00:00
GDB Administrator
4de38a3a76 Automatic date update in version.in 2019-08-04 00:01:40 +00:00
Tom Tromey
15522b80c9 Fix buglet in cp_print_value_fields patch
[ Backport of master commit 3d507ff23b. ]

Pedro pointed out an issue in the cp_print_value_fields
patch, aka the fix for PR c++/20020.

This patch addresses the issue.  Tested on x86-64 Fedora 29.

gdb/testsuite/ChangeLog
2019-06-27  Tom Tromey  <tromey@adacore.com>

	* gdb.cp/constexpr-field.exp: Use setup_xfail.
2019-08-03 09:42:28 +02:00
Tom Tromey
98c90f8028 Fix crash in cp_print_value_fields
[ Backport of master commit 4330d61dfb. ]

PR c++/20020 concerns a crash in cp_print_value_fields.  The immediate
cause is that cp_print_value_fields does not handle the case where
value_static_field fails.  This is fixed in this patch by calling
cp_print_static_field from the "try" block.

Digging a bit deeper, the error occurs because GCC does not emit a
DW_AT_const_value for a static constexpr member appearing in a
template class.  I've filed a GCC bug for this.

Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	PR c++/20020:
	* cp-valprint.c (cp_print_value_fields): Call
	cp_print_static_field inside "try".

gdb/testsuite/ChangeLog
2019-05-29  Tom Tromey  <tromey@adacore.com>

	PR c++/20020:
	* gdb.cp/constexpr-field.exp: New file.
	* gdb.cp/constexpr-field.cc: New file.
2019-08-03 09:42:28 +02:00
GDB Administrator
0bcd30db25 Automatic date update in version.in 2019-08-03 00:00:52 +00:00
GDB Administrator
e758a22f82 Automatic date update in version.in 2019-08-02 00:01:43 +00:00
GDB Administrator
121fe927df Automatic date update in version.in 2019-08-01 00:00:56 +00:00
GDB Administrator
05e432469a Automatic date update in version.in 2019-07-31 00:01:59 +00:00
GDB Administrator
708c7c8ea3 Automatic date update in version.in 2019-07-30 00:01:00 +00:00
GDB Administrator
9c3b4a444a Automatic date update in version.in 2019-07-29 00:00:56 +00:00
GDB Administrator
b93a00ca4d Automatic date update in version.in 2019-07-28 00:02:26 +00:00
GDB Administrator
746dfd243d Automatic date update in version.in 2019-07-27 00:00:58 +00:00
GDB Administrator
8b6767f3b7 Automatic date update in version.in 2019-07-26 00:01:06 +00:00
GDB Administrator
a5eb8e13d5 Automatic date update in version.in 2019-07-25 00:01:06 +00:00
GDB Administrator
0281a23925 Automatic date update in version.in 2019-07-24 00:00:57 +00:00
GDB Administrator
2eb697ef70 Automatic date update in version.in 2019-07-23 00:02:10 +00:00
GDB Administrator
b741158440 Automatic date update in version.in 2019-07-22 00:00:59 +00:00
Tom de Vries
4de026046b [gdb/symtab] Fix symbol loading performance regression
[ Backport of master commit e99f9db0f5. ]

The commit "[gdb/symtab] Fix language of duplicate static minimal symbol"
introduces a performance regression, when loading a cc1 executable build with
-O0 -g and gcc 7.4.0.  The performance regression, measured in 'real' time is
about 175%.

The slower execution comes from the fact that the fix in symbol_set_names
makes the call to symbol_find_demangled_name unconditional.

Fix this by reverting the commit, and redoing the fix as follows.

Recapturing the original problem, the first time symbol_set_names is called
with gsymbol.language == lang_auto and linkage_name == "_ZL3foov", the name is
not present in the per_bfd->demangled_names_hash hash table, so
symbol_find_demangled_name is called to demangle the name, after which the
mangled/demangled pair is added to the hashtable.  The call to
symbol_find_demangled_name also sets gsymbol.language to lang_cplus.
The second time symbol_set_names is called with gsymbol.language == lang_auto
and linkage_name == "_ZL3foov", the name is present in the hash table, so the
demangled name from the hash table is used.  However, the language of the
symbol remains lang_auto.

Fix this by adding a field language in struct demangled_name_entry, and using
the field in symbol_set_names to set the language of gsymbol, if necessary.

Tested on x86_64-linux.

gdb/ChangeLog:

2019-06-10  Tom de Vries  <tdevries@suse.de>

	PR symtab/24545
	* symtab.c (struct demangled_name_entry): Add language field.
	(symbol_set_names):  Revert "[gdb/symtab] Fix language of duplicate
	static minimal symbol".  Set and use language field.
2019-07-21 20:01:35 +02:00
GDB Administrator
8a0bb7c9cf Automatic date update in version.in 2019-07-21 00:01:39 +00:00
GDB Administrator
1e2ec04bbb Automatic date update in version.in 2019-07-20 00:01:00 +00:00
GDB Administrator
c11739d63e Automatic date update in version.in 2019-07-19 00:01:02 +00:00
GDB Administrator
1185603e67 Automatic date update in version.in 2019-07-18 00:01:03 +00:00
GDB Administrator
2879fa960d Automatic date update in version.in 2019-07-17 00:00:56 +00:00
GDB Administrator
6adb346028 Automatic date update in version.in 2019-07-16 00:01:12 +00:00
GDB Administrator
94648c5870 Automatic date update in version.in 2019-07-15 00:01:06 +00:00
GDB Administrator
bf5178fce9 Automatic date update in version.in 2019-07-14 00:01:40 +00:00
GDB Administrator
935e9d9f20 Automatic date update in version.in 2019-07-13 00:00:58 +00:00
Kevin Buettner
1e31ba6536 Fix regression caused by recently added syscall restart code
[ Backport of master commit e90a813d96. ]

This line of code...

       *(int64_t *) ptr = *(int32_t *) ptr;

...in linux-x86-low.c is not needed (and does not work correctly)
within a 32-bit executable.  I added an __x86_64__ ifdef (which is
used extensively elsewhere in the file for like purposes) to prevent
this code from being included in 32-bit builds.

It fixes the following regressions when running on native
i686-pc-linux-gnu:

FAIL: gdb.server/abspath.exp: continue to main
FAIL: gdb.server/connect-without-multi-process.exp: multiprocess=auto: continue to main
FAIL: gdb.server/connect-without-multi-process.exp: multiprocess=off: continue to main
FAIL: gdb.server/ext-restart.exp: restart: run to main
FAIL: gdb.server/ext-restart.exp: run to main
FAIL: gdb.server/ext-run.exp: continue to main
FAIL: gdb.server/ext-wrapper.exp: print d
FAIL: gdb.server/ext-wrapper.exp: restart: print d
FAIL: gdb.server/ext-wrapper.exp: restart: run to marker
FAIL: gdb.server/ext-wrapper.exp: run to marker
FAIL: gdb.server/no-thread-db.exp: continue to breakpoint: after tls assignment
FAIL: gdb.server/reconnect-ctrl-c.exp: first: stop with control-c
FAIL: gdb.server/reconnect-ctrl-c.exp: second: stop with control-c
FAIL: gdb.server/run-without-local-binary.exp: run test program until the end
FAIL: gdb.server/server-kill.exp: continue to breakpoint: after server_pid assignment
FAIL: gdb.server/server-kill.exp: tstatus
FAIL: gdb.server/server-run.exp: continue to main

gdb/gdbserver/ChangeLog:

	PR gdb/24592
	* linux-x86-low.c (x86_fill_gregset): Don't compile 64-bit
	sign extension code on 32-bit builds.
2019-07-12 14:33:40 +02:00
Kevin Buettner
a252e71900 Fix amd64->i386 linux syscall restart problem
[ Backport of master commit 3f52fdbcb5. ]

This commit fixes some failures in gdb.base/interrupt.exp
when debugging a 32-bit i386 linux inferior from an amd64 host.

When running the following test...

  make check RUNTESTFLAGS="--target_board unix/-m32 interrupt.exp"

... without this commit, I see the following output:

FAIL: gdb.base/interrupt.exp: continue (the program exited)
FAIL: gdb.base/interrupt.exp: echo data
FAIL: gdb.base/interrupt.exp: Send Control-C, second time
FAIL: gdb.base/interrupt.exp: signal SIGINT (the program is no longer running)
ERROR: Undefined command "".
ERROR: GDB process no longer exists

		=== gdb Summary ===

When the test is run with this commit in place, we see 12 passes
instead.  This is the desired behavior.

Analysis:

On Linux, when a syscall is interrupted by a signal, the syscall
may return -ERESTARTSYS when a signal occurs.  Doing so indicates that
the syscall is restartable.  Then, depending on settings associated
with the signal handler, and after the signal handler is called, the
kernel can then either return -EINTR or can cause the syscall to be
restarted.  In this discussion, we are concerned with the latter
case.

On i386, the kernel returns this status via the EAX register.

When debugging a 32-bit (i386) process from a 64-bit (amd64)
GDB, the debugger fetches 64-bit registers even though the
process being debugged is 32-bit.  Since we're debugging a 32-bit
target, only 32 bits are being saved in the register cache.
Now, ideally, GDB would save all 64-bits in the regcache and
then would be able to restore those same values when it comes
time to continue the target.  I've looked into doing this, but
it's not easy and I don't see many benefits to doing so.  One
benefit, however, would be that EAX would appear as a negative
value for doing syscall restarts.

At the moment, GDB is setting the high 32 bits of RAX (and other
registers too) to 0.  So, when GDB restores EAX just prior to
a syscall restart, the high 32 bits of RAX are zeroed, thus making
it look like a positive value.  For this particular purpose, we
need to sign extend EAX so that RAX will appear as a negative
value when EAX is set to -ERESTARTSYS.  This in turn will cause
the signal handling code in the kernel to recognize -ERESTARTSYS
which will in turn cause the syscall to be restarted.

This commit is based on work by Jan Kratochvil from 2009:

https://sourceware.org/ml/gdb-patches/2009-11/msg00592.html

Jan's patch had the sign extension code in amd64-nat.c.  Several
other native targets make use of this code, so it seemed better
to move the sign extension code to a linux specific file.  I
also added similar code to gdbserver.

Another approach is to fix the problem in the kernel.  Hui Zhu
tried to get a fix into the kernel back in 2014, but it was not
accepted.  Discussion regarding this approach may be found here:

https://lore.kernel.org/patchwork/patch/457841/

Even if a fix were to be put into the kernel, we'd still need
some kind of fix in GDB in order to support older kernels.

Finally, I'll note that Fedora has been carrying a similar patch for
at least nine years.  Other distributions, including RHEL and CentOS
have picked up this change and have been using it too.

gdb/ChangeLog:

	PR gdb/24592
	* amd64-linux-nat.c (amd64_linux_collect_native_gregset): New
	function.
	(fill_gregset): Call amd64_linux_collect_native_gregset instead
	of amd64_collect_native_gregset.
	(amd64_linux_nat_target::store_registers): Likewise.

gdb/gdbserver/ChangeLog:

	PR gdb/24592
	* linux-x86-low.c (x86_fill_gregset): Sign extend EAX value
	when using a 64-bit gdbserver.
2019-07-12 14:33:40 +02:00
GDB Administrator
b09548933a Automatic date update in version.in 2019-07-12 00:01:02 +00:00
GDB Administrator
0fee5d8d9b Automatic date update in version.in 2019-07-11 00:01:07 +00:00
GDB Administrator
3caf9fe243 Automatic date update in version.in 2019-07-10 00:01:08 +00:00
GDB Administrator
e908e11a4f Automatic date update in version.in 2019-07-09 00:00:51 +00:00
GDB Administrator
6f3872e420 Automatic date update in version.in 2019-07-08 00:01:03 +00:00
GDB Administrator
aacdded679 Automatic date update in version.in 2019-07-07 00:01:41 +00:00
GDB Administrator
4762f10bd5 Automatic date update in version.in 2019-07-06 00:01:00 +00:00
GDB Administrator
9b06c95d41 Automatic date update in version.in 2019-07-05 00:01:03 +00:00
GDB Administrator
ba52e3295f Automatic date update in version.in 2019-07-04 00:00:59 +00:00
GDB Administrator
66263c8cdb Automatic date update in version.in 2019-07-03 00:01:05 +00:00
GDB Administrator
b6a8c842ba Automatic date update in version.in 2019-07-02 00:01:49 +00:00
GDB Administrator
d707f03a58 Automatic date update in version.in 2019-07-01 00:01:59 +00:00
GDB Administrator
76cb58381e Automatic date update in version.in 2019-06-30 00:01:41 +00:00
GDB Administrator
1dfeef2bc8 Automatic date update in version.in 2019-06-29 00:01:04 +00:00
GDB Administrator
70a37db2e4 Automatic date update in version.in 2019-06-28 00:01:52 +00:00
GDB Administrator
568cc1eb75 Automatic date update in version.in 2019-06-27 00:01:01 +00:00
GDB Administrator
94c98a9880 Automatic date update in version.in 2019-06-26 00:01:06 +00:00
GDB Administrator
20a60e4cae Automatic date update in version.in 2019-06-25 00:01:10 +00:00
GDB Administrator
c1ebdd5837 Automatic date update in version.in 2019-06-24 00:01:04 +00:00
GDB Administrator
402cb29da7 Automatic date update in version.in 2019-06-23 00:01:31 +00:00
GDB Administrator
0aac89d158 Automatic date update in version.in 2019-06-22 00:00:58 +00:00
GDB Administrator
bb8a6e0cac Automatic date update in version.in 2019-06-21 00:01:04 +00:00
GDB Administrator
dd687532a6 Automatic date update in version.in 2019-06-20 00:00:56 +00:00
GDB Administrator
871d2d33d9 Automatic date update in version.in 2019-06-19 00:01:22 +00:00
GDB Administrator
73c04885b4 Automatic date update in version.in 2019-06-18 00:01:12 +00:00
GDB Administrator
ddef9ecd5c Automatic date update in version.in 2019-06-17 00:01:06 +00:00
GDB Administrator
75d31484a5 Automatic date update in version.in 2019-06-16 00:01:42 +00:00
GDB Administrator
34a33f9052 Automatic date update in version.in 2019-06-15 00:01:06 +00:00
GDB Administrator
abe4c19c54 Automatic date update in version.in 2019-06-14 00:00:57 +00:00
GDB Administrator
a6f14e523b Automatic date update in version.in 2019-06-13 00:01:30 +00:00
GDB Administrator
759896c081 Automatic date update in version.in 2019-06-12 00:00:58 +00:00
GDB Administrator
aeb89fc4a2 Automatic date update in version.in 2019-06-11 00:00:52 +00:00
GDB Administrator
ad9e6d7b30 Automatic date update in version.in 2019-06-10 00:00:55 +00:00
GDB Administrator
74923ff252 Automatic date update in version.in 2019-06-09 00:01:36 +00:00
GDB Administrator
59cbd46e2a Automatic date update in version.in 2019-06-08 00:01:47 +00:00
GDB Administrator
275b4e7df5 Automatic date update in version.in 2019-06-07 00:00:54 +00:00
GDB Administrator
08d9f6eac5 Automatic date update in version.in 2019-06-06 00:00:53 +00:00
GDB Administrator
2ebf289fc9 Automatic date update in version.in 2019-06-05 00:00:56 +00:00
GDB Administrator
59ff5f11e6 Automatic date update in version.in 2019-06-04 00:00:52 +00:00
GDB Administrator
7e18a384f9 Automatic date update in version.in 2019-06-03 00:01:37 +00:00
GDB Administrator
7dc4f1d187 Automatic date update in version.in 2019-06-02 00:01:36 +00:00
GDB Administrator
a022590cba Automatic date update in version.in 2019-06-01 00:01:00 +00:00
GDB Administrator
0e59a829ca Automatic date update in version.in 2019-05-31 00:00:57 +00:00
GDB Administrator
b629b1cb7b Automatic date update in version.in 2019-05-30 00:00:56 +00:00
GDB Administrator
f3514e2bd7 Automatic date update in version.in 2019-05-29 00:01:02 +00:00
GDB Administrator
9ca7b838b9 Automatic date update in version.in 2019-05-28 00:00:52 +00:00
GDB Administrator
37844d8af3 Automatic date update in version.in 2019-05-27 00:00:52 +00:00
GDB Administrator
ca21e65906 Automatic date update in version.in 2019-05-26 00:01:29 +00:00
GDB Administrator
fc4aeb0cb0 Automatic date update in version.in 2019-05-25 00:01:01 +00:00
GDB Administrator
88f24dca5c Automatic date update in version.in 2019-05-24 00:01:00 +00:00
GDB Administrator
f77234d1ac Automatic date update in version.in 2019-05-23 00:00:49 +00:00
GDB Administrator
41ba5296f4 Automatic date update in version.in 2019-05-22 00:00:54 +00:00
GDB Administrator
f51eb14ee1 Automatic date update in version.in 2019-05-21 00:00:52 +00:00
GDB Administrator
5f022de96a Automatic date update in version.in 2019-05-20 00:01:02 +00:00
GDB Administrator
bb4eaf0525 Automatic date update in version.in 2019-05-19 00:01:37 +00:00
GDB Administrator
59c391b04d Automatic date update in version.in 2019-05-18 00:00:52 +00:00
GDB Administrator
404b4cfa15 Automatic date update in version.in 2019-05-17 00:00:54 +00:00
GDB Administrator
6e8063f794 Automatic date update in version.in 2019-05-16 00:00:47 +00:00
GDB Administrator
92d8930c87 Automatic date update in version.in 2019-05-15 00:00:53 +00:00
GDB Administrator
d2e9f688cd Automatic date update in version.in 2019-05-14 00:00:46 +00:00
GDB Administrator
fd16a08ea3 Automatic date update in version.in 2019-05-13 00:00:56 +00:00
GDB Administrator
759bd5ef05 Automatic date update in version.in 2019-05-12 00:01:39 +00:00
Joel Brobecker
9c5d0147d8 Bump GDB version number to 8.3.0.DATE-git.
gdb/ChangeLog:

	* version.in: Set GDB version number to 8.3.0.DATE-git.
2019-05-11 11:37:30 -07:00
Joel Brobecker
ce22166dc5 Document the GDB 8.3 release in gdb/ChangeLog
gdb/ChangeLog:

	GDB 8.3 released.
2019-05-11 11:28:58 -07:00
39 changed files with 925 additions and 137 deletions

View File

@@ -1,3 +1,9 @@
2019-08-19 Tom Tromey <tom@tromey.com>
PR gdb/25009
* configure: Rebuild.
* configure.ac: Add --with-static-standard-libraries.
2018-06-24 Nick Clifton <nickc@redhat.com>
2.32 branch created.

View File

@@ -16,7 +16,7 @@
In releases, the date is not included in either version strings or
sonames. */
#define BFD_VERSION_DATE 20190511
#define BFD_VERSION_DATE 20191211
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@

24
configure vendored
View File

@@ -802,6 +802,7 @@ with_gmp
with_gmp_include
with_gmp_lib
with_stage1_libs
with_static_standard_libraries
with_stage1_ldflags
with_boot_libs
with_boot_ldflags
@@ -1572,6 +1573,9 @@ Optional Packages:
--with-gmp-include=PATH specify directory for installed GMP include files
--with-gmp-lib=PATH specify directory for the installed GMP library
--with-stage1-libs=LIBS libraries for stage1
--with-static-standard-libraries
use -static-libstdc++ and -static-libgcc
(default=auto)
--with-stage1-ldflags=FLAGS
linker flags for stage1
--with-boot-libs=LIBS libraries for stage2 and later
@@ -5824,6 +5828,23 @@ fi
# Whether or not to use -static-libstdc++ and -static-libgcc. The
# default is yes if gcc is being built; no otherwise. The reason for
# this default is that gdb is sometimes linked against GNU Source
# Highlight, which is a shared library that uses C++ exceptions. In
# this case, -static-libstdc++ will cause crashes.
# Check whether --with-static-standard-libraries was given.
if test "${with_static_standard_libraries+set}" = set; then :
withval=$with_static_standard_libraries;
else
with_static_standard_libraries=auto
fi
if test "$with_static_standard_libraries" = auto; then
with_static_standard_libraries=$have_compiler
fi
# Linker flags to use for stage1 or when not bootstrapping.
# Check whether --with-stage1-ldflags was given.
@@ -5838,7 +5859,8 @@ else
# In stage 1, default to linking libstdc++ and libgcc statically with GCC
# if supported. But if the user explicitly specified the libraries to use,
# trust that they are doing what they want.
if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \
-a "$have_static_libs" = yes; then
stage1_ldflags="-static-libstdc++ -static-libgcc"
fi
fi

View File

@@ -1602,6 +1602,19 @@ AC_ARG_WITH(stage1-libs,
[stage1_libs=])
AC_SUBST(stage1_libs)
# Whether or not to use -static-libstdc++ and -static-libgcc. The
# default is yes if gcc is being built; no otherwise. The reason for
# this default is that gdb is sometimes linked against GNU Source
# Highlight, which is a shared library that uses C++ exceptions. In
# this case, -static-libstdc++ will cause crashes.
AC_ARG_WITH(static-standard-libraries,
[AS_HELP_STRING([--with-static-standard-libraries],
[use -static-libstdc++ and -static-libgcc (default=auto)])],
[], [with_static_standard_libraries=auto])
if test "$with_static_standard_libraries" = auto; then
with_static_standard_libraries=$have_compiler
fi
# Linker flags to use for stage1 or when not bootstrapping.
AC_ARG_WITH(stage1-ldflags,
[AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])],
@@ -1614,7 +1627,8 @@ AC_ARG_WITH(stage1-ldflags,
# In stage 1, default to linking libstdc++ and libgcc statically with GCC
# if supported. But if the user explicitly specified the libraries to use,
# trust that they are doing what they want.
if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then
if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \
-a "$have_static_libs" = yes; then
stage1_ldflags="-static-libstdc++ -static-libgcc"
fi])
AC_SUBST(stage1_ldflags)

View File

@@ -1,3 +1,86 @@
2019-09-20 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 8.3.1.DATE-git.
2019-09-20 Joel Brobecker <brobecker@adacore.com>
GDB 8.3.1 released.
2019-09-20 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 8.3.1.
2019-08-19 Tom Tromey <tom@tromey.com>
PR gdb/25009
* configure: Rebuild.
* configure.ac: Disallow the combination of -static-libstdc++ and
source highlight.
* source-cache.c (get_language_name): Handle rust.
(source_cache::get_source_lines): Ignore highlighting exceptions.
2019-06-28 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/24541
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh: Add 'stap_adjust_register'.
* i386-tdep.c: Include '<unordered_set>'.
(i386_stap_adjust_register): New function.
(i386_elf_init_abi): Register 'i386_stap_adjust_register'.
* stap-probe.c (stap_parse_register_operand): Call
'gdbarch_stap_adjust_register'.
2019-05-16 Sergio Durigan Junior <sergiodj@redhat.com>
PR breakpoints/24541
* stap-probe.c (stap_parse_register_operand): Make "regname" an
"std::string", simplifying the algorithm.
2019-05-28 Alan Hayward <alan.hayward@arm.com>
PR gdb/25010
* event-top.c: Remove include comment.
* inflow.c (class scoped_ignore_sigttou): Move from here...
* inflow.h (class scoped_ignore_sigttou): ...to here.
* ser-unix.c (hardwire_drain_output): Block SIGTTOU during drain.
* top.c: Remove include comment.
2019-08-04 Alan Hayward <alan.hayward@arm.com>
PR breakpoints/25011
* symfile.c (symbol_file_command): Call solib_create_inferior_hook.
2019-05-29 Tom Tromey <tromey@adacore.com>
PR c++/20020:
* cp-valprint.c (cp_print_value_fields): Call
cp_print_static_field inside "try".
2019-06-10 Tom de Vries <tdevries@suse.de>
PR symtab/24545
* symtab.c (struct demangled_name_entry): Add language field.
(symbol_set_names): Revert "[gdb/symtab] Fix language of duplicate
static minimal symbol". Set and use language field.
2019-04-10 Kevin Buettner <kevinb@redhat.com>
PR gdb/24592
* amd64-linux-nat.c (amd64_linux_collect_native_gregset): New
function.
(fill_gregset): Call amd64_linux_collect_native_gregset instead
of amd64_collect_native_gregset.
(amd64_linux_nat_target::store_registers): Likewise.
2019-05-11 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 8.3.0.DATE-git.
2019-05-11 Joel Brobecker <brobecker@adacore.com>
GDB 8.3 released.
2019-05-11 Joel Brobecker <brobecker@adacore.com>
* version.in: Set GDB version number to 8.3.

View File

@@ -92,6 +92,71 @@ static int amd64_linux_gregset32_reg_offset[] =
/* Transfering the general-purpose registers between GDB, inferiors
and core files. */
/* See amd64_collect_native_gregset. This linux specific version handles
issues with negative EAX values not being restored correctly upon syscall
return when debugging 32-bit targets. It has no effect on 64-bit
targets. */
static void
amd64_linux_collect_native_gregset (const struct regcache *regcache,
void *gregs, int regnum)
{
amd64_collect_native_gregset (regcache, gregs, regnum);
struct gdbarch *gdbarch = regcache->arch ();
if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32)
{
/* Sign extend EAX value to avoid potential syscall restart
problems.
On Linux, when a syscall is interrupted by a signal, the
(kernel function implementing the) syscall may return
-ERESTARTSYS when a signal occurs. Doing so indicates that
the syscall is restartable. Then, depending on settings
associated with the signal handler, and after the signal
handler is called, the kernel can then either return -EINTR
or it can cause the syscall to be restarted. We are
concerned with the latter case here.
On (32-bit) i386, the status (-ERESTARTSYS) is placed in the
EAX register. When debugging a 32-bit process from a 64-bit
(amd64) GDB, the debugger fetches 64-bit registers even
though the process being debugged is only 32-bit. The
register cache is only 32 bits wide though; GDB discards the
high 32 bits when placing 64-bit values in the 32-bit
regcache. Normally, this is not a problem since the 32-bit
process should only care about the lower 32-bit portions of
these registers. That said, it can happen that the 64-bit
value being restored will be different from the 64-bit value
that was originally retrieved from the kernel. The one place
(that we know of) where it does matter is in the kernel's
syscall restart code. The kernel's code for restarting a
syscall after a signal expects to see a negative value
(specifically -ERESTARTSYS) in the 64-bit RAX register in
order to correctly cause a syscall to be restarted.
The call to amd64_collect_native_gregset, above, is setting
the high 32 bits of RAX (and other registers too) to 0. For
syscall restart, we need to sign extend EAX so that RAX will
appear as a negative value when EAX is set to -ERESTARTSYS.
This in turn will cause the signal handling code in the
kernel to recognize -ERESTARTSYS which will in turn cause the
syscall to be restarted.
The test case gdb.base/interrupt.exp tests for this problem.
Without this sign extension code in place, it'll show
a number of failures when testing against unix/-m32. */
if (regnum == -1 || regnum == I386_EAX_REGNUM)
{
void *ptr = ((gdb_byte *) gregs
+ amd64_linux_gregset32_reg_offset[I386_EAX_REGNUM]);
*(int64_t *) ptr = *(int32_t *) ptr;
}
}
}
/* Fill GDB's register cache with the general-purpose register values
in *GREGSETP. */
@@ -109,7 +174,7 @@ void
fill_gregset (const struct regcache *regcache,
elf_gregset_t *gregsetp, int regnum)
{
amd64_collect_native_gregset (regcache, gregsetp, regnum);
amd64_linux_collect_native_gregset (regcache, gregsetp, regnum);
}
/* Transfering floating-point registers between GDB, inferiors and cores. */
@@ -237,7 +302,7 @@ amd64_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
if (ptrace (PTRACE_GETREGS, tid, 0, (long) &regs) < 0)
perror_with_name (_("Couldn't get registers"));
amd64_collect_native_gregset (regcache, &regs, regnum);
amd64_linux_collect_native_gregset (regcache, &regs, regnum);
if (ptrace (PTRACE_SETREGS, tid, 0, (long) &regs) < 0)
perror_with_name (_("Couldn't write registers"));

6
gdb/configure vendored
View File

@@ -11503,6 +11503,12 @@ $as_echo "no - pkg-config not found" >&6; }
as_fn_error $? "pkg-config was not found in your system" "$LINENO" 5
fi
else
case "$LDFLAGS" in
*static-libstdc*)
as_fn_error $? "source highlight is incompatible with -static-libstdc++; either use --disable-source-highlight or --without-static-standard-libraries" "$LINENO" 5
;;
esac
if ${pkg_config_prog_path} --exists source-highlight; then
SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`

View File

@@ -1251,6 +1251,14 @@ if test "${enable_source_highlight}" != "no"; then
AC_MSG_ERROR([pkg-config was not found in your system])
fi
else
case "$LDFLAGS" in
*static-libstdc*)
AC_MSG_ERROR([source highlight is incompatible with -static-libstdc++; dnl
either use --disable-source-highlight or dnl
--without-static-standard-libraries])
;;
esac
if ${pkg_config_prog_path} --exists source-highlight; then
SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`

View File

@@ -314,13 +314,14 @@ cp_print_value_fields (struct type *type, struct type *real_type,
}
else if (field_is_static (&TYPE_FIELD (type, i)))
{
struct value *v = NULL;
TRY
{
v = value_static_field (type, i);
}
struct value *v = value_static_field (type, i);
cp_print_static_field (TYPE_FIELD_TYPE (type, i),
v, stream, recurse + 1,
options);
}
CATCH (ex, RETURN_MASK_ERROR)
{
fprintf_filtered (stream,
@@ -328,10 +329,6 @@ cp_print_value_fields (struct type *type, struct type *real_type,
ex.message);
}
END_CATCH
cp_print_static_field (TYPE_FIELD_TYPE (type, i),
v, stream, recurse + 1,
options);
}
else if (i == vptr_fieldno && type == vptr_basetype)
{

View File

@@ -24,7 +24,7 @@
#include "inferior.h"
#include "infrun.h"
#include "target.h"
#include "terminal.h" /* for job_control */
#include "terminal.h"
#include "event-loop.h"
#include "event-top.h"
#include "interps.h"

View File

@@ -323,6 +323,7 @@ struct gdbarch
const char * stap_gdb_register_suffix;
gdbarch_stap_is_single_operand_ftype *stap_is_single_operand;
gdbarch_stap_parse_special_token_ftype *stap_parse_special_token;
gdbarch_stap_adjust_register_ftype *stap_adjust_register;
gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument;
gdbarch_dtrace_probe_is_enabled_ftype *dtrace_probe_is_enabled;
gdbarch_dtrace_enable_probe_ftype *dtrace_enable_probe;
@@ -685,6 +686,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of stap_gdb_register_suffix, invalid_p == 0 */
/* Skip verify of stap_is_single_operand, has predicate. */
/* Skip verify of stap_parse_special_token, has predicate. */
/* Skip verify of stap_adjust_register, has predicate. */
/* Skip verify of dtrace_parse_probe_argument, has predicate. */
/* Skip verify of dtrace_probe_is_enabled, has predicate. */
/* Skip verify of dtrace_enable_probe, has predicate. */
@@ -1388,6 +1390,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: stack_frame_destroyed_p = <%s>\n",
host_address_to_string (gdbarch->stack_frame_destroyed_p));
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_stap_adjust_register_p() = %d\n",
gdbarch_stap_adjust_register_p (gdbarch));
fprintf_unfiltered (file,
"gdbarch_dump: stap_adjust_register = <%s>\n",
host_address_to_string (gdbarch->stap_adjust_register));
fprintf_unfiltered (file,
"gdbarch_dump: stap_gdb_register_prefix = %s\n",
pstring (gdbarch->stap_gdb_register_prefix));
@@ -4483,6 +4491,30 @@ set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch,
gdbarch->stap_parse_special_token = stap_parse_special_token;
}
int
gdbarch_stap_adjust_register_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);
return gdbarch->stap_adjust_register != NULL;
}
void
gdbarch_stap_adjust_register (struct gdbarch *gdbarch, struct stap_parse_info *p, std::string &regname, int regnum)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->stap_adjust_register != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_stap_adjust_register called\n");
gdbarch->stap_adjust_register (gdbarch, p, regname, regnum);
}
void
set_gdbarch_stap_adjust_register (struct gdbarch *gdbarch,
gdbarch_stap_adjust_register_ftype stap_adjust_register)
{
gdbarch->stap_adjust_register = stap_adjust_register;
}
int
gdbarch_dtrace_parse_probe_argument_p (struct gdbarch *gdbarch)
{

View File

@@ -1338,6 +1338,36 @@ typedef int (gdbarch_stap_parse_special_token_ftype) (struct gdbarch *gdbarch, s
extern int gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p);
extern void set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype *stap_parse_special_token);
/* Perform arch-dependent adjustments to a register name.
In very specific situations, it may be necessary for the register
name present in a SystemTap probe's argument to be handled in a
special way. For example, on i386, GCC may over-optimize the
register allocation and use smaller registers than necessary. In
such cases, the client that is reading and evaluating the SystemTap
probe (ourselves) will need to actually fetch values from the wider
version of the register in question.
To illustrate the example, consider the following probe argument
(i386):
4@%ax
This argument says that its value can be found at the %ax register,
which is a 16-bit register. However, the argument's prefix says
that its type is "uint32_t", which is 32-bit in size. Therefore, in
this case, GDB should actually fetch the probe's value from register
%eax, not %ax. In this scenario, this function would actually
replace the register name from %ax to %eax.
The rationale for this can be found at PR breakpoints/24541. */
extern int gdbarch_stap_adjust_register_p (struct gdbarch *gdbarch);
typedef void (gdbarch_stap_adjust_register_ftype) (struct gdbarch *gdbarch, struct stap_parse_info *p, std::string &regname, int regnum);
extern void gdbarch_stap_adjust_register (struct gdbarch *gdbarch, struct stap_parse_info *p, std::string &regname, int regnum);
extern void set_gdbarch_stap_adjust_register (struct gdbarch *gdbarch, gdbarch_stap_adjust_register_ftype *stap_adjust_register);
/* DTrace related functions.
The expression to compute the NARTGth+1 argument to a DTrace USDT probe.
NARG must be >= 0. */

View File

@@ -1022,6 +1022,31 @@ M;int;stap_is_single_operand;const char *s;s
# parser), and should advance the buffer pointer (p->arg).
M;int;stap_parse_special_token;struct stap_parse_info *p;p
# Perform arch-dependent adjustments to a register name.
#
# In very specific situations, it may be necessary for the register
# name present in a SystemTap probe's argument to be handled in a
# special way. For example, on i386, GCC may over-optimize the
# register allocation and use smaller registers than necessary. In
# such cases, the client that is reading and evaluating the SystemTap
# probe (ourselves) will need to actually fetch values from the wider
# version of the register in question.
#
# To illustrate the example, consider the following probe argument
# (i386):
#
# 4@%ax
#
# This argument says that its value can be found at the %ax register,
# which is a 16-bit register. However, the argument's prefix says
# that its type is "uint32_t", which is 32-bit in size. Therefore, in
# this case, GDB should actually fetch the probe's value from register
# %eax, not %ax. In this scenario, this function would actually
# replace the register name from %ax to %eax.
#
# The rationale for this can be found at PR breakpoints/24541.
M;void;stap_adjust_register;struct stap_parse_info *p, std::string \&regname, int regnum;p, regname, regnum
# DTrace related functions.
# The expression to compute the NARTGth+1 argument to a DTrace USDT probe.

View File

@@ -1,3 +1,15 @@
2019-05-06 Kevin Buettner <kevinb@redhat.com>
PR gdb/24592
* linux-x86-low.c (x86_fill_gregset): Don't compile 64-bit
sign extension code on 32-bit builds.
2019-04-10 Kevin Buettner <kevinb@redhat.com>
PR gdb/24592
* linux-x86-low.c (x86_fill_gregset): Sign extend EAX value
when using a 64-bit gdbserver.
2019-03-04 Sergio Durigan Junior <sergiodj@redhat.com>
* configure.srv: Use '$enable_unittest' instead of '$development'

View File

@@ -338,6 +338,21 @@ x86_fill_gregset (struct regcache *regcache, void *buf)
collect_register_by_name (regcache, "orig_eax",
((char *) buf) + ORIG_EAX * REGSIZE);
#ifdef __x86_64__
/* Sign extend EAX value to avoid potential syscall restart
problems.
See amd64_linux_collect_native_gregset() in gdb/amd64-linux-nat.c
for a detailed explanation. */
if (register_size (regcache->tdesc, 0) == 4)
{
void *ptr = ((gdb_byte *) buf
+ i386_regmap[find_regno (regcache->tdesc, "eax")]);
*(int64_t *) ptr = *(int32_t *) ptr;
}
#endif
}
static void

View File

@@ -64,6 +64,7 @@
#include "parser-defs.h"
#include <ctype.h>
#include <algorithm>
#include <unordered_set>
/* Register names. */
@@ -4388,6 +4389,32 @@ i386_stap_parse_special_token (struct gdbarch *gdbarch,
return 0;
}
/* Implementation of 'gdbarch_stap_adjust_register', as defined in
gdbarch.h. */
static void
i386_stap_adjust_register (struct gdbarch *gdbarch, struct stap_parse_info *p,
std::string &regname, int regnum)
{
static const std::unordered_set<std::string> reg_assoc
= { "ax", "bx", "cx", "dx",
"si", "di", "bp", "sp" };
if (register_size (gdbarch, regnum) >= TYPE_LENGTH (p->arg_type))
{
/* If we're dealing with a register whose size is greater or
equal than the size specified by the "[-]N@" prefix, then we
don't need to do anything. */
return;
}
if (reg_assoc.find (regname) != reg_assoc.end ())
{
/* Use the extended version of the register. */
regname = "e" + regname;
}
}
/* gdbarch gnu_triplet_regexp method. Both arches are acceptable as GDB always
@@ -4436,6 +4463,8 @@ i386_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
i386_stap_is_single_operand);
set_gdbarch_stap_parse_special_token (gdbarch,
i386_stap_parse_special_token);
set_gdbarch_stap_adjust_register (gdbarch,
i386_stap_adjust_register);
set_gdbarch_in_indirect_branch_thunk (gdbarch,
i386_in_indirect_branch_thunk);

View File

@@ -103,35 +103,6 @@ static serial_ttystate initial_gdb_ttystate;
static struct terminal_info *get_inflow_inferior_data (struct inferior *);
/* RAII class used to ignore SIGTTOU in a scope. */
class scoped_ignore_sigttou
{
public:
scoped_ignore_sigttou ()
{
#ifdef SIGTTOU
if (job_control)
m_osigttou = signal (SIGTTOU, SIG_IGN);
#endif
}
~scoped_ignore_sigttou ()
{
#ifdef SIGTTOU
if (job_control)
signal (SIGTTOU, m_osigttou);
#endif
}
DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigttou);
private:
#ifdef SIGTTOU
sighandler_t m_osigttou = NULL;
#endif
};
/* While the inferior is running, we want SIGINT and SIGQUIT to go to the
inferior only. If we have job control, that takes care of it. If not,
we save our handlers in these two variables and set SIGINT and SIGQUIT

View File

@@ -21,5 +21,36 @@
#define INFLOW_H
#include <unistd.h>
#include <signal.h>
#include "common/job-control.h"
/* RAII class used to ignore SIGTTOU in a scope. */
class scoped_ignore_sigttou
{
public:
scoped_ignore_sigttou ()
{
#ifdef SIGTTOU
if (job_control)
m_osigttou = signal (SIGTTOU, SIG_IGN);
#endif
}
~scoped_ignore_sigttou ()
{
#ifdef SIGTTOU
if (job_control)
signal (SIGTTOU, m_osigttou);
#endif
}
DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigttou);
private:
#ifdef SIGTTOU
sighandler_t m_osigttou = NULL;
#endif
};
#endif /* inflow.h */

View File

@@ -914,10 +914,14 @@ handle_vfork_child_exec_or_exit (int exec)
int resume_parent = -1;
/* This exec or exit marks the end of the shared memory region
between the parent and the child. If the user wanted to
detach from the parent, now is the time. */
between the parent and the child. Break the bonds. */
inferior *vfork_parent = inf->vfork_parent;
inf->vfork_parent->vfork_child = NULL;
inf->vfork_parent = NULL;
if (inf->vfork_parent->pending_detach)
/* If the user wanted to detach from the parent, now is the
time. */
if (vfork_parent->pending_detach)
{
struct thread_info *tp;
struct program_space *pspace;
@@ -925,7 +929,7 @@ handle_vfork_child_exec_or_exit (int exec)
/* follow-fork child, detach-on-fork on. */
inf->vfork_parent->pending_detach = 0;
vfork_parent->pending_detach = 0;
gdb::optional<scoped_restore_exited_inferior>
maybe_restore_inferior;
@@ -940,7 +944,7 @@ handle_vfork_child_exec_or_exit (int exec)
maybe_restore_thread.emplace ();
/* We're letting loose of the parent. */
tp = any_live_thread_of_inferior (inf->vfork_parent);
tp = any_live_thread_of_inferior (vfork_parent);
switch_to_thread (tp);
/* We're about to detach from the parent, which implicitly
@@ -963,7 +967,7 @@ handle_vfork_child_exec_or_exit (int exec)
if (print_inferior_events)
{
const char *pidstr
= target_pid_to_str (ptid_t (inf->vfork_parent->pid));
= target_pid_to_str (ptid_t (vfork_parent->pid));
target_terminal::ours_for_output ();
@@ -981,7 +985,7 @@ handle_vfork_child_exec_or_exit (int exec)
}
}
target_detach (inf->vfork_parent, 0);
target_detach (vfork_parent, 0);
/* Put it back. */
inf->pspace = pspace;
@@ -996,10 +1000,7 @@ handle_vfork_child_exec_or_exit (int exec)
inf->removable = 1;
set_current_program_space (inf->pspace);
resume_parent = inf->vfork_parent->pid;
/* Break the bonds. */
inf->vfork_parent->vfork_child = NULL;
resume_parent = vfork_parent->pid;
}
else
{
@@ -1029,17 +1030,13 @@ handle_vfork_child_exec_or_exit (int exec)
set_current_program_space (pspace);
inf->removable = 1;
inf->symfile_flags = SYMFILE_NO_READ;
clone_program_space (pspace, inf->vfork_parent->pspace);
clone_program_space (pspace, vfork_parent->pspace);
inf->pspace = pspace;
inf->aspace = pspace->aspace;
resume_parent = inf->vfork_parent->pid;
/* Break the bonds. */
inf->vfork_parent->vfork_child = NULL;
resume_parent = vfork_parent->pid;
}
inf->vfork_parent = NULL;
gdb_assert (current_program_space == inf->pspace);
if (non_stop && resume_parent != -1)

View File

@@ -32,6 +32,7 @@
#include "gdbcmd.h"
#include "common/filestuff.h"
#include <termios.h>
#include "inflow.h"
struct hardwire_ttystate
{
@@ -164,6 +165,9 @@ hardwire_print_tty_state (struct serial *scb,
static int
hardwire_drain_output (struct serial *scb)
{
/* Ignore SIGTTOU which may occur during the drain. */
scoped_ignore_sigttou ignore_sigttou;
return tcdrain (scb->fd);
}

View File

@@ -156,8 +156,7 @@ get_language_name (enum language lang)
break;
case language_rust:
/* Not handled by Source Highlight. */
break;
return "rust.lang";
case language_ada:
return "ada.lang";
@@ -213,21 +212,33 @@ source_cache::get_source_lines (struct symtab *s, int first_line,
use-after-free. */
fullname = symtab_to_fullname (s);
}
srchilite::SourceHighlight highlighter ("esc.outlang");
highlighter.setStyleFile("esc.style");
try
{
srchilite::SourceHighlight highlighter ("esc.outlang");
highlighter.setStyleFile("esc.style");
std::ostringstream output;
highlighter.highlight (input, output, lang_name, fullname);
std::ostringstream output;
highlighter.highlight (input, output, lang_name, fullname);
source_text result = { fullname, output.str () };
m_source_map.push_back (std::move (result));
source_text result = { fullname, output.str () };
m_source_map.push_back (std::move (result));
if (m_source_map.size () > MAX_ENTRIES)
m_source_map.erase (m_source_map.begin ());
if (m_source_map.size () > MAX_ENTRIES)
m_source_map.erase (m_source_map.begin ());
*lines = extract_lines (m_source_map.back (), first_line,
last_line);
return true;
*lines = extract_lines (m_source_map.back (), first_line,
last_line);
return true;
}
catch (...)
{
/* Source Highlight will throw an exception if
highlighting fails. One possible reason it can fail
is if the language is unknown -- which matters to gdb
because Rust support wasn't added until after 3.1.8.
Ignore exceptions here and fall back to
un-highlighted text. */
}
}
}
}

View File

@@ -684,12 +684,8 @@ stap_parse_register_operand (struct stap_parse_info *p)
/* Variables used to extract the register name from the probe's
argument. */
const char *start;
char *regname;
int len;
const char *gdb_reg_prefix = gdbarch_stap_gdb_register_prefix (gdbarch);
int gdb_reg_prefix_len = gdb_reg_prefix ? strlen (gdb_reg_prefix) : 0;
const char *gdb_reg_suffix = gdbarch_stap_gdb_register_suffix (gdbarch);
int gdb_reg_suffix_len = gdb_reg_suffix ? strlen (gdb_reg_suffix) : 0;
const char *reg_prefix;
const char *reg_ind_prefix;
const char *reg_suffix;
@@ -751,37 +747,54 @@ stap_parse_register_operand (struct stap_parse_info *p)
while (isalnum (*p->arg))
++p->arg;
len = p->arg - start;
regname = (char *) alloca (len + gdb_reg_prefix_len + gdb_reg_suffix_len + 1);
regname[0] = '\0';
std::string regname (start, p->arg - start);
/* We only add the GDB's register prefix/suffix if we are dealing with
a numeric register. */
if (gdb_reg_prefix && isdigit (*start))
if (isdigit (*start))
{
strncpy (regname, gdb_reg_prefix, gdb_reg_prefix_len);
strncpy (regname + gdb_reg_prefix_len, start, len);
if (gdb_reg_prefix != NULL)
regname = gdb_reg_prefix + regname;
if (gdb_reg_suffix)
strncpy (regname + gdb_reg_prefix_len + len,
gdb_reg_suffix, gdb_reg_suffix_len);
len += gdb_reg_prefix_len + gdb_reg_suffix_len;
if (gdb_reg_suffix != NULL)
regname += gdb_reg_suffix;
}
else
strncpy (regname, start, len);
regname[len] = '\0';
int regnum = user_reg_map_name_to_regnum (gdbarch, regname.c_str (),
regname.size ());
/* Is this a valid register name? */
if (user_reg_map_name_to_regnum (gdbarch, regname, len) == -1)
if (regnum == -1)
error (_("Invalid register name `%s' on expression `%s'."),
regname, p->saved_arg);
regname.c_str (), p->saved_arg);
/* Check if there's any special treatment that the arch-specific
code would like to perform on the register name. */
if (gdbarch_stap_adjust_register_p (gdbarch))
{
std::string oldregname = regname;
gdbarch_stap_adjust_register (gdbarch, p, regname, regnum);
if (regname != oldregname)
{
/* This is just a check we perform to make sure that the
arch-dependent code has provided us with a valid
register name. */
regnum = user_reg_map_name_to_regnum (gdbarch, regname.c_str (),
regname.size ());
if (regnum == -1)
internal_error (__FILE__, __LINE__,
_("Invalid register name '%s' after replacing it"
" (previous name was '%s')"),
regname.c_str (), oldregname.c_str ());
}
}
write_exp_elt_opcode (&p->pstate, OP_REGISTER);
str.ptr = regname;
str.length = len;
str.ptr = regname.c_str ();
str.length = regname.size ();
write_exp_string (&p->pstate, str);
write_exp_elt_opcode (&p->pstate, OP_REGISTER);

View File

@@ -1672,7 +1672,19 @@ symbol_file_command (const char *args, int from_tty)
validate_readnow_readnever (flags);
/* Set SYMFILE_DEFER_BP_RESET because the proper displacement for a PIE
(Position Independent Executable) main symbol file will only be
computed by the solib_create_inferior_hook below. Without it,
breakpoint_re_set would fail to insert the breakpoints with the zero
displacement. */
add_flags |= SYMFILE_DEFER_BP_RESET;
symbol_file_add_main_1 (name, add_flags, flags, offset);
solib_create_inferior_hook (from_tty);
/* Now it's safe to re-add the breakpoints. */
breakpoint_re_set ();
}
}

View File

@@ -701,6 +701,7 @@ symbol_set_language (struct general_symbol_info *gsymbol,
struct demangled_name_entry
{
const char *mangled;
ENUM_BITFIELD(language) language : LANGUAGE_BITS;
char demangled[1];
};
@@ -841,11 +842,6 @@ symbol_set_names (struct general_symbol_info *gsymbol,
else
linkage_name_copy = linkage_name;
/* Set the symbol language. */
char *demangled_name_ptr
= symbol_find_demangled_name (gsymbol, linkage_name_copy);
gdb::unique_xmalloc_ptr<char> demangled_name (demangled_name_ptr);
entry.mangled = linkage_name_copy;
slot = ((struct demangled_name_entry **)
htab_find_slot (per_bfd->demangled_names_hash,
@@ -858,6 +854,9 @@ symbol_set_names (struct general_symbol_info *gsymbol,
|| (gsymbol->language == language_go
&& (*slot)->demangled[0] == '\0'))
{
char *demangled_name_ptr
= symbol_find_demangled_name (gsymbol, linkage_name_copy);
gdb::unique_xmalloc_ptr<char> demangled_name (demangled_name_ptr);
int demangled_len = demangled_name ? strlen (demangled_name.get ()) : 0;
/* Suppose we have demangled_name==NULL, copy_name==0, and
@@ -894,12 +893,16 @@ symbol_set_names (struct general_symbol_info *gsymbol,
strcpy (mangled_ptr, linkage_name_copy);
(*slot)->mangled = mangled_ptr;
}
(*slot)->language = gsymbol->language;
if (demangled_name != NULL)
strcpy ((*slot)->demangled, demangled_name.get());
strcpy ((*slot)->demangled, demangled_name.get ());
else
(*slot)->demangled[0] = '\0';
}
else if (gsymbol->language == language_unknown
|| gsymbol->language == language_auto)
gsymbol->language = (*slot)->language;
gsymbol->name = (*slot)->mangled;
if ((*slot)->demangled[0] != '\0')

View File

@@ -1,3 +1,41 @@
2019-04-29 Tom de Vries <tdevries@suse.de>
PR testsuite/25005
* lib/opencl.exp (skip_opencl_tests): Add missing "with" in regexp.
2019-04-18 Tom de Vries <tdevries@suse.de>
Pedro Alves <palves@redhat.com>
PR gdb/24454
* gdb.threads/vfork-follow-child-exec.c: New file.
* gdb.threads/vfork-follow-child-exec.exp: New file.
* gdb.threads/vfork-follow-child-exit.c: New file.
* gdb.threads/vfork-follow-child-exit.exp: New file.
2019-07-08 Alan Hayward <alan.hayward@arm.com>
PR breakpoints/25011
* gdb.base/break-idempotent.exp: Test both PIE and non PIE.
2019-03-22 Alan Hayward <alan.hayward@arm.com>
PR testsuite/25016
* README: Add pie options.
* gdb.base/break-interp.exp: Ensure pie is disabled.
* gdb.base/dump.exp: Likewise.
* lib/gdb.exp (gdb_compile): Add pie option.
2019-06-27 Tom Tromey <tromey@adacore.com>
PR c++/20020:
* gdb.cp/constexpr-field.exp: Use setup_xfail.
2019-05-29 Tom Tromey <tromey@adacore.com>
PR c++/20020:
* gdb.cp/constexpr-field.exp: New file.
* gdb.cp/constexpr-field.cc: New file.
2019-04-30 Tom Tromey <tromey@adacore.com>
PR c++/24470:

View File

@@ -482,6 +482,16 @@ gdb,no_thread_names
The target doesn't support thread names.
gdb,pie_flag
The flag required to force the compiler to produce position-independent
executables.
gdb,pie_ldflag
The flag required to force the linker to produce position-independent
executables.
gdb,nopie_flag
The flag required to force the compiler to produce non-position-independent

View File

@@ -36,23 +36,6 @@
standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
return -1
}
if ![runto_main] then {
fail "can't run to main"
return 0
}
if [is_remote host] {
set arg [remote_download host $binfile]
if { $arg == "" } {
perror "download failed"
return -1
}
}
# Force a breakpoint re-set in GDB. Currently this is done by
# reloading symbols with the "file" command.
@@ -123,7 +106,7 @@ proc set_breakpoint { break_command } {
proc test_break { always_inserted break_command } {
set cmd [lindex [split "$break_command"] 0]
with_test_prefix "always-inserted $always_inserted: $cmd" {
with_test_prefix "$cmd" {
delete_breakpoints
if ![runto_main] then {
@@ -163,20 +146,43 @@ proc test_break { always_inserted break_command } {
}
}
foreach always_inserted { "off" "on" } {
test_break $always_inserted "break"
# The testcase uses the "file" command to force breakpoint re-set in
# GDB. Test both with and without PIE, as GDB used to mishandle
# breakpoint re-set when reloading PIEs.
foreach_with_prefix pie { "nopie" "pie" } {
if {![skip_hw_breakpoint_tests]} {
test_break $always_inserted "hbreak"
set opts {debug}
lappend opts $pie
set binfile [standard_output_file $testfile-$pie]
if {[prepare_for_testing "failed to prepare" $binfile $srcfile $opts]} {
continue
}
if {![skip_hw_watchpoint_tests]} {
test_break $always_inserted "watch"
if [is_remote host] {
set arg [remote_download host $binfile]
if { $arg == "" } {
untested "download failed"
continue
}
}
if {![skip_hw_watchpoint_access_tests]
&& ![skip_hw_watchpoint_multi_tests]} {
test_break $always_inserted "rwatch"
test_break $always_inserted "awatch"
foreach_with_prefix always_inserted { "off" "on" } {
test_break $always_inserted "break"
if {![skip_hw_breakpoint_tests]} {
test_break $always_inserted "hbreak"
}
if {![skip_hw_watchpoint_tests]} {
test_break $always_inserted "watch"
}
if {![skip_hw_watchpoint_access_tests]
&& ![skip_hw_watchpoint_multi_tests]} {
test_break $always_inserted "rwatch"
test_break $always_inserted "awatch"
}
}
}

View File

@@ -625,8 +625,10 @@ foreach ldprelink {NO YES} {
lappend opts {debug}
}
if {$binpie != "NO"} {
lappend opts {additional_flags=-fPIE}
lappend opts {ldflags=-pie}
lappend opts {pie}
} else {
# Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled.
lappend opts {nopie}
}
set dir ${exec}.d

View File

@@ -36,6 +36,10 @@ if {[istarget "spu*-*-*"]} then {
set is64bitonly "yes"
}
# Debian9/Ubuntu16.10 onwards default to PIE enabled. Ensure it is disabled as
# this causes addresses to be out of range for IHEX.
lappend options {nopie}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable ${options}] != "" } {
untested "failed to compile"
return -1

View File

@@ -0,0 +1,37 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
template<typename T>
struct X
{
static constexpr bool f = true;
};
X<int> x;
struct Y
{
static constexpr bool f = true;
};
Y y;
int
main (void)
{
return 0;
}

View File

@@ -0,0 +1,37 @@
# Copyright 2019 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file is part of the gdb testsuite.
if {[skip_cplus_tests]} { continue }
standard_testfile .cc
if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
{c++ debug additional_flags=-std=c++17}]} {
return -1
}
if {![runto_main]} {
perror "couldn't run to breakpoint"
continue
}
# "x" sometimes isn't available due to
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90526
setup_xfail *-*-* gcc/90526
gdb_test "print x" " = {static f = true}"
gdb_test "print y" " = {static f = true}"

View File

@@ -0,0 +1,66 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
static char *program_name;
static void *
f (void *arg)
{
int res = vfork ();
if (res == -1)
{
perror ("vfork");
return NULL;
}
else if (res == 0)
{
/* Child. */
execl (program_name, program_name, "1", NULL);
perror ("exec");
abort ();
}
else
{
/* Parent. */
return NULL;
}
}
int
main (int argc, char **argv)
{
pthread_t tid;
if (argc > 1)
{
/* Getting here via execl. */
return 0;
}
program_name = argv[0];
pthread_create (&tid, NULL, f, NULL);
pthread_join (tid, NULL);
return 0;
}

View File

@@ -0,0 +1,64 @@
# Copyright (C) 2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
# Test following a vfork child that execs, when the vfork parent is a
# threaded program, and it's a non-main thread that vforks.
standard_testfile
if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]} {
return -1
}
# DETACH indicates whether "set detach-on-fork" is enabled. It is
# either "on" or "off".
proc test_vfork {detach} {
global binfile
clean_restart $binfile
if ![runto_main] then {
fail "can't run to main"
return 0
}
delete_breakpoints
gdb_test_no_output "set follow-fork-mode child"
gdb_test_no_output "set detach-on-fork $detach"
if {$detach == "off"} {
gdb_test "continue" \
[multi_line \
"Attaching after .* vfork to child .*" \
".*New inferior 2 .*" \
".* is executing new program: .*" \
".*Inferior 2 .* exited normally.*"]
} else {
gdb_test "continue" \
[multi_line \
"Attaching after .* vfork to child .*" \
".*New inferior 2 .*" \
".*Detaching vfork parent process .* after child exec.*" \
".*Inferior 1 .* detached.*" \
".*is executing new program: .*" \
".*Inferior 2 .*exited normally.*"]
}
}
foreach_with_prefix detach-on-fork {"off" "on"} {
test_vfork ${detach-on-fork}
}

View File

@@ -0,0 +1,52 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
static void *
f (void *arg)
{
int res = vfork ();
if (res == -1)
{
perror ("vfork");
return NULL;
}
else if (res == 0)
{
/* Child. */
_exit (0);
}
else
{
/* Parent. */
return NULL;
}
}
int
main (void)
{
pthread_t tid;
pthread_create (&tid, NULL, f, NULL);
pthread_join (tid, NULL);
return 0;
}

View File

@@ -0,0 +1,60 @@
# Copyright (C) 2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
# Test following a vfork child that exits, when the vfork parent is a
# threaded program, and it's a non-main thread that vforks.
standard_testfile
if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]} {
return -1
}
# DETACH indicates whether "set detach-on-fork" is enabled. It is
# either "on" or "off".
proc test_vfork {detach} {
global binfile
clean_restart $binfile
if ![runto_main] then {
fail "can't run to main"
return 0
}
gdb_test_no_output "set follow-fork-mode child"
gdb_test_no_output "set detach-on-fork $detach"
if {$detach == "off"} {
gdb_test "continue" \
[multi_line \
"Attaching after .* vfork to child .*" \
".*New inferior 2 .*" \
".*Inferior 2 .*exited normally.*"]
} else {
gdb_test "continue" \
[multi_line \
"Attaching after .* vfork to child .*" \
".*New inferior 2 .*" \
".*Detaching vfork parent process .* after child exit.*" \
".*Inferior 1 .* detached.*" \
".*Inferior 2 .*exited normally.*"]
}
}
foreach_with_prefix detach-on-fork {"off" "on"} {
test_vfork ${detach-on-fork}
}

View File

@@ -3492,6 +3492,7 @@ set gdb_saved_set_unbuffered_mode_obj ""
# dynamically load libraries at runtime. For example, on Linux, this adds
# -ldl so that the test can use dlopen.
# - nowarnings: Inhibit all compiler warnings.
# - pie: Force creation of PIE executables.
# - nopie: Prevent creation of PIE executables.
#
# And here are some of the not too obscure options understood by DejaGnu that
@@ -3630,8 +3631,33 @@ proc gdb_compile {source dest type options} {
set options [lreplace $options $nowarnings $nowarnings $flag]
}
# Replace the "nopie" option with the appropriate additional_flags
# to disable PIE executables.
# Replace the "pie" option with the appropriate compiler and linker flags
# to enable PIE executables.
set pie [lsearch -exact $options pie]
if {$pie != -1} {
if [target_info exists gdb,pie_flag] {
set flag "additional_flags=[target_info gdb,pie_flag]"
} else {
# For safety, use fPIE rather than fpie. On AArch64, m68k, PowerPC
# and SPARC, fpie can cause compile errors due to the GOT exceeding
# a maximum size. On other architectures the two flags are
# identical (see the GCC manual). Note Debian9 and Ubuntu16.10
# onwards default GCC to using fPIE. If you do require fpie, then
# it can be set using the pie_flag.
set flag "additional_flags=-fPIE"
}
set options [lreplace $options $pie $pie $flag]
if [target_info exists gdb,pie_ldflag] {
set flag "ldflags=[target_info gdb,pie_ldflag]"
} else {
set flag "ldflags=-pie"
}
lappend options "$flag"
}
# Replace the "nopie" option with the appropriate linker flag to disable
# PIE executables. There are no compiler flags for this option.
set nopie [lsearch -exact $options nopie]
if {$nopie != -1} {
if [target_info exists gdb,nopie_flag] {

View File

@@ -58,7 +58,7 @@ gdb_caching_proc skip_opencl_tests {
verbose -log "\n$me: OpenCL support detected"
set result 0
}
-re ".*$inferior_exited_re code.*${gdb_prompt} $" {
-re ".*$inferior_exited_re with code.*${gdb_prompt} $" {
verbose -log "\n$me: OpenCL support not detected"
set result 1
}

View File

@@ -34,7 +34,7 @@
#include "expression.h"
#include "value.h"
#include "language.h"
#include "terminal.h" /* For job_control. */
#include "terminal.h"
#include "common/job-control.h"
#include "annotate.h"
#include "completer.h"

View File

@@ -1 +1 @@
8.3
8.3.1.DATE-git