binutils-gdb.git
10 years agoPR build/17105.
Doug Evans [Sat, 26 Jul 2014 23:41:29 +0000 (16:41 -0700)]
PR build/17105.

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.

10 years agoPR guile/17177
Doug Evans [Sat, 26 Jul 2014 21:58:58 +0000 (14:58 -0700)]
PR guile/17177

* guile/lib/gdb.scm (pretty-printers): Export.
(set-pretty-printers!): Export.
* guile/lib/gdb/printing.scm (gdb module): Update.
(prepend-pretty-printer!, append-pretty-printer!): Update.
* guile/scm-pretty-print.c (pretty_printer_list_name): Delete.
(pretty_printer_list_var): Delete.
(pretty_printer_list): New static global.
(gdbscm_pretty_printers): New function.
(gdbscm_set_pretty_printers_x): New function.
(ppscm_find_pretty_printer_from_gdb): Update.
(pretty_printer_functions): Add pretty-printers, set-pretty-printers!.
(gdbscm_initialize_pretty_printers): Update.

doc/
* guile.texi (Guile Pretty Printing API): Fix typo.
Document set-pretty-printers!, pretty-printers.
(Selecting Guile Pretty-Printers): Update.
Mention program-space based pretty-printers.

10 years agoPR 17185
Doug Evans [Sat, 26 Jul 2014 21:49:04 +0000 (14:49 -0700)]
PR 17185

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.

10 years agoPrepare gas for 64-bit obstacks
Alan Modra [Sat, 26 Jul 2014 11:30:50 +0000 (21:00 +0930)]
Prepare gas for 64-bit obstacks

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.

10 years agodaily update
Alan Modra [Sat, 26 Jul 2014 00:00:48 +0000 (09:30 +0930)]
daily update

10 years agoAdd a .gitattributes file for use with git-merge-changelog
Samuel Bronson [Fri, 20 Jun 2014 01:59:19 +0000 (21:59 -0400)]
Add a .gitattributes file for use with git-merge-changelog

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.]

10 years agoMIPS: Respect the "set mips compression" command
Maciej W. Rozycki [Fri, 25 Jul 2014 17:57:06 +0000 (18:57 +0100)]
MIPS: Respect the "set mips compression" command

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.

10 years agoremove using_exec_ops global
Tom Tromey [Sat, 13 Jul 2013 17:19:14 +0000 (11:19 -0600)]
remove using_exec_ops global

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.

10 years agofix build: update clear_proceed_status callers
Pedro Alves [Fri, 25 Jul 2014 16:34:05 +0000 (17:34 +0100)]
fix build: update clear_proceed_status callers

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.

10 years agoAlways pass signals to the right thread
Pedro Alves [Fri, 25 Jul 2014 15:57:31 +0000 (16:57 +0100)]
Always pass signals to the right thread

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.

10 years agoproperly parenthesize two macros
Tom Tromey [Fri, 25 Jul 2014 15:20:03 +0000 (09:20 -0600)]
properly parenthesize two macros

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.

10 years agoClarify the address and pointer conversions on AVR.
Pierre Langlois [Fri, 25 Jul 2014 13:45:03 +0000 (14:45 +0100)]
Clarify the address and pointer conversions on AVR.

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.

10 years agoFix paginate-*.exp races
Pedro Alves [Fri, 25 Jul 2014 09:07:38 +0000 (10:07 +0100)]
Fix paginate-*.exp races

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.

10 years agodaily update
Alan Modra [Fri, 25 Jul 2014 00:00:39 +0000 (09:30 +0930)]
daily update

10 years agoconstify target fields
Tom Tromey [Tue, 22 Jul 2014 02:57:15 +0000 (20:57 -0600)]
constify target fields

This constifies the target_ops fields to_shortname, to_longname, and
to_doc.

2014-07-24  Tom Tromey  <tromey@redhat.com>

* monitor.c (compile_pattern): Update.
* target.h (struct target_ops) <to_shortname, to_longname,
to_doc>: Now const.

10 years agoconstify command docs
Tom Tromey [Tue, 22 Jul 2014 02:55:16 +0000 (20:55 -0600)]
constify command docs

This makes the command "doc" parameter const.

2014-07-24  Tom Tromey  <tromey@redhat.com>

* cli/cli-decode.c (add_cmd, add_prefix_cmd)
(add_abbrev_prefix_cmd, add_set_or_show_cmd, add_info)
(add_info_alias, add_com): Make "doc" const.
(print_doc_line): Make "str" const.
(delete_cmd): Update.
* cli/cli-decode.h (struct cmd_list_element) <doc>: Now const.
(print_doc_line): Update.
* cli/cli-script.c (document_command): Update.
* command.h (add_cmd, add_prefix_cmd, add_abbrev_prefix_cmd)
(add_com, add_info, add_info_alias): Update.
* guile/scm-cmd.c (cmdscm_destroyer): Update.
* python/py-cmd.c (cmdpy_destroyer): Update.

10 years agoconstify command prefix
Tom Tromey [Tue, 22 Jul 2014 02:43:04 +0000 (20:43 -0600)]
constify command prefix

This constifies the "prefix" argument to the various command-adding
functions.

2014-07-24  Tom Tromey  <tromey@redhat.com>

* cli/cli-decode.c (print_help_for_command): Make "prefix" const.
(add_prefix_cmd, add_abbrev_prefix_cmd, apropos_cmd, help_list)
(help_cmd_list): Constify.
(lookup_cmd): Update.
* cli/cli-decode.h (struct cmd_list_element) <prefixname>: Now
const.
(help_cmd_list, apropos_cmd): Update.
* cli/cli-script.c (show_user): Update.
* cli/cli-setshow.c (cmd_show_list): Make "prefix" const.
* cli/cli-setshow.h (cmd_show_list): Update.
* command.h (add_prefix_cmd, add_abbrev_prefix_cmd, help_list)
(cmd_show_list): Update.
* guile/scm-cmd.c (cmdscm_destroyer): Update.
* python/py-cmd.c (cmdpy_destroyer): Update.

10 years agoconstify deprecate_cmd
Tom Tromey [Tue, 22 Jul 2014 02:37:34 +0000 (20:37 -0600)]
constify deprecate_cmd

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.

10 years agoconstify help_cmd
Tom Tromey [Mon, 21 Jul 2014 23:35:10 +0000 (17:35 -0600)]
constify help_cmd

This constifies help_cmd.

2014-07-24  Tom Tromey  <tromey@redhat.com>

* cli/cli-decode.c (help_cmd): Make parameter "const".
* cli/cli-decode.h (help_cmd): Update.

10 years agoconstify stack.c
Tom Tromey [Mon, 21 Jul 2014 23:06:20 +0000 (17:06 -0600)]
constify stack.c

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.

10 years agoconstify solib_add
Tom Tromey [Mon, 21 Jul 2014 23:05:16 +0000 (17:05 -0600)]
constify solib_add

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.

10 years agoconstify remote.c
Tom Tromey [Mon, 21 Jul 2014 23:01:55 +0000 (17:01 -0600)]
constify remote.c

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.

10 years agoconstify monitor_open
Tom Tromey [Mon, 21 Jul 2014 22:56:28 +0000 (16:56 -0600)]
constify monitor_open

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.

10 years agoconstify maint.c
Tom Tromey [Mon, 21 Jul 2014 22:54:06 +0000 (16:54 -0600)]
constify maint.c

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.

10 years agoconstify inf_child_open_target
Tom Tromey [Mon, 21 Jul 2014 22:49:09 +0000 (16:49 -0600)]
constify inf_child_open_target

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.

10 years agoconstify unset_in_environ
Tom Tromey [Mon, 21 Jul 2014 22:33:21 +0000 (16:33 -0600)]
constify unset_in_environ

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.

10 years agoconstify cli-dump.c
Tom Tromey [Mon, 21 Jul 2014 22:20:24 +0000 (16:20 -0600)]
constify cli-dump.c

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.

10 years agoFix pagination crash when the TUI is active
Pedro Alves [Thu, 24 Jul 2014 14:51:21 +0000 (15:51 +0100)]
Fix pagination crash when the TUI is active

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.

