These tests used to fail on ARM but now pass, so remove the KFAIL.
gdb/testsuite/ChangeLog:
2014-07-28 Will Newton <will.newton@linaro.org>
* gdb.base/varargs.exp: Remove KFAILs for ARM.
* configure.ac (or1k*-*-rtems*): gdb not supported. The ordering
of the stanzas results in this not being caught by or1k*-*-* later.
* configure. Regenerated.
Signed-off-by: Christian Svensson <blue@cmd.nu>
* gas/configure.tgt (or1k*-*-rtems*): Ensure a match.
(or1k*-*-*): Use or1k* to match or1knd and or1kZ.
Signed-off-by: Christian Svensson <blue@cmd.nu>
* acinclude.m4 (GDB_GUILE_PROGRAM_NAMES): New macro.
(GDB_GUILD_TARGET_FLAG, GDB_TRY_GUILD): New macros.
* configure.ac: Try to use guild to compile an scm file, if it fails
then disable guile support.
* configure: Regenerate.
* data-directory/Makefile.in (GUILE_SOURCE_FILES): Renamed from
GUILE_FILE_LIST.
(GUILE_COMPILED_FILES): New variable.
(GUILE_FILES) Update.
(GUILD, GUILD_TARGET_FLAG, GUILD_COMPILE_FLAGS): New variables.
(stamp-guile): Compile scm files.
* guile/guile.c (boot_guile_support): New function.
(standard_throw_args_p): New function.
(print_standard_throw_error, print_throw_error): New functions.
(handle_boot_error): New function.
(initialize_scheme_side): Rewrite to call boot_guile_support.
* guile/lib/gdb/boot.scm: Update %load-compiled-path. Load gdb.go.
* guile/lib/gdb/init.scm (%silence-compiler-warnings%): New function.
* data-directory/Makefile.in (GUILE_FILES): Add support.scm.
* guile/lib/gdb/support.scm: New file.
* guile/guile.c (gdbscm_init_module_name): Change to "gdb".
* guile/lib/gdb.scm: Load gdb/init.scm as an include file.
All uses updated.
* guile/lib/gdb/init.scm (SCM_ARG1, SCM_ARG2): Moved to support.scm.
All uses updated.
(%assert-type): Ditto, and renamed to assert-type.
(%exception-print-style): Delete.
testsuite/
* gdb.guile/types-module.exp: Add tests for wrong type arguments.
Tested with/without guile,python on amd64-linux.
I'm not sure we still have to deal with shells that can't
handle empty for lists, but I played it safe.
Otherwise this patch would be a lot smaller (though a diff -b
will still show the real changes).
PR build/17105
* configure.ac: Add AM_CONDITIONALs for HAVE_PYTHON, HAVE_GUILE.
* configure: Regenerate.
* data-directory/Makefile.in (PYTHON_FILE_LIST): Renamed from
PYTHON_FILES.
(PYTHON_FILES): New variable.
(GUILE_FILE_LIST): Renamed from GUILE_FILES.
(GUILE_FILES): New variable.
(stamp-python, install-python, uninstall-python): Handle empty
file list.
(stamp-guile, install-guile, uninstall-guile): Ditto.
PR 17185 describes a problem with using gdb+guile with libgc 7.4.0.
The symptom is a hang in sigsuspend.
[The thread referenced in the PR has the details.]
It's not clear what the right fix is, or even where the bug is yet.
This patch applies the same workaround Guile has applied.
There is no functionality or real performance loss with this,
and Guile has been using it for awhile.
* configure.ac: Add check for header gc/gc.h.
Add check for function setenv.
* configure: Regenerate.
* config.in: Regenerate.
* guile/guile.c (_initialize_guile): Add workaround for libgc 7.4.0.
Use size_t in a few places involved with obstacks, and don't include
obstack.h in files that don't use obstacks.
gas/
* config/bfin-parse.y: Don't include obstack.h.
* config/obj-aout.c: Likewise.
* config/obj-coff.c: Likewise.
* config/obj-som.c: Likewise.
* config/tc-bfin.c: Likewise.
* config/tc-i960.c: Likewise.
* config/tc-rl78.c: Likewise.
* config/tc-rx.c: Likewise.
* config/tc-tic4x.c: Likewise.
* expr.c: Likewise.
* listing.c: Likewise.
* config/obj-elf.c (elf_file_symbol): Make name_length a size_t.
* config/tc-aarch64.c (symbol_locate): Likewise.
* config/tc-arm.c (symbol_locate): Likewise.
* config/tc-mmix.c (mmix_handle_mmixal): Make len_0 a size_t.
* config/tc-score.c (s3_build_score_ops_hsh): Make len a size_t.
(s3_build_dependency_insn_hsh): Likewise.
* config/tc-score7.c (s7_build_score_ops_hsh): Likewise.
(s7_build_dependency_insn_hsh): Likewise.
* frags.c (frag_grow): Make parameter a size_t, and use size_t locals.
(frag_new): Make parameter a size_t.
(frag_var_init): Make max_chars and var parameters size_t.
(frag_var, frag_variant): Likewise.
(frag_room): Return a size_t.
(frag_align_pattern): Make n_fill parameter a size_t.
* frags.h: Update function prototypes.
* symbols.c (save_symbol_name): Make name_length a size_t.
Individual users will still have to:
1. Install git-merge-changelog
2. Set up the merge driver in their git config
See gnulib's lib/git-merge-changelog.c [1] for details.
For example, I:
1. Patched Debian's gnulib package to build git-merge-changelog, and
sent the patch to the Debian maintainer, who then proceeded to not
only accept my patch but even write a *manpage* for
git-merge-changelog! (Let's hear it for Ian Beckwith.)
So now, I can install it simply by running "apt-get install
git-merge-changelog". (Except, of course, that I already have it
installed from when I was testing my patch.)
2. Did step (2) from .gitattributes
With this patch applied and the above two steps done by whatever means
you deem best, you can say goodbye to merge conflicts in ChangeLog
files -- at least *IF* people stop renaming the danged things, anyway.
If you don't do step 2, you will continue to suffer from ChangeLog
merge conflicts exactly as before, whether or not you did step 1.
If you do step 2 but not step 1, git will likely start complaining
that it can't find any "git-merge-changelog" to run.
[1]: http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c
[Note: The docs for git-merge-changelog (the comments at the top) say
that you need a .gitattributes in every directory. The docs are wrong.
Ignore the docs. Well, not the whole docs; just that part.
You really only need one at the top level, since .gitattributes uses
the same pattern matching rules as .gitignore, which match files in
any subdirectory unless you prefix the pattern with a "/", as
explained in the gitignore(5) manpage.]
This fixes gdbarch matching, making sure one for the opposite compressed
ISA variation is not chosen. That in turn makes "set mips compression"
work; right now the setting sticks to the initial value, either inferred
from the ELF header of the binary first loaded or the default value if
no binary has been used. This only affects debugging with no symbol
table available or no binary chosen at all, as otherwise symbol
annotations determine the compressed ISA variation.
* mips-tdep.c (mips_gdbarch_init): Also check the compressed ISA
variation in gdbarch matching.
This removes the using_exec_ops global from exec.c, in favor of
querying the target stack directly using target_is_pushed. This is
more in keeping with other code in gdb, and is also more future-proof
as it is more multi-target-ready.
Built and regtested on x86-64 Fedora 20.
2014-07-25 Tom Tromey <tromey@redhat.com>
* exec.c (using_exec_ops): Remove.
(exec_close_1): Update. Remove extraneous block, reindent.
(add_target_sections): Use target_is_pushed.
A previous patch added a new parameter to clear_proceed_status, but
forgot to update a few callers.
Tested by building on x86_64 Fedora 20, with --enable-targets=all.
gdb/
2014-07-25 Pedro Alves <palves@redhat.com>
* go32-nat.c (go32_create_inferior): Pass 0 to clear_proceed_status.
* monitor.c (monitor_create_inferior): Likewise.
* remote-m32r-sdi.c (m32r_create_inferior): Likewise.
* remote-sim.c (gdbsim_create_inferior): Likewise.
* solib-irix.c (irix_solib_create_inferior_hook): Likewise.
* solib-osf.c (osf_solib_create_inferior_hook): Likewise.
* windows-nat.c (do_initial_windows_stuff): Likewise.
Currently, GDB can pass a signal to the wrong thread in several
different but related scenarios.
E.g., if thread 1 stops for signal SIGFOO, the user switches to thread
2, and then issues "continue", SIGFOO is actually delivered to thread
2, not thread 1. This obviously messes up programs that use
pthread_kill to send signals to specific threads.
This has been a known issue for a long while. Back in 2008 when I
made stop_signal be per-thread (2020b7ab), I kept the behavior -- see
code in 'proceed' being removed -- wanting to come back to it later.
The time has finally come now.
The patch fixes this -- on resumption, intercepted signals are always
delivered to the thread that had intercepted them.
Another example: if thread 1 stops for a breakpoint, the user switches
to thread 2, and then issues "signal SIGFOO", SIGFOO is actually
delivered to thread 1, not thread 2, because 'proceed' first switches
to thread 1 to step over its breakpoint... If the user deletes the
breakpoint before issuing "signal FOO", then the signal is delivered
to thread 2 (the current thread).
"signal SIGFOO" can be used for two things: inject a signal in the
program while the program/thread had stopped for none, bypassing
"handle nopass"; or changing/suppressing a signal the program had
stopped for. These scenarios are really two faces of the same coin,
and GDB can't really guess what the user is trying to do. GDB might
have intercepted signals in more than one thread even (see the new
signal-command-multiple-signals-pending.exp test). At least in the
inject case, it's obviously clear to me that the user means to deliver
the signal to the currently selected thread, so best is to make the
command's behavior consistent and easy to explain.
Then, if the user is trying to suppress/change a signal the program
had stopped for instead of injecting a new signal, but, the user had
changed threads meanwhile, then she will be surprised that with:
(gdb) continue
Thread 1 stopped for signal SIGFOO.
(gdb) thread 2
(gdb) signal SIGBAR
... GDB actually delivers SIGFOO to thread 1, and SIGBAR to thread 2
(with scheduler-locking off, which is the default, because then
"signal" or any other resumption command resumes all threads).
So the patch makes GDB detect that, and ask for confirmation:
(gdb) thread 1
[Switching to thread 1 (Thread 10979)]
(gdb) signal SIGUSR2
Note:
Thread 3 previously stopped with signal SIGUSR2, User defined signal 2.
Thread 2 previously stopped with signal SIGUSR1, User defined signal 1.
Continuing thread 1 (the current thread) with specified signal will
still deliver the signals noted above to their respective threads.
Continue anyway? (y or n)
All these scenarios are covered by the new tests.
Tested on x86_64 Fedora 20, native and gdbserver.
gdb/
2014-07-25 Pedro Alves <palves@redhat.com>
* NEWS: Mention signal passing and "signal" command changes.
* gdbthread.h (struct thread_suspend_state) <stop_signal>: Extend
comment.
* breakpoint.c (until_break_command): Adjust clear_proceed_status
call.
* infcall.c (run_inferior_call): Adjust clear_proceed_status call.
* infcmd.c (proceed_thread_callback, continue_1, step_once)
(jump_command): Adjust clear_proceed_status call.
(signal_command): Warn if other thread that are resumed have
signals that will be delivered. Adjust clear_proceed_status call.
(until_next_command, finish_command)
(proceed_after_attach_callback, attach_command_post_wait)
(attach_command): Adjust clear_proceed_status call.
* infrun.c (proceed_after_vfork_done): Likewise.
(proceed_after_attach_callback): Adjust comment.
(clear_proceed_status_thread): Clear stop_signal if not in pass
state.
(clear_proceed_status_callback): Delete.
(clear_proceed_status): New 'step' parameter. Only clear the
proceed status of threads the command being prepared is about to
resume.
(proceed): If passed in an explicit signal, override stop_signal
with it. Don't pass the last stop signal to the thread we're
resuming.
(init_wait_for_inferior): Adjust clear_proceed_status call.
(switch_back_to_stepped_thread): Clear the signal if it should not
be passed.
* infrun.h (clear_proceed_status): New 'step' parameter.
(user_visible_resume_ptid): Add comment.
* linux-nat.c (linux_nat_resume_callback): Don't check whether the
signal is in pass state.
* remote.c (append_pending_thread_resumptions): Likewise.
* mi/mi-main.c (proceed_thread): Adjust clear_proceed_status call.
gdb/doc/
2014-07-25 Pedro Alves <palves@redhat.com>
Eli Zaretskii <eliz@gnu.org>
* gdb.texinfo (Signaling) <signal command>: Explain what happens
with multi-threaded programs.
gdb/testsuite/
2014-07-25 Pedro Alves <palves@redhat.com>
* gdb.threads/signal-command-handle-nopass.c: New file.
* gdb.threads/signal-command-handle-nopass.exp: New file.
* gdb.threads/signal-command-multiple-signals-pending.c: New file.
* gdb.threads/signal-command-multiple-signals-pending.exp: New file.
* gdb.threads/signal-delivered-right-thread.c: New file.
* gdb.threads/signal-delivered-right-thread.exp: New file.
I happened to notice that a couple of macros in target.h weren't
properly using parens and as a result had a strange definition.
This patch adds the parens and then fixes the macros to be written as
must have been intended.
Tested by rebuilding.
I'm pushing this as obvious.
2014-07-25 Tom Tromey <tromey@redhat.com>
* target.h (target_stopped_data_address)
(target_watchpoint_addr_within_range): Use "->", not ".". Fix
parentheses.
This patch adds additional comments about the conversion of addresses to
pointers and vice-versa on AVR.
Special conversion needs to be done when dealing with an address in the
flash address space, where both code and read-only data can be stored.
Code and data pointers to flash are not addressed the same way:
A code pointer is 16 bit addressed. A data pointer is 8 bit addressed,
even if the data is in flash.
2014-07-25 Pierre Langlois <pierre.langlois@embecosm.com>
* avr-tdep.c (avr_address_to_pointer): Clarify the conversion in the
comments.
(avr_pointer_to_address): Likewise.
Jan pointed out in
<https://sourceware.org/ml/gdb-patches/2014-07/msg00553.html> that
these testcases have racy results:
gdb.base/double-prompt-target-event-error.exp
gdb.base/paginate-after-ctrl-c-running.exp
gdb.base/paginate-bg-execution.exp
gdb.base/paginate-execution-startup.exp
gdb.base/paginate-inferior-exit.exp
This is easily reproducible with "read1" from:
[reproducer for races of expect incomplete reads]
http://sourceware.org/bugzilla/show_bug.cgi?id=12649
The '-notransfer -re "<return>" { exp_continue }' trick in the current
tests doesn't actually work.
The issue that led to the -notransfer trick was that
"---Type <return> to continue, or q <return> to quit---"
has two "<return>"s. If one wants gdb_test_multiple to not hit the
built-in "<return>" match that results in FAIL, one has to expect the
pagination prompt in chunks, first up to the first "<return>", then
again, up to the second. Something around these lines:
gdb_test_multiple "" $test {
-re "<return>" {
exp_continue
}
-re "to quit ---" {
pass $test
}
}
The intent was for -notransfer+exp_continue to make expect fetch more
input, and rerun the matches against the now potentially fuller
buffer, and then eventually the -re that includes the full pagination
prompt regex would match instead (because it's listed higher up, it
would match first). But, once that "<return>" -notransfer -re
matches, it keeps re-matching forever. It seems like with
exp_continue, expect immediately retries matching, instead of first
reading in more data into the buffer, if available.
Fix this like I should have done in the first place. There's actually
no good reason for gdb_test_multiple to only match "<return>". We can
make gdb_test_multiple expect the whole pagination prompt text
instead, which is store in the 'pagination_prompt' global (similar to
'gdb_prompt'). Then a gdb_test_multiple caller that doesn't want the
default match to trigger, because it wants to see one pagination
prompt, does simply:
gdb_test_multiple "" $test {
-re "$pagination_prompt$" {
pass $test
}
}
which is just like when we don't want the default $gdb_prompt match
within gdb_test_multiple to trigger, like:
gdb_test_multiple "" $test {
-re "$gdb_prompt $" {
pass $test
}
}
Tested on x86_64 Fedora 20. In addition, I've let the racy tests run
all in parallel in a loop for 30 minutes, and they never failed.
gdb/testsuite/
2014-07-25 Pedro Alves <palves@redhat.com>
* gdb.base/double-prompt-target-event-error.exp
(cancel_pagination_in_target_event): Remove '-notransfer <return>'
match.
(cancel_pagination_in_target_event): Rework double prompt
detection.
* gdb.base/paginate-after-ctrl-c-running.exp
(test_ctrlc_while_target_running_paginates): Remove '-notransfer
<return>' match.
* gdb.base/paginate-bg-execution.exp
(test_bg_execution_pagination_return)
(test_bg_execution_pagination_cancel): Remove '-notransfer
<return>' matches.
* gdb.base/paginate-execution-startup.exp
(test_fg_execution_pagination_return)
(test_fg_execution_pagination_cancel): Remove '-notransfer
<return>' matches.
* gdb.base/paginate-inferior-exit.exp
(test_paginate_inferior_exited): Remove '-notransfer <return>'
match.
* lib/gdb-utils.exp (string_to_regexp): Move here from lib/gdb.exp.
* lib/gdb.exp (pagination_prompt): Run text through
string_to_regexp.
(gdb_test_multiple): Match $pagination_prompt instead of
"<return>".
(string_to_regexp): Move to lib/gdb-utils.exp.
This constifies deprecate_cmd and the "replacement" field in struct
cmd_list_element.
2014-07-24 Tom Tromey <tromey@redhat.com>
* cli/cli-decode.c (deprecate_cmd): Make "replacement" const.
* cli/cli-decode.h (struct cmd_list_element) <replacement>: Now
const.
* command.h (deprecate_cmd): Update.
* maint.c (maintenance_do_deprecate): Add casts.
This constifies a couple of functions in stack.c.
2014-07-24 Tom Tromey <tromey@redhat.com>
* stack.c (up_silently_base, down_silently_base): Make argument
const.
This constifies the "pattern" argument to solib_add.
2014-07-24 Tom Tromey <tromey@redhat.com>
* solib.c (solib_add): Make "pattern" const.
* solib.h (solib_add): Update.
This does some more constification in remote.c.
2014-07-24 Tom Tromey <tromey@redhat.com>
* remote.c (remote_serial_open, print_packet, putpkt)
(putpkt_binary): Constify.
* remote.h (putpkt): Update.
This constifies an argument to monitor_open.
2014-07-24 Tom Tromey <tromey@redhat.com>
* monitor.c (monitor_open): Make "args" const.
* monitor.h (monitor_open): Update.
This does a bit of constification in maint.c, making
print_bfd_section_info a bit cleaner in the process.
2014-07-24 Tom Tromey <tromey@redhat.com>
* maint.c (match_bfd_flags): Make "string" const.
(print_bfd_section_info): Remove casts.
(print_objfile_section_info): Make "string" const.
This constifies an argument to inf_child_open_target.
2014-07-24 Tom Tromey <tromey@redhat.com>
* inf-child.c (inf_child_open_target): Make "arg" const.
* inf-child.h (inf_child_open_target): Update.
This constifies an argument to unset_in_environ.
2014-07-24 Tom Tromey <tromey@redhat.com>
* environ.c (unset_in_environ): Make "var" const.
* environ.h (unset_in_environ): Update.
This does some minor constification in cli-dump.c.
2014-07-24 Tom Tromey <tromey@redhat.com>
* cli/cli-dump.c (scan_expression_with_cleanup): Return const.
Make "cmd" const.
(scan_filename_with_cleanup): Likewise.
(dump_memory_to_file, dump_value_to_file, restore_binary_file):
Make arguments const.
(restore_command): Update.
The TUI currently crashes when the user types <return> in response to
a pagination prompt:
$ gdb --tui ...
*the TUI is now active*
(gdb) set height 2
(gdb) help
List of classes of commands:
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106 movdqu (%rax), %xmm12
(top-gdb) bt
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x000000000086be5f in xstrdup (s=0x0) at ../src/libiberty/xstrdup.c:33
#2 0x00000000005163f9 in tui_prep_terminal (notused1=1) at ../src/gdb/tui/tui-io.c:296
#3 0x000000000077a7ee in _rl_callback_newline () at ../src/readline/callback.c:82
#4 0x000000000077a853 in rl_callback_handler_install (prompt=0x0, linefunc=0x618b60 <command_line_handler>) at ../src/readline/callback.c:102
#5 0x0000000000718a5c in gdb_readline_wrapper_cleanup (arg=0xfd14d0) at ../src/gdb/top.c:788
#6 0x0000000000596d08 in do_my_cleanups (pmy_chain=0xcf0b38 <cleanup_chain>, old_chain=0x1043d10) at ../src/gdb/cleanups.c:155
#7 0x0000000000596d75 in do_cleanups (old_chain=0x1043d10) at ../src/gdb/cleanups.c:177
#8 0x0000000000718bd9 in gdb_readline_wrapper (prompt=0x7fffffffcfa0 "---Type <return> to continue, or q <return> to quit---")
at ../src/gdb/top.c:835
#9 0x000000000071cf74 in prompt_for_continue () at ../src/gdb/utils.c:1894
#10 0x000000000071d434 in fputs_maybe_filtered (linebuffer=0x1043db0 "List of classes of commands:\n\n", stream=0xf72e20, filter=1)
at ../src/gdb/utils.c:2111
#11 0x000000000071da0f in vfprintf_maybe_filtered (stream=0xf72e20, format=0x89aef8 "List of classes of %scommands:\n\n", args=0x7fffffffd118, filter=1)
at ../src/gdb/utils.c:2339
#12 0x000000000071da4a in vfprintf_filtered (stream=0xf72e20, format=0x89aef8 "List of classes of %scommands:\n\n", args=0x7fffffffd118)
at ../src/gdb/utils.c:2347
#13 0x000000000071dc72 in fprintf_filtered (stream=0xf72e20, format=0x89aef8 "List of classes of %scommands:\n\n") at ../src/gdb/utils.c:2399
#14 0x00000000004f90ab in help_list (list=0xe6d100, cmdtype=0x89ad8c "", class=all_classes, stream=0xf72e20)
at ../src/gdb/cli/cli-decode.c:1038
#15 0x00000000004f8dba in help_cmd (arg=0x0, stream=0xf72e20) at ../src/gdb/cli/cli-decode.c:946
Git 0017922 added:
@@ -776,6 +777,12 @@ gdb_readline_wrapper_cleanup (void *arg)
gdb_assert (input_handler == gdb_readline_wrapper_line);
input_handler = cleanup->handler_orig;
+
+ /* Reinstall INPUT_HANDLER in readline, without displaying a
+ prompt. */
+ if (async_command_editing_p)
+ rl_callback_handler_install (NULL, input_handler);
and tui_prep_terminal simply misses handling the case of a NULL
rl_prompt.
I also checked that readline's sources do similar checks.
gdb/
2014-07-24 Pedro Alves <palves@redhat.com>
* tui/tui-io.c (tui_prep_terminal): Handle NULL rl_prompt.
This patch removes some GDBSERVER checks from nat/linux-ptrace.c.
Currently the code uses a compile-time check to decide whether some
flags should be used. This changes the code to instead let users of
the module specify an additional set of flags; and then changes gdb's
linux-nat.c to call this function. At some later date, when the back
ends are fully merged, we will be able to remove this function again.
gdb/
2014-07-24 Tom Tromey <tromey@redhat.com>
Gary Benson <gbenson@redhat.com>
* nat/linux-ptrace.c (additional_flags): New global.
(linux_test_for_tracesysgood, linux_test_for_tracefork): Use
additional_flags; don't check GDBSERVER.
(linux_ptrace_set_additional_flags): New function.
* nat/linux-ptrace.h (linux_ptrace_set_additional_flags):
Declare.
* linux-nat.c (_initialize_linux_nat): Call
linux_ptrace_set_additional_flags.
gdbserver defines CORE_ADDR to be signed. This seems erroneous to
me; and furthermore likely to cause problems in common/, as it is
different from gdb's definition.
gdb/gdbserver/
2014-07-24 Tom Tromey <tromey@redhat.com>
Gary Benson <gbenson@redhat.com>
* server.h (CORE_ADDR): Now unsigned.
The target debug methods are inconsistently maintained. Most to_*
methods have some kind of targetdebug awareness, but not all of them
do. The ones that do vary in the quantity and quality of output they
generate.
This patch changes most of the target debug methods to be
automatically generated. All the arguments are printed, and separate
lines are printed for entering and existing the outermost call to the
target stack.
For example now you'd see:
-> multi-thread->to_terminal_ours (...)
-> multi-thread->to_is_async_p (...)
<- multi-thread->to_is_async_p (0x1ebb580) = 1
<- multi-thread->to_terminal_ours (0x1ebb580)
-> multi-thread->to_thread_address_space (...)
<- multi-thread->to_thread_address_space (0x1ebb580, 26802) = 1
In this case you can see nested calls. The "multi-thread" on the left
hand side is the topmost target's shortname.
There are some oddities with this patch. I'm on the fence about it
all, I really just wrote it on a whim.
It's not simple to convert every possible method, since a few don't
participate in target delegation.
Printing is done by type, so I introduced some new
debug-printing-specific typedefs to handle cases where it is nicer to
do something else.
On the plus side, this lays the groundwork for making targetdebug
affect every layer of the target stack. The idea would be to wrap
each target_ops in the stack with its own debug_target, and then you
could see calls propagate down the stack and back up; I suppose with
indentation to make it prettier. (That said there are some gotchas
lurking in this idea due to target stack introspection.)
Regtested on x86-64 Fedora 20.
2014-07-24 Tom Tromey <tromey@redhat.com>
* make-target-delegates (munge_type, write_debugmethod): New
functions.
(debug_names): New global.
($TARGET_DEBUG_PRINTER): New global.
(write_function_header): Strip TARGET_DEBUG_PRINTER from the type
name.
Write debug methods. Generate init_debug_target.
* target-debug.h: New file.
* target-delegates.c: Rebuild.
* target.c: Include target-debug.h.
(debug_target): Hoist definition.
(target_kill, target_get_section_table, target_memory_map)
(target_flash_erase, target_flash_done, target_detach)
(target_disconnect, target_wait, target_resume)
(target_pass_signals, target_program_signals, target_follow_fork)
(target_mourn_inferior, target_search_memory)
(target_thread_address_space, target_close)
(target_find_new_threads, target_core_of_thread)
(target_verify_memory, target_insert_mask_watchpoint)
(target_remove_mask_watchpoint): Remove targetdebug code.
(debug_to_post_attach, debug_to_prepare_to_store)
(debug_to_files_info, debug_to_insert_breakpoint)
(debug_to_remove_breakpoint, debug_to_can_use_hw_breakpoint)
(debug_to_region_ok_for_hw_watchpoint)
(debug_to_can_accel_watchpoint_condition)
(debug_to_stopped_by_watchpoint, debug_to_stopped_data_address)
(debug_to_watchpoint_addr_within_range)
(debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint)
(debug_to_insert_watchpoint, debug_to_remove_watchpoint)
(debug_to_terminal_init, debug_to_terminal_inferior)
(debug_to_terminal_ours_for_output, debug_to_terminal_ours)
(debug_to_terminal_save_ours, debug_to_terminal_info)
(debug_to_load, debug_to_post_startup_inferior)
(debug_to_insert_fork_catchpoint)
(debug_to_remove_fork_catchpoint)
(debug_to_insert_vfork_catchpoint)
(debug_to_remove_vfork_catchpoint)
(debug_to_insert_exec_catchpoint)
(debug_to_remove_exec_catchpoint, debug_to_has_exited)
(debug_to_can_run, debug_to_thread_architecture, debug_to_stop)
(debug_to_rcmd, debug_to_pid_to_exec_file): Remove.
(setup_target_debug): Call init_debug_target.
* target.h (TARGET_DEBUG_PRINTER): New macro.
(struct target_ops) <to_resume, to_wait, to_pass_signals,
to_program_signals>: Use TARGET_DEBUG_PRINTER.
GDB and gdbserver have functions named "fatal" that are used in
completely different ways. In gdbserver "fatal" is used to handle
critical errors: it differs from "error" in that "fatal" causes
gdbserver to exit whereas "error" does not. In GDB "fatal" is used
to abort the current operation and return to the command level.
This is implemented by throwing a non-error "RETURN_QUIT" exception.
This commit removes GDB's "fatal" and "vfatal" functions entirely.
The exception-throwing function "throw_vfatal" is renamed as
"throw_vquit", and a new convenience function "throw_quit" is added.
The small number of calls to "fatal" are replaced with calls to
"throw_quit", making what is happening more obvious.
This commit also modifies GDB's "throw_error" to call "throw_verror"
rather than calling "throw_it" directly. This change means the
assignment of RETURN_ERROR as the exception type now happens in
precisely one place in GDB rather than two.
gdb/
2014-07-24 Gary Benson <gbenson@redhat.com>
* exceptions.h (throw_vfatal): Renamed to...
(throw_vquit): New declaration.
(throw_quit): Likewise.
* exceptions.c (throw_vfatal): Renamed to...
(throw_vquit): New function.
(throw_quit): Likewise.
(throw_error): Call throw_verror rather than throw_it.
* utils.h (vfatal): Removed.
(fatal): Likewise.
* utils.c (vfatal): Removed.
(fatal): Likewise.
(internal_verror): Replaced call to fatal with call to throw_quit.
(quit): Replaced calls to fatal with calls to throw_quit.
microblaze_fetch instruction in order to use cache memory accesses
requested in target_read_code.
ChangeLog:
2014-06-17 Ajit Agarwal <ajitkum@xilinx.com>
* microblaze-tdep.c (microblaze_fetch_instruction): Use of
target_read_code.
also check whether less than zero -- for 'reg' is type 'int', and sizeof
(dwarf2_to_reg_map) is less than 0x7fff.
It is quoted in gdb_assert(), so need check 'reg' whether less than zero.
And the related warning (with '-W'):
../../binutils-gdb/gdb/microblaze-tdep.c:667:3: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
ChangeLog:
* microblaze-tdep.c (microblaze_dwarf2_reg_to_regnum): Check whether
less tha zero in conditional expression.
This patch rewrites the make-target-delegates matching code a little
bit. The result is functionally the same (the output has some small
whitespace differences), but the new code is more forgiving regarding
the formatting of target.h. In particular now there's no need to
ensure that the return type and the method name appear on the same
line.
2014-07-23 Tom Tromey <tromey@redhat.com>
* make-target-delegates ($ARGS_PART): Match trailing close paren.
($INTRO_PART): Don't match whitespace.
($METHOD_TRAILER): Move earlier. Remove trailing semicolon and
argument matching.
($METHOD): Add $METHOD_TRAILER.
(trim): Rewrite.
(scan_target_h): New sub.
Change main loop not to collect state.
* target-delegates.c: Rebuild.
This commit fixes the build on systems without sigaltstack.
gdb/
2014-07-23 Gary Benson <gbenson@redhat.com>
* cp-support.c (gdb_demangle): Fix build on systems without
sigaltstack.
I cannot reproduce any wrong case having the code removed.
I just do not find it correct to have it disabled. But at the same time I do
like much / I do not find correct the code myself. It is a bit problematic to
have struct value describing a memory content which is no longer present
there.
What happens there:
------------------------------------------------------------------------------
volatile int vv;
static __attribute__((noinline)) int
bar (int &ref) {
ref = 20;
vv++; /* break-here */
return ref;
}
int main (void) {
int var = 10;
return bar (var);
}
------------------------------------------------------------------------------
<4><c7>: Abbrev Number: 13 (DW_TAG_GNU_call_site_parameter)
<c8> DW_AT_location : 1 byte block: 55 (DW_OP_reg5 (rdi))
<ca> DW_AT_GNU_call_site_value: 2 byte block: 91 74 (DW_OP_fbreg: -12)
<cd> DW_AT_GNU_call_site_data_value: 1 byte block: 3a (DW_OP_lit10)
------------------------------------------------------------------------------
gdb -ex 'b value_addr' -ex r --args ../gdb ./1 -ex 'watch vv' -ex r -ex 'p &ref@entry'
->
6 return ref;
bar (ref=@0x7fffffffd944: 20, ref@entry=@0x7fffffffd944: 10) at 1.C:25
------------------------------------------------------------------------------
At /* break-here */ struct value variable 'ref' is TYPE_CODE_REF.
With FSF GDB HEAD:
(gdb) x/gx arg1.contents
0x6004000a4ad0: 0x00007fffffffd944
(gdb) p ((struct value *)arg1.location.computed.closure).lval
$1 = lval_memory
(gdb) p/x ((struct value *)arg1.location.computed.closure).location.address
$3 = 0x7fffffffd944
With your #if0-ed code:
(gdb) x/gx arg1.contents
0x6004000a4ad0: 0x00007fffffffd944
(gdb) p ((struct value *)arg1.location.computed.closure).lval
$8 = not_lval
(gdb) p/x ((struct value *)arg1.location.computed.closure).location.address
$9 = 0x0
I do not see how to access
((struct value *)arg1.location.computed.closure).location.address
from GDB CLI. Trying
(gdb) p &ref@entry
will invoke value_addr()'s:
if (TYPE_CODE (type) == TYPE_CODE_REF)
/* Copy the value, but change the type from (T&) to (T*). We
keep the same location information, which is efficient, and
allows &(&X) to get the location containing the reference. */
and therefore the address gets fetched already from
arg1.contents
and not from
((struct value *)arg1.location.computed.closure).location.address
.
And for any other type than TYPE_CODE_REF this code you removed does not get
executed at all. This DW_AT_GNU_call_site_data_value DWARF was meant
primarily for Fortran but with -O0 entry values do not get produced
and with -Og and higher Fortran always optimizes out the passing by reference.
If you do not like the removed code there I am OK with removing it as I do not
know how to make it's use reproducible for user anyway. In the worst case
- if there really is some way how to exploit it - one should just get
Attempt to take address of value not located in memory.
instead of some wrong value and it may be easy to fix then.
gdb/
2014-07-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2loc.c (value_of_dwarf_reg_entry): Remove setting value address
for reference entry value target data value.
Message-ID: <20140720150727.GA18488@host2.jankratochvil.net>