]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 21 Jan 2021 00:00:41 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 20 Jan 2021 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 19 Jan 2021 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 18 Jan 2021 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 17 Jan 2021 00:00:26 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agolibiberty: Support the new ("v0") mangling scheme in rust-demangle
Eduard-Mihai Burtescu [Fri, 13 Nov 2020 18:55:45 +0000 (18:55 +0000)] 
libiberty: Support the new ("v0") mangling scheme in rust-demangle

This is the libiberty (mainly for binutils/gdb) counterpart of
https://github.com/alexcrichton/rustc-demangle/pull/23.

Relevant links for the new Rust mangling scheme (aka "v0"):
* Rust RFC: https://github.com/rust-lang/rfcs/pull/2603
* tracking issue: https://github.com/rust-lang/rust/issues/60705
* implementation: https://github.com/rust-lang/rust/pull/57967

This implementation includes full support for UTF-8 identifiers
via punycode, so I've included a testcase for that as well.

libiberty/ChangeLog
2021-01-16  Eduard-Mihai Burtescu  <eddyb@lyken.rs>

* rust-demangle.c (struct rust_demangler): Add
skipping_printing and bound_lifetime_depth fields.
(eat): Add (v0-only).
(parse_integer_62): Add (v0-only).
(parse_opt_integer_62): Add (v0-only).
(parse_disambiguator): Add (v0-only).
(struct rust_mangled_ident): Add punycode{,_len} fields.
(parse_ident): Support v0 identifiers.
(print_str): Respect skipping_printing.
(print_uint64): Add (v0-only).
(print_uint64_hex): Add (v0-only).
(print_ident): Respect skipping_printing,
Support v0 identifiers.
(print_lifetime_from_index): Add (v0-only).
(demangle_binder): Add (v0-only).
(demangle_path): Add (v0-only).
(demangle_generic_arg): Add (v0-only).
(demangle_type): Add (v0-only).
(demangle_path_maybe_open_generics): Add (v0-only).
(demangle_dyn_trait): Add (v0-only).
(demangle_const): Add (v0-only).
(demangle_const_uint): Add (v0-only).
(basic_type): Add (v0-only).
(rust_demangle_callback): Support v0 symbols.
* testsuite/rust-demangle-expected: Add v0 testcases.

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 16 Jan 2021 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 15 Jan 2021 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 14 Jan 2021 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 13 Jan 2021 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 12 Jan 2021 00:00:22 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 11 Jan 2021 00:00:18 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 10 Jan 2021 00:00:21 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 9 Jan 2021 00:00:18 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years ago[gdb] Fix internal-error in process_event_stop_test
Tom de Vries [Fri, 8 Jan 2021 10:58:41 +0000 (11:58 +0100)] 
[gdb] Fix internal-error in process_event_stop_test

The function create_exception_master_breakpoint in gdb/breakpoint.c attempts
to set a master exception breakpoint in each objfile.  It tries this using
a libgcc/unwind probe, and if that fails then using the
_Unwind_DebugHook symbol:
...
   for (objfile *objfile : current_program_space->objfiles ())
     {
        /* Try using probes.  */
        if (/* successful */)
          continue;

        /* Try using _Unwind_DebugHook */
     }
...

The preference scheme works ok both if the objfile has debug info, and if it's
stripped.

But it doesn't work when the objfile has a .gnu_debuglink to a .debug file
(and the .debug file is present).  What happens is that:
- we first encounter objfile libgcc.debug
- we try using probes, and this fails
- so we try _Unwind_DebugHook, which succeeds
- next we encounter objfile libgcc
- we try using probes, and this succeeds.
So, we end up with a master exception breakpoint in both libgcc (using probes)
and libgcc.debug (using _Unwind_DebugHook).