10 years agoRemove some GDBSERVER checks from linux-ptrace
Tom Tromey [Fri, 3 Jan 2014 17:55:52 +0000 (10:55 -0700)]
Remove some GDBSERVER checks from linux-ptrace

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.

10 years agoMake gdbserver CORE_ADDR unsigned
Tom Tromey [Fri, 13 Jun 2014 15:22:09 +0000 (09:22 -0600)]
Make gdbserver CORE_ADDR unsigned

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.

10 years agoauto-generate most target debug methods
Tom Tromey [Mon, 16 Jun 2014 03:28:57 +0000 (21:28 -0600)]
auto-generate most target debug methods

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.

10 years agoRationalize "fatal" error handling outside of gdbserver
Gary Benson [Wed, 23 Jul 2014 13:51:26 +0000 (14:51 +0100)]
Rationalize "fatal" error handling outside of gdbserver

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.

10 years agoThis patch uses target_read_code instead of target_read_memory in
Michael Eager [Thu, 24 Jul 2014 02:27:20 +0000 (19:27 -0700)]
This patch uses target_read_code instead of target_read_memory in
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.

10 years agose typecast 'size_t' on 'reg', not only avoid the related warning, but
Michael Eager [Thu, 24 Jul 2014 02:21:42 +0000 (19:21 -0700)]
se typecast 'size_t' on 'reg', not only avoid the related warning, but
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.

10 years agodaily update
Alan Modra [Thu, 24 Jul 2014 00:00:40 +0000 (09:30 +0930)]
daily update

10 years agorewrite make-target-delegates matching code
Tom Tromey [Tue, 15 Jul 2014 18:08:54 +0000 (12:08 -0600)]
rewrite make-target-delegates matching code

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.

10 years agoFix build on systems without sigaltstack.
Gary Benson [Wed, 23 Jul 2014 14:25:05 +0000 (15:25 +0100)]
Fix build on systems without sigaltstack.

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.

10 years agodaily update
Alan Modra [Wed, 23 Jul 2014 00:00:42 +0000 (09:30 +0930)]
daily update

10 years agoRemove setting value address for reference entry value target data value.
Jan Kratochvil [Tue, 22 Jul 2014 20:15:27 +0000 (22:15 +0200)]
Remove setting value address for reference entry value target data value.

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>

10 years agoFix read_frame_arg for optimized-out entry values.
Jan Kratochvil [Tue, 22 Jul 2014 20:09:35 +0000 (22:09 +0200)]
Fix read_frame_arg for optimized-out entry values.

gdb/
2014-07-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

* stack.c (read_frame_arg): Verify value_optimized_out before calling
value_available_contents_eq.

gdb/testsuite/
2014-07-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

* gdb.arch/amd64-entry-value-paramref.S: New file.
* gdb.arch/amd64-entry-value-paramref.cc: New file.
* gdb.arch/amd64-entry-value-paramref.exp: New file.
* gdb.arch/amd64-optimout-repeat.S: New file.
* gdb.arch/amd64-optimout-repeat.c: New file.
* gdb.arch/amd64-optimout-repeat.exp: New file.

Message-ID: <20140720150727.GA18488@host2.jankratochvil.net>
Message-ID: <20140711153757.GA452@host2.jankratochvil.net>

10 years agoFix crash on optimized-out entry data values
Pedro Alves [Tue, 22 Jul 2014 18:56:28 +0000 (19:56 +0100)]
Fix crash on optimized-out entry data values

The tests at
<https://sourceware.org/ml/gdb-patches/2014-07/msg00277.html> show
that comparing a fully optimized out value's contents with a value
that has not been optimized out, or is partially optimized out crashes
GDB:

 (gdb) bt
 #0  __memcmp_sse4_1 () at ../sysdeps/x86_64/multiarch/memcmp-sse4.S:816
 #1  0x00000000005a1914 in memcmp_with_bit_offsets (ptr1=0x202b2f0 "\n", offset1_bits=0, ptr2=0x0, offset2_bits=0, length_bits=32)
     at /home/pedro/gdb/mygit/build/../src/gdb/value.c:678
 #2  0x00000000005a1a05 in value_available_contents_bits_eq (val1=0x2361ad0, offset1=0, val2=0x23683b0, offset2=0, length=32)
     at /home/pedro/gdb/mygit/build/../src/gdb/value.c:717
 #3  0x00000000005a1c09 in value_available_contents_eq (val1=0x2361ad0, offset1=0, val2=0x23683b0, offset2=0, length=4)
     at /home/pedro/gdb/mygit/build/../src/gdb/value.c:769
 #4  0x00000000006033ed in read_frame_arg (sym=0x1b78d20, frame=0x19bca50, argp=0x7fff4aba82b0, entryargp=0x7fff4aba82d0)
     at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:416
 #5  0x0000000000603abb in print_frame_args (func=0x1b78cb0, frame=0x19bca50, num=-1, stream=0x1aea450) at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:671
 #6  0x0000000000604ae8 in print_frame (frame=0x19bca50, print_level=0, print_what=SRC_AND_LOC, print_args=1, sal=...)
     at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:1205
 #7  0x0000000000604050 in print_frame_info (frame=0x19bca50, print_level=0, print_what=SRC_AND_LOC, print_args=1, set_current_sal=1)
     at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:857
 #8  0x00000000006029b3 in print_stack_frame (frame=0x19bca50, print_level=0, print_what=SRC_AND_LOC, set_current_sal=1)
     at /home/pedro/gdb/mygit/build/../src/gdb/stack.c:169
 #9  0x00000000005fc4b8 in print_stop_event (ws=0x7fff4aba8790) at /home/pedro/gdb/mygit/build/../src/gdb/infrun.c:6068
 #10 0x00000000005fc830 in normal_stop () at /home/pedro/gdb/mygit/build/../src/gdb/infrun.c:6214

The 'ptr2=0x0' in frame #1 is val2->contents, and since git 4f14910f:

    gdb/ChangeLog
    2013-11-26  Andrew Burgess  <aburgess@broadcom.com>

        * value.c (allocate_optimized_out_value): Mark value as non-lazy.

... a fully optimized-out value can have it's value contents buffer
NULL.

As a spotgap fix, revert 4f14910f, with a comment.  A full fix would
be too invasive for 7.8.

gdb/
2014-07-22  Pedro Alves  <palves@redhat.com>

* value.c (allocate_optimized_out_value): Don't mark value as
non-lazy.

10 years agoAdd AVX512DQ instructions and their AVX512VL variants.
Ilya Tocar [Tue, 15 Jul 2014 09:33:39 +0000 (13:33 +0400)]
Add AVX512DQ instructions and their AVX512VL variants.

gas/

* config/tc-i386.c (cpu_arch): Add .avx512dq, CPU_AVX512DQ_FLAGS.
* doc/c-i386.texi: Document avx512dq/.avx512dq.

gas/testsuite/

* gas/i386/avx512dq-intel.d: New.
* gas/i386/avx512dq.d: New.
* gas/i386/avx512dq.s: New.
* gas/i386/avx512dq_vl-intel.d: New.
* gas/i386/avx512dq_vl.d: New.
* gas/i386/avx512dq_vl.s: New.
* gas/i386/i386.exp: Run new AVX-512 tests.
* gas/i386/x86-64-avx512dq-intel.d: New.
* gas/i386/x86-64-avx512dq.d: New.
* gas/i386/x86-64-avx512dq.s: New.
* gas/i386/x86-64-avx512dq_vl-intel.d: New.
* gas/i386/x86-64-avx512dq_vl.d: New.
* gas/i386/x86-64-avx512dq_vl.s: New.

opcodes/

