aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2014-07-27 * guile/scm-param.c (pascm_print_param_smob): Fix output.Doug Evans2-1/+5
2014-07-27 * guile/guile.c (gdbscm_execute_gdb_command): Fix typo in comment.Doug Evans2-1/+5
2014-07-26PR guile/17146Doug Evans8-25/+334
* 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.
2014-07-26PR guile/17146 preparatory work.Doug Evans13-38/+90
* 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.
2014-07-26PR build/17105.Doug Evans4-40/+102
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.
2014-07-26PR guile/17177Doug Evans6-29/+95
* 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.
2014-07-26PR 17185Doug Evans5-0/+61
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.
2014-07-25MIPS: Respect the "set mips compression" commandMaciej W. Rozycki2-2/+9
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.
2014-07-25remove using_exec_ops globalTom Tromey2-21/+17
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.
2014-07-25fix build: update clear_proceed_status callersPedro Alves8-7/+17
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.
2014-07-25Always pass signals to the right threadPedro Alves20-79/+716
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.
2014-07-25properly parenthesize two macrosTom Tromey2-2/+8
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.
2014-07-25Clarify the address and pointer conversions on AVR.Pierre Langlois2-5/+18
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.
2014-07-25Fix paginate-*.exp racesPedro Alves8-46/+56
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.
2014-07-24constify target fieldsTom Tromey3-4/+10
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.
2014-07-24constify command docsTom Tromey8-26/+45
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.
2014-07-24constify command prefixTom Tromey9-22/+40
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.
2014-07-24constify deprecate_cmdTom Tromey5-5/+13
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.
2014-07-24constify help_cmdTom Tromey3-3/+7
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.
2014-07-24constify stack.cTom Tromey2-2/+7
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.
2014-07-24constify solib_addTom Tromey3-2/+7
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.
2014-07-24constify remote.cTom Tromey3-7/+13
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.
2014-07-24constify monitor_openTom Tromey3-2/+8
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.
2014-07-24constify maint.cTom Tromey2-6/+13
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.
2014-07-24constify inf_child_open_targetTom Tromey3-2/+8
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.
2014-07-24constify unset_in_environTom Tromey3-2/+7
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.
2014-07-24constify cli-dump.cTom Tromey2-17/+27
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.
2014-07-24Fix pagination crash when the TUI is activePedro Alves2-1/+5
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.
2014-07-24Remove some GDBSERVER checks from linux-ptraceTom Tromey4-25/+52
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.
2014-07-24Make gdbserver CORE_ADDR unsignedTom Tromey2-1/+6
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.
2014-07-24auto-generate most target debug methodsTom Tromey6-700/+2589
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.
2014-07-24Rationalize "fatal" error handling outside of gdbserverGary Benson5-33/+35
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.
2014-07-23This patch uses target_read_code instead of target_read_memory inMichael Eager2-1/+6
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.
2014-07-23se typecast 'size_t' on 'reg', not only avoid the related warning, butMichael Eager2-1/+6
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.
2014-07-23rewrite make-target-delegates matching codeTom Tromey3-55/+83
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.
2014-07-23Fix build on systems without sigaltstack.Gary Benson2-0/+9
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.
2014-07-22Remove setting value address for reference entry value target data value.Jan Kratochvil2-9/+5
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>
2014-07-22Fix read_frame_arg for optimized-out entry values.Jan Kratochvil9-0/+905
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>
2014-07-22Fix crash on optimized-out entry data valuesPedro Alves2-1/+9
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.
2014-07-22Fix typo in my email address.Jiong Wang1-1/+1
2014-07-22Update email address in gdb MAINTAINERS list.Jiong Wang2-1/+5
2014-07-20Improve error message to cope with pr 17147.Doug Evans2-1/+10
PR server/17147 * remote.c (putpkt_binary): Add text to error message.
2014-07-21Remove Chill from commentsYao Qi4-11/+15
gdb: 2014-07-20 Yao Qi <yao@codesourcery.com> * eval.c: Remove "Chill" from comments. * gdbtypes.h: Likewise. * symtab.h: Likewise.
2014-07-21Update comments to TERNOP_SLICEYao Qi2-2/+6
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.
2014-07-21Remove operator BINOP_RANGEYao Qi5-50/+12
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.
2014-07-21Remove operator BINOP_INYao Qi5-14/+7
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.
2014-07-19Fix for remote G Packet message too long error for baremetal.Michael Eager13-26/+507
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
2014-07-18make exec_ops staticTom Tromey3-3/+6
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.
2014-07-18fix calls to find_target_beneathTom Tromey3-3/+11
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.
2014-07-18fix PR gdb/17130Tom Tromey4-2/+34
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.