Commit Graph

112623 Commits

Author SHA1 Message Date
GDB Administrator
c9cdea72da Automatic date update in version.in 2023-05-20 00:01:19 +00:00
GDB Administrator
dd397e126a Automatic date update in version.in 2023-05-19 00:01:15 +00:00
GDB Administrator
9fa7f3deb2 Automatic date update in version.in 2023-05-18 00:00:59 +00:00
GDB Administrator
0459630d58 Automatic date update in version.in 2023-05-17 00:01:02 +00:00
Khem Raj
186143c39e gdbserver/linux-low.cc: Fix a typo in ternary operator
Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 2e977d9901)
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30450
2023-05-16 10:52:49 -06:00
GDB Administrator
53d9d0516b Automatic date update in version.in 2023-05-16 00:00:59 +00:00
Tom Tromey
49664141e1 Correctly handle forward DIE references in scanner
The cooked index scanner has special code to handle forward DIE
references.  However, a bug report lead to the discovery that this
code does not work -- the "deferred_entry::spec_offset" field is
written to but never used, i.e., the lookup is done using the wrong
key.

This patch fixes the bug and adds a regression test.

The test in the bug itself used a thread_local variable, which
provoked a failure at runtime.  This test instead uses "maint print
objfiles" and then inspects to ensure that the entry in question has a
parent.  This lets us avoid a clang dependency in the test.

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

(cherry picked from commit b10f2cd3f3)
2023-05-15 09:10:33 -06:00
GDB Administrator
df7e1a3c15 Automatic date update in version.in 2023-05-15 00:00:58 +00:00
GDB Administrator
29d0a4928e Automatic date update in version.in 2023-05-14 00:00:46 +00:00
GDB Administrator
dab27b8a37 Automatic date update in version.in 2023-05-13 00:00:51 +00:00
GDB Administrator
dbaf8426ea Automatic date update in version.in 2023-05-12 00:01:41 +00:00
GDB Administrator
bf1abbf3a1 Automatic date update in version.in 2023-05-11 00:00:45 +00:00
GDB Administrator
54fb01a5c4 Automatic date update in version.in 2023-05-10 00:01:45 +00:00
GDB Administrator
2f464f5237 Automatic date update in version.in 2023-05-09 00:01:28 +00:00
GDB Administrator
26570c3c45 Automatic date update in version.in 2023-05-08 00:01:13 +00:00
GDB Administrator
28962d16b6 Automatic date update in version.in 2023-05-07 00:01:03 +00:00
GDB Administrator
8415822ffa Automatic date update in version.in 2023-05-06 00:00:54 +00:00
Simon Marchi
caaf38247f gdb: fix -Wsingle-bit-bitfield-constant-conversion warning in z80-tdep.c
When building with clang 16, I see:

    /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:338:32: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
            info->prologue_type.load_args = 1;
                                          ^ ~
    /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:345:36: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
          info->prologue_type.critical = 1;
                                       ^ ~
    /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:351:37: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
          info->prologue_type.interrupt = 1;
                                        ^ ~
    /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:367:36: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
                  info->prologue_type.fp_sdcc = 1;
                                              ^ ~
    /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:375:35: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
          info->prologue_type.fp_sdcc = 1;
                                      ^ ~
    /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:380:35: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
          info->prologue_type.fp_sdcc = 1;
                                      ^ ~

Fix that by using "unsigned int" as the bitfield's underlying type.

(cherry picked from commit 07f2859348)

Change-Id: I3550a0112f993865dc70b18f02ab11bb5012693d
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30423
Approved-By: Tom Tromey <tom@tromey.com>
2023-05-05 15:27:06 -04:00
Simon Marchi
12e3f3bc6e gdbsupport: ignore -Wenum-constexpr-conversion in enum-flags.h
When building with clang 16, we get:

      CXX    gdb.o
    In file included from /home/smarchi/src/binutils-gdb/gdb/gdb.c:19:
    In file included from /home/smarchi/src/binutils-gdb/gdb/defs.h:65:
    /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/enum-flags.h:95:52: error: integer value -1 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
        integer_for_size<sizeof (T), static_cast<bool>(T (-1) < T (0))>::type
                                                       ^

The error message does not make it clear in the context of which enum
flag this fails (i.e. what is T in this context), but it doesn't really
matter, we have similar warning/errors for many of them, if we let the
build go through.

