Compare commits

...

188 Commits

Author SHA1 Message Date
GDB Administrator
123beb129e Automatic date update in version.in 2024-12-29 00:01:36 +00:00
GDB Administrator
475f2cbbbd Automatic date update in version.in 2024-12-28 00:01:30 +00:00
GDB Administrator
1fb59405aa Automatic date update in version.in 2024-12-27 00:01:30 +00:00
GDB Administrator
3a20929e71 Automatic date update in version.in 2024-12-26 00:01:28 +00:00
GDB Administrator
0c5e1b96e6 Automatic date update in version.in 2024-12-25 00:00:37 +00:00
GDB Administrator
dd5eb961c9 Automatic date update in version.in 2024-12-24 00:00:34 +00:00
GDB Administrator
ea2db342a9 Automatic date update in version.in 2024-12-23 00:01:01 +00:00
GDB Administrator
bfc7a30a7d Automatic date update in version.in 2024-12-22 00:00:36 +00:00
GDB Administrator
0f8e4e7f5f Automatic date update in version.in 2024-12-21 00:01:20 +00:00
GDB Administrator
15e2e49ed0 Automatic date update in version.in 2024-12-20 00:00:41 +00:00
GDB Administrator
9b90800559 Automatic date update in version.in 2024-12-19 00:01:45 +00:00
GDB Administrator
80966f0224 Automatic date update in version.in 2024-12-18 00:00:53 +00:00
GDB Administrator
30e1c7c3b9 Automatic date update in version.in 2024-12-17 00:01:34 +00:00
GDB Administrator
b474a1c652 Automatic date update in version.in 2024-12-16 00:01:24 +00:00
GDB Administrator
3e280897de Automatic date update in version.in 2024-12-15 00:00:35 +00:00
GDB Administrator
cfe4f165c6 Automatic date update in version.in 2024-12-14 00:01:04 +00:00
GDB Administrator
7eefed90bf Automatic date update in version.in 2024-12-13 00:00:58 +00:00
GDB Administrator
b243eaa001 Automatic date update in version.in 2024-12-12 00:00:48 +00:00
GDB Administrator
308e46ba8f Automatic date update in version.in 2024-12-11 00:01:30 +00:00
GDB Administrator
728a97eb92 Automatic date update in version.in 2024-12-10 00:00:31 +00:00
GDB Administrator
b91f11ef64 Automatic date update in version.in 2024-12-09 00:01:27 +00:00
GDB Administrator
d939da6c03 Automatic date update in version.in 2024-12-08 00:00:42 +00:00
GDB Administrator
b80e240e95 Automatic date update in version.in 2024-12-07 00:00:26 +00:00
GDB Administrator
1d8a8bd951 Automatic date update in version.in 2024-12-06 00:00:30 +00:00
GDB Administrator
ed543a1ad8 Automatic date update in version.in 2024-12-05 00:00:40 +00:00
GDB Administrator
eaa8ce62a8 Automatic date update in version.in 2024-12-04 00:00:44 +00:00
GDB Administrator
9cc8124148 Automatic date update in version.in 2024-12-03 00:00:39 +00:00
GDB Administrator
aae4f96d04 Automatic date update in version.in 2024-12-02 00:00:28 +00:00
GDB Administrator
aa8cd56a24 Automatic date update in version.in 2024-12-01 00:01:43 +00:00
GDB Administrator
b7918205e0 Automatic date update in version.in 2024-11-30 00:01:16 +00:00
GDB Administrator
752fd3dee2 Automatic date update in version.in 2024-11-29 00:00:19 +00:00
GDB Administrator
6c15056535 Automatic date update in version.in 2024-11-28 00:01:40 +00:00
GDB Administrator
74665e9c83 Automatic date update in version.in 2024-11-27 00:01:52 +00:00
GDB Administrator
8105349d0c Automatic date update in version.in 2024-11-26 00:01:59 +00:00
GDB Administrator
e812d600ca Automatic date update in version.in 2024-11-25 00:02:17 +00:00
GDB Administrator
d1e92a4e5d Automatic date update in version.in 2024-11-24 00:02:28 +00:00
GDB Administrator
4938c2a14d Automatic date update in version.in 2024-11-23 00:02:14 +00:00
GDB Administrator
293608c633 Automatic date update in version.in 2024-11-22 00:01:47 +00:00
GDB Administrator
72cae7e307 Automatic date update in version.in 2024-11-21 00:00:44 +00:00
GDB Administrator
d60e081397 Automatic date update in version.in 2024-11-20 00:01:49 +00:00
GDB Administrator
a4e9a4a258 Automatic date update in version.in 2024-11-19 00:00:57 +00:00
GDB Administrator
a7e8c33b49 Automatic date update in version.in 2024-11-18 00:00:52 +00:00
GDB Administrator
7f55224bf9 Automatic date update in version.in 2024-11-17 00:01:24 +00:00
GDB Administrator
1c2a6995af Automatic date update in version.in 2024-11-16 00:01:14 +00:00
GDB Administrator
1845efd7ef Automatic date update in version.in 2024-11-15 00:00:48 +00:00
GDB Administrator
884ceb0648 Automatic date update in version.in 2024-11-14 00:01:28 +00:00
GDB Administrator
36b9e9cda4 Automatic date update in version.in 2024-11-13 00:01:51 +00:00
GDB Administrator
a82c5b2b0d Automatic date update in version.in 2024-11-12 00:01:36 +00:00
GDB Administrator
853b50ce68 Automatic date update in version.in 2024-11-11 00:01:18 +00:00
GDB Administrator
b0722a909e Automatic date update in version.in 2024-11-10 00:00:26 +00:00
GDB Administrator
8ec3ace7e9 Automatic date update in version.in 2024-11-09 00:01:21 +00:00
GDB Administrator
6fbec02804 Automatic date update in version.in 2024-11-08 00:01:03 +00:00
GDB Administrator
7775dfb416 Automatic date update in version.in 2024-11-07 00:01:28 +00:00
GDB Administrator
e07b759696 Automatic date update in version.in 2024-11-06 00:01:57 +00:00
GDB Administrator
19a3119365 Automatic date update in version.in 2024-11-05 00:01:34 +00:00
GDB Administrator
614cee8bd3 Automatic date update in version.in 2024-11-04 00:01:22 +00:00
GDB Administrator
b21808d156 Automatic date update in version.in 2024-11-03 00:01:26 +00:00
GDB Administrator
c7eb8137bd Automatic date update in version.in 2024-11-02 00:00:37 +00:00
GDB Administrator
2a7d2f7b17 Automatic date update in version.in 2024-11-01 00:02:23 +00:00
GDB Administrator
06a25c25ee Automatic date update in version.in 2024-10-31 00:01:29 +00:00
GDB Administrator
5918e612c5 Automatic date update in version.in 2024-10-30 00:01:23 +00:00
GDB Administrator
d3ddd57c5c Automatic date update in version.in 2024-10-29 00:01:55 +00:00
GDB Administrator
06afc6e611 Automatic date update in version.in 2024-10-28 00:00:55 +00:00
GDB Administrator
14a86c2024 Automatic date update in version.in 2024-10-27 00:00:41 +00:00
GDB Administrator
6a4f7b4344 Automatic date update in version.in 2024-10-26 00:01:01 +00:00
GDB Administrator
c331a477e1 Automatic date update in version.in 2024-10-25 00:01:03 +00:00
GDB Administrator
b04e41f000 Automatic date update in version.in 2024-10-24 00:00:53 +00:00
GDB Administrator
4141e65c9e Automatic date update in version.in 2024-10-23 00:01:18 +00:00
GDB Administrator
e27deb60b1 Automatic date update in version.in 2024-10-22 00:00:42 +00:00
GDB Administrator
aea7c65622 Automatic date update in version.in 2024-10-21 00:01:27 +00:00
GDB Administrator
96caeefbf2 Automatic date update in version.in 2024-10-20 00:01:21 +00:00
GDB Administrator
cee605dec1 Automatic date update in version.in 2024-10-19 00:01:44 +00:00
GDB Administrator
58b9983b03 Automatic date update in version.in 2024-10-18 00:01:15 +00:00
GDB Administrator
665ee950cb Automatic date update in version.in 2024-10-17 00:00:45 +00:00
GDB Administrator
782bbd70ea Automatic date update in version.in 2024-10-16 00:01:05 +00:00
GDB Administrator
ab78989a68 Automatic date update in version.in 2024-10-15 00:00:45 +00:00
GDB Administrator
e076e02ac7 Automatic date update in version.in 2024-10-14 00:00:47 +00:00
GDB Administrator
afc31609dd Automatic date update in version.in 2024-10-13 00:00:39 +00:00
GDB Administrator
ac3fac59de Automatic date update in version.in 2024-10-12 00:00:21 +00:00
GDB Administrator
174b564643 Automatic date update in version.in 2024-10-11 00:02:11 +00:00
GDB Administrator
1ea44b4dda Automatic date update in version.in 2024-10-10 00:00:37 +00:00
GDB Administrator
1f92e8f540 Automatic date update in version.in 2024-10-09 00:01:10 +00:00
GDB Administrator
6c2f118aec Automatic date update in version.in 2024-10-08 00:01:27 +00:00
GDB Administrator
896464c092 Automatic date update in version.in 2024-10-07 00:00:30 +00:00
GDB Administrator
7ad81401be Automatic date update in version.in 2024-10-06 00:00:40 +00:00
GDB Administrator
3c8349d9c5 Automatic date update in version.in 2024-10-05 00:00:33 +00:00
GDB Administrator
6ee5218bb3 Automatic date update in version.in 2024-10-04 00:00:27 +00:00
GDB Administrator
87fd313a63 Automatic date update in version.in 2024-10-03 00:00:57 +00:00
GDB Administrator
721c6d6a56 Automatic date update in version.in 2024-10-02 00:00:28 +00:00
GDB Administrator
7e95080f06 Automatic date update in version.in 2024-10-01 00:01:03 +00:00
GDB Administrator
d6e12e6521 Automatic date update in version.in 2024-09-30 00:00:20 +00:00
Joel Brobecker
f1ca7a8663 Bump GDB's version number to 15.2.90.DATE-git.
This commit changes gdb/version.in to 15.2.90.DATE-git.

