This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
gdb and binutils branch master updated. 8258415802426fd3e6956cc8dc7aa093052177a5
- From: palves at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 14 Jul 2014 19:38:28 -0000
- Subject: gdb and binutils branch master updated. 8258415802426fd3e6956cc8dc7aa093052177a5
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".
The branch, master has been updated
via 8258415802426fd3e6956cc8dc7aa093052177a5 (commit)
via 1e9735707b34b8141ea3bfd88205ea26e99891fc (commit)
via 93d6eb10ede1d8b72b274345c63f66439eaf7fd0 (commit)
via 0017922d0292d8c374584f6100874580659c9973 (commit)
via 94696ad31c3fac4a3bc17391e42362d83be1fb56 (commit)
via bd29394088b5685d336a501fadca88b25ed777bc (commit)
via 9d1e69a21488cb5b8b7553c8df18ee5c3f4d82e3 (commit)
via feefc97b5942325a8b7793e7ae089d87ecdee11c (commit)
via c933f875f4416a2a06c14fb9e483dd888a948eb2 (commit)
from feb6f816c2246f29e1f71db11a757cbf99c25492 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8258415802426fd3e6956cc8dc7aa093052177a5
commit 8258415802426fd3e6956cc8dc7aa093052177a5
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:32 2014 +0100
Put GDB's terminal settings into effect when paginating
When the target is resumed in the foreground, we put the inferior's
terminal settings into effect, and remove stdin from the event loop.
When the target stops, we put GDB's terminal settings into effect
again, and re-register stdin in the event loop, ready for user input.
The former is done by target_terminal_inferior, and the latter by
target_terminal_ours.
There's an intermediate -- target_terminal_ours_for_output -- that is
called when printing output related to target events, and we don't
know yet whether we'll stop the program. That puts our terminal
settings into effect, enough to get proper results from our output,
but leaves input wired into the inferior.
If such output paginates, then we need the full target_terminal_ours
in order for the user to be able to provide input to answer the
pagination query.
The test in this commit hangs in async-capable targets without the fix
(as the user/test can't answer the pagination query). It doesn't hang
on sync targets because on those we don't unregister stdin from the
event loop while the target is running (because we block in
target_wait instead of in the event loop in that case).
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* utils.c (prompt_for_continue): Call target_terminal_ours.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/paginate-after-ctrl-c-running.c: New file.
* gdb.base/paginate-after-ctrl-c-running.exp: New file.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1e9735707b34b8141ea3bfd88205ea26e99891fc
commit 1e9735707b34b8141ea3bfd88205ea26e99891fc
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:32 2014 +0100
Fix double prompt
If an error is thrown while handling a target event (within
fetch_inferior_event), and, the interpreter is not async (but the
target is), then GDB prints the prompt twice.
One way to see that in action is throw a QUIT while in a pagination
prompt issued from within fetch_inferior_event (or one of its
callees). E.g. from the test:
---Type <return> to continue, or q <return> to quit---
^CQuit
(gdb) (gdb) p 1
^^^^^^^^^^^
$1 = 1
(gdb)
The issue is that inferior_event_handler swallows errors and notifies
the observers (the interpreters) about the command error, even if the
interpreter is forced sync while we're handling a nested event loop
(for execute_command). The observers print a prompt, and then when we
get back to the top event loop, we print another (in
start_event_loop).
I see no reason the error should be swallowed here. Just cancel the
execution related bits and let the error propagate to the top level
(start_event_loop), which re-enables stdin and notifies observers.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* inf-loop.c (inferior_event_handler): Use TRY_CATCH instead of
catch_errors. Don't re-enable stdin or notify observers where,
and rethrow error.
(fetch_inferior_event_wrapper): Delete.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/double-prompt-target-event-error.c: New file.
* gdb.base/double-prompt-target-event-error.exp: New file.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=93d6eb10ede1d8b72b274345c63f66439eaf7fd0
commit 93d6eb10ede1d8b72b274345c63f66439eaf7fd0
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:32 2014 +0100
Remove the target from the event loop while in secondary prompts
If a pagination prompt triggers while the target is running, and the
target exits before the user responded to the pagination query, this
happens:
Starting program: foo
---Type <return> to continue, or q <return> to quit---No unwaited-for children left.
Couldn't get registers: No such process.
Couldn't get registers: No such process.
Couldn't get registers: No such process.
(gdb) Couldn't get registers: No such process.
(gdb)
To reiterate, the user hasn't replied to the pagination prompt above.
A pagination query nests an event loop (in gdb_readline_wrapper). In
async mode, in addition to stdin and signal handlers, we'll have the
target also installed in the event loop still. So if the target
reports an event, that wakes up the nested event loop, which calls
into fetch_inferior_event etc. to handle the event which generates
further output, all while we should be waiting for pagination
confirmation...
(TBC, any target event that generates output ends up spuriously waking
up the pagination, though exits seem to be the worse kind.)
I've played with a couple different approaches to fixing this, while
at the same time trying to avoid being invasive. Both revolve around
not listening to target events while in a pagination prompt (doing
anything else I think would be a much bigger change).
The approach taken just removes the target from the event loop while
within gdb_readline_wrapper. The other approach used gdb_select
directly, with only input_fd installed, but that had the issue that it
didn't handle the async signal handlers, and turned out to be a bit
more code than the first version.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* top.c: Include "inf-loop.h".
(struct gdb_readline_wrapper_cleanup) <target_is_async_orig>: New
field.
(gdb_readline_wrapper_cleanup): Make the target async again, if it
was async before.
(gdb_readline_wrapper): Store whether the target is async, and
make it sync.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-inferior-exit.c: New file.
* gdb.base/paginate-inferior-exit.exp: New file.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0017922d0292d8c374584f6100874580659c9973
commit 0017922d0292d8c374584f6100874580659c9973
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:32 2014 +0100
Background execution + pagination aborts readline/gdb
If pagination occurs as result of output sent as response to a target
event while the target is executing in the background, subsequent
input aborts readline/gdb:
$ gdb program
...
(gdb) continue&
Continuing.
(gdb)
---Type <return> to continue, or q <return> to quit---
*return*
---Type <return> to continue, or q <return> to quit---
Breakpoint 2, after_sleep () at paginate-bg-execution.c:21
---Type <return> to continue, or q <return> to quit---
21 return; /* after sleep */
p 1
readline: readline_callback_read_char() called with no handler!
*abort/SIGABRT*
$
gdb_readline_wrapper_line removes the handler after a line is
processed. Usually, we'll end up re-displaying the prompt, and that
reinstalls the handler. But if the output is coming out of handling
a stop event, we don't re-display the prompt, and nothing restores the
handler. So the next input wakes up the event loop and calls into
readline, which aborts.
We should do better with the prompt handling while the target is
running (I think we should coordinate with readline, and
hide/redisplay it around output), but that's a more invasive change
better done post 7.8, so this patch is conservative and just
reinstalls the handler as soon as we're out of the readline line
callback.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* top.c (gdb_readline_wrapper_line): Tweak comment.
(gdb_readline_wrapper_cleanup): If readline is enabled, reinstall
the input handler callback.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-bg-execution.c: New file.
* gdb.base/paginate-bg-execution.exp: New file.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=94696ad31c3fac4a3bc17391e42362d83be1fb56
commit 94696ad31c3fac4a3bc17391e42362d83be1fb56
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:31 2014 +0100
Canceling pagination caused by execution command from command line aborts readline/gdb
This fixes:
$ ./gdb program -ex "set height 2" -ex "start"
...
Reading symbols from /home/pedro/gdb/tests/threads...done.
---Type <return> to continue, or q <return> to quit---^CQuit << ctrl-c triggers a Quit
*type something*
readline: readline_callback_read_char() called with no handler!
Aborted
$
Usually, if an error propagates all the way to the top level, we'll
re-enable stdin, in case the command that was running was a
synchronous command. That's done in the event loop's actual loop
(event-loop.c:start_event_loop). However, if a foreground execution
command is run before the event loop starts and throws, nothing is
presently reenabling stdin, which leaves sync_execution set.
When we do start the event loop, because sync_execution is still
(mistakenly) set, display_gdb_prompt removes the readline input
callback, even though stdin is registered in the event loop. Any
input from here on results in readline aborting.
Such commands are run through catch_command_errors,
catch_command_errors_const, so add the tweak there.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* main.c: Include event-top.h.
(handle_command_errors): New function.
(catch_command_errors, catch_command_errors_const): Use it.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
PR gdb/17072
* gdb.base/paginate-execution-startup.c: New file.
* gdb.base/paginate-execution-startup.exp: New file.
* lib/gdb.exp (pagination_prompt): New global.
(default_gdb_spawn): New procedure, factored out from
default_gdb_spawn.
(default_gdb_start): Adjust to call default_gdb_spawn.
(gdb_spawn): New procedure.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bd29394088b5685d336a501fadca88b25ed777bc
commit bd29394088b5685d336a501fadca88b25ed777bc
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:31 2014 +0100
testsuite: Introduce gdb_assert
Often we'll do something like:
if {$ok} {
fail "whatever"
} else {
pass "whatever"
}
This adds a helper procedure for that, and converts one random place
to use it, as an example.
2014-07-14 Pedro Alves <palves@redhat.com>
* lib/gdb.exp (gdb_assert): New procedure.
* gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Use it.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9d1e69a21488cb5b8b7553c8df18ee5c3f4d82e3
commit 9d1e69a21488cb5b8b7553c8df18ee5c3f4d82e3
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:31 2014 +0100
Move catch_command_errors and catch_command_errors_const to main.c
We'll need to add error handling code to commands run before the event
loop starts (commands in .gdbinit, -ex commands, etc.). Turns out
those are run through catch_command_errors, and, catch_command_errors
is used nowhere else. Move it (and the _const variant) to main.c, so
that we can further specialize it freely.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* exceptions.c (catch_command_errors, catch_command_errors_const):
Moved to main.c.
* exceptions.h (catch_command_errors_ftype)
(catch_command_errors_const_ftype): Moved to main.c.
(catch_command_errors, catch_command_errors_const): Delete
declarations.
* main.c (catch_command_errors_ftype)
(catch_command_errors_const_ftype): Moved here from exceptions.h.
(catch_command_errors, catch_command_errors_const)): Moved here
from exceptions.c and make static.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=feefc97b5942325a8b7793e7ae089d87ecdee11c
commit feefc97b5942325a8b7793e7ae089d87ecdee11c
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:30 2014 +0100
Eliminate exceptions.c:print_any_exception.
exception_print and exception_fprintf call print_flush, which does all the
same flushing and annotation things that print_any_exception does, and more.
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* exceptions.c (print_any_exception): Delete.
(catch_exceptions_with_msg): Use exception_print instead of
print_any_exception.
(catch_errors): Use exception_fprintf instead of
print_any_exception.
(catch_command_errors, catch_command_errors_const): Use
exception_print instead of print_any_exception.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c933f875f4416a2a06c14fb9e483dd888a948eb2
commit c933f875f4416a2a06c14fb9e483dd888a948eb2
Author: Pedro Alves <palves@redhat.com>
Date: Mon Jul 14 19:55:30 2014 +0100
Put the inferior's terminal settings in effect while running (fg) infcalls
The "call" and "print" commands presently always run synchronously, in
the foreground, but GDB currently forgets to put the inferior's
terminal settings into effect while running them, on async-capable
targets, resulting in:
(gdb) print func ()
hello world
Program received signal SIGTTOU, Stopped (tty output).
0x000000373bceb8d0 in __libc_tcdrain (fd=1) at ../sysdeps/unix/sysv/linux/tcdrain.c:29
29 return INLINE_SYSCALL (ioctl, 3, fd, TCSBRK, 1);
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on".
Evaluation of the expression containing the function
(func) will be abandoned.
When the function is done executing, GDB will silently stop.
(gdb)
That's because target_terminal_inferior skips actually doing anything
if running in the background, and, nothing is setting sync_execution
while running infcalls:
void
target_terminal_inferior (void)
{
/* A background resume (``run&'') should leave GDB in control of the
terminal. Use target_can_async_p, not target_is_async_p, since at
this point the target is not async yet. However, if sync_execution
is not set, we know it will become async prior to resume. */
if (target_can_async_p () && !sync_execution)
return;
This would best be all cleaned up by making GDB not even call
target_terminal_inferior and try to pass the terminal to the inferior
if running in the background, but that's a more invasive fix that is
better done post-7.8.
This was originally caught by a patch later in this series that makes
catch_command_errors use exception_print instead of
print_any_exception. Note that print_flush calls serial_drain_output
while print_any_exception doesnt't have that bit. And,
gdb.gdb/python-selftest.exp does:
gdb_test "call catch_command_errors(execute_command, \"python print 5\", 0, RETURN_MASK_ALL)" \
"Python not initialized.* = 0"
which without this fix results in SIGTTOU...
gdb/
2014-07-14 Pedro Alves <palves@redhat.com>
* infcall.c (run_inferior_call): Set 'sync_execution' while
running the inferior call.
gdb/testsuite/
2014-07-14 Pedro Alves <palves@redhat.com>
* gdb.base/execution-termios.c: New file.
* gdb.base/execution-termios.exp: New file.
-----------------------------------------------------------------------
Summary of changes:
gdb/ChangeLog | 60 ++++++
gdb/exceptions.c | 54 +------
gdb/exceptions.h | 13 --
gdb/inf-loop.c | 36 ++--
gdb/infcall.c | 7 +
gdb/main.c | 58 ++++++
gdb/testsuite/ChangeLog | 38 ++++
.../gdb.base/double-prompt-target-event-error.c | 25 +++
.../gdb.base/double-prompt-target-event-error.exp | 111 ++++++++++++
gdb/testsuite/gdb.base/execution-termios.c | 35 ++++
gdb/testsuite/gdb.base/execution-termios.exp | 60 ++++++
.../gdb.base/paginate-after-ctrl-c-running.c | 25 +++
.../gdb.base/paginate-after-ctrl-c-running.exp | 87 +++++++++
gdb/testsuite/gdb.base/paginate-bg-execution.c | 32 ++++
gdb/testsuite/gdb.base/paginate-bg-execution.exp | 127 +++++++++++++
.../gdb.base/paginate-execution-startup.c | 32 ++++
.../gdb.base/paginate-execution-startup.exp | 189 ++++++++++++++++++++
gdb/testsuite/gdb.base/paginate-inferior-exit.c | 32 ++++
gdb/testsuite/gdb.base/paginate-inferior-exit.exp | 85 +++++++++
gdb/testsuite/gdb.trace/backtrace.exp | 7 +-
gdb/testsuite/lib/gdb.exp | 82 +++++++--
gdb/top.c | 21 ++-
gdb/utils.c | 4 +
23 files changed, 1118 insertions(+), 102 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/double-prompt-target-event-error.c
create mode 100644 gdb/testsuite/gdb.base/double-prompt-target-event-error.exp
create mode 100644 gdb/testsuite/gdb.base/execution-termios.c
create mode 100644 gdb/testsuite/gdb.base/execution-termios.exp
create mode 100644 gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.c
create mode 100644 gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp
create mode 100644 gdb/testsuite/gdb.base/paginate-bg-execution.c
create mode 100644 gdb/testsuite/gdb.base/paginate-bg-execution.exp
create mode 100644 gdb/testsuite/gdb.base/paginate-execution-startup.c
create mode 100644 gdb/testsuite/gdb.base/paginate-execution-startup.exp
create mode 100644 gdb/testsuite/gdb.base/paginate-inferior-exit.c
create mode 100644 gdb/testsuite/gdb.base/paginate-inferior-exit.exp
hooks/post-receive
--
gdb and binutils