This eventually causes:
...
(gdb) PASS: gdb.cp/nextoverthrow.exp: post-check - next over a throw 3
next^M
src/gdb/infrun.c:6384: internal-error: \
  void process_event_stop_test(execution_control_state*): \
  Assertion `ecs->event_thread->control.exception_resume_breakpoint != NULL' \
  failed.^M
A problem internal to GDB has been detected,^M
further debugging may prove unreliable.^M
Quit this debugging session? (y or n) FAIL: gdb.cp/nextoverthrow.exp: next
past catch (GDB internal error)
...

To trigger this internal-error, we need to use gcc-10 or later to compile the
test-case, such that it contains the fix for gcc PR97774 - "Incorrect line
info for try/catch".

Fix this by only trying to install the master exception breakpoint in
libgcc.debug using the _Unwind_DebugHook method, if the install using probes
in libgcc failed.

Tested on x86_64-linux.

gdb/ChangeLog:

2021-01-08  Tom de Vries  <tdevries@suse.de>

PR gdb/26881
* breakpoint.c (create_exception_master_breakpoint_probe)
(create_exception_master_breakpoint_hook): Factor out
of ...
(create_exception_master_breakpoint): ... here.  Only try to install
the master exception breakpoint in objfile.debug using the
_Unwind_DebugHook method, if the install using probes in objfile
failed.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 8 Jan 2021 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years ago[gdb/remote] Fix invalid pointer in remote_async_serial_handler
Pedro Alves [Thu, 7 Jan 2021 20:41:03 +0000 (21:41 +0100)] 
[gdb/remote] Fix invalid pointer in remote_async_serial_handler

On rare occasions, we run into this ERROR/UNRESOLVED on gdb-10-branch:
...
(gdb) PASS: gdb.multi/multi-target.exp: continue: non-stop=on: inferior 2
Remote debugging from host ::1, port 34088^M
Process outputs/gdb.multi/multi-target/multi-target created; pid = 8649^M
monitor exit^M
(gdb) Killing process(es): 8649^M
ERROR: GDB process no longer exists
GDB process exited with wait status 8627 exp14 0 0 CHILDKILLED SIGABRT SIGABRT
UNRESOLVED: gdb.multi/multi-target.exp: continue: non-stop=on: inferior 5
...

A trigger patch makes the crash happen all the time:
...
diff --git a/gdb/remote.c b/gdb/remote.c
index 71f814efb365..53ff8b63a1dc 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -14161,14 +14161,12 @@ remote_target::is_async_p ()
    will be able to delay notifying the client of an event until the
    point where an entire packet has been received.  */

-static serial_event_ftype remote_async_serial_handler;
-
 static void
 remote_async_serial_handler (struct serial *scb, void *context)
 {
-  /* Don't propogate error information up to the client.  Instead let
-     the client find out about the error by querying the target.  */
-  inferior_event_handler (INF_REG_EVENT);
+  remote_state *rs = (remote_state *) context;
+
+  mark_async_event_handler (rs->remote_async_inferior_event_token);
 }

 static void
...

And using -fsanitizer=address we can get a more elaborate error message:
...
==7196==ERROR: AddressSanitizer: heap-use-after-free on address \
  0x6170000bf258 at pc 0x000001481755 bp 0x7fff05b20840 sp 0x7fff05b20838
READ of size 8 at 0x6170000bf258 thread T0
    #0 0x1481754 in std::_Hashtable<gdbarch*, std::pair<gdbarch* const,
    remote_arch_state>, std::allocator<std::pair<gdbarch* const,
    remote_arch_state> >, std::__detail::_Select1st, std::equal_to<gdbarch*>,
    std::hash<gdbarch*>, std::__detail::_Mod_range_hashing,
    std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy,
    std::__detail::_Hashtable_traits<false, false, true>
    >::_M_bucket_index(unsigned long) const
    /usr/include/c++/11/bits/hashtable.h:719
    #1 0x147c8ab in std::_Hashtable<gdbarch*, std::pair<gdbarch* const,
    remote_arch_state>, std::allocator<std::pair<gdbarch* const,
    remote_arch_state> >, std::__detail::_Select1st, std::equal_to<gdbarch*>,
    std::hash<gdbarch*>, std::__detail::_Mod_range_hashing,
    std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy,
    std::__detail::_Hashtable_traits<false, false, true> >::find(gdbarch*
    const&) /usr/include/c++/11/bits/hashtable.h:1500
    #2 0x147852c in std::unordered_map<gdbarch*, remote_arch_state,
    std::hash<gdbarch*>, std::equal_to<gdbarch*>,
    std::allocator<std::pair<gdbarch* const, remote_arch_state> >
    >::find(gdbarch* const&) /usr/include/c++/11/bits/unordered_map.h:869
    #3 0x14306db in remote_state::get_remote_arch_state(gdbarch*)
    src/gdb/remote.c:1203
    #4 0x14309dc in remote_target::get_remote_state() src/gdb/remote.c:1232
    #5 0x1470c08 in remote_async_inferior_event_handler src/gdb/remote.c:14169
    #6 0xaa9f6b in check_async_event_handlers() src/gdb/async-event.c:295
    #7 0x1e93ab4 in gdb_do_one_event() src/gdbsupport/event-loop.cc:194
    #8 0x118f5f9 in start_event_loop src/gdb/main.c:356
    #9 0x118f8ed in captured_command_loop src/gdb/main.c:416
    #10 0x1192d6a in captured_main src/gdb/main.c:1253
    #11 0x1192dfa in gdb_main(captured_main_args*) src/gdb/main.c:1268
    #12 0x97b380 in main src/gdb/gdb.c:32
    #13 0x7f550c211349 in __libc_start_main ../csu/libc-start.c:308
    #14 0x97b199 in _start (build/gdb/gdb+0x97b199)

0x6170000bf258 is located 600 bytes inside of 648-byte region \
  [0x6170000bf000,0x6170000bf288)
freed by thread T0 here:
    #0 0x7f550f516a57 in operator delete(void*, unsigned long)
    (/usr/lib64/libasan.so.6+0xaea57)
    #1 0x148b1fe in extended_remote_target::~extended_remote_target()
    src/gdb/remote.c:958
    #2 0x143b483 in remote_target::close() src/gdb/remote.c:4074
    #3 0x16cb90f in target_close(target_ops*) src/gdb/target.c:3230
    #4 0x16a2635 in decref_target(target_ops*) src/gdb/target.c:557
    #5 0x16a2abb in target_stack::unpush(target_ops*) src/gdb/target.c:645
    #6 0x16d01ef in inferior::unpush_target(target_ops*)
    src/gdb/inferior.h:356
    #7 0x16a2877 in unpush_target(target_ops*) src/gdb/target.c:607
    #8 0x16a2adf in unpush_target_and_assert src/gdb/target.c:655
    #9 0x16a2c57 in pop_all_targets_at_and_above(strata) src/gdb/target.c:678
    #10 0x1442749 in remote_unpush_target src/gdb/remote.c:5522
    #11 0x1458c16 in remote_target::readchar(int) src/gdb/remote.c:9137
    #12 0x145b25b in remote_target::getpkt_or_notif_sane_1(std::vector<char,
    gdb::default_init_allocator<char, std::allocator<char> > >*, int, int,
    int*) src/gdb/remote.c:9683
    #13 0x145bc9a in remote_target::getpkt_sane(std::vector<char,
    gdb::default_init_allocator<char, std::allocator<char> > >*, int)
    src/gdb/remote.c:9790
    #14 0x145b040 in remote_target::getpkt(std::vector<char,
    gdb::default_init_allocator<char, std::allocator<char> > >*, int)
    src/gdb/remote.c:9623
    #15 0x145780b in remote_target::remote_read_bytes_1(unsigned long,
    unsigned char*, unsigned long, int, unsigned long*) src/gdb/remote.c:8860
    #16 0x145805e in remote_target::remote_read_bytes(unsigned long,
    unsigned char*, unsigned long, int, unsigned long*) src/gdb/remote.c:8987
    #17 0x146113a in remote_target::xfer_partial(target_object, char const*,
    unsigned char*, unsigned char const*, unsigned long, unsigned long,
    unsigned long*) src/gdb/remote.c:10987
    #18 0x16a4004 in raw_memory_xfer_partial(target_ops*, unsigned char*,
    unsigned char const*, unsigned long, long, unsigned long*)
    src/gdb/target.c:918
    #19 0x16a4fcf in target_xfer_partial(target_ops*, target_object, char
    const*, unsigned char*, unsigned char const*, unsigned long, unsigned
    long, unsigned long*) src/gdb/target.c:1156
    #20 0x16a5d65 in target_read_partial src/gdb/target.c:1387
    #21 0x16a5f19 in target_read(target_ops*, target_object, char const*,
    unsigned char*, unsigned long, long) src/gdb/target.c:1427
    #22 0x16a5666 in target_read_raw_memory(unsigned long, unsigned char*,
    long) src/gdb/target.c:1260
    #23 0xd22f2a in dcache_read_line src/gdb/dcache.c:336
    #24 0xd232b7 in dcache_peek_byte src/gdb/dcache.c:403
    #25 0xd23845 in dcache_read_memory_partial(target_ops*, dcache_struct*,
    unsigned long, unsigned char*, unsigned long, unsigned long*) src/gdb/dcache.c:484
    #26 0x16a47da in memory_xfer_partial_1 src/gdb/target.c:1041
    #27 0x16a4a1e in memory_xfer_partial src/gdb/target.c:1084
    #28 0x16a4f44 in target_xfer_partial(target_ops*, target_object,
    char const*, unsigned char*, unsigned char const*, unsigned long,
    unsigned long, unsigned long*) src/gdb/target.c:1141
    #29 0x18203d4 in read_value_memory(value*, long, int, unsigned long,
    unsigned char*, unsigned long) src/gdb/valops.c:956

previously allocated by thread T0 here:
    #0 0x7f550f515c37 in operator new(unsigned long)
    (/usr/lib64/libasan.so.6+0xadc37)
    #1 0x14429f0 in remote_target::open_1(char const*, int, int)
    src/gdb/remote.c:5562
    #2 0x14405e6 in extended_remote_target::open(char const*, int)
    src/gdb/remote.c:4907
    #3 0x16a0f3c in open_target src/gdb/target.c:242
    #4 0xc19ff5 in do_sfunc src/gdb/cli/cli-decode.c:111
    #5 0xc221db in cmd_func(cmd_list_element*, char const*, int)
    src/gdb/cli/cli-decode.c:2181
    #6 0x16feda6 in execute_command(char const*, int) src/gdb/top.c:668
    #7 0xee9dc9 in command_handler(char const*) src/gdb/event-top.c:588
    #8 0xeea6a8 in command_line_handler(std::unique_ptr<char,
    gdb::xfree_deleter<char> >&&) src/gdb/event-top.c:773
    #9 0xee8a12 in gdb_rl_callback_handler src/gdb/event-top.c:219
    #10 0x7f550f24aead in rl_callback_read_char
    (/lib64/libreadline.so.7+0x31ead)
...

The problem is here in remote_async_inferior_event_handler:
...
static void
remote_async_inferior_event_handler (gdb_client_data data)
{
  inferior_event_handler (INF_REG_EVENT);

  remote_target *remote = (remote_target *) data;
  remote_state *rs = remote->get_remote_state ();
...

The remote target (passed in the data argument) can be destroyed during the
call to inferior_event_handler.  If so, the call to remote->get_remote_state
() is done using a dangling pointer.

Fix this by increasing the reference count on the remote target before calling
inferior_event_handler, such that it won't get destroyed until right before
returning from remote_async_inferior_event_handler.

Tested on x86_64-linux.

Intended for gdb-10-branch.

The problem has stopped reproducing with the trigger patch since master commit
79952e69634 "Make scoped_restore_current_thread's cdtors exception free
(RFC)".  We could still apply this to master though.

gdb/ChangeLog:

2021-01-07  Pedro Alves  <pedro@palves.net>
    Simon Marchi  <simon.marchi@polymtl.ca>
    Tom de Vries  <tdevries@suse.de>

PR remote/26614
* remote.c (remote_async_inferior_event_handler):  Hold a strong
reference to the remote target while handling an event.

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 7 Jan 2021 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 6 Jan 2021 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 5 Jan 2021 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 4 Jan 2021 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 3 Jan 2021 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 2 Jan 2021 00:00:20 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoManual updates of copyright year range not covered by gdb/copyright.py
Joel Brobecker [Fri, 1 Jan 2021 08:24:28 +0000 (12:24 +0400)] 
Manual updates of copyright year range not covered by gdb/copyright.py

gdb/ChangeLog:

        * gdbarch.sh: Update copyright year range.

gdb/doc/ChangeLog:

        * gdb.texinfo, refcard.tex: Update copyright year range.

(cherry picked from commit b5b5650a49f326a63fcf79db280f11c01ba7da9f)

4 years agoUpdate copyright year range in all GDB files
Joel Brobecker [Fri, 1 Jan 2021 08:22:49 +0000 (12:22 +0400)] 
Update copyright year range in all GDB files

This commits the result of running gdb/copyright.py as per our Start
of New Year procedure...

gdb/ChangeLog

        Update copyright year range in copyright header of all GDB files.

4 years agogdb/copyright.py: Also update sources in "gdbserver" and "gdbsupport"
Joel Brobecker [Fri, 1 Jan 2021 07:56:12 +0000 (11:56 +0400)] 
gdb/copyright.py: Also update sources in "gdbserver" and "gdbsupport"

This commit adjusts GDB's copyright.py script, following two past changes:
  - gdb/gdbserver/ being move to the toplevel directory;
  - gdb/common/ being renamed to gdbsupport/.

gdb/ChangeLog:

        * copyright.py (get_update_list): Add "gdbserver" and "gdbsupport"
        to the list of directories to update.

(cherry picked from commit ff7e39b613503fa5d7417e284ee2549117efdb91)

4 years agoUpdate copyright year in version message for gdb, gdbserver and gdbreplay
Joel Brobecker [Fri, 1 Jan 2021 07:53:14 +0000 (11:53 +0400)] 
Update copyright year in version message for gdb, gdbserver and gdbreplay

gdb/ChangeLog:

        * top.c (print_gdb_version): Update copyright year.

gdbserver/ChangeLog:

        * server.cc (gdbserver_version): Update copyright year.
        * gdbreplay.cc (gdbreplay_version): Likewise.

(cherry picked from commit 2b47c078fd49164af654744cef9bb8135069199b)

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 1 Jan 2021 00:00:17 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 31 Dec 2020 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 30 Dec 2020 00:00:22 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 29 Dec 2020 00:00:19 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 28 Dec 2020 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 27 Dec 2020 00:00:34 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoFix capitalization in the GDB manual
Jeanne Rasata [Mon, 14 Dec 2020 14:00:24 +0000 (09:00 -0500)] 
Fix capitalization in the GDB manual

gdb/doc/ChangeLog:
2020-12-26  Jeanne Rasata <jeanne@fsf.org>

* gdb.texinfo: Fix capitalization in many sections following CMS
style-guide rules, remove period at end of a few headings.

Copyright-paperwork-exempt: yes

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 26 Dec 2020 00:00:16 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 25 Dec 2020 00:00:22 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 24 Dec 2020 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 23 Dec 2020 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 22 Dec 2020 00:00:31 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 21 Dec 2020 00:00:17 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 20 Dec 2020 00:00:18 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 19 Dec 2020 00:00:17 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 18 Dec 2020 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 17 Dec 2020 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 16 Dec 2020 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 15 Dec 2020 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 14 Dec 2020 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 13 Dec 2020 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 12 Dec 2020 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 11 Dec 2020 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 10 Dec 2020 00:00:35 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogdb: address review comments of previous series
Simon Marchi [Wed, 9 Dec 2020 19:49:02 +0000 (14:49 -0500)] 
gdb: address review comments of previous series

I forgot to include fixes for review comments I got before pushing the
previous commits (or I pushed the wrong commits).  This one fixes it.

 - Return {} instead of false in get_discrete_low_bound and
   get_discrete_high_bound.
 - Compute high bound after confirming low bound is valid in
   get_discrete_bounds.

gdb/ChangeLog:

* gdbtypes.c (get_discrete_low_bound, get_discrete_high_bound):
Return {} instead of false.
(get_discrete_bounds): Compute high bound only if low bound is
valid.

Change-Id: I5f9a66b3672adfac9441068c899ab113ab2c331a

4 years agogdb: fix value_subscript when array upper bound is not known
Simon Marchi [Wed, 9 Dec 2020 18:52:12 +0000 (13:52 -0500)] 
gdb: fix value_subscript when array upper bound is not known

Since commit 7c6f27129631 ("gdb: make get_discrete_bounds check for
non-constant range bounds"), subscripting  flexible array member fails:

    struct no_size
    {
      int n;
      int items[];
    };

    (gdb) p *ns
    $1 = {n = 3, items = 0x5555555592a4}
    (gdb) p ns->items[0]
    Cannot access memory at address 0xfffe555b733a0164
    (gdb) p *((int *) 0x5555555592a4)
    $2 = 101  <--- we would expect that
    (gdb) p &ns->items[0]
    $3 = (int *) 0xfffe5559ee829a24  <--- wrong address

Since the flexible array member (items) has an unspecified size, the array type
created for it in the DWARF doesn't have dimensions (this is with gcc 9.3.0,
Ubuntu 20.04):

    0x000000a4:   DW_TAG_array_type
                    DW_AT_type [DW_FORM_ref4]       (0x00000038 "int")
                    DW_AT_sibling [DW_FORM_ref4]    (0x000000b3)

    0x000000ad:     DW_TAG_subrange_type
                      DW_AT_type [DW_FORM_ref4]     (0x00000031 "long unsigned int")

This causes GDB to create a range type (TYPE_CODE_RANGE) with a defined
constant low bound (dynamic_prop with kind PROP_CONST) and an undefined
high bound (dynamic_prop with kind PROP_UNDEFINED).

value_subscript gets both bounds of that range using
get_discrete_bounds.  Before commit 7c6f27129631, get_discrete_bounds
didn't check the kind of the dynamic_props and would just blindly read
them as if they were PROP_CONST.  It would return 0 for the high bound,
because we zero-initialize the range_bounds structure.  And it didn't
really matter in this case, because the returned high bound wasn't used
in the end.

Commit 7c6f27129631 changed get_discrete_bounds to return a failure if
either the low or high bound is not a constant, to make sure we don't
read a dynamic prop that isn't a PROP_CONST as a PROP_CONST.  This
change made get_discrete_bounds start to return a failure for that
range, and as a result would not set *lowp and *highp.  And since
value_subscript doesn't check get_discrete_bounds' return value, it just
carries on an uses an uninitialized value for the low bound.  If
value_subscript did check the return value of get_discrete_bounds, we
would get an error message instead of a bogus value.  But it would still
be a bug, as we wouldn't be able to print the flexible array member's
elements.

Looking at value_subscript, we see that the low bound is always needed,
but the high bound is only needed if !c_style.  So, change
value_subscript to use get_discrete_low_bound and
get_discrete_high_bound separately.  This fixes the case described
above, where the low bound is known but the high bound isn't (and is not
needed).  This restores the original behavior without accessing a
dynamic_prop in a wrong way.

A test is added.  In addition to the case described above, a case with
an array member of size 0 is added, which is a GNU C extension that
existed before flexible array members were introduced.  That case
currently fails when compiled with gcc <= 8.  gcc <= 8 produces DWARF
similar to the one shown above, while gcc 9 adds a DW_AT_count of 0 in
there, which makes the high bound known.  A case where an array member
of size 0 is the only member of the struct is also added, as that was
how PR 28675 was originally reported, and it's an interesting corner
case that I think could trigger other funny bugs.

Question about the implementation: in value_subscript, I made it such
that if the low or high bound is unknown, we fall back to zero.  That
effectively makes it the same as it was before 7c6f27129631.  But should
we instead error() out?

gdb/ChangeLog:

PR 26875, PR 26901
* gdbtypes.c (get_discrete_low_bound): Make non-static.
(get_discrete_high_bound): Make non-static.
* gdbtypes.h (get_discrete_low_bound): New declaration.
(get_discrete_high_bound): New declaration.
* valarith.c (value_subscript): Only fetch high bound if
necessary.

gdb/testsuite/ChangeLog:

PR 26875, PR 26901
* gdb.base/flexible-array-member.c: New test.
* gdb.base/flexible-array-member.exp: New test.

Change-Id: I832056f80e6c56f621f398b4780d55a3a1e299d7

4 years agogdb: split get_discrete_bounds in two
Simon Marchi [Wed, 9 Dec 2020 18:52:03 +0000 (13:52 -0500)] 
gdb: split get_discrete_bounds in two

get_discrete_bounds is not flexible for ranges (TYPE_CODE_RANGE), in the
sense that it returns true (success) only if both bounds are present and
constant values.

This is a problem for code that only needs to know the low bound and
fails unnecessarily if the high bound is unknown.

Split the function in two, get_discrete_low_bound and
get_discrete_high_bound, that both return an optional.  Provide a new
implementation of get_discrete_bounds based on the two others, so the
callers don't have to be changed.

gdb/ChangeLog:

* gdbtypes.c (get_discrete_bounds): Implement with
get_discrete_low_bound and get_discrete_high_bound.
(get_discrete_low_bound): New.
(get_discrete_high_bound): New.

Change-Id: I986b5e9c0dd969800e3fb9546af9c827d52e80d0

4 years agogdb: make get_discrete_bounds return bool
Simon Marchi [Wed, 9 Dec 2020 18:51:57 +0000 (13:51 -0500)] 
gdb: make get_discrete_bounds return bool

get_discrete_bounds currently has three possible return values (see its
current doc for details).  It appears that for all callers, it would be
sufficient to have a boolean "worked" / "didn't work" return value.

Change the return type of get_discrete_bounds to bool and adjust all
callers.  Doing so simplifies the following patch.

gdb/ChangeLog:

* gdbtypes.h (get_discrete_bounds): Return bool, adjust all
callers.
* gdbtypes.c (get_discrete_bounds): Return bool.

Change-Id: Ie51feee23c75f0cd7939742604282d745db59172

4 years agogdb: make discrete_position return optional
Simon Marchi [Wed, 9 Dec 2020 18:51:45 +0000 (13:51 -0500)] 
gdb: make discrete_position return optional

Instead of returning a boolean status and returning the value through a
pointer, return an optional that does both jobs.  This helps in the
following patches, and I think it is an improvement in general.

gdb/ChangeLog:

* ada-lang.c (ada_value_slice_from_ptr): Adjust.
(ada_value_slice): Adjust.
(pos_atr): Adjust.
* gdbtypes.c (get_discrete_bounds): Adjust.
(discrete_position): Return optional.
* gdbtypes.h (discrete_position): Return optional.

Change-Id: I758dbd8858b296ee472ed39ec35db1dbd624a5ae

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 9 Dec 2020 00:00:44 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 8 Dec 2020 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 7 Dec 2020 00:00:34 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agos390: Fix BC instruction breakpoint handling
Giancarlo Frix [Sun, 6 Dec 2020 10:30:53 +0000 (14:30 +0400)] 
s390: Fix BC instruction breakpoint handling

This fixes a long-lived bug in the s390 port.

When trying to step over a breakpoint set on a BC (branch on condition)
instruction with displaced stepping on IBM Z, gdb would incorrectly
adjust the pc regardless of whether or not the branch was taken. Since
the branch target is an absolute address, this would cause the inferior
to jump around wildly whenever the branch was taken, either crashing it
or causing it to behave unpredictably.

It turns out that the logic to handle BC instructions correctly was in
the code, but that the enum value representing its opcode has always
been incorrect.

This patch corrects the enum value to the actual opcode, fixing the
stepping problem. The enum value is also used in the prologue analysis
code, so this also fixes a minor bug where more of the prologue would
be read than was necessary.

gdb/ChangeLog:

        PR breakpoints/27009
        * s390-tdep.h (op_bc): Correct BC opcode value.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 6 Dec 2020 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 5 Dec 2020 00:00:28 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoUpdate gdb/ChangeLog to reflect the PR for a bug fix
Shahab Vahedi [Fri, 4 Dec 2020 15:28:37 +0000 (16:28 +0100)] 
Update gdb/ChangeLog to reflect the PR for a bug fix

This is just an update in the gdb/ChangeLog to reflect a newly
created PR [27015] for a bugfix commit:

abaf3df9  arc: Write correct "eret" value during register collection

4 years agoarc: Write correct "eret" value during register collection
Shahab Vahedi [Thu, 12 Nov 2020 11:50:33 +0000 (12:50 +0100)] 
arc: Write correct "eret" value during register collection

In collect_register() function of arc-linux-tdep.c, the "eret"
(exception return) register value was not being reported correctly.
This patch fixes that.

Background:
When asked for the "pc" value, we have to update the "eret" register
with GDB's STOP_PC.  The "eret" instructs the kernel code where to
jump back when an instruction has stopped due to a breakpoint.  This
is how collect_register() was doing so:

--------------8<--------------
  if (regnum == gdbarch_pc_regnum (gdbarch))
    regnum = ARC_ERET_REGNUM;
  regcache->raw_collect (regnum, buf + arc_linux_core_reg_offsets[regnum]);
-------------->8--------------

Root cause:
Although this is using the correct offset (ERET register's), it is also
changing the REGNUM itself.  Therefore, raw_collect (regnum, ...) is
not reading from "pc" anymore.

v2:
- Fix a copy/paste issue as rightfully addressed by Tom [1].

[1]
https://sourceware.org/pipermail/gdb-patches/2020-November/173208.html

gdb/ChangeLog:

* arc-linux-tdep.c (collect_register): Populate "eret" by
"pc" value from the regcache when asked for "pc" value.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 4 Dec 2020 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 3 Dec 2020 00:00:34 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 2 Dec 2020 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 1 Dec 2020 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 30 Nov 2020 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoFix Value.format_string docu for static members argument
Hannes Domani [Tue, 24 Nov 2020 18:43:19 +0000 (19:43 +0100)] 
Fix Value.format_string docu for static members argument

The argument is called static_members, not static_fields.

gdb/doc/ChangeLog:

2020-11-29  Hannes Domani  <ssbssa@yahoo.de>

PR python/26974
* python.texi: Fix docu for static members argument.

4 years agoDon't delete the locator win info
Hannes Domani [Thu, 19 Nov 2020 15:49:53 +0000 (16:49 +0100)] 
Don't delete the locator win info

The locator win info is special because it is static, all the others are
created dynamically.

gdb/ChangeLog:

2020-11-29  Hannes Domani  <ssbssa@yahoo.de>

PR tui/26973
* tui/tui-layout.c (tui_apply_current_layout): Don't delete the
static locator win info.

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 29 Nov 2020 00:00:41 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 28 Nov 2020 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 27 Nov 2020 00:00:55 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 26 Nov 2020 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 25 Nov 2020 00:00:35 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 24 Nov 2020 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 23 Nov 2020 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 22 Nov 2020 00:00:35 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 21 Nov 2020 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 20 Nov 2020 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 19 Nov 2020 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 18 Nov 2020 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 17 Nov 2020 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 16 Nov 2020 00:00:35 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 15 Nov 2020 00:00:33 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 14 Nov 2020 00:00:40 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 13 Nov 2020 00:00:54 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 12 Nov 2020 00:00:45 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 11 Nov 2020 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 10 Nov 2020 00:00:48 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 9 Nov 2020 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sun, 8 Nov 2020 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Sat, 7 Nov 2020 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agogdb: better static python detection in configure machinery
Romain Geissler [Fri, 6 Nov 2020 17:47:21 +0000 (17:47 +0000)] 
gdb: better static python detection in configure machinery

In python 3, itertools is a builtin module, so whether or not the
python you link against is a shared or a static one, importing it
works.

Change the import test to use ctypes which is a dynamic module in both
python 2 and 3.

gdb/ChangeLog:

PR python/26832
* configure: Regenerate.
* configure.ac: Check for python modules ctypes instead of
itertools.

4 years agoAutomatic date update in version.in
GDB Administrator [Fri, 6 Nov 2020 00:00:49 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Thu, 5 Nov 2020 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Wed, 4 Nov 2020 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Tue, 3 Nov 2020 00:00:41 +0000 (00:00 +0000)] 
Automatic date update in version.in

4 years agoAutomatic date update in version.in
GDB Administrator [Mon, 2 Nov 2020 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in