* i386-dis-evex.h: Updated.
* i386-dis.c (PREFIX enum): Add PREFIX_EVEX_0F54, PREFIX_EVEX_0F55,
PREFIX_EVEX_0F56, PREFIX_EVEX_0F57, PREFIX_EVEX_0F3A16,
PREFIX_EVEX_0F3A22, PREFIX_EVEX_0F3A50, PREFIX_EVEX_0F3A51,
PREFIX_EVEX_0F3A56, PREFIX_EVEX_0F3A57, PREFIX_EVEX_0F3A66,
PREFIX_EVEX_0F3A67.
(VEX_LEN enum): Add VEX_LEN_0F92_P_2, VEX_LEN_0F93_P_2,
VEX_W_0F92_P_2_LEN_0, VEX_W_0F93_P_2_LEN_0.
(VEX_W enum): Add EVEX_W_0F54_P_0, EVEX_W_0F54_P_2, EVEX_W_0F55_P_0,
EVEX_W_0F55_P_2, EVEX_W_0F56_P_0, EVEX_W_0F56_P_2, EVEX_W_0F57_P_0,
EVEX_W_0F57_P_2, EVEX_W_0F78_P_2, EVEX_W_0F79_P_2, EVEX_W_0F7A_P_2,
EVEX_W_0F7B_P_2, EVEX_W_0F3838_P_1, EVEX_W_0F3839_P_1,
EVEX_W_0F3A16_P_2, EVEX_W_0F3A22_P_2, EVEX_W_0F3A50_P_2,
EVEX_W_0F3A51_P_2, EVEX_W_0F3A56_P_2, EVEX_W_0F3A57_P_2,
EVEX_W_0F3A66_P_2, EVEX_W_0F3A67_P_2.
(prefix_table): Add entries for new instructions.
(vex_len_table): Ditto.
(vex_w_table): Ditto.
(OP_E_memory): Update xmmq_mode handling.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512DQ_FLAGS.
(cpu_flags): Add CpuAVX512DQ.
* i386-init.h: Regenerared.
* i386-opc.h (CpuAVX512DQ): New.
(i386_cpu_flags): Add cpuavx512dq.
* i386-opc.tbl: Add AVX512DQ instructions.
* i386-tbl.h: Regenerate.

10 years agoAdd support for AVX512BW instructions and their AVX512VL versions.
Ilya Tocar [Fri, 11 Jul 2014 12:32:29 +0000 (16:32 +0400)]
Add support for AVX512BW instructions and their AVX512VL versions.

gas/

* config/tc-i386.c (cpu_arch): Add .avx512bw, CPU_AVX512BW_FLAGS.
* doc/c-i386.texi: Document avx512bw/.avx512bw.

gas/testsuite/

* gas/i386/avx512bw-intel.d: New.
* gas/i386/avx512bw-opts-intel.d: New.
* gas/i386/avx512bw-opts.d: New.
* gas/i386/avx512bw-opts.s: New.
* gas/i386/avx512bw-wig.s: New.
* gas/i386/avx512bw-wig1-intel.d: New.
* gas/i386/avx512bw-wig1.d: New.
* gas/i386/avx512bw.d: New.
* gas/i386/avx512bw.s: New.
* gas/i386/avx512bw_vl-intel.d: New.
* gas/i386/avx512bw_vl-opts-intel.d: New.
* gas/i386/avx512bw_vl-opts.d: New.
* gas/i386/avx512bw_vl-opts.s: New.
* gas/i386/avx512bw_vl-wig.s: New.
* gas/i386/avx512bw_vl-wig1-intel.d: New.
* gas/i386/avx512bw_vl-wig1.d: New.
* gas/i386/avx512bw_vl.d: New.
* gas/i386/avx512bw_vl.s: New.
* gas/i386/i386.exp: Run new AVX-512 tests.
* gas/i386/x86-64-avx512bw-intel.d: New.
* gas/i386/x86-64-avx512bw-opts-intel.d: New.
* gas/i386/x86-64-avx512bw-opts.d: New.
* gas/i386/x86-64-avx512bw-opts.s: New.
* gas/i386/x86-64-avx512bw-wig.s: New.
* gas/i386/x86-64-avx512bw-wig1-intel.d: New.
* gas/i386/x86-64-avx512bw-wig1.d: New.
* gas/i386/x86-64-avx512bw.d: New.
* gas/i386/x86-64-avx512bw.s: New.
* gas/i386/x86-64-avx512bw_vl-intel.d: New.
* gas/i386/x86-64-avx512bw_vl-opts-intel.d: New.
* gas/i386/x86-64-avx512bw_vl-opts.d: New.
* gas/i386/x86-64-avx512bw_vl-opts.s: New.
* gas/i386/x86-64-avx512bw_vl-wig.s: New.
* gas/i386/x86-64-avx512bw_vl-wig1-intel.d: New.
* gas/i386/x86-64-avx512bw_vl-wig1.d: New.
* gas/i386/x86-64-avx512bw_vl.d: New.
* gas/i386/x86-64-avx512bw_vl.s: New.

opcodes/

* i386-dis-evex.h: Add new instructions (prefixes bellow).
* i386-dis.c (fetch_data): Add EdqwS, Edb, Edw, MaskBDE.
(enum): Add dqw_swap_mode, db_mode, dw_mode, mask_bd_mode, REG_EVEX_0F71.
(PREFIX enum): Add PREFIX_VEX_0F4A, PREFIX_VEX_0F99, PREFIX_VEX_0F3A31,
PREFIX_VEX_0F3A33, PREFIX_EVEX_0F60, PREFIX_EVEX_0F61, PREFIX_EVEX_0F63,
PREFIX_EVEX_0F64, PREFIX_EVEX_0F65, PREFIX_EVEX_0F67, PREFIX_EVEX_0F68,
PREFIX_EVEX_0F69, PREFIX_EVEX_0F6B, PREFIX_EVEX_0F71_REG_2, PREFIX_EVEX_0F71_REG_4,
PREFIX_EVEX_0F71_REG_6, PREFIX_EVEX_0F73_REG_3, PREFIX_EVEX_0F73_REG_7,
PREFIX_EVEX_0F74, PREFIX_EVEX_0F75, PREFIX_EVEX_0FC4, PREFIX_EVEX_0FC5,
PREFIX_EVEX_0FD1, PREFIX_EVEX_0FD5, PREFIX_EVEX_0FD8, PREFIX_EVEX_0FD9,
PREFIX_EVEX_0FDA, PREFIX_EVEX_0FDC, PREFIX_EVEX_0FDD, PREFIX_EVEX_0FDE,
PREFIX_EVEX_0FE0, PREFIX_EVEX_0FE1, PREFIX_EVEX_0FE3, PREFIX_EVEX_0FE4,
PREFIX_EVEX_0FE5, PREFIX_EVEX_0FE8, PREFIX_EVEX_0FE9, PREFIX_EVEX_0FEA,
PREFIX_EVEX_0FEC, PREFIX_EVEX_0FED, PREFIX_EVEX_0FEE, PREFIX_EVEX_0FF1,
PREFIX_EVEX_0FF5, PREFIX_EVEX_0FF6, PREFIX_EVEX_0FF8, PREFIX_EVEX_0FF9,
PREFIX_EVEX_0FFC, PREFIX_EVEX_0FFD, PREFIX_EVEX_0F3800, PREFIX_EVEX_0F3804,
PREFIX_EVEX_0F380B, PREFIX_EVEX_0F3810, PREFIX_EVEX_0F381C, PREFIX_EVEX_0F381D,
PREFIX_EVEX_0F3820, PREFIX_EVEX_0F3826, PREFIX_EVEX_0F382B, PREFIX_EVEX_0F3830,
PREFIX_EVEX_0F3838, PREFIX_EVEX_0F383C, PREFIX_EVEX_0F383E, PREFIX_EVEX_0F3866,
PREFIX_EVEX_0F3875, PREFIX_EVEX_0F3878, PREFIX_EVEX_0F3879, PREFIX_EVEX_0F387A,
PREFIX_EVEX_0F387B, PREFIX_EVEX_0F387D, PREFIX_EVEX_0F388D, PREFIX_EVEX_0F3A0F,
PREFIX_EVEX_0F3A14, PREFIX_EVEX_0F3A15, PREFIX_EVEX_0F3A20, PREFIX_EVEX_0F3A3E,
PREFIX_EVEX_0F3A3F, PREFIX_EVEX_0F3A42.
(VEX_LEN enum): Add VEX_LEN_0F41_P_2, VEX_LEN_0F42_P_2, VEX_LEN_0F44_P_2,
VEX_LEN_0F45_P_2, VEX_LEN_0F46_P_2, VEX_LEN_0F47_P_2, VEX_LEN_0F4A_P_0,
VEX_LEN_0F4A_P_2, VEX_LEN_0F4B_P_0, VEX_LEN_0F90_P_2, VEX_LEN_0F91_P_2,
VEX_LEN_0F92_P_3, VEX_LEN_0F93_P_3, VEX_LEN_0F98_P_2, VEX_LEN_0F99_P_0,
VEX_LEN_0F99_P_2, VEX_LEN_0F3A31_P_2, VEX_LEN_0F3A33_P_2, VEX_W_0F41_P_2_LEN_1,
VEX_W_0F42_P_2_LEN_1, VEX_W_0F44_P_2_LEN_0, VEX_W_0F45_P_2_LEN_1,
VEX_W_0F46_P_2_LEN_1, VEX_W_0F47_P_2_LEN_1, VEX_W_0F4A_P_0_LEN_1,
VEX_W_0F4A_P_2_LEN_1, VEX_W_0F4B_P_0_LEN_1, VEX_W_0F90_P_2_LEN_0,
VEX_W_0F91_P_2_LEN_0, VEX_W_0F92_P_3_LEN_0, VEX_W_0F93_P_3_LEN_0,
VEX_W_0F98_P_2_LEN_0, VEX_W_0F99_P_0_LEN_0, VEX_W_0F99_P_2_LEN_0,
VEX_W_0F3A31_P_2_LEN_0, VEX_W_0F3A33_P_2_LEN_0.
(VEX_W enum): Add EVEX_W_0F6B_P_2, EVEX_W_0F6F_P_3, EVEX_W_0F7F_P_3,
EVEX_W_0F3810_P_1, EVEX_W_0F3810_P_2, EVEX_W_0F3811_P_2, EVEX_W_0F3812_P_2,
EVEX_W_0F3820_P_1, EVEX_W_0F3826_P_1, EVEX_W_0F3826_P_2, EVEX_W_0F3828_P_1,
EVEX_W_0F3829_P_1, EVEX_W_0F382B_P_2, EVEX_W_0F3830_P_1, EVEX_W_0F3866_P_2,
EVEX_W_0F3875_P_2, EVEX_W_0F3878_P_2, EVEX_W_0F3879_P_2, EVEX_W_0F387A_P_2,
EVEX_W_0F387B_P_2, EVEX_W_0F387D_P_2, EVEX_W_0F388D_P_2, EVEX_W_0F3A3E_P_2,
EVEX_W_0F3A3F_P_2, EVEX_W_0F3A42_P_2.
(prefix_table): Add entries for new instructions.
(vex_table) : Ditto.
(vex_len_table): Ditto.
(vex_w_table): Ditto.
(intel_operand_size): Add db_mode, dw_mode, dqw_swap_mode,
mask_bd_mode handling.
(OP_E_register): Add dqw_swap_mode, dw_mode, db_mode, mask_bd_mode
handling.
(OP_E_memory): Add dqw_mode, dw_mode, dqw_swap_mode, dqb_mode, db_mode
handling.
(OP_G): Add db_mode, dw_mode, dqw_swap_mode, mask_bd_mode handling.
(OP_EX): Add dqw_swap_mode handling.
(OP_VEX): Add mask_bd_mode handling.
(OP_Mask): Add mask_bd_mode handling.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512BW_FLAGS.
(cpu_flags): Add CpuAVX512BW.
* i386-init.h: Regenerated.
* i386-opc.h (CpuAVX512BW): New.
(i386_cpu_flags): Add cpuavx512bw.
* i386-opc.tbl: Add AVX512BW instructions.
* i386-tbl.h: Regenerate.

