GDB Administrator [Wed, 12 Jun 2019 00:00:58 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 11 Jun 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 10 Jun 2019 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 9 Jun 2019 00:01:36 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 8 Jun 2019 00:01:47 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 7 Jun 2019 00:00:54 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 6 Jun 2019 00:00:53 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 5 Jun 2019 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 4 Jun 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 3 Jun 2019 00:01:37 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 2 Jun 2019 00:01:36 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 1 Jun 2019 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 31 May 2019 00:00:57 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 30 May 2019 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 29 May 2019 00:01:02 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 28 May 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 27 May 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 26 May 2019 00:01:29 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 25 May 2019 00:01:01 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 24 May 2019 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 23 May 2019 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 22 May 2019 00:00:54 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 21 May 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 20 May 2019 00:01:02 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 19 May 2019 00:01:37 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 18 May 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 17 May 2019 00:00:54 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 16 May 2019 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 15 May 2019 00:00:53 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 14 May 2019 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 13 May 2019 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 12 May 2019 00:01:39 +0000 (00:01 +0000)]
Automatic date update in version.in
Joel Brobecker [Sat, 11 May 2019 18:37:30 +0000 (11:37 -0700)]
Bump GDB version number to 8.3.0.DATE-git.
gdb/ChangeLog:
* version.in: Set GDB version number to 8.3.0.DATE-git.
Joel Brobecker [Sat, 11 May 2019 18:28:58 +0000 (11:28 -0700)]
Document the GDB 8.3 release in gdb/ChangeLog
gdb/ChangeLog:
GDB 8.3 released.
Joel Brobecker [Sat, 11 May 2019 18:19:03 +0000 (11:19 -0700)]
Set GDB version number to 8.3.
gdb/ChangeLog:
* version.in: Set GDB version number to 8.3.
GDB Administrator [Sat, 11 May 2019 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 10 May 2019 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 9 May 2019 00:01:18 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Wed, 1 May 2019 17:13:31 +0000 (11:13 -0600)]
Fix style bug when paging
Philippe pointed out a styling bug that would occur in some conditions
when paging:
https://sourceware.org/ml/gdb-patches/2019-04/msg00101.html
I was finally able to reproduce this, and this patch fixes the bug.
The problem occurred when text overflowed the line, causing a
pagination prompt, but when no wrap column had been set. In this
case, the current style was reset to show the prompt, but then not
reset back to the previously applied style before emitting the rest of
the line.
The fix is to record the applied style in this case, and re-apply it
afterward -- but only if the pager prompt was emitted, something that
the existing style.exp pointed out on the first, more naive, version
of the patch.
Tested on x86-64 Fedora 29.
gdb/ChangeLog
2019-05-08 Tom Tromey <tromey@adacore.com>
* utils.c (fputs_maybe_filtered): Reset style after paging, even
when no wrap column is set.
GDB Administrator [Wed, 8 May 2019 00:01:01 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 7 May 2019 00:00:51 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 6 May 2019 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 5 May 2019 00:01:33 +0000 (00:01 +0000)]
Automatic date update in version.in
Tom Tromey [Tue, 23 Apr 2019 22:42:14 +0000 (16:42 -0600)]
Don't derive partial_symbol from general_symbol_info
This patch partly reverts commit
8a6d42345 ("Change representation of
psymbol to flush out accessors"); specifically, it changes
partial_symbol to no longer derive from general_symbol_info.
The basic problem here is that the bcache compares objects bitwise,
and this change made it less likely that the relevant fields in the
psymbol would be fully initialized. This could be seen by running a
test under valgrind on the Fedora-i686 buildbot.
I considered a simpler patch, namely just zeroing the psymbol's
"value" field in add_psymbol_to_bcache. However, it wasn't clear to
me that this memset could not then be optimized away by the compiler.
Regression tested by the buildbot. I think this should go in 8.3 as
well.
2019-05-04 Tom Tromey <tom@tromey.com>
* psymtab.c (psymbol_name_matches, match_partial_symbol)
(lookup_partial_symbol, print_partial_symbols)
(recursively_search_psymtabs, sort_pst_symbols, psymbol_hash)
(psymbol_compare): Update.
(add_psymbol_to_bcache): Clear the entire psymbol.
(maintenance_check_psymtabs): Update.
* psympriv.h (struct partial_symbol): Don't derive from
general_symbol_info.
<obj_section, unrelocated_address, address,
set_unrelocated_address>: Update.
<ginfo>: New member.
* dwarf-index-write.c (write_psymbols, debug_names::insert)
(debug_names::write_psymbols): Update.
GDB Administrator [Sat, 4 May 2019 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in
Eli Zaretskii [Fri, 3 May 2019 07:40:02 +0000 (10:40 +0300)]
Fix compilation with mingw.org's MinGW.
That flavor of MinGW assumes Windows 9X as the default target,
which doesn't expose CONSOLE_FONT_INFO stuff in Windows header
files. Since we no longer support running on Windows older
than XP anyway, requiring it at build time makes sense.
gdb/ChangeLog
2019-05-03 Eli Zaretskii <eliz@gnu.org>
* windows-nat.c [_WIN32_WINNT]: Define _WIN32_WINNT to Windows XP
level, so that various Windows header files expose the necessary
declarations and definitions.
Eli Zaretskii [Fri, 3 May 2019 07:29:59 +0000 (10:29 +0300)]
Fix lookup of separate debug file on MS-Windows.
If you put the separate debug file in a global debug directory, GDB on
MS-Windows would fail to find it. This happens because we obtain the
directory to look up the debug file by concatenating the debug
directory name with the leading directories of the executable, and the
latter includes the drive letter on MS-Windows. So we get an invalid
file name like
d:/usr/lib/debug/d:/usr/bin/foo.debug
This commit fixes that by removing the colon of the drive letter,
thus producing
d:/usr/lib/debug/d/usr/bin/foo.debug
gdb/ChangeLog:
2019-05-03 Eli Zaretskii <eliz@gnu.org>
* symfile.c (find_separate_debug_file): Remove colon from the
drive spec of DOS/Windows file names of the target, so that the
file name produced from DEBUGDIR and the target's directory will
be valid on DOS/Windows systems.
gdb/doc/ChangeLog:
2019-05-03 Eli Zaretskii <eliz@gnu.org>
* gdb.texinfo (Separate Debug Files): Document how the
subdirectory of the global debug directory is computed on
MS-Windows/MS-DOS.
(cherry picked from commit
5f2459c233faebe8f882e556b2f4a86594a51292)
Nick Clifton [Thu, 2 May 2019 14:11:39 +0000 (15:11 +0100)]
Treat the .gnu.debuglink and .gnu.debugaltlink sections as debug sections when reading them in from COFF/PE format files.
PR 24493
* coffcode.h (styp_to_sec_flags): Treat .gnu.debuglink and
.gnu.debugaltlink sections as debugging sections.
(cherry picked from commit
2cdc1a970d3249888524d251abfb87a9bdc77434)
GDB Administrator [Fri, 3 May 2019 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 2 May 2019 00:01:06 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 1 May 2019 00:00:46 +0000 (00:00 +0000)]
Automatic date update in version.in
Joel Brobecker [Tue, 30 Apr 2019 21:03:13 +0000 (16:03 -0500)]
(Windows) fix thr != nullptr assert failure in delete_thread_1
We have observed that GDB would randomly trip the following
assertion failure when debugging on Windows. When allowing
the program to run until the inferior exits, we occasionally see:
(gdb) cont
Continuing.
[Thread 48192.0xd100 exited with code 1]
[Thread 48192.0x10ad8 exited with code 1]
[Thread 48192.0x36e28 exited with code 0]
[Thread 48192.0x52be4 exited with code 0]
[Thread 48192.0x5aa40 exited with code 0]
../../src/gdb/thread.c:453: internal-error: void delete_thread_1(thread_inf
o*, bool): Assertion `thr != nullptr' failed.
Running the same scenario with some additional traces enabled...
(gdb) set verbose
(gdb) set debugevents
... allows us to understand what the issue is. To understand, we need
to first look at the events received when starting the program, and
in particular which threads got created how. First, we get a
CREATE_PROCESS_DEBUG_EVENT for tid=0x442a8:
gdb: kernel event for pid=317536 tid=0x442a8 code=CREATE_PROCESS_DEBUG_EVENT)
Shortly after, we get some CREATE_THREAD_DEBUG_EVENT events,
one of them being for tid=0x4010c:
gdb: kernel event for pid=317536 tid=0x4010c code=CREATE_THREAD_DEBUG_EVENT)
Fast forward a bit of debugging, and we do a "cont" as above,
at which point the programs reaches the end, and the system reports
"exit" events. The first interesting one is the following:
gdb: kernel event for pid=317536 tid=0x442a8 code=EXIT_THREAD_DEBUG_EVENT)
This is reporting a thread-exit event for a thread whose tid
is the TID of what we call the "main thread". That's the thread
that was created when we received the CREATE_PROCESS_DEBUG_EVENT
notification, and whose TID is actually stored in a global variable
named main_thread_id. This is not something we expected, as
the assumption we made was that the main thread would exit last,
and we would be notified of it via an EXIT_PROCESS_DEBUG_EVENT.
But apparently, this is not always true, at least on Windows Server
2012 and 2016 where this issue has been observed happening randomly.
The consequence of the above notification is that we call
windows_delete_thread for that thread, which removes it from
our list of known threads.
And a little bit later, then we then get the EXIT_PROCESS_DEBUG_EVENT,
and we can see that the associated tid is not the main_thread_id,
but rather the tid of one of the threads that was created during
the lifetime of the program, in this case tid=0x4010c:
gdb: kernel event for pid=317536 tid=0x4010c code=EXIT_PROCESS_DEBUG_EVENT)
And the debug trace printed right after shows why we're crashing:
[Deleting Thread 317536.0x442a8]
We are trying to delete the thread whose tid=0x442a8, which is
the main_thread_id! As we have already deleted that thread before,
the search for it returns a nullptr, which then trips the assertion
check in delete_thread_1.
This commit fixes this issue. It ignores the open question of
what to do with the main_thread_id global, particularly after
that thread has been removed from our list of threads. This will
be dealt with as a separate patch, to allow cherry-picking
this patch into a release branch.
For now, we fix the code so as to avoid this crash.
gdb/ChangeLog:
* windows-nat.c (get_windows_debug_event) <EXIT_PROCESS_DEBUG_EVENT>:
Use current_event.dwThreadId instead of main_thread_id.
Tom Tromey [Mon, 22 Apr 2019 17:46:47 +0000 (11:46 -0600)]
Fix crash in dwarf2read.c with template parameters
PR c++/24470 concerns a crash in dwarf2read.c that occurs with a
particular test case.
The issue turns out to be that process_structure_scope will pass NULL
to symbol_symtab. This happens because new_symbol decided not to
create a symbol for the particular DIE.
This patch fixes the problem by finding another reasonably-appropriate
symtab to use instead; issuing a complaint if one cannot be found for
some reason.
As mentioned in the bug, I think there are other bugs here. For
example, when using "ptype" on the "l" object in the test case, I
think I would expect to see the template parameter. I didn't research
this too closely, since it seemed more important to fix the crash.
Tested on x86-64 Fedora 29.
I'd like to check this in to the 8.3 branch as well.
gdb/ChangeLog
2019-04-30 Tom Tromey <tromey@adacore.com>
PR c++/24470:
* dwarf2read.c (process_structure_scope): Handle case where type
has template parameters but no symbol was created.
gdb/testsuite/ChangeLog
2019-04-30 Tom Tromey <tromey@adacore.com>
PR c++/24470:
* gdb.cp/temargs.cc: Add test code from PR.
GDB Administrator [Tue, 30 Apr 2019 00:00:58 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 29 Apr 2019 00:00:59 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 28 Apr 2019 00:01:32 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 27 Apr 2019 00:01:30 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 26 Apr 2019 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 25 Apr 2019 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 24 Apr 2019 00:00:54 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 23 Apr 2019 00:00:49 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 22 Apr 2019 00:01:37 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 21 Apr 2019 00:01:36 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 20 Apr 2019 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in
Sergei Trofimovich [Sun, 17 Mar 2019 22:48:02 +0000 (22:48 +0000)]
gdb/configure.ac: add --enable-source-highlight
Allow disabling source-highlight dependency autodetection even
it exists in the system. More details on problem of automatic
dependencies:
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Automagic_dependencies
Noticed by Jeroen Roovers in https://bugs.gentoo.org/680238
* configure.ac: add --enable-source-highlight switch.
* configure: Regenerate.
* top.c (print_gdb_version): plumb --enable-source-highlight
status to "show configuration".
gdb/ChangeLog
2019-04-19 Sergei Trofimovich <siarheit@google.com>
* configure.ac: add --enable-source-highlight switch.
* configure: Regenerate.
* top.c (print_gdb_version): plumb --enable-source-highlight
status to "show configuration".
Tom Tromey [Tue, 9 Apr 2019 18:52:46 +0000 (12:52 -0600)]
Fix "list" when control characters are seen
PR symtab/24423 points out that control characters in a source file
cause a hang in the "list" command, a regression introduced by the
styling changes.
This patch, from the PR, fixes the bug. I've included a minimal
change to the "list" test that exercises this code.
I recall that this bug was discussed on gdb-patches, and I thought
there was a patch there as well, but I was unable to find it.
2019-04-19 Ilya Yu. Malakhov <malakhov@mcst.ru>
PR symtab/24423:
* source.c (print_source_lines_base): Advance "iter" when a
control character is seen.
gdb/testsuite/ChangeLog
2019-04-19 Tom Tromey <tromey@adacore.com>
PR symtab/24423:
* gdb.base/list0.h (foo): Add a control-l character.
Philippe Waroquiers [Sat, 13 Apr 2019 07:13:53 +0000 (09:13 +0200)]
Fix GDB 8.3 regression crash when registers cannot be modified.
This crash was detected when using GDB with the valgrind gdbserver.
To reproduce:
valgrind sleep 10000
In another window:
gdb
target remote | vgdb
p printf("make sleep print something\n")
=>
terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR'
Aborted
The problem is that the valgrind gdbserver does not allow to change
registers when the inferior is blocked in a system call.
GDB then raises an exception. The exception causes the destructor
of
typedef std::unique_ptr<infcall_suspend_state, infcall_suspend_state_deleter>
infcall_suspend_state_up;
to be called. This destructor itself tries to restore the value of
the registers, and fails similarly. We must catch the exception in
the destructor to avoid crashing GDB.
If the destructor encounters a problem, no warning is produced if
there is an uncaught exception, as in this case, the user will already
be informed of a problem via this exception.
With this change, no crash anymore, and all the valgrind 3.15 tests
pass succesfully.
Note: when this patch is approved, I will push an equivalent patch
on master, but with TRY/CATCH/e.message () replaced by
try/catch/e.what ().
gdb/ChangeLog
2019-04-19 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* inferior.h (struct infcall_suspend_state_deleter):
Catch exception in destructor to avoid crash.
GDB Administrator [Fri, 19 Apr 2019 00:00:59 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 18 Apr 2019 00:00:54 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 17 Apr 2019 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 16 Apr 2019 00:01:00 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 15 Apr 2019 00:00:53 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 14 Apr 2019 00:01:33 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 13 Apr 2019 00:01:38 +0000 (00:01 +0000)]
Automatic date update in version.in
Eli Zaretskii [Fri, 12 Apr 2019 12:35:57 +0000 (15:35 +0300)]
Another fix for GDB styling
gdb/ChangeLog:
2019-04-12 Eli Zaretskii <eliz@gnu.org>
* utils.c (prompt_for_continue): Don't restore the styling at the
end, as applied_style has the wrong value. This fixes styling in
long lists of file names that are interrupted by the "Continue?"
prompt.
(cherry picked from commit
51196bbc5618a3741bd7bbed01ac76b25a2e6f9c)
GDB Administrator [Fri, 12 Apr 2019 00:01:19 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 11 Apr 2019 00:01:23 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 10 Apr 2019 00:01:14 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 9 Apr 2019 00:01:04 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 8 Apr 2019 00:01:11 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 7 Apr 2019 00:02:24 +0000 (00:02 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 6 Apr 2019 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 5 Apr 2019 00:00:51 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Thu, 4 Apr 2019 00:00:55 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 3 Apr 2019 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Tue, 2 Apr 2019 00:01:26 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Mon, 1 Apr 2019 00:01:37 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 31 Mar 2019 00:02:08 +0000 (00:02 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 30 Mar 2019 00:01:16 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Fri, 29 Mar 2019 00:01:25 +0000 (00:01 +0000)]
Automatic date update in version.in
Pedro Alves [Thu, 28 Mar 2019 17:33:13 +0000 (12:33 -0500)]
Fix testsuite hangs when gdb_test_multiple body errors out
This commit fixes a regression in the testsuite itself, triggered by
errors being raised from within gdb_test_multiple, originally reported
by Pedro Franco de Carvalho's at
<https://sourceware.org/ml/gdb-patches/2019-03/msg00160.html>. Parts
of the commit message are based on his report.
This started happening due to a commit that was introduced recently,
and it can cause the testsuite to hang.
The commit that triggers this is:
fe1a5cad302b5535030cdf62895e79512713d738
[gdb/testsuite] Log wait status on process no longer exists error
That commit introduces a new "eof" block in gdb_test_multiple. That
is not incorrect itself, but dejagnu's remote_expect is picking that
block as the "default" action when an error is raised from within the
commands inside a call to gdb_test_multiple:
# remote_expect works basically the same as standard expect, but it
# also takes care of getting the file descriptor from the specified
# host and also calling the timeout/eof/default section if there is an
# error on the expect call.
#
proc remote_expect { board timeout args } {
I find that "feature" surprising, and I don't really know why it
exists, but this means that the eof section that remote_expect picks
as the error block can be executed even when there was no actual eof
and the GDB process is still running, so the wait introduced in the
commit that tries to get the exit status of GDB hangs forever, while
GDB itself waits for input.
This only happens when there are internal testsuite errors (not
testcase failures). This can be reproduced easily with a testcase
such as:
gdb_start
gdb_test_multiple "show version" "show version" {
-re ".*" {
error "forced error"
}
}
I think that working around this in GDB is useful so that the
testsuite doesn't hang in these cases.
Adding an empty "default" block at the end of the expect body in
gdb_test_multiple doesn't work, because dejagnu gives preference to
"eof" blocks:
if { $x eq "eof" } {
set save_next 1
} elseif { $x eq "default" || $x eq "timeout" } {
if { $error_sect eq "" } {
set save_next 1
}
}
And we do have "eof" blocks. So we need to make sure that the last
"eof" block is safe to use as the default error block. It's also
pedantically incorrect to print
"ERROR: Process no longer exists"
which is what we'd get if the last eof block we have was selected
(more below on this).
So this commit solves this by appending an "eof" with an empty
spawn_id list, so that it won't ever match.
Now, why is the first "eof" block selected today as the error block,
instead of the last one?
The reason is that remote_expect, while parsing the body to select the
default block to execute after an error, is affected by the comments
in the body (since they are also parsed).
If this comment in gdb_test_multiple
# patterns below apply to any spawn id specified.
is changed to
# The patterns below apply to any spawn id specified.
then the second eof block is selected and there is no hang.
Any comment at that same place with an even number of tokens also
works.
This is IMO a coincidence caused by how comments work in TCL.
Comments should only appear in places where a command can appear. And
here, remote_expect is parsing a list of options, not commands, so
it's not unreasonable to not parse comments, similarly to how this:
set a_list {
an_element
# another_element
}
results in a list with three elements, not one element.
The fact that comments with an even number of tokens work is just a
coincidence of how remote_expect's little state machine is
implemented.
I thought we could solve this by stripping out comment lines in
gdb_expect, but I didn't find an easy way to do that. Particularly, a
couple naive approaches I tried run into complications. For example,
we have gdb_test calls with regular expressions that include sequences
like "\r\n#", and by the time we get to gdb_expect, the \r\n have
already been expanded to a real newline, so just splitting the whole
body at newline boundaries, looking for lines that start with #
results in incorrectly stripping out half of the gdb_text regexp. I
think it's better (at least in this commit), to move the comments out
of the list, because it's much simpler and risk free.
gdb/testsuite/ChangeLog:
2019-03-25 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (gdb_test_multiple): Split appends to $code and
move comments outside list. Append '-i "" eof' section.
(cherry picked from commit
9a93502fa81734d39f213ccb33b497bc40e1423d)
GDB Administrator [Thu, 28 Mar 2019 00:01:39 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Wed, 27 Mar 2019 00:01:35 +0000 (00:01 +0000)]
Automatic date update in version.in
Joel Brobecker [Tue, 26 Mar 2019 23:02:09 +0000 (16:02 -0700)]
Bump GDB version number to 8.2.91.DATE-git.
gdb/ChangeLog:
* version.in: Set GDB version number to 8.2.91.DATE-git.
Joel Brobecker [Tue, 26 Mar 2019 23:01:55 +0000 (16:01 -0700)]
Document the GDB 8.2.91 release in gdb/ChangeLog
gdb/ChangeLog:
GDB 8.2.91 released.
Joel Brobecker [Tue, 26 Mar 2019 22:52:05 +0000 (15:52 -0700)]
Set GDB version number to 8.2.91.
gdb/ChangeLog:
* version.in: Set GDB version number to 8.2.91.
Andrew Burgess [Tue, 26 Mar 2019 22:42:01 +0000 (15:42 -0700)]
gdb/testsuite: Prepare for DejaGnu 1.6.2
Changes in DejaGnu 1.6.2 mean that our testsuite will no longer run.
This is because of some confusion over how the gdb.exp file is
handled.
The gdb.exp file is really the tool init file, which is loaded from
within the DejaGnu core, and it should not be loaded directly from any
other file in the testsuite.
DejaGnu tries to prevent the same library being loaded twice by
remembering the names of library files as they are loaded. Until
recently loading the tool init file in DejaGnu was very similar to
loading a library file, as a result, loading the gdb.exp tool init
file simply recorded 'gdb.exp' as having been loaded, future attempts
to load 'gdb.exp' as a library would then be ignored (as the file was
marked as already loaded).
DejaGnu has now changed so that it supports having both a tool init
file and a library with the same name, something that was not possible
before. What this means however is that when the core loads the
'gdb.exp' tool init file it no longer marks the library 'gdb.exp' as
having been loaded. When we then execute 'load_lib gdb.exp' we then
try to reload the 'gdb.exp' file.
Unfortunately our gdb.exp file can only be loaded once. It use of
'rename cd builtin_cd' means that a second attempt to load this file
will fail.
This was discussed on the DejaGnu list here:
http://lists.gnu.org/archive/html/dejagnu/2019-03/msg00000.html
and the suggested advice is that, unless we have some real requirement
to load the tool init file twice, we should remove calls to 'load_lib
gdb.exp' and rely on DejaGnu to load the file for us, which is what
this patch does.
I've tested with native X86-64/GNU Linux and see no regressions.
gdb/testsuite/ChangeLog:
* config/default.exp: Remove 'load_lib gdb.exp'.
* config/monitor.exp: Likewise.
* config/sid.exp: Likewise.
* config/sim.exp: Likewise.
* config/slite.exp: Likewise.
* config/unix.exp: Likewise.
* gdb.base/default.exp: Remove unhelpful comment.
Tom Tromey [Wed, 20 Mar 2019 13:57:09 +0000 (07:57 -0600)]
Merge handle_inferior_event and handle_inferior_event_1
I noticed that handle_inferior_event is just a small wrapper that
frees the value chain. This patch replaces it with a
scoped_value_mark, reducing the number of lines of code here.
Regression tested on x86-64 Fedora 29.
gdb/ChangeLog
2019-03-20 Tom Tromey <tromey@adacore.com>
PR gdb/24391
* infrun.c (handle_inferior_event): Rename from
handle_inferior_event_1. Create a scoped_value_mark.
(handle_inferior_event): Remove.
Simon Marchi [Tue, 26 Mar 2019 00:29:18 +0000 (20:29 -0400)]
Fix use-after-free in source_cache::get_source_lines
Commit
ab42892fb7d2 ("Fix vertical scrolling of TUI source window")
introduced a use-after-free in source_cache::get_source_lines.
At the beginning of the method, we get the fullname of the symtab:
const char *fullname = symtab_to_fullname (s);
fullname points to the string owned by the symtab (s.fullname). When we
later do
scoped_fd desc = open_source_file (s);
s.fullname gets reallocated (even though the string contents may not
change). The fullname local variable now points to freed memory.
To avoid it, refresh the value of fullname after calling
open_source_file.
Here is the ASan report:
$ ./gdb -nx --data-directory=data-directory ./a.out
(gdb) start
Temporary breakpoint 1 at 0x1130: file test.cpp, line 12.
Starting program: /home/simark/build/binutils-gdb/gdb/a.out
Temporary breakpoint 1, main () at test.cpp:12
=================================================================
==26068==ERROR: AddressSanitizer: heap-use-after-free on address 0x6210003d4100 at pc 0x7fed89a34681 bp 0x7ffd8d185d80 sp 0x7ffd8d185528
READ of size 2 at 0x6210003d4100 thread T0
#0 0x7fed89a34680 in __interceptor_strlen /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:301
#1 0x55b6edf6c2f7 in std::char_traits<char>::length(char const*) /usr/include/c++/8.2.1/bits/char_traits.h:320
#2 0x55b6edf6c9b2 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) /usr/include/c++/8.2.1/bits/basic_string.h:516
#3 0x55b6ef09121b in source_cache::get_source_lines(symtab*, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) /home/simark/src/binutils-gdb/gdb/source-cache.c:214
#4 0x55b6ef0a15cb in print_source_lines_base /home/simark/src/binutils-gdb/gdb/source.c:1340
#5 0x55b6ef0a2045 in print_source_lines(symtab*, int, int, enum_flags<print_source_lines_flag>) /home/simark/src/binutils-gdb/gdb/source.c:1415
#6 0x55b6ef112c87 in print_frame_info(frame_info*, int, print_what, int, int) /home/simark/src/binutils-gdb/gdb/stack.c:914
#7 0x55b6ef10e90d in print_stack_frame(frame_info*, int, print_what, int) /home/simark/src/binutils-gdb/gdb/stack.c:180
#8 0x55b6ee9592f8 in print_stop_location /home/simark/src/binutils-gdb/gdb/infrun.c:7853
#9 0x55b6ee95948f in print_stop_event(ui_out*) /home/simark/src/binutils-gdb/gdb/infrun.c:7870
#10 0x55b6ef34b962 in tui_on_normal_stop /home/simark/src/binutils-gdb/gdb/tui/tui-interp.c:98
#11 0x55b6ee01a14d in std::_Function_handler<void (bpstats*, int), void (*)(bpstats*, int)>::_M_invoke(std::_Any_data const&, bpstats*&&, int&&) /usr/include/c++/8.2.1/bits/std_function.h:297
#12 0x55b6ee965415 in std::function<void (bpstats*, int)>::operator()(bpstats*, int) const /usr/include/c++/8.2.1/bits/std_function.h:687
#13 0x55b6ee962f1b in gdb::observers::observable<bpstats*, int>::notify(bpstats*, int) const /home/simark/src/binutils-gdb/gdb/common/observable.h:106
#14 0x55b6ee95a6e7 in normal_stop() /home/simark/src/binutils-gdb/gdb/infrun.c:8142
#15 0x55b6ee93f236 in fetch_inferior_event(void*) /home/simark/src/binutils-gdb/gdb/infrun.c:3782
#16 0x55b6ee8f2641 in inferior_event_handler(inferior_event_type, void*) /home/simark/src/binutils-gdb/gdb/inf-loop.c:43
#17 0x55b6eea2a1f0 in handle_target_event /home/simark/src/binutils-gdb/gdb/linux-nat.c:4358
#18 0x55b6ee7045f1 in handle_file_event /home/simark/src/binutils-gdb/gdb/event-loop.c:733
#19 0x55b6ee704e89 in gdb_wait_for_event /home/simark/src/binutils-gdb/gdb/event-loop.c:859
#20 0x55b6ee7027b5 in gdb_do_one_event() /home/simark/src/binutils-gdb/gdb/event-loop.c:322
#21 0x55b6ee702907 in start_event_loop() /home/simark/src/binutils-gdb/gdb/event-loop.c:371
#22 0x55b6eeadfc16 in captured_command_loop /home/simark/src/binutils-gdb/gdb/main.c:331
#23 0x55b6eeae2ef9 in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1174
#24 0x55b6eeae30c2 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1190
#25 0x55b6edf4fa89 in main /home/simark/src/binutils-gdb/gdb/gdb.c:32
#26 0x7fed88ad8222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
#27 0x55b6edf4f86d in _start (/home/simark/build/binutils-gdb/gdb/gdb+0x197186d)
0x6210003d4100 is located 0 bytes inside of 4096-byte region [0x6210003d4100,0x6210003d5100)
freed by thread T0 here:
#0 0x7fed89a8ac19 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:66
#1 0x55b6edfe12df in xfree<char> /home/simark/src/binutils-gdb/gdb/common/common-utils.h:60
#2 0x55b6edfea675 in gdb::xfree_deleter<char>::operator()(char*) const /home/simark/src/binutils-gdb/gdb/common/gdb_unique_ptr.h:34
#3 0x55b6edfe532c in std::unique_ptr<char, gdb::xfree_deleter<char> >::reset(char*) /usr/include/c++/8.2.1/bits/unique_ptr.h:382
#4 0x55b6edfe7329 in std::unique_ptr<char, gdb::xfree_deleter<char> >::operator=(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) /usr/include/c++/8.2.1/bits/unique_ptr.h:289
#5 0x55b6ef09ec2b in find_and_open_source(char const*, char const*, std::unique_ptr<char, gdb::xfree_deleter<char> >*) /home/simark/src/binutils-gdb/gdb/source.c:990
#6 0x55b6ef09f56a in open_source_file(symtab*) /home/simark/src/binutils-gdb/gdb/source.c:1069
#7 0x55b6ef090f78 in source_cache::get_source_lines(symtab*, int, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) /home/simark/src/binutils-gdb/gdb/source-cache.c:205
#8 0x55b6ef0a15cb in print_source_lines_base /home/simark/src/binutils-gdb/gdb/source.c:1340
#9 0x55b6ef0a2045 in print_source_lines(symtab*, int, int, enum_flags<print_source_lines_flag>) /home/simark/src/binutils-gdb/gdb/source.c:1415
#10 0x55b6ef112c87 in print_frame_info(frame_info*, int, print_what, int, int) /home/simark/src/binutils-gdb/gdb/stack.c:914
#11 0x55b6ef10e90d in print_stack_frame(frame_info*, int, print_what, int) /home/simark/src/binutils-gdb/gdb/stack.c:180
#12 0x55b6ee9592f8 in print_stop_location /home/simark/src/binutils-gdb/gdb/infrun.c:7853
#13 0x55b6ee95948f in print_stop_event(ui_out*) /home/simark/src/binutils-gdb/gdb/infrun.c:7870
#14 0x55b6ef34b962 in tui_on_normal_stop /home/simark/src/binutils-gdb/gdb/tui/tui-interp.c:98
#15 0x55b6ee01a14d in std::_Function_handler<void (bpstats*, int), void (*)(bpstats*, int)>::_M_invoke(std::_Any_data const&, bpstats*&&, int&&) /usr/include/c++/8.2.1/bits/std_function.h:297
#16 0x55b6ee965415 in std::function<void (bpstats*, int)>::operator()(bpstats*, int) const /usr/include/c++/8.2.1/bits/std_function.h:687
#17 0x55b6ee962f1b in gdb::observers::observable<bpstats*, int>::notify(bpstats*, int) const /home/simark/src/binutils-gdb/gdb/common/observable.h:106
#18 0x55b6ee95a6e7 in normal_stop() /home/simark/src/binutils-gdb/gdb/infrun.c:8142
#19 0x55b6ee93f236 in fetch_inferior_event(void*) /home/simark/src/binutils-gdb/gdb/infrun.c:3782
#20 0x55b6ee8f2641 in inferior_event_handler(inferior_event_type, void*) /home/simark/src/binutils-gdb/gdb/inf-loop.c:43
#21 0x55b6eea2a1f0 in handle_target_event /home/simark/src/binutils-gdb/gdb/linux-nat.c:4358
#22 0x55b6ee7045f1 in handle_file_event /home/simark/src/binutils-gdb/gdb/event-loop.c:733
#23 0x55b6ee704e89 in gdb_wait_for_event /home/simark/src/binutils-gdb/gdb/event-loop.c:859
#24 0x55b6ee7027b5 in gdb_do_one_event() /home/simark/src/binutils-gdb/gdb/event-loop.c:322
#25 0x55b6ee702907 in start_event_loop() /home/simark/src/binutils-gdb/gdb/event-loop.c:371
#26 0x55b6eeadfc16 in captured_command_loop /home/simark/src/binutils-gdb/gdb/main.c:331
#27 0x55b6eeae2ef9 in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1174
#28 0x55b6eeae30c2 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1190
#29 0x55b6edf4fa89 in main /home/simark/src/binutils-gdb/gdb/gdb.c:32
previously allocated by thread T0 here:
#0 0x7fed89a8b019 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:86
#1 0x7fed88af983f in realpath@@GLIBC_2.3 (/usr/lib/libc.so.6+0x4583f)
#2 0x7fed899dbbbc in __interceptor_canonicalize_file_name /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:3297
#3 0x55b6ee376a03 in gdb_realpath(char const*) /home/simark/src/binutils-gdb/gdb/common/pathstuff.c:72
#4 0x55b6ef09ec12 in find_and_open_source(char const*, char const*, std::unique_ptr<char, gdb::xfree_deleter<char> >*) /home/simark/src/binutils-gdb/gdb/source.c:990
#5 0x55b6ef09f56a in open_source_file(symtab*) /home/simark/src/binutils-gdb/gdb/source.c:1069
#6 0x55b6ef0a0f12 in print_source_lines_base /home/simark/src/binutils-gdb/gdb/source.c:1270
#7 0x55b6ef0a2045 in print_source_lines(symtab*, int, int, enum_flags<print_source_lines_flag>) /home/simark/src/binutils-gdb/gdb/source.c:1415
#8 0x55b6ef112c87 in print_frame_info(frame_info*, int, print_what, int, int) /home/simark/src/binutils-gdb/gdb/stack.c:914
#9 0x55b6ef10e90d in print_stack_frame(frame_info*, int, print_what, int) /home/simark/src/binutils-gdb/gdb/stack.c:180
#10 0x55b6ee9592f8 in print_stop_location /home/simark/src/binutils-gdb/gdb/infrun.c:7853
#11 0x55b6ee95948f in print_stop_event(ui_out*) /home/simark/src/binutils-gdb/gdb/infrun.c:7870
#12 0x55b6ef34b962 in tui_on_normal_stop /home/simark/src/binutils-gdb/gdb/tui/tui-interp.c:98
#13 0x55b6ee01a14d in std::_Function_handler<void (bpstats*, int), void (*)(bpstats*, int)>::_M_invoke(std::_Any_data const&, bpstats*&&, int&&) /usr/include/c++/8.2.1/bits/std_function.h:297
#14 0x55b6ee965415 in std::function<void (bpstats*, int)>::operator()(bpstats*, int) const /usr/include/c++/8.2.1/bits/std_function.h:687
#15 0x55b6ee962f1b in gdb::observers::observable<bpstats*, int>::notify(bpstats*, int) const /home/simark/src/binutils-gdb/gdb/common/observable.h:106
#16 0x55b6ee95a6e7 in normal_stop() /home/simark/src/binutils-gdb/gdb/infrun.c:8142
#17 0x55b6ee93f236 in fetch_inferior_event(void*) /home/simark/src/binutils-gdb/gdb/infrun.c:3782
#18 0x55b6ee8f2641 in inferior_event_handler(inferior_event_type, void*) /home/simark/src/binutils-gdb/gdb/inf-loop.c:43
#19 0x55b6eea2a1f0 in handle_target_event /home/simark/src/binutils-gdb/gdb/linux-nat.c:4358
#20 0x55b6ee7045f1 in handle_file_event /home/simark/src/binutils-gdb/gdb/event-loop.c:733
#21 0x55b6ee704e89 in gdb_wait_for_event /home/simark/src/binutils-gdb/gdb/event-loop.c:859
#22 0x55b6ee7027b5 in gdb_do_one_event() /home/simark/src/binutils-gdb/gdb/event-loop.c:322
#23 0x55b6ee702907 in start_event_loop() /home/simark/src/binutils-gdb/gdb/event-loop.c:371
#24 0x55b6eeadfc16 in captured_command_loop /home/simark/src/binutils-gdb/gdb/main.c:331
#25 0x55b6eeae2ef9 in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1174
#26 0x55b6eeae30c2 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1190
#27 0x55b6edf4fa89 in main /home/simark/src/binutils-gdb/gdb/gdb.c:32
#28 0x7fed88ad8222 in __libc_start_main (/usr/lib/libc.so.6+0x24222)
gdb/ChangeLog:
* source-cache.c (source_cache::get_source_lines): Re-read
fullname after calling open_source_file.
GDB Administrator [Tue, 26 Mar 2019 00:01:35 +0000 (00:01 +0000)]
Automatic date update in version.in