This commit also makes the following changes in gdb/testsuite:

	* gdb.base/default.exp: Change $_gdb_minor to 3.
2024-09-29 10:21:19 +02:00
Joel Brobecker
23c84db5b3 Set GDB version number to 15.2.
This commit changes gdb/version.in to 15.2.
2024-09-29 10:04:37 +02:00
GDB Administrator
0252f80e2d Automatic date update in version.in 2024-09-29 00:00:23 +00:00
GDB Administrator
5d9b7e7274 Automatic date update in version.in 2024-09-28 00:00:47 +00:00
GDB Administrator
5fc6163431 Automatic date update in version.in 2024-09-27 00:00:24 +00:00
GDB Administrator
c9013a8511 Automatic date update in version.in 2024-09-26 00:00:48 +00:00
Tom de Vries
4ff12ed8a6 [gdb/python] Make sure python sys.exit makes gdb exit
With gdb 15.1, python sys.exit no longer makes gdb exit:
...
$ gdb -q -batch -ex "python sys.exit(2)" -ex "print 123"; echo $?
Python Exception <class 'SystemExit'>: 2
Error occurred in Python: 2
$1 = 123
0
...

This is a change in behaviour since commit a207f6b3a3 ("Rewrite "python"
command exception handling"), first available in gdb 15.1.

This patch reverts to the old behaviour by handling PyExc_SystemExit in
gdbpy_handle_exception, such what we have instead:
...
$ gdb -q -batch -ex "python sys.exit(2)" -ex "print 123"; echo $?
2
...

Tested on x86_64-linux, with python 3.6 and 3.13.

Tested-By: Guinevere Larsen <blarsen@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>

PR python/31946
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31946
2024-09-26 00:36:21 +02:00
GDB Administrator
37cba8b06c Automatic date update in version.in 2024-09-25 00:00:29 +00:00
GDB Administrator
f4887f348a Automatic date update in version.in 2024-09-24 00:00:50 +00:00
GDB Administrator
6869c5ee9e Automatic date update in version.in 2024-09-23 00:00:43 +00:00
GDB Administrator
0f40ae10c7 Automatic date update in version.in 2024-09-22 00:00:24 +00:00
GDB Administrator
7898a62f32 Automatic date update in version.in 2024-09-21 00:00:39 +00:00
GDB Administrator
ba51e24c34 Automatic date update in version.in 2024-09-20 00:00:33 +00:00
GDB Administrator
62eb742c4f Automatic date update in version.in 2024-09-19 00:00:59 +00:00
GDB Administrator
ff6e00ab63 Automatic date update in version.in 2024-09-18 00:01:28 +00:00
GDB Administrator
8aecb61b34 Automatic date update in version.in 2024-09-17 00:00:55 +00:00
GDB Administrator
eb95d7939d Automatic date update in version.in 2024-09-16 00:00:28 +00:00
Tom de Vries
21528df40e [gdb/symtab] Revert "Change handling of DW_TAG_enumeration_type in DWARF scanner"
After adding dwarf assembly to test-case gdb.dwarf2/enum-type.exp that adds
this debug info:
...
 <1><11f>: Abbrev Number: 3 (DW_TAG_enumeration_type)
    <120>   DW_AT_specification: <0x130>
 <2><124>: Abbrev Number: 4 (DW_TAG_enumerator)
    <125>   DW_AT_name        : val1
    <12a>   DW_AT_const_value : 1
 <2><12b>: Abbrev Number: 0
 <1><12c>: Abbrev Number: 5 (DW_TAG_namespace)
    <12d>   DW_AT_name        : ns
 <2><130>: Abbrev Number: 6 (DW_TAG_enumeration_type)
    <131>   DW_AT_name        : e
    <133>   DW_AT_type        : <0x118>
    <137>   DW_AT_declaration : 1
...
I run into an assertion failure:
...
(gdb) file enum-type^M
Reading symbols from enum-type...^M
cooked-index.h:214: internal-error: get_parent: \
  Assertion `(flags & IS_PARENT_DEFERRED) == 0' failed.^M
...

This was reported in PR32160 comment 1.

This is a regression since commit 4e417d7bb1 ("Change handling of
DW_TAG_enumeration_type in DWARF scanner").

Fix this by reverting the commit.

[ Also drop the kfails for PR31900 and PR32158, which are regressions by that
same commit. ]

That allows us to look at the output of "maint print objfiles", and for val1
we get an entry without parent:
...
    [27] ((cooked_index_entry *) 0x7fbbb4002ef0)
    name:       val1
    canonical:  val1
    qualified:  val1
    DWARF tag:  DW_TAG_enumerator
    flags:      0x0 []
    DIE offset: 0x124
    parent:     ((cooked_index_entry *) 0)
...
which is incorrect, as noted in that same comment, but an improvement over the
assertion failure, and I don't think that ever worked.  This is to be
addressed in a follow-up patch.

Reverting the commit begs the question: what was it trying to fix in the first
place, and do we need a different fix?  I've investigated this and filed
PR32160 to track this.

My guess is that the commit was based on a misunderstand of what we track
in cooked_indexer::m_die_range_map.

Each DIE has two types of parent DIEs:
- a DIE that is the parent as indicated by the tree structure in which DIEs
  occur, and
- a DIE that represent the parent scope.

In most cases, these two are the same, but some times they're not.

The debug info above demonstrates such a case.  The DIE at 0x11f:
- has a tree-parent: the DIE representing the CU, and
- has a scope-parent: DIE 0x12c representing namespace ns.

In cooked_indexer::m_die_range_map, we track scope-parents, and the commit
tried to add a tree-parent instead.

So, I don't think we need a different fix, and propose we backport the reversal
for gdb 15.2.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31900
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32158
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32160
(cherry picked from commit a2860473ef)
2024-09-15 15:30:53 +02:00
Tom de Vries
9ca807bc5f [gdb/testsuite] Add regression test for PR32158
Consider test-case:
...
namespace ns {
  enum class ec {
    val2 = 2
  };
}

int main () {
  return (int)ns::ec::val2;
}
...
compiled with debug info:
...
$ g++ test.c -g
...

When looking at the cooked index entry for val2 using "maint print objfiles",
we get:
...
    [7] ((cooked_index_entry *) 0x7f8ecc002ef0)
    name:       val2
    canonical:  val2
    qualified:  ns::val2
    DWARF tag:  DW_TAG_enumerator
    flags:      0x0 []
    DIE offset: 0xe9
    parent:     ((cooked_index_entry *) 0x7f8ecc002e90) [ns]
...
which is wrong, there is no source level entity ns::val2.

This is PR symtab/32158.

This is a regression since commit 4e417d7bb1 ("Change handling of
DW_TAG_enumeration_type in DWARF scanner").

Reverting the commit on current trunk fixes the problem, and gets us instead:
...
    [7] ((cooked_index_entry *) 0x7fba70002ef0)
    name:       val2
    canonical:  val2
    qualified:  ns::ec::val2
    DWARF tag:  DW_TAG_enumerator
    flags:      0x0 []
    DIE offset: 0xe9
    parent:     ((cooked_index_entry *) 0x7fba70002ec0) [ec]
...

Add a regression test for this PR in test-case gdb.dwarf2/enum-type-c++.exp.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32158
(cherry picked from commit 93a20d956e)
2024-09-15 15:30:53 +02:00
Tom de Vries
cac6b1f3b0 [gdb/testsuite] Add gdb.dwarf2/enum-type-c++.exp, regression test for PR31900.
Consider the following test-case:
...
$ cat a.h
namespace ns {

class A {
public:
  enum {
    val1 = 1
  };
};

}
$ cat main.c

ns::A a;

int
main (void)
{
  return 0;
}
$ cat val1.c

int u1 = ns::A::val1;
...
compiled with debug info:
...
$ g++ main.c val1.c -g
...

When trying to print ns::A::val with current trunk and gdb 15.1 we get:
...
$ gdb -q -batch a.out -ex "print ns::A::val1"
There is no field named val1
...

This PR c++/31900.

With gdb 14.2 we get the expected:
...
$ gdb -q -batch a.out -ex "print ns::A::val1"
$1 = ns::A::val1
...

This is a regression since commit 4e417d7bb1 ("Change handling of
DW_TAG_enumeration_type in DWARF scanner").

Reverting the commit on current trunk fixes the problem.

So how does this problem happen?

First, let's consider the current trunk, with the commit reverted.

Gdb looks for the entry ns::A::val1, and find this entry:
...
    [29] ((cooked_index_entry *) 0x7f7830002ef0)
    name:       val1
    canonical:  val1
    qualified:  ns::A::val1
    DWARF tag:  DW_TAG_enumerator
    flags:      0x0 []
    DIE offset: 0x15a
    parent:     ((cooked_index_entry *) 0x7f7830002ec0) [A]
...
and expands the corresponding CU val1.c containing this debug info:
...
 <2><14a>: Abbrev Number: 3 (DW_TAG_class_type)
    <14b>   DW_AT_name        : A
    <14d>   DW_AT_byte_size   : 1
 <3><150>: Abbrev Number: 4 (DW_TAG_enumeration_type)
    <151>   DW_AT_encoding    : 7       (unsigned)
    <152>   DW_AT_byte_size   : 4
    <153>   DW_AT_type        : <0x163>
    <159>   DW_AT_accessibility: 1      (public)
 <4><15a>: Abbrev Number: 5 (DW_TAG_enumerator)
    <15b>   DW_AT_name        : val1
    <15f>   DW_AT_const_value : 1
 <4><160>: Abbrev Number: 0
 <3><161>: Abbrev Number: 0
 <2><162>: Abbrev Number: 0
...
after which it finds ns::A::val1 in the expanded symtabs.

Now let's consider the current trunk as is (so, with the commit present).

Gdb looks for the entry ns::A::val1, but doesn't find it because the val1
entry is missing its parent:
...
   [29] ((cooked_index_entry *) 0x7f5240002ef0)
    name:       val1
    canonical:  val1
    qualified:  val1
    DWARF tag:  DW_TAG_enumerator
    flags:      0x0 []
    DIE offset: 0x15a
    parent:     ((cooked_index_entry *) 0)
...

Then gdb looks for the entry ns::A, and finds this entry:
...
   [3] ((cooked_index_entry *) 0x7f5248002ec0)
    name:       A
    canonical:  A
    qualified:  ns::A
    DWARF tag:  DW_TAG_class_type
    flags:      0x0 []
    DIE offset: 0xdd
    parent:     ((cooked_index_entry *) 0x7f5248002e90) [ns]
...
which corresponds to this debug info, which doesn't contain val1
due to -fno-eliminate-unused-debug-types:
...
 <2><dd>: Abbrev Number: 3 (DW_TAG_class_type)
    <de>   DW_AT_name        : A
    <e0>   DW_AT_byte_size   : 1
 <2><e3>: Abbrev Number: 0
...

Gdb expands the corresponding CU main.c, after which it doesn't find
ns::A::val1 in the expanded symtabs.

The root cause of the problem is the missing parent on the val1
cooked_index_entry, but this only becomes user-visible through the
elaborate scenario above.

Add a test-case gdb.dwarf2/enum-type-c++.exp that contains a regression test
for this problem that doesn't rely on expansion state or
-feliminate-unused-debug-types, but simply tests for the root cause by
grepping for ns::A::val1 in the output of "maint print objfile".

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31900
(cherry picked from commit 2693187cc5)
2024-09-15 15:30:53 +02:00
GDB Administrator
b99d8c2e96 Automatic date update in version.in 2024-09-15 00:00:41 +00:00
GDB Administrator
838176b1d7 Automatic date update in version.in 2024-09-14 00:00:19 +00:00
GDB Administrator
2b19251be8 Automatic date update in version.in 2024-09-13 00:00:56 +00:00
GDB Administrator
f86feb2a7f Automatic date update in version.in 2024-09-12 00:00:37 +00:00
GDB Administrator
fa08fd1d77 Automatic date update in version.in 2024-09-11 00:00:37 +00:00
GDB Administrator
9ade3065a1 Automatic date update in version.in 2024-09-10 00:00:39 +00:00
GDB Administrator
846d33f338 Automatic date update in version.in 2024-09-09 00:00:26 +00:00
H.J. Lu
68163a5c4f gdb-15-branch: Clear the X86_XSTATE_MPX bit in XCRO for x32
commit 868883583e
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Sat Mar 23 16:17:36 2024 +0000

    gdb/arch: assert that X86_XSTATE_MPX is not set for x32

added

  if (xcr0 & X86_XSTATE_MPX)
    {
      /* MPX is not available on x32.  */
      gdb_assert (!is_x32);
      regnum = create_feature_i386_64bit_mpx (tdesc.get (), regnum);
    }

But x32 is a software convention.  There is no x32 mode in hardware and
CPU always returns the 64-bit mode XCR0 value for x32 processes.  This
regression was fixed on master branch by

commit bf616be991 (HEAD)
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Thu Jan 25 14:25:57 2024 +0000

    gdb/gdbserver: share some code relating to target description creation

which used the gdbserver code to clear the X86_XSTATE_MPX bit in XCR0 for
x32.  Fix this regression on gdb-15-branch by clearing the X86_XSTATE_MPX
bit in XCR0 for x32 in gdb.

	PR gdb/32143
	* x86-linux-nat.c (x86_linux_nat_target::read_description): Clear
	the X86_XSTATE_MPX bit in XCR0 for x32.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-09-08 16:03:09 -07:00
GDB Administrator
897204a988 Automatic date update in version.in 2024-09-08 00:00:53 +00:00
GDB Administrator
c331455027 Automatic date update in version.in 2024-09-07 00:00:52 +00:00
GDB Administrator
fdcd19f594 Automatic date update in version.in 2024-09-06 00:00:32 +00:00
GDB Administrator
1f7b8cce76 Automatic date update in version.in 2024-09-05 00:00:46 +00:00
Dmitry Neverov
9542d1b3a0 Recognize -2 as a tombstone value in .debug_line
Commit a8caed5d7f handled the tombstone
value -1 used by lld (https://reviews.llvm.org/D81784).  The
referenced lld commit also uses the tombstone value -2 for
pre-DWARF-v5
(e618ccbf43).

If not handled, -2 breaks the pc step range calculation and triggers
the assertion:

  gdb/infrun.c:2794: internal-error: resume_1: Assertion
  `pc_in_thread_step_range (pc, tp)' failed.

This commit adds -2 tombstone value and handles it in the same way as -1.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31727
Cherry-picked from e814012b2b
Approved-By: Tom Tromey <tom@tromey.com>
2024-09-04 20:38:12 +02:00
GDB Administrator
4210743723 Automatic date update in version.in 2024-09-04 00:00:33 +00:00
GDB Administrator
2daf900f61 Automatic date update in version.in 2024-09-03 00:00:43 +00:00
GDB Administrator
f74feca10c Automatic date update in version.in 2024-09-02 00:00:37 +00:00
GDB Administrator
9c8ee57a0f Automatic date update in version.in 2024-09-01 00:00:32 +00:00
GDB Administrator
865b7d5d83 Automatic date update in version.in 2024-08-31 00:00:37 +00:00
GDB Administrator
3831f9d6f1 Automatic date update in version.in 2024-08-30 00:00:36 +00:00
GDB Administrator
5b1b2884ce Automatic date update in version.in 2024-08-29 00:00:37 +00:00
GDB Administrator
1210b9b0ed Automatic date update in version.in 2024-08-28 00:00:30 +00:00
GDB Administrator
05d5112c10 Automatic date update in version.in 2024-08-27 00:00:39 +00:00
GDB Administrator
f086ab70d5 Automatic date update in version.in 2024-08-26 00:00:39 +00:00
GDB Administrator
524b5ad7db Automatic date update in version.in 2024-08-25 00:00:22 +00:00
GDB Administrator
5a8e6d7e78 Automatic date update in version.in 2024-08-24 00:00:21 +00:00
GDB Administrator
867d8e09d7 Automatic date update in version.in 2024-08-23 00:00:48 +00:00
Tom de Vries
de553d417e [gdb] Handle ^C during disassembly
In PR gdb/32025, a fatal error was reported when sending a SIGINT to gdb while
disassembling.

I managed to reproduce this on aarch64-linux in a Leap 15.5 container using
this trigger patch:
...
 gdb_disassembler_memory_reader::dis_asm_read_memory
   (bfd_vma memaddr, gdb_byte *myaddr, unsigned int len,
    struct disassemble_info *info) noexcept
 {
+  set_quit_flag ();
   return target_read_code (memaddr, myaddr, len);
 }
...
and a simple gdb command line calling the disassemble command:
...
$ gdb -q -batch a.out -ex "disassemble main"
...

The following scenario leads to the fatal error:
- the disassemble command is executed,
- set_quit_flag is called in
  gdb_disassembler_memory_reader::dis_asm_read_memory, pretending that a
  user pressed ^C,
- target_read_code calls QUIT, which throws a
  gdb_exception_quit,
- the exception propagation mechanism reaches c code in libopcodes and a fatal
  error triggers because the c code is not compiled with -fexception.

Fix this by:
- wrapping the body of gdb_disassembler_memory_reader::dis_asm_read_memory in
  catch_exceptions (which consequently needs moving to a header file), and
- reraising the caught exception in default_print_insn using QUIT.

Tested on aarch64-linux.

Approved-By: Andrew Burgess <aburgess@redhat.com>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32025
(cherry picked from commit c45c3b4162)
2024-08-22 11:43:32 +02:00
GDB Administrator
731a801b1e Automatic date update in version.in 2024-08-22 00:01:41 +00:00
GDB Administrator
2c9e05f3a6 Automatic date update in version.in 2024-08-21 00:01:36 +00:00
GDB Administrator
fa0424d0e3 Automatic date update in version.in 2024-08-20 00:00:42 +00:00
GDB Administrator
67196cabf5 Automatic date update in version.in 2024-08-19 00:00:55 +00:00
GDB Administrator
98032324bc Automatic date update in version.in 2024-08-18 00:00:33 +00:00
GDB Administrator
3aa3fd0c2e Automatic date update in version.in 2024-08-17 00:01:47 +00:00
GDB Administrator
771c98e80e Automatic date update in version.in 2024-08-16 00:00:30 +00:00
GDB Administrator
f171f7e8df Automatic date update in version.in 2024-08-15 00:01:44 +00:00
GDB Administrator
2ed13e3b58 Automatic date update in version.in 2024-08-14 00:01:01 +00:00
GDB Administrator
9e58138c75 Automatic date update in version.in 2024-08-13 00:01:12 +00:00
GDB Administrator
7b14ea4637 Automatic date update in version.in 2024-08-12 00:01:21 +00:00
GDB Administrator
a0ac39eba6 Automatic date update in version.in 2024-08-11 00:01:26 +00:00
GDB Administrator
056d54b711 Automatic date update in version.in 2024-08-10 00:01:22 +00:00
GDB Administrator
7aa46e36e1 Automatic date update in version.in 2024-08-09 00:01:32 +00:00
GDB Administrator
07f7e1c042 Automatic date update in version.in 2024-08-08 00:01:34 +00:00
Hannes Domani
b822630603 Mark unavailable bytes of limited-length arrays when allocating contents
Using 'output' to print arrays larger than max-value-size, with only
repeating elements, can cause gdb to crash:
```
$ cat a.c:
char a[1000000];

int main()
{
  return a[0];
}
$ gdb -q a
(gdb) print a
$1 = {0 '\000' <repeats 65536 times>, <unavailable> <repeats 934464 times>}
(gdb) output a

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
```

Using 'print' works, because value::record_latest sets the unavailable
bytes of the value when it's added to the value history.
But 'outout' doesn't do that, so the printing tries to access more bytes
than are available.

The original problem in PR32015 was about using 'print' of a dynamic
array in a D program.
Here the crash happens because for 'print' the value was a struct with
length/ptr fields, which is converted in d-valprint.c into an array.
So value::record_latest didn't have a chance to mark the unavailable
bytes in this case.

To make sure the unavailable bytes always match the contents, this fixes
it by marking the unavailable bytes immediately after the contents are
allocated.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32015
Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
(cherry picked from commit 8fdd2b2bcd)
2024-08-07 15:05:06 +02:00
GDB Administrator
f3fed29a2c Automatic date update in version.in 2024-08-07 00:00:40 +00:00
GDB Administrator
74b18e3538 Automatic date update in version.in 2024-08-06 00:00:57 +00:00
GDB Administrator
7ae383fd7a Automatic date update in version.in 2024-08-05 00:01:04 +00:00
GDB Administrator
a443ee2422 Automatic date update in version.in 2024-08-04 00:01:12 +00:00
GDB Administrator
1260e51a7f Automatic date update in version.in 2024-08-03 00:00:40 +00:00
GDB Administrator
87984f7698 Automatic date update in version.in 2024-08-02 00:00:52 +00:00
GDB Administrator
23b8eaaff0 Automatic date update in version.in 2024-08-01 00:01:15 +00:00
GDB Administrator
416907555e Automatic date update in version.in 2024-07-31 00:00:52 +00:00
GDB Administrator
a363b89f09 Automatic date update in version.in 2024-07-30 00:01:13 +00:00
GDB Administrator
0770a377d1 Automatic date update in version.in 2024-07-29 00:00:37 +00:00
GDB Administrator
afc5aff69f Automatic date update in version.in 2024-07-28 00:01:23 +00:00
GDB Administrator
dc36238f1d Automatic date update in version.in 2024-07-27 00:01:25 +00:00
GDB Administrator
79cc1a2d92 Automatic date update in version.in 2024-07-26 00:00:59 +00:00
GDB Administrator
278329cf8f Automatic date update in version.in 2024-07-25 00:00:57 +00:00
GDB Administrator
46042a600e Automatic date update in version.in 2024-07-24 00:01:12 +00:00
Simon Marchi
760242224f gdb/solib-frv: move lm_info object to solib
I noticed that the lm_info_frv objects created in frv_current_sos are
never moved to the solib object.  This bug was introduced in 8971d2788e
("gdb: link so_list using intrusive_list"), which mistakenly removed the
line

    sop->lm_info = std::move (li);

... probably due so a bad merge conflict resolution.

Re-add this line.

If merged in master, I would cherry-pick this to gdb-15-branch.

Change-Id: I609a1a5ad39e93f70a95ea5ebe3f8ff4ab6a8db2
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32005
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-07-23 10:34:47 -04:00
GDB Administrator
ef812cfbf2 Automatic date update in version.in 2024-07-23 00:00:44 +00:00
GDB Administrator
42fcd11a89 Automatic date update in version.in 2024-07-22 00:00:27 +00:00
GDB Administrator
bb49d104a5 Automatic date update in version.in 2024-07-21 00:01:09 +00:00
GDB Administrator
7ff33e182c Automatic date update in version.in 2024-07-20 00:00:36 +00:00
GDB Administrator
2d25abcf7d Automatic date update in version.in 2024-07-19 00:00:33 +00:00
GDB Administrator
ef1b80e913 Automatic date update in version.in 2024-07-18 00:00:35 +00:00
GDB Administrator
e9d2651cb2 Automatic date update in version.in 2024-07-17 00:00:34 +00:00
GDB Administrator
de136936c7 Automatic date update in version.in 2024-07-16 00:00:43 +00:00
Hannes Domani
e7c91a1ff9 Fix loading a saved recording
Currently you get this assertion failure if you try to execute the
inferior after loading a saved recording, when no recording was done
earlier in the same gdb session:
```
$ gdb -q c -ex "record restore test.rec"
Reading symbols from c...
[New LWP 26428]
Core was generated by `/tmp/c'.
Restored records from core file /tmp/test.rec.
(gdb) c
Continuing.
../../gdb/inferior.c:293: internal-error: inferior* find_inferior_pid(process_stratum_target*, int): Assertion `pid != 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
```

The change in step-precsave.exp triggers this bug, since now the
recording is loaded in a new gdb session, where
record_full_resume_ptid was never set.

The fix is to simply set record_full_resume_ptid when resuming a loaded
recording.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31971
Approved-By: Guinevere Larsen <blarsen@redhat.com>
2024-07-15 18:24:57 +02:00
GDB Administrator
4a8ff36655 Automatic date update in version.in 2024-07-15 00:00:21 +00:00
GDB Administrator
b178b3d8d0 Automatic date update in version.in 2024-07-14 00:00:43 +00:00
GDB Administrator
ea91792f47 Automatic date update in version.in 2024-07-13 00:00:24 +00:00
GDB Administrator
76604451b4 Automatic date update in version.in 2024-07-12 00:00:43 +00:00
GDB Administrator
8d3ad0528d Automatic date update in version.in 2024-07-11 00:00:30 +00:00
GDB Administrator
2b04f85455 Automatic date update in version.in 2024-07-10 00:01:18 +00:00
GDB Administrator
60c75436e4 Automatic date update in version.in 2024-07-09 00:00:35 +00:00
GDB Administrator
e885320150 Automatic date update in version.in 2024-07-08 00:00:25 +00:00
Joel Brobecker
f6535ad6bf Bump GDB's version number to 15.1.90.DATE-git.
This commit changes gdb/version.in to 15.1.90.DATE-git.

This commit also makes the following changes in gdb/testsuite:

	* gdb.base/default.exp: Change $_gdb_minor to 2.
2024-07-07 09:49:14 -07:00
20 changed files with 307 additions and 44 deletions

View File

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

View File

@@ -37,6 +37,7 @@
#include "auxv.h"
#include "observable.h"
#include "solib-target.h"
#include "event-top.h"
#include "gdbsupport/version.h"
@@ -1040,7 +1041,11 @@ default_print_insn (bfd_vma memaddr, disassemble_info *info)
info->mach, current_program_space->exec_bfd ());
gdb_assert (disassemble_fn != NULL);
return (*disassemble_fn) (memaddr, info);
int res = (*disassemble_fn) (memaddr, info);
QUIT;
return res;
}
/* See arch-utils.h. */