10 years agoAdd support for AVX512VL versions of AVX512CD instructions.
Ilya Tocar [Thu, 10 Jul 2014 10:21:48 +0000 (14:21 +0400)]
Add support for AVX512VL versions of AVX512CD instructions.

gas/testsuite/

* gas/i386/avx512cd_vl-intel.d: New.
* gas/i386/avx512cd_vl.d: New.
* gas/i386/avx512cd_vl.s: New.
* gas/i386/i386.exp: Run new AVX-512 tests.
* gas/i386/x86-64-avx512cd_vl-intel.d: New.
* gas/i386/x86-64-avx512cd_vl.d: New.
* gas/i386/x86-64-avx512cd_vl.s: New.

opcodes/

* i386-opc.tbl: Add AVX512VL and AVX512CD instructions.
* i386-tbl.h: Regenerate.

10 years agoAdd support for AVX512VL. Add AVX512VL versions of AVX512F instructions.
Ilya Tocar [Fri, 18 Jul 2014 10:59:54 +0000 (14:59 +0400)]
Add support for AVX512VL. Add AVX512VL versions of AVX512F instructions.

gas/

* config/tc-i386.c (cpu_arch): Add .avx512vl, CPU_AVX512VL_FLAGS.
(build_vex_prefix): Don't abort on VEX.W.
(check_VecOperands): Support BROADCAST_1TO4 and BROADCAST_1TO2.
(check_VecOperations): Ditto.
* doc/c-i386.texi: Document avx512vl/.avx512vl.

gas/testsuite/

* gas/i386/avx512f_vl-intel.d: New.
* gas/i386/avx512f_vl-opts-intel.d: New.
* gas/i386/avx512f_vl-opts.d: New.
* gas/i386/avx512f_vl-opts.s: New.
* gas/i386/avx512f_vl-wig.s: New.
* gas/i386/avx512f_vl-wig1-intel.d: New.
* gas/i386/avx512f_vl-wig1.d: New.
* gas/i386/avx512f_vl.d: New.
* gas/i386/avx512f_vl.s: New.
* gas/i386/i386.exp: Run new AVX-512 tests.
* gas/i386/x86-64-avx512f_vl-intel.d: New.
* gas/i386/x86-64-avx512f_vl-opts-intel.d: New.
* gas/i386/x86-64-avx512f_vl-opts.d: New.
* gas/i386/x86-64-avx512f_vl-opts.s: New.
* gas/i386/x86-64-avx512f_vl-wig.s: New.
* gas/i386/x86-64-avx512f_vl-wig1-intel.d: New.
* gas/i386/x86-64-avx512f_vl-wig1.d: New.
* gas/i386/x86-64-avx512f_vl.d: New.
* gas/i386/x86-64-avx512f_vl.s: New.

opcodes/

* i386-dis.c (intel_operand_size): Support 128/256 length in
vex_vsib_q_w_dq_mode.
(OP_E_memory): Add ymmq_mode handling, handle new broadcast.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512VL_FLAGS.
(cpu_flags): Add CpuAVX512VL.
* i386-init.h: Regenerated.
* i386-opc.h (CpuAVX512VL): New.
(i386_cpu_flags): Add cpuavx512vl.
(BROADCAST_1TO4, BROADCAST_1TO2): Define.
* i386-opc.tbl: Add AVX512VL instructions.
* i386-tbl.h: Regenerate.

10 years agoFix typo in my email address.
Jiong Wang [Tue, 22 Jul 2014 15:22:50 +0000 (16:22 +0100)]
Fix typo in my email address.

10 years agoUpdate email address in gdb MAINTAINERS list.
Jiong Wang [Tue, 22 Jul 2014 15:18:02 +0000 (16:18 +0100)]
Update email address in gdb MAINTAINERS list.