clang is right that the value -1 is invalid for the enum type we cast -1
to.  However, we do need this expression in order to select an integer
type with the appropriate signedness.  That is, with the same signedness
as the underlying type of the enum.

I first wondered if that was really needed, if we couldn't use
std::underlying_type for that.  It turns out that the comment just above
says:

    /* Note that std::underlying_type<enum_type> is not what we want here,
       since that returns unsigned int even when the enum decays to signed
       int.  */

I was surprised, because std::is_signed<std::underlying_type<enum_type>>
returns the right thing.  So I tried replacing all this with
std::underlying_type, see if that would work.  Doing so causes some
build failures in unittests/enum-flags-selftests.c:

      CXX    unittests/enum-flags-selftests.o
    /home/smarchi/src/binutils-gdb/gdb/unittests/enum-flags-selftests.c:254:1: error: static assertion failed due to requirement 'gdb::is_same<selftests::enum_flags_tests::check_valid_expr254::archetype<enum_flags<s
    elftests::enum_flags_tests::RE>, selftests::enum_flags_tests::RE, enum_flags<selftests::enum_flags_tests::RE2>, selftests::enum_flags_tests::RE2, enum_flags<selftests::enum_flags_tests::URE>, selftests::enum_fla
    gs_tests::URE, int>, selftests::enum_flags_tests::check_valid_expr254::archetype<enum_flags<selftests::enum_flags_tests::RE>, selftests::enum_flags_tests::RE, enum_flags<selftests::enum_flags_tests::RE2>, selfte
    sts::enum_flags_tests::RE2, enum_flags<selftests::enum_flags_tests::URE>, selftests::enum_flags_tests::URE, unsigned int>>::value == true':
    CHECK_VALID (true,  int,  true ? EF () : EF2 ())
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/smarchi/src/binutils-gdb/gdb/unittests/enum-flags-selftests.c:91:3: note: expanded from macro 'CHECK_VALID'
      CHECK_VALID_EXPR_6 (EF, RE, EF2, RE2, UEF, URE, VALID, EXPR_TYPE, EXPR)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/valid-expr.h:105:3: note: expanded from macro 'CHECK_VALID_EXPR_6'
      CHECK_VALID_EXPR_INT (ESC_PARENS (typename T1, typename T2,           \
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/smarchi/src/binutils-gdb/gdb/../gdbsupport/valid-expr.h:66:3: note: expanded from macro 'CHECK_VALID_EXPR_INT'
      static_assert (gdb::is_detected_exact<archetype<TYPES, EXPR_TYPE>,    \
      ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is a bit hard to decode, but basically enumerations have the
following funny property that they decay into a signed int, even if
their implicit underlying type is unsigned.  This code:

    enum A {};
    enum B {};

    int main() {
      std::cout << std::is_signed<std::underlying_type<A>::type>::value
                << std::endl;
      std::cout << std::is_signed<std::underlying_type<B>::type>::value
                << std::endl;
      auto result = true ? A() : B();
      std::cout << std::is_signed<decltype(result)>::value << std::endl;
    }

produces:

    0
    0
    1

So, the "CHECK_VALID" above checks that this property works for enum flags the
same way as it would if you were using their underlying enum types.  And
somehow, changing integer_for_size to use std::underlying_type breaks that.

Since the current code does what we want, and I don't see any way of doing it
differently, ignore -Wenum-constexpr-conversion around it.

(cherry picked from commit ae61525fcf)

Change-Id: Ibc82ae7bbdb812102ae3f1dd099fc859dc6f3cc2
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30423
Approved-By: Tom Tromey <tom@tromey.com>
2023-05-05 15:27:04 -04:00
GDB Administrator
1eee7aa650 Automatic date update in version.in 2023-05-05 00:00:57 +00:00
GDB Administrator
e3c9db5ea3 Automatic date update in version.in 2023-05-04 00:00:45 +00:00
GDB Administrator
6c6747bc53 Automatic date update in version.in 2023-05-03 00:01:18 +00:00
GDB Administrator
6a880a3ac0 Automatic date update in version.in 2023-05-02 00:01:02 +00:00
GDB Administrator
372e8383ca Automatic date update in version.in 2023-05-01 00:01:01 +00:00
GDB Administrator
3c79bd3620 Automatic date update in version.in 2023-04-30 00:00:56 +00:00
GDB Administrator
106c36ff21 Automatic date update in version.in 2023-04-29 00:01:09 +00:00
GDB Administrator
a49112870d Automatic date update in version.in 2023-04-28 00:00:53 +00:00
GDB Administrator
10765a6650 Automatic date update in version.in 2023-04-27 00:01:02 +00:00
GDB Administrator
81b693a4e7 Automatic date update in version.in 2023-04-26 00:01:07 +00:00
GDB Administrator
3c2fcf70d6 Automatic date update in version.in 2023-04-25 00:00:58 +00:00
GDB Administrator
e78b5e649a Automatic date update in version.in 2023-04-24 00:00:46 +00:00
GDB Administrator
08af75307f Automatic date update in version.in 2023-04-23 00:01:14 +00:00
WANG Rui
3310ec8b5b gdb: Fix false match issue in skip_prologue_using_linetable
[ Changes in v2:
  - rebase on trunk
  Changes in v3:
  - add test-case ]

We should exclude matches to the ending PC to prevent false matches with the
next function, as prologue_end is located at the end PC.

  <fun1>:
    0x00: ... <-- start_pc
    0x04: ...
    0x08: ... <-- breakpoint
    0x0c: ret
  <fun2>:
    0x10: ret <-- end_pc | prologue_end of fun2

Tested on x86_64-linux.

Co-Authored-By: WANG Rui <r@hev.cc> (fix, tiny change [1])
Co-Authored-By: Tom de Vries <tdevries@suse.de> (test-case)
Approved-by: Kevin Buettner <kevinb@redhat.com>

[1] https://www.gnu.org/prep/maintain/html_node/Legally-Significant.html

PR symtab/30369
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30369
2023-04-22 09:33:45 +02:00
GDB Administrator
6f0d75747f Automatic date update in version.in 2023-04-22 00:00:37 +00:00
GDB Administrator
1c2960e25c Automatic date update in version.in 2023-04-21 00:00:41 +00:00
GDB Administrator
e907ecf5e0 Automatic date update in version.in 2023-04-20 00:00:36 +00:00
GDB Administrator
b89160c2d8 Automatic date update in version.in 2023-04-19 00:01:21 +00:00
Tom de Vries
69eedc8e31 [gdb/symtab] Handle empty file name in .debug_line section
With DWARF 5, it's possible to produce an empty file name in the File Name
Table of the .debug_line section:
...
 The File Name Table (offset 0x112, lines 1, columns 2):
  Entry Dir     Name
  0     1       (indirect line string, offset: 0x2d):
...

Currently, when gdb reads an exec containing such debug info, it segfaults:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
0x000000000072cd38 in dwarf2_start_subfile (cu=0x2badc50, fe=..., lh=...) at \
  gdb/dwarf2/read.c:18716
18716     if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
...
because read_direct_string transforms "" into a nullptr, and we end up
dereferencing the nullptr.

Note that the behaviour of read_direct_string has been present since repo
creation.

Fix this in read_formatted_entries, by transforming nullptr filenames in to ""
filenames.

Tested on x86_64-linux.

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

PR symtab/30357
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30357
2023-04-18 05:47:21 +02:00
GDB Administrator
05eafba441 Automatic date update in version.in 2023-04-18 00:01:13 +00:00
GDB Administrator
264563f173 Automatic date update in version.in 2023-04-17 00:00:58 +00:00
GDB Administrator
7559342d20 Automatic date update in version.in 2023-04-16 00:01:02 +00:00
GDB Administrator
3b8178bea2 Automatic date update in version.in 2023-04-15 00:00:56 +00:00
GDB Administrator
ae435ba3a4 Automatic date update in version.in 2023-04-14 00:00:56 +00:00
GDB Administrator
cb9fbf2694 Automatic date update in version.in 2023-04-13 00:00:37 +00:00
GDB Administrator
116524243e Automatic date update in version.in 2023-04-12 00:00:34 +00:00
GDB Administrator
7840e64290 Automatic date update in version.in 2023-04-11 00:00:34 +00:00
GDB Administrator
38e89bef80 Automatic date update in version.in 2023-04-10 00:00:55 +00:00
GDB Administrator
30c525d47f Automatic date update in version.in 2023-04-09 00:00:40 +00:00
GDB Administrator
35bcb4f14a Automatic date update in version.in 2023-04-08 00:00:50 +00:00
GDB Administrator
c35a7c837c Automatic date update in version.in 2023-04-07 00:00:31 +00:00