View File

@@ -197,7 +197,12 @@ gdb_disassembler_memory_reader::dis_asm_read_memory
(bfd_vma memaddr, gdb_byte *myaddr, unsigned int len,
struct disassemble_info *info) noexcept
{
return target_read_code (memaddr, myaddr, len);
auto res = catch_exceptions<int, -1> ([&]
{
return target_read_code (memaddr, myaddr, len);
});
return res;
}
/* Wrapper of memory_error. */

View File

@@ -16440,12 +16440,6 @@ cooked_indexer::index_dies (cutu_reader *reader,
flags &= ~IS_STATIC;
flags |= parent_entry->flags & IS_STATIC;
}
/* If the parent is an enum, but not an enum class, then use the
grandparent instead. */
if (this_parent_entry != nullptr
&& this_parent_entry->tag == DW_TAG_enumeration_type
&& !is_enum_class)
this_parent_entry = this_parent_entry->get_parent ();
if (abbrev->tag == DW_TAG_namespace
&& m_language == language_cplus
@@ -16505,7 +16499,15 @@ cooked_indexer::index_dies (cutu_reader *reader,
break;
case DW_TAG_enumeration_type:
info_ptr = recurse (reader, info_ptr, this_entry, fully);
/* We need to recurse even for an anonymous enumeration.
Which scope we record as the parent scope depends on
whether we're reading an "enum class". If so, we use
the enum itself as the parent, yielding names like
"enum_class::enumerator"; otherwise we inject the
names into our own parent scope. */
info_ptr = recurse (reader, info_ptr,
is_enum_class ? this_entry : parent_entry,
fully);
continue;
case DW_TAG_module:
@@ -17914,8 +17916,8 @@ public:
we're processing the end of a sequence. */
void record_line (bool end_sequence);
/* Check ADDRESS is -1, or zero and less than UNRELOCATED_LOWPC, and if true
nop-out rest of the lines in this sequence. */
/* Check ADDRESS is -1, -2, or zero and less than UNRELOCATED_LOWPC, and if
true nop-out rest of the lines in this sequence. */
void check_line_address (struct dwarf2_cu *cu,
const gdb_byte *line_ptr,
unrelocated_addr unrelocated_lowpc,
@@ -18325,13 +18327,16 @@ lnp_state_machine::check_line_address (struct dwarf2_cu *cu,
unrelocated_addr unrelocated_lowpc,
unrelocated_addr address)
{
/* Linkers resolve a symbolic relocation referencing a GC'd function to 0 or
-1. If ADDRESS is 0, ignoring the opcode will err if the text section is
/* Linkers resolve a symbolic relocation referencing a GC'd function to 0,
-1 or -2 (-2 is used by certain lld versions, see
https://github.com/llvm/llvm-project/commit/e618ccbf431f6730edb6d1467a127c3a52fd57f7).
If ADDRESS is 0, ignoring the opcode will err if the text section is
located at 0x0. In this case, additionally check that if
ADDRESS < UNRELOCATED_LOWPC. */
if ((address == (unrelocated_addr) 0 && address < unrelocated_lowpc)
|| address == (unrelocated_addr) -1)
|| address == (unrelocated_addr) -1
|| address == (unrelocated_addr) -2)
{
/* This line table is for a function which has been
GCd by the linker. Ignore it. PR gdb/12528 */

View File

@@ -24,6 +24,8 @@
#include <signal.h>
#include "extension.h"
struct cmd_list_element;
/* The current quit handler (and its type). This is called from the
@@ -81,6 +83,29 @@ extern void quit_serial_event_set ();
extern void quit_serial_event_clear ();
/* Wrap f (args) and handle exceptions by:
- returning val, and
- calling set_quit_flag or set_force_quit_flag, if needed. */
template <typename R, R val, typename F, typename... Args>
static R
catch_exceptions (F &&f, Args&&... args)
{
try
{
return f (std::forward<Args> (args)...);
}
catch (const gdb_exception &ex)
{
if (ex.reason == RETURN_QUIT)
set_quit_flag ();
else if (ex.reason == RETURN_FORCED_QUIT)
set_force_quit_flag ();
}
return val;
}
extern void display_gdb_prompt (const char *new_prompt);
extern void gdb_setup_readline (int);
extern void gdb_disable_readline (void);

View File

@@ -930,29 +930,6 @@ gdb_bfd_openw (const char *filename, const char *target)
return gdb_bfd_ref_ptr::new_reference (result);
}
/* Wrap f (args) and handle exceptions by:
- returning val, and
- calling set_quit_flag or set_force_quit_flag, if needed. */
template <typename R, R val, typename F, typename... Args>
static R
catch_exceptions (F &&f, Args&&... args)
{
try
{
return f (std::forward<Args> (args)...);
}
catch (const gdb_exception &ex)
{
if (ex.reason == RETURN_QUIT)
set_quit_flag ();
else if (ex.reason == RETURN_FORCED_QUIT)
set_force_quit_flag ();
}
return val;
}
/* See gdb_bfd.h. */
gdb_bfd_ref_ptr

View File

@@ -390,6 +390,35 @@ gdbpy_handle_exception ()
if (fetched_error.type_matches (PyExc_KeyboardInterrupt))
throw_quit ("Quit");
else if (fetched_error.type_matches (PyExc_SystemExit))
{
gdbpy_ref<> value = fetched_error.value ();
gdbpy_ref<> code (PyObject_GetAttrString (value.get (), "code"));
int exit_arg;
if (code.get () == Py_None)
{
/* CODE == None: exit status is 0. */
exit_arg = 0;
}
else if (code.get () != nullptr && PyLong_Check (code.get ()))
{
/* CODE == integer: exit status is aforementioned integer. */
exit_arg = PyLong_AsLong (code.get ());
}
else
{
if (code.get () == nullptr)
gdbpy_print_stack ();
/* Otherwise: exit status is 1, print code to stderr. */
if (msg != nullptr)
gdb_printf (gdb_stderr, "%s\n", msg.get ());
exit_arg = 1;
}
quit_force (&exit_arg, 0);
}
else if (! fetched_error.type_matches (gdbpy_gdberror_exc)
|| msg == NULL || *msg == '\0')
{

View File

@@ -2072,6 +2072,7 @@ record_full_core_target::resume (ptid_t ptid, int step,
enum gdb_signal signal)
{
record_full_resume_step = step;
record_full_resume_ptid = ptid;
record_full_resumed = 1;
record_full_execution_dir = ::execution_direction;
}

View File

@@ -382,6 +382,8 @@ frv_current_sos ()
li->map = loadmap;
li->got_value = got_addr;
li->lm_addr = lm_addr;
sop->lm_info = std::move (li);
/* Fetch the name. */
addr = extract_unsigned_integer (lm_buf.l_name,
sizeof (lm_buf.l_name),

View File

@@ -692,7 +692,7 @@ set show_conv_list \
{$_gdb_setting_str = <internal function _gdb_setting_str>} \
{$_gdb_setting = <internal function _gdb_setting>} \
{$_gdb_major = 15} \
{$_gdb_minor = 1} \
{$_gdb_minor = 3} \
{$_shell_exitsignal = void} \
{$_shell_exitcode = 0} \
}

View File

@@ -41,6 +41,8 @@ int large_2d_array[][10] = {
{90, 91, 92, 93, 94, 95, 96, 97, 98, 99}
};
char large_empty_string[100000] = "";
int
main ()
{

View File

@@ -240,3 +240,13 @@ with_test_prefix "with unlimited print elements" {
"value is not available" \
"output expression referring unavailable element from history"
}
gdb_test_no_output "set max-value-size 10000"
gdb_test_no_output "set print elements 200"
gdb_test "print large_empty_string" \
" = \\\{0 '\\\\000' <repeats 10000 times>, <unavailable> <repeats 90000 times>\\\}" \
"print large empty string which is not fully available"
gdb_test -nonl "output large_empty_string" \
"\\\{0 '\\\\000' <repeats 10000 times>, <unavailable> <repeats 90000 times>\\\}" \
"output large empty string which is not fully available"

View File

@@ -0,0 +1,35 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2024 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/>. */
namespace ns {
class A {
public:
enum {
val1 = 1
};
};
enum class ec
{
val2 = 2,
};
}
int u1 = ns::A::val1;
int u2 = (int)ns::ec::val2;

View File

@@ -0,0 +1,54 @@
# Copyright 2024 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/>.
require !readnow
load_lib dwarf.exp
# This test can only be run on targets which support DWARF-2 and use gas.
require dwarf2_support
standard_testfile main.c .cc
if { [prepare_for_testing "failed to prepare" $testfile \
[list $srcfile $srcfile2] {debug c++}] } {
return -1
}
require {string equal [have_index $binfile] ""}
set re_ws "\[ \t\]"
# Regression test for PR31900.
set val1 ns::A::val1
gdb_test_lines "maint print objfiles" \
"val1 has a parent" \
[multi_line \
"" \
"$re_ws+qualified:$re_ws+$val1" \
".*"]
gdb_test "print $val1" " = $val1"
# Regression test for PR32158.
set val2 ns::ec::val2
gdb_test_lines "maint print objfiles" \
"val2 has correct parent" \
[multi_line \
"" \
"$re_ws+qualified:$re_ws+$val2" \
".*"]
gdb_test "print $val2" " = $val2"

View File

@@ -65,6 +65,41 @@ Dwarf::assemble $asm_file {
}
}
}
cu {} {
DW_TAG_compile_unit {
{DW_AT_language @DW_LANG_C_plus_plus}
{DW_AT_name tmp.c}
{DW_AT_comp_dir /tmp}
} {
declare_labels integer_label forward
integer_label: DW_TAG_base_type {
{DW_AT_byte_size 4 DW_FORM_sdata}
{DW_AT_encoding @DW_ATE_signed}
{DW_AT_name int}
}
DW_TAG_enumeration_type {
{DW_AT_specification :$forward}
} {
DW_TAG_enumerator {
{DW_AT_name val1}
{DW_AT_const_value 1 DW_FORM_sdata}
}
}
DW_TAG_namespace {
{DW_AT_name ns}
} {
forward: DW_TAG_enumeration_type {
{DW_AT_name e}
{DW_AT_type :$integer_label}
{DW_AT_declaration 1 flag}
}
}
}
}
}
if { [prepare_for_testing "failed to prepare" ${testfile} \

View File

@@ -0,0 +1,69 @@
# Copyright 2024 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/>.
# Check that python sys.exit makes gdb exit, with the correct exit status.
require allow_python_tests
# Have this code in a proc avoids clashing with runtest variable exit_status.
proc do_test { n {expected_exit_status ""} {msg ""}} {
if { $expected_exit_status == "" } {
set expected_exit_status $n
}
with_test_prefix $n {
clean_restart
# Regression test for PR python/31946.
set seen_message 0
gdb_test_multiple "python sys.exit ($n)" "python sys.exit" {
-re "\r\n$msg\r\n" {
set seen_message 1
exp_continue
}
eof {
set wait_status [wait -i $::gdb_spawn_id]
clear_gdb_spawn_id
verbose -log "GDB process exited with wait status $wait_status"
set os_error [lindex $wait_status 2]
set exit_status [lindex $wait_status 3]
gdb_assert \
{ $os_error == 0 \
&& $exit_status == $expected_exit_status } \
$gdb_test_name
if { $msg != "" } {
gdb_assert { $seen_message }
}
}
}
}
}
# Test sys.exit (<int>).
do_test 0
do_test 1
do_test 2
# Test sys.exit (None).
do_test None 0
# Test sys.exit (<string>).
do_test {"Error Message"} 1 "Error Message"
do_test {""} 1

View File

@@ -69,6 +69,8 @@ with_timeout_factor 10 {
gdb_test "kill" "" "kill process, prepare to debug log file" \
"Kill the program being debugged\\? \\(y or n\\) " "y"
clean_restart ${binfile}
gdb_test "record restore $precsave" \
"Restored records from core file .*" \
"reload core file"

View File

@@ -1716,10 +1716,6 @@ value::record_latest ()
fetch_lazy ();
}
ULONGEST limit = m_limited_length;
if (limit != 0)
mark_bytes_unavailable (limit, m_enclosing_type->length () - limit);
/* Mark the value as recorded in the history for the availability check. */
m_in_history = true;
@@ -3931,6 +3927,11 @@ value::fetch_lazy_memory ()
if (len > 0)
read_value_memory (this, 0, stack (), addr,
contents_all_raw ().data (), len);
/* If only part of an array was loaded, mark the rest as unavailable. */
if (m_limited_length > 0)
mark_bytes_unavailable (m_limited_length,
m_enclosing_type->length () - m_limited_length);
}
/* See value.h. */

View File

@@ -1 +1 @@
15.1
15.2.90.DATE-git

View File

@@ -180,6 +180,12 @@ x86_linux_nat_target::read_description ()
xcr0 = xstateregs[(I386_LINUX_XSAVE_XCR0_OFFSET
/ sizeof (uint64_t))];
#ifdef __x86_64__
/* No MPX on x32. */
if (is_x32)
xcr0 &= ~X86_XSTATE_MPX;
#endif
m_xsave_layout = x86_fetch_xsave_layout (xcr0, x86_xsave_length ());
}
}