10 years agodaily update
Alan Modra [Tue, 22 Jul 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agoDisable gdb for or1k*-*-* until supported
Joel Sherrill [Mon, 21 Jul 2014 22:38:56 +0000 (17:38 -0500)]
Disable gdb for or1k*-*-* until supported

* configure.ac (or1k*-*-*): Disable gdb.
* configure: Regenerated.

Signed-off-by: Christian Svensson <blue@cmd.nu>
10 years agoAdd or reactivate or1k-*-rtems*
Joel Sherrill [Mon, 21 Jul 2014 22:27:05 +0000 (17:27 -0500)]
Add or reactivate or1k-*-rtems*

* bfd/config.bfd (or1k-*-rtems*): Reactivate.
* gas/configure.tgt (or1k-*-rtems*): Add.

Signed-off-by: Christian Svensson <blue@cmd.nu>
10 years agoFix ChangeLog entry:
Sriraman Tallam [Mon, 21 Jul 2014 18:15:38 +0000 (11:15 -0700)]
Fix ChangeLog entry:

2014-07-21  Sriraman Tallam  <tmsriram@google.com>

* object.cc (Relobj::is_section_name_included): Add
".rodata.nptl_version" to not garbage collect this section.

10 years ago2014-07-21 Sriraman Tallam <tmsriram@google.com>
Sriraman Tallam [Mon, 21 Jul 2014 18:12:05 +0000 (11:12 -0700)]
2014-07-21  Sriraman Tallam  <tmsriram@google.com>

* object.cc (Relobj::is_section_name_included): Add
".rodata.nptl_version".

10 years agodaily update
Alan Modra [Mon, 21 Jul 2014 00:01:37 +0000 (09:31 +0930)]
daily update

10 years agoImprove error message to cope with pr 17147.
Doug Evans [Sun, 20 Jul 2014 22:36:23 +0000 (15:36 -0700)]
Improve error message to cope with pr 17147.

PR server/17147
* remote.c (putpkt_binary): Add text to error message.

10 years agoRemove Chill from comments
Yao Qi [Thu, 17 Apr 2014 01:14:34 +0000 (09:14 +0800)]
Remove Chill from comments

gdb:

2014-07-20  Yao Qi  <yao@codesourcery.com>

* eval.c: Remove "Chill" from comments.
* gdbtypes.h: Likewise.
* symtab.h: Likewise.

10 years agoUpdate comments to TERNOP_SLICE
Yao Qi [Tue, 15 Apr 2014 03:39:26 +0000 (11:39 +0800)]
Update comments to TERNOP_SLICE

TERNOP_SLICE was added for language Chill, but it is used for Ada and D later.
Since language Chill was removed from GDB, TERNOP_SLICE is only used for
Ada and D.  This patch is to update its comments.

gdb:

2014-07-20  Yao Qi  <yao@codesourcery.com>

* std-operator.def: Update comments to TERNOP_SLICE.

10 years agoRemove operator BINOP_RANGE
Yao Qi [Tue, 15 Apr 2014 03:28:15 +0000 (11:28 +0800)]
Remove operator BINOP_RANGE

BINOP_RANGE was added by the following commit for chill language.

commit badefd2800f5ee2dc6a0eef870771af9dc29bba7
Author: Per Bothner <per@bothner.com>
Date:   Wed Nov 29 22:59:31 1995 +0000

        * expression.h (enum exp_opcode):  Add BINOP_RANGE.
        * expprint.c (dump_expression):  Support BINOP_RANGE.
        * eval.c (evaluate_subexp_standard):  Handle BINOP_RANGE (as error).
        (case MULTI_SUBSCRIPT):  Fix broken f77 value->int ad hoc conversion.
        * ch-lang.c (chill_op_print_tab):  Support BINOP_RANGE.
        (evaluate_subexp_chill):  Error on BINOP_COMMA.

Chill language is no longer supported, so we can remove BINOP_RANGE too.
This patch is to remove BINOP_RANGE.

gdb:

2014-07-20  Yao Qi  <yao@codesourcery.com>

* std-operator.def: Remove BINOP_RANGE.
* breakpoint.c (watchpoint_exp_is_const): Update.
* expprint.c (dump_subexp_body_standard): Likewise.
* eval.c (init_array_element): Remove dead code.
(evaluate_subexp_standard): Likewise.

10 years agoRemove operator BINOP_IN
Yao Qi [Tue, 15 Apr 2014 03:10:56 +0000 (11:10 +0800)]
Remove operator BINOP_IN

Chill language support was removed several years ago, and BINOP_IN
isn't used for Pascal.  This patch is to remove BINOP_IN.

gdb:

2014-07-20  Yao Qi  <yao@codesourcery.com>

* std-operator.def: Remove BINOP_IN.
* breakpoint.c (watchpoint_exp_is_const): Update.
* eval.c (evaluate_subexp_standard): Likewise.
* expprint.c (dump_subexp_body_standard): Likewise.

10 years agoor1k: add missing l.msync, l.psync and l.psync instructions.
Stefan Kristiansson [Sun, 20 Jul 2014 17:26:09 +0000 (20:26 +0300)]
or1k: add missing l.msync, l.psync and l.psync instructions.

Even though the opcodes were defined for these instructions,
the actual instruction definitions were lacking.

cpu/
* or1korbis.cpu (l-msync, l-psync, l-csync): New instructions.

opcodes/
* or1k-desc.c, * or1k-desc.h, * or1k-opc.c, * or1k-opc.h,
* or1k-opinst.c: Regenerate.

10 years agoFix for remote G Packet message too long error for baremetal.
Michael Eager [Sun, 20 Jul 2014 00:47:52 +0000 (17:47 -0700)]
Fix for remote G Packet message too long error for baremetal.

Prior to version MicroBlaze v8.10.a,EDK 13.1, XMD's gdbserver stub returned 57
registers in response to GDB's G request. Starting with version MicroBlaze
v8.10.a, EDK 13.1, XMD added the slr and shr register, for a count of 59
registers. This patch adds these registers to the expected G response. This patch
fixes the above problem for baremetal and also supports the backward compatibility.

ChangeLog:
2014-07-02  Ajit Agarwal  <ajitkum@xilinx.com>

* microblaze-tdep.c (microblaze_register_names): Add
the rshr and rslr register names.
(microblaze_gdbarch_init): Use of tdesc_has_registers.
Use of tdesc_find_feature. Use of tdesc_data_alloc.
Use of tdesc_numbered_register. Use of
microblaze_register_g_packet_guesses. Use of
tdesc_use_registers. Use of set_gdbarch_register_type.
(microblaze_register_g_packet_guesses): New.
* microblaze-tdep.h (microblaze_reg_num): Add
field MICROBLAZE_SLR_REGNUM MICROBLAZE_SHR_REGNUM
MICROBLAZE_NUM_REGS and MICROBLAZE_NUM_CORE_REGS.
(microblaze_frame_cache): Use of MICROBLAZE_NUM_REGS.
* features/microblaze-core.xml: New file.
* features/microblaze-stack-protect.xml: New file.
* features/microblaze-with-stack-protect.c: New file.
* features/microblaze-with-stack-protect.xml: New file.
* features/microblaze.xml: New file.
* features/microblaze.c: New file.
* features/Makefile (microblaze-with-stack-protect): Add
microblaze-with-stack-protect microblaze and
microblaze-expedite.
* regformats/microblaze-with-stack-protect.dat: New file.
* regformats/microblaze.dat: New file.
* doc/gdb.texinfo (MicroBlaze Features): New.

Signed-off-by:Ajit Agarwal ajitkum@xilinx.com

10 years agodaily update
Alan Modra [Sun, 20 Jul 2014 00:00:36 +0000 (09:30 +0930)]
daily update

10 years agodaily update
Alan Modra [Sat, 19 Jul 2014 00:00:38 +0000 (09:30 +0930)]
daily update

10 years agomake exec_ops static
Tom Tromey [Fri, 18 Jul 2014 15:27:17 +0000 (09:27 -0600)]
make exec_ops static

While working on some target stack changes, I noticed that exec_ops is
only used from exec.c.  This patch makes it "static".  This is cleaner
and makes it simpler to reason about the use of the target.

Tested by rebuilding.
I'm checking this in as obvious.

2014-07-18  Tom Tromey  <tromey@redhat.com>

* exec.c (exec_ops): Now static.
* exec.h (exec_ops): Don't declare.

10 years agofix calls to find_target_beneath
Tom Tromey [Fri, 11 Jul 2014 15:39:12 +0000 (09:39 -0600)]
fix calls to find_target_beneath

A long time ago Pedro pointed out that there are some calls to
find_target_beneath that pass in an explicit target_ops; but which
should instead use the ops provided to the method in question.  See:

    https://sourceware.org/ml/gdb-patches/2014-01/msg00429.html

This patch is just a minor cleanup to fix all such calls.  There were
only three.

2014-07-18  Tom Tromey  <tromey@redhat.com>

* spu-multiarch.c (spu_region_ok_for_hw_watchpoint): Pass "self"
to find_target_beneath.
* ravenscar-thread.c (ravenscar_prepare_to_store): Pass "ops" to
find_target_beneath.
(ravenscar_mourn_inferior): Pass "self" to find_target_beneath.

10 years agofix PR gdb/17130
Tom Tromey [Fri, 11 Jul 2014 14:30:34 +0000 (08:30 -0600)]
fix PR gdb/17130

This fixes PR gdb/17130.

The bug is that some code in utils.c was not updated during the target
delegation change:

  if (job_control
      /* If there is no terminal switching for this target, then we can't
         possibly get screwed by the lack of job control.  */
      || current_target.to_terminal_ours == NULL)
    fatal ("Quit");
  else
    fatal ("Quit (expect signal SIGINT when the program is resumed)");

After the delegation change, to_terminal_ours will never be NULL.

I think this bug can be seen before the target delegation change by
enabling target debugging -- this would also cause to_terminal_ours to
be non-NULL.

The fix is to introduce a new target_supports_terminal_ours function,
that properly checks the target stack.  This is not perhaps ideal, but
I think is a reasonable-enough approach, and in keeping with some
other existing code of the same form.

This patch also fixes a similar bug in target_supports_delete_record.

2014-07-18  Tom Tromey  <tromey@redhat.com>

PR gdb/17130:
* utils.c (quit): Use target_supports_terminal_ours.
* target.h (target_supports_terminal_ours): Declare.
* target.c (target_supports_delete_record): Don't check
to_delete_record against NULL.
(target_supports_terminal_ours): New function.

10 years agoclean up some target delegation cases
Tom Tromey [Fri, 11 Jul 2014 14:02:03 +0000 (08:02 -0600)]
clean up some target delegation cases

This patch cleans up some minor inconsistencies in target delegation.
It's primary purpose is to avoid confusion in the code.  A few spots
were checking the "beneath" target; however this can only be NULL for
the dummy target, so such tests are not needed.  Some other spots were
iterating over the beneath targets, looking for a method
implementation.  This is not needed for methods handled by
make-target-delegates, as there is always an implementation.

2014-07-18  Tom Tromey  <tromey@redhat.com>

PR gdb/17130:
* spu-multiarch.c (spu_region_ok_for_hw_watchpoint)
(spu_fetch_registers, spu_store_registers, spu_xfer_partial)
(spu_search_memory, spu_mourn_inferior): Simplify delegation.
* linux-thread-db.c (thread_db_pid_to_str): Always delegate.
* windows-nat.c (windows_xfer_partial): Always delegate.
* record-btrace.c (record_btrace_xfer_partial): Simplify
delegation.
(record_btrace_fetch_registers, record_btrace_store_registers)
(record_btrace_prepare_to_store, record_btrace_resume)
(record_btrace_wait, record_btrace_find_new_threads)
(record_btrace_thread_alive): Likewise.
* procfs.c (procfs_xfer_partial): Always delegate.
* corelow.c (core_xfer_partial): Always delegate.
* sol-thread.c (sol_find_new_threads): Simplify delegation.

10 years agomove exec_make_note_section earlier
Tom Tromey [Fri, 18 Jul 2014 15:35:04 +0000 (09:35 -0600)]
move exec_make_note_section earlier

This patch moves exec_make_note_section a bit earlier in exec.c.  This
lets us remove an otherwise unnecessary forward declaration and it
also makes the file a bit more in line with other code, as now
_initialize_exec is the final function in the file.

Tested by rebuilding.
I'm committing this as obvious.

2014-07-18  Tom Tromey  <tromey@redhat.com>

* exec.c (exec_make_note_section): Move earlier.

10 years agodaily update
Alan Modra [Fri, 18 Jul 2014 00:00:39 +0000 (09:30 +0930)]
daily update

10 years agoProperly handle EVEX register aliases
Ilya Tocar [Thu, 17 Jul 2014 09:59:32 +0000 (13:59 +0400)]
Properly handle EVEX register aliases

gas/

* config/tc-i386.c (parse_register): Set need_vrex.

gas/testsuite/

* gas/i386/x86-64-equ.d: New.
* gas/i386/x86-64-equ.s: New.
* gas/i386/i386.exp: Run x86-64-equ.

10 years agoPR 17170 - testcase for GDB global --statistics regression - fix up.
Jan Kratochvil [Thu, 17 Jul 2014 11:59:03 +0000 (13:59 +0200)]
PR 17170 - testcase for GDB global --statistics regression - fix up.

Add missing file to previous entry.

10 years agoPR 17170 - testcase for GDB global --statistics regression.
Jan Kratochvil [Thu, 17 Jul 2014 11:56:24 +0000 (13:56 +0200)]
PR 17170 - testcase for GDB global --statistics regression.

gdb/testsuite/
2014-07-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

PR gdb/17170
* gdb.base/statistics.exp: New file.

Message-ID: <20140712174217.GA1478@host2.jankratochvil.net>

10 years agoAdd reference to PR 17170 to previous entry.
Doug Evans [Thu, 17 Jul 2014 09:42:55 +0000 (02:42 -0700)]
Add reference to PR 17170 to previous entry.

10 years agoFix 17170.
Doug Evans [Thu, 17 Jul 2014 09:38:32 +0000 (02:38 -0700)]
Fix 17170.

* maint.c (count_symtabs_and_blocks): Handle NULL
current_program_space.
(report_command_stats): Check global enabled flag in addition to
recorded enabled flag.
(make_command_stats_cleanup): Handle msg_type == 0, startup.

testsuite/
* gdb.base/maint.exp: Update testing of per-command stats.

10 years agodaily update
Alan Modra [Thu, 17 Jul 2014 00:00:48 +0000 (09:30 +0930)]
daily update

10 years agoor1k: increase linux TEXT_START_ADDR to 0x2000
Stefan Kristiansson [Wed, 16 Jul 2014 21:25:20 +0000 (00:25 +0300)]
or1k: increase linux TEXT_START_ADDR to 0x2000

Override the default value of 0x0000 defined in
TEXT_START_ADDR to avoid linux executables to be mapped
at zero page.

ld/
* emulparams/elf32or1k_linux.sh (TEXT_START_ADDR): Increase from
0x0 to first page boundary at 0x2000.

10 years agoLinux: Use kill_lwp/tkill instead of kill when killing a process
Pedro Alves [Wed, 16 Jul 2014 19:06:55 +0000 (20:06 +0100)]
Linux: Use kill_lwp/tkill instead of kill when killing a process

Since we use tkill everywhere, using kill to try to kill each lwp
individually looks suspiciously odd.  We should really be using tgkill
everywhere, but at least while we don't get there this makes us
consistent.

gdb/gdbserver/
2014-07-16  Pedro Alves  <palves@redhat.com>

* linux-low.c (linux_kill_one_lwp): Use kill_lwp, not kill.

gdb/
2014-07-16  Pedro Alves  <palves@redhat.com>

* linux-nat.c (kill_callback): Use kill_lwp, not kill.

10 years agogdb.trace/tfile.c: Remove Thumb bit in one more more, general cleanup
Pedro Alves [Wed, 16 Jul 2014 18:25:41 +0000 (19:25 +0100)]
gdb.trace/tfile.c: Remove Thumb bit in one more more, general cleanup

I noticed that the existing code casts a function's address to 'long',
but that doesn't work correctly on some ABIs, like Win64, where long
is 32-bit and while pointers are 64-bit:

  func_addr = (long) &write_basic_trace_file;

Fixing that showed there's actually another place in the file that
writes a function address to file, and therefore should clear the
Thumb bit.  This commit adds a macro+function pair to centralize the
Thumb bit handling, and uses it in both places.

The rest is just enough changes to make the file build without
warnings with "-Wall -Wextra" with x86_64-w64-mingw32-gcc and
i686-w64-mingw32-gcc cross compilers, and with -m32/-m64 on x86_64
GNU/Linux.  Currently with x86_64-w64-mingw32-gcc we get:

  $ x86_64-w64-mingw32-gcc tfile.c  -Wall -DTFILE_DIR=\"\"
  tfile.c: In function 'start_trace_file':
  tfile.c:51:23: error: 'S_IRGRP' undeclared (first use in this function)
 S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
 ^
  tfile.c:51:23: note: each undeclared identifier is reported only once for each function it appears in
  tfile.c:51:31: error: 'S_IROTH' undeclared (first use in this function)
 S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
 ^
  tfile.c: In function 'add_memory_block':
  tfile.c:79:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     ll_x = (unsigned long) addr;
    ^
  tfile.c: In function 'write_basic_trace_file':
  tfile.c:113:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     func_addr = (long) &write_basic_trace_file;
 ^
  tfile.c:137:3: warning: passing argument 1 of 'add_memory_block' from incompatible pointer type [enabled by default]
     add_memory_block (&testglob, sizeof (testglob));
     ^
  tfile.c:72:1: note: expected 'char *' but argument is of type 'int *'
   add_memory_block (char *addr, int size)
   ^
  tfile.c:139:3: warning: passing argument 1 of 'add_memory_block' from incompatible pointer type [enabled by default]
     add_memory_block (&testglob2, 1);
     ^
  tfile.c:72:1: note: expected 'char *' but argument is of type 'int *'
   add_memory_block (char *addr, int size)
   ^
  tfile.c: In function 'write_error_trace_file':
  tfile.c:185:3: warning: implicit declaration of function 'alloca' [-Wimplicit-function-declaration]
     char *hex = alloca (len * 2 + 1);
     ^
  tfile.c:185:15: warning: incompatible implicit declaration of built-in function 'alloca' [enabled by default]
     char *hex = alloca (len * 2 + 1);
 ^
  tfile.c:211:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(long) &write_basic_trace_file);
      ^

Tested on x86_64 Fedora 20, -m64 and -m32.
Tested by Yao on arm targets.

gdb/testsuite/
2014-07-16  Pedro Alves  <palves@redhat.com>

* gdb.trace/tfile.c: Include unistd.h and stdint.h.
(start_trace_file): Guard S_IRGRP and S_IROTH uses behind #ifdef.
(tfile_write_64, tfile_write_16, tfile_write_8, tfile_write_addr)
(tfile_write_buf): New functions.
(add_memory_block): Rewrite using the above.
(adjust_function_address): New function.
(FUNCTION_ADDRESS): New macro.
(write_basic_trace_file): Remove short_x local, and use
tfile_write_16. Change type of func_addr local to unsigned long
long.  Use FUNCTION_ADDRESS instead of handling the Thumb bit
here.  Cast argument of add_memory_block to char pointer.
(write_error_trace_file): Avoid alloca.  Use FUNCTION_ADDRESS.
(main): Remove parameters.
* gdb.trace/tfile.exp: Remove nowarnings.

10 years agoMatch PLT entry only for ELFOSABI_GNU input
H.J. Lu [Wed, 16 Jul 2014 18:15:56 +0000 (11:15 -0700)]
Match PLT entry only for ELFOSABI_GNU input

* elf32-i386.c (elf_i386_plt_sym_val): Match PLT entry only for
ELFOSABI_GNU input.
* elf64-x86-64.c (elf_x86_64_plt_sym_val): Likewise.
(elf_x86_64_plt_sym_val_offset_plt_bnd): Likewise.

10 years agoProperly match PLT entry against .got.plt relocation
H.J. Lu [Wed, 16 Jul 2014 15:16:24 +0000 (08:16 -0700)]
Properly match PLT entry against .got.plt relocation

Relocations against .got.plt section may not be in the same order as
entries in PLT section.  It is incorrect to assume that the Ith reloction
index against .got.plt section always maps to the (I + 1)th entry in PLT
section.  This patch matches the .got.plt relocation offset/index in PLT
entry against the index in .got.plt relocation table.  It only checks
R_*_JUMP_SLOT and R_*_IRELATIVE relocations.  It ignores R_*_TLS_DESC
and R_*_TLSDESC relocations since they have different PLT entries.

bfd/

PR binutils/17154
* elf32-i386.c (elf_i386_plt_sym_val): Only match R_*_JUMP_SLOT
and R_*_IRELATIVE relocation offset with PLT entry.
* elf64-x86-64.c (elf_x86_64_plt_sym_val): Likewise.
(elf_x86_64_plt_sym_val_offset_plt_bnd): New.
(elf_x86_64_get_synthetic_symtab): Use it.

ld/testsuite/

PR binutils/17154
* ld-ifunc/pr17154-i386.d: New file.
* ld-ifunc/pr17154-x86-64.d: Likewise.
* ld-ifunc/pr17154-x86.s: Likewise.
* ld-x86-64/bnd-ifunc-2.d: Likewise.
* ld-x86-64/bnd-ifunc-2.s: Likewise.
* ld-x86-64/mpx.exp: Run bnd-ifunc-2.
* ld-x86-64/tlsdesc-nacl.pd: Updated.
* ld-x86-64/tlsdesc.pd: Likewise.

10 years agoAdd test for string evaluation with "debug expression" on
Simon Marchi [Tue, 15 Jul 2014 17:04:31 +0000 (13:04 -0400)]
Add test for string evaluation with "debug expression" on

As Joel pointed out in...
https://sourceware.org/ml/gdb-patches/2014-07/msg00391.html
...it would be nice to add a test for that.

Tested on Linux x86_64 (Ubuntu 14.10).

gdb/testsuite/ChangeLog

2014-07-15  Simon Marchi  <simon.marchi@ericsson.com>

* gdb.base/debug-expr.exp: Test string evaluation with
"debug expression" on.

10 years agoreformat comment in target.h
Tom Tromey [Wed, 16 Jul 2014 14:09:27 +0000 (08:09 -0600)]
reformat comment in target.h

A comment in target.h went past the column limit.  This patch
reformats it.  I'm pushing this as obvious.

2014-07-16  Tom Tromey  <tromey@redhat.com>

* target.h (struct target_ops) <to_delete_record>: Reformat
comment.

10 years agorebuild target-delegates.c
Tom Tromey [Wed, 16 Jul 2014 14:05:03 +0000 (08:05 -0600)]
rebuild target-delegates.c

target-delegates.c was out of date.  This patch rebuilds it.
Built and regtested on x86-64 Fedora 20.
Committed as obvious.

2014-07-16  Tom Tromey  <tromey@redhat.com>

* target-delegates.c: Rebuild.

10 years agodaily update
Alan Modra [Wed, 16 Jul 2014 00:00:55 +0000 (09:30 +0930)]
daily update

10 years agoUpdate elf_i386_compute_jump_table_size
H.J. Lu [Tue, 15 Jul 2014 20:09:55 +0000 (13:09 -0700)]
Update elf_i386_compute_jump_table_size

Commit e1f987424b7b3f5ac63a2a6ae044a202a44b8ff8 changed how
next_tls_desc_index was set up.  This patch updates
elf_i386_compute_jump_table_size to use elf.srelplt->reloc_count
instead of next_tls_desc_index.

bfd/

PR ld/17057
* elf32-i386.c (elf_i386_compute_jump_table_size): Replace
next_tls_desc_index with elf.srelplt->reloc_count.

ld/testsuite/

PR ld/17057
* ld-i386/i386.exp: Run pr17057.
* ld-i386/pr17057.d: New file.
* ld-i386/pr17057.s: Likewise.

10 years agogdb.base/reread.exp: Really restart GDB
Pedro Alves [Tue, 15 Jul 2014 16:30:34 +0000 (17:30 +0100)]
gdb.base/reread.exp: Really restart GDB

The other day I noticed that default_gdb_start reuses the GDB process
if it has been spawned already:

proc default_gdb_start { } {
...
    if [info exists gdb_spawn_id] {
return 0
    }

I was a bit surprised, and so I hacked in an error to check whether
anything is relying on it:

 + if [info exists gdb_spawn_id] {
 +    error "GDB already spawned"
 + }

And lo, that tripped on a funny buglet (see below).  The comment in
reread.exp says "Restart GDB entirely", but in reality, due to the
above, that's not what is happening, as a gdb_exit call is missing.
The test is proceeding with the previous GDB process...

I don't really want to go hunt for whether there's an odd setup out
there that assumes this in its board file or something, so for now,
I'm taking the simple route of just making the test do what it says it
does.  I think this much makes it an obvious fix.

 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 (gdb) PASS: gdb.base/reread.exp: run to foo() second time
 ERROR: tcl error sourcing ../src/gdb/testsuite/gdb.base/reread.exp.
 ERROR: GDB already spawned
     while executing
 "error "GDB already spawned""
     invoked from within
 "if [info exists gdb_spawn_id] {
 error "GDB already spawned"
     }"
     (procedure "default_gdb_start" line 22)
     invoked from within
 "default_gdb_start"
     (procedure "gdb_start" line 2)
     invoked from within
 "gdb_start"
     invoked from within
 "if [is_remote target] {
     unsupported "second pass: GDB should check for changes before running"
 } else {

     # Put the older executable back in pl..."
     (file "../src/gdb/testsuite/gdb.base/reread.exp" line 114)
     invoked from within
 "source ../src/gdb/testsuite/gdb.base/reread.exp"
     ("uplevel" body line 1)
     invoked from within
 "uplevel #0 source ../src/gdb/testsuite/gdb.base/reread.exp"
     invoked from within
 "catch "uplevel #0 source $test_file_name""
 testcase ../src/gdb/testsuite/gdb.base/reread.exp completed in 1 seconds
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gdb/testsuite/
2014-07-15  Pedro Alves  <palves@redhat.com>

* gdb.base/reread.exp: Use clean_restart.

10 years agoAdd support for the __flash qualifier on AVR
Pierre Langlois [Tue, 15 Jul 2014 16:03:09 +0000 (17:03 +0100)]
Add support for the __flash qualifier on AVR

The __flash qualifier is part of the named address spaces for AVR [1]. It
allows putting read-only data in the flash memory, normally reserved for
code.

When used together with a pointer, the DW_AT_address_class attribute is set
to 1 and allows GDB to detect that when it will be dereferenced, the data
will be loaded from the flash memory (with the LPM instruction).

We can now properly debug the following code:

~~~
const __flash char data_in_flash = 0xab;

int
main (void)
{
  const __flash char *pointer_to_flash = &data_in_flash;
}
~~~

~~~
(gdb) print pointer_to_flash
$1 = 0x1e8 <data_in_flash> "\253"
(gdb) print/x *pointer_to_flash
$2 = 0xab
(gdb) x/x pointer_to_flash
0x1e8 <data_in_flash>: 0xXXXXXXab
~~~

Whereas previously, GDB would revert to the default address space which is
RAM and mapped in higher memory:

~~~
(gdb) print pointer_to_flash
$1 = 0x8001e8 ""
~~~

[1] https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html

2014-07-15  Pierre Langlois  <pierre.langlois@embecosm.com>

gdb/
* avr-tdep.c (AVR_TYPE_ADDRESS_CLASS_FLASH): New macro.
(AVR_TYPE_INSTANCE_FLAG_ADDRESS_CLASS_FLASH): Likewise.
(avr_address_to_pointer): Check for AVR_TYPE_ADDRESS_CLASS_FLASH.
(avr_pointer_to_address): Likewise.
(avr_address_class_type_flags): New function.
(avr_address_class_type_flags_to_name): Likewise.
(avr_address_class_name_to_type_flags): Likewise.
(avr_gdbarch_init): Set address_class_type_flags,
address_class_type_flags_to_name and
address_class_name_to_type_flags.

gdb/testsuite/
* gdb.arch/avr-flash-qualifer.c: New.
* gdb.arch/avr-flash-qualifer.exp: New.

10 years ago[GDB/Linux] Avoid stale errno
Pedro Alves [Tue, 15 Jul 2014 15:22:14 +0000 (16:22 +0100)]
[GDB/Linux] Avoid stale errno

The fix that went into GDBserver is also needed on the GDB side.

Although most compilers follow right-to-left evaluation order, the
order of evaluation of a function call's arguments is really
unspecified.  target_pid_to_str may well clobber errno when we get to
evaluate the third argument to fprintf_unfiltered.

gdb/
2014-07-15  Pedro Alves  <palves@redhat.com>

* linux-nat.c (kill_callback): Save errno and work with saved
copy.

10 years agoHandle OP_STRING in dump_subexp_body_standard
Simon Marchi [Thu, 19 Jun 2014 14:45:33 +0000 (10:45 -0400)]
Handle OP_STRING in dump_subexp_body_standard

For some reason, OP_STRING is not handled in dump_subexp_body_standard.
This makes the output of "set debug expression 1" very bad when a string
is involved. Example:

(gdb) set debug expression 1
(gdb) print "hello"
... (random garbage, possibly segfault)

This commit handles OP_STRING and skips the appropriate number of exp
elements. The line corresponding to the string now looks like:

    0  OP_STRING             Language-specific string type: 0

gdb/ChangeLog:

2014-07-15  Simon Marchi  <simon.marchi@ericsson.com>

* expprint.c (dump_subexp_body_standard): Handle OP_STRING.

10 years ago[GDBserver] Avoid stale errno
Pedro Alves [Tue, 15 Jul 2014 14:35:28 +0000 (15:35 +0100)]
[GDBserver] Avoid stale errno

Although most compilers follow right-to-left evaluation order, the
order of evaluation of a function call's arguments is really
unspecified.  target_pid_to_str or ptid_of may well clobber errno when
we get to evaluate the third argument to debug_printf.

gdb/gdbserver/
2014-07-15  Pedro Alves  <palves@redhat.com>

* linux-low.c (linux_kill_one_lwp): Save errno and work with saved
copy.

10 years ago[ARM] Fix 32-bit host build failure.
Jiong Wang [Tue, 15 Jul 2014 09:15:43 +0000 (10:15 +0100)]
[ARM] Fix 32-bit host build failure.

  gas/
    * config/tc-arm.c (add_to_lit_pool): Use "inst.operands[1].imm" for * sign
    extension.  Casting the type of imm1 and imm2 to offsetT.  Fix one logic
    error when checking X_op.

10 years ago[AArch64] Fix ld testcase linker script glitch.
Jiong Wang [Tue, 15 Jul 2014 09:08:55 +0000 (10:08 +0100)]
[AArch64] Fix ld testcase linker script glitch.

  Specify -T relocs.ld for emit-relocs-local-addend.d to be consistent
  will all other emit-relocs* testcases

  ld/testsuite/
    * ld-aarch64/emit-relocs-local-addend.d: Use target linker script.

10 years agoDon't complain about dbCC to long branch conversion
Andreas Schwab [Mon, 14 Jul 2014 18:59:50 +0000 (20:59 +0200)]
Don't complain about dbCC to long branch conversion

* config/tc-m68k.c (md_convert_frag_1): Don't complain with
--pcrel about TAB (DBCCLBR, LONG) conversion.

10 years agoAccount for trailing bytes read from bfd_bread
Alan Modra [Wed, 9 Jul 2014 10:34:40 +0000 (20:04 +0930)]
Account for trailing bytes read from bfd_bread

* cache.c (cache_bread_1): Don't return -1 when fread returns
a positive value.

10 years agotidy elf_merge_st_other
Alan Modra [Wed, 9 Jul 2014 05:23:00 +0000 (14:53 +0930)]
tidy elf_merge_st_other

So that we munge isym->st_other once per symbol.

* elflink.c (elf_merge_st_other): Update comments.  Simplify
visibility handling.  Make isym const.  Move code modifying
isym->st_other for --exclude-libs to..
(elf_link_add_object_symbols): ..here.

10 years agodaily update
Alan Modra [Tue, 15 Jul 2014 00:00:48 +0000 (09:30 +0930)]
daily update

10 years ago2014-07-14 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>
Edjunior Barbosa Machado [Mon, 14 Jul 2014 23:18:10 +0000 (20:18 -0300)]
2014-07-14  Edjunior Barbosa Machado  <emachado@linux.vnet.ibm.com>

* ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no hardware
breakpoint support correctly.

10 years agoAdd missing ChangeLog entry for 15cd413a
Pedro Alves [Mon, 14 Jul 2014 19:39:53 +0000 (20:39 +0100)]
Add missing ChangeLog entry for 15cd413a

Put GDB's terminal settings into effect when paginating
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.

10 years agoPut GDB's terminal settings into effect when paginating
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +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.

10 years agoFix double prompt
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +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.

10 years agoRemove the target from the event loop while in secondary prompts
Pedro Alves [Mon, 14 Jul 2014 18:55:32 +0000 (19:55 +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.