and though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here

  1. 29 Jul, 2014 5 commits
    • Joel Brobecker's avatar
      Set GDB version number to 7.8. · f39c1f89
      Joel Brobecker authored
      gdb/ChangeLog:
      
      	* version.in: Set GDB version number to 7.8.
      f39c1f89
    • Joel Brobecker's avatar
      Update gdb/NEWS in preparation for GDB 7.8 release. · fb696ab8
      Joel Brobecker authored
      gdb/ChangeLog:
      
      	* NEWS: Change "Changes since GDB 7.7" into "Changes in GDB 7.8".
      fb696ab8
    • Yao Qi's avatar
      Fix PR 17206 · f7f4b7af
      Yao Qi authored
      As reported in PR 17206, an internal error is triggered when command
      until is executed.  In infcmd.c:until_next_command, step_range_end is
      set to 'pc',
      
        if (!func)
          {
            struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (pc);
      
            if (msymbol.minsym == NULL)
      	error (_("Execution is not within a known function."));
      
            tp->control.step_range_start = BMSYMBOL_VALUE_ADDRESS (msymbol);
            tp->control.step_range_end = pc;
          }
      
      and later in infrun.c:resume, the assert below is triggered in PR
      17206.
      
        if (tp->control.may_range_step)
          {
            /* If we're resuming a thread with the PC out of the step
      	 range, then we're doing some nested/finer run control
      	 operation, like stepping the thread out of the dynamic
      	 linker or the displaced stepping scratch pad.  We
      	 shouldn't have allowed a range step then.  */
            gdb_assert (pc_in_thread_step_range (pc, tp));
          }
      
      In until_next_command, we set step range to [XXX, pc), so pc isn't
      within the range.  pc_in_thread_step_range returns false and the
      assert is triggered.  AFAICS, the range we want in until_next_command
      is [XXX, pc] instead of [XXX, pc), because we want to program step
      until greater than pc.  This patch is to set step_range_end to
      'pc + 1'.  Running until-nodebug.exp with unpatched GDB will get the
      following fail,
      
      FAIL: gdb.base/until-nodebug.exp: until 2 (GDB internal error)
      
      and the fail goes away when the fix is applied.
      
      gdb:
      
      2014-07-29  Yao Qi  <yao@codesourcery.com>
      
      	PR gdb/17206
      	* infcmd.c (until_next_command): Set step_range_end to PC + 1.
      
      gdb/testsuite:
      
      2014-07-29  Yao Qi  <yao@codesourcery.com>
      
      	PR gdb/17206
      	* gdb.base/until-nodebug.exp: New.
      f7f4b7af
    • Doug Evans's avatar
      PR guile/17203 · c201aa93
      Doug Evans authored
      	* guile/scm-param.c (pascm_parameter_defined_p): New function.
      	(gdbscm_register_parameter_x): Call it.  Raise error for pre-existing
      	parameters.
      
      	testsuite/
      	* gdb.guile/scm-parameter.exp: Add tests for trying to create
      	previously existing parameter, and previously ambiguously spelled
      	parameter.
      c201aa93
    • GDB Administrator's avatar
      Automatic date update in version.in · 40bd5bed
      GDB Administrator authored
      40bd5bed
  2. 28 Jul, 2014 5 commits
    • Edjunior Barbosa Machado's avatar
      2014-07-28 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> · ab830d9e
      Edjunior Barbosa Machado authored
          * ppc-linux-nat.c (ppc_linux_can_use_hw_breakpoint): Report no hardware
          breakpoint support correctly.
      ab830d9e
    • Andreas Arnez's avatar
      watchpoint-reuse-slot.exp: Correctly skip unsupported commands. · 59390040
      Andreas Arnez authored
      The test case "watchpoint-reuse-slot.exp" yields a lot of failures on
      s390/s390x: all instances of awatch, rwatch, and hbreak are performed
      even though they aren't supported on these targets.  This is because
      the test case ignores non-support error messages when probing for
      support of these commands, like:
      
          (gdb) rwatch buf.byte[0]
          Target does not support this type of hardware watchpoint.
      
      The patch adds handling for this case in the appropriate
      gdb_test_multiple invocations.
      
      gdb/testsuite/
          * gdb.base/watchpoint-reuse-slot.exp: Handle the case that the
          target lacks support for awatch, rwatch, or hbreak.
      59390040
    • H.J. Lu's avatar
      Match PLT entry only for ELFOSABI_GNU input · bfeda6dc
      H.J. Lu authored
      	* 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.
      bfeda6dc
    • H.J. Lu's avatar
      Properly match PLT entry against .got.plt relocation · 5840bf27
      H.J. Lu authored
      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.
      5840bf27
    • GDB Administrator's avatar
      Automatic date update in version.in · 89d63ded
      GDB Administrator authored
      89d63ded
  3. 27 Jul, 2014 6 commits
    • Doug Evans's avatar
      PR guile/17146 · 2dfee787
      Doug Evans authored
      	* 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.
      2dfee787
    • Doug Evans's avatar
      PR guile/17146 preparatory work. · 4024328e
      Doug Evans authored
      	* 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.
      4024328e
    • Doug Evans's avatar
      PR build/17105. · 8550a71c
      Doug Evans authored
      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.
      8550a71c
    • Doug Evans's avatar
      PR guile/17177 · 68455456
      Doug Evans authored
      	* 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.
      68455456
    • Doug Evans's avatar
      PR 17185 · b13f24b8
      Doug Evans authored
      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.
      b13f24b8
    • GDB Administrator's avatar
      Automatic date update in version.in · 05e19170
      GDB Administrator authored
      05e19170
  4. 26 Jul, 2014 1 commit
  5. 25 Jul, 2014 2 commits
    • Pedro Alves's avatar
      Fix paginate-*.exp races · d1156d42
      Pedro Alves authored
      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 7.8: lib/gdb-utils.exp didn't exist in the branch yet, so this patch adds it.]
      
      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: New file.
      	* lib/gdb.exp: Load gdb-utils.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.
      d1156d42
    • GDB Administrator's avatar
      Automatic date update in version.in · 197a92ef
      GDB Administrator authored
      197a92ef
  6. 24 Jul, 2014 2 commits
    • Pedro Alves's avatar
      Fix pagination crash when the TUI is active · c46269f2
      Pedro Alves authored
      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 0017922d 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.
      c46269f2
    • GDB Administrator's avatar
      Automatic date update in version.in · e3d37054
      GDB Administrator authored
      e3d37054
  7. 23 Jul, 2014 1 commit
  8. 22 Jul, 2014 3 commits
    • Jan Kratochvil's avatar
      Fix read_frame_arg for optimized-out entry values. · 0f9e1204
      Jan Kratochvil authored
      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>
      0f9e1204
    • Pedro Alves's avatar
      Fix crash on optimized-out entry data values · c666adc6
      Pedro Alves authored
      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.
      c666adc6
    • GDB Administrator's avatar
      Automatic date update in version.in · e51fbbc2
      GDB Administrator authored
      e51fbbc2
  9. 21 Jul, 2014 1 commit
  10. 20 Jul, 2014 2 commits
  11. 19 Jul, 2014 1 commit
  12. 18 Jul, 2014 4 commits
  13. 17 Jul, 2014 3 commits
  14. 16 Jul, 2014 1 commit
  15. 15 Jul, 2014 1 commit
  16. 14 Jul, 2014 2 commits
    • Pedro Alves's avatar
      Put GDB's terminal settings into effect when paginating · 06f304e8
      Pedro Alves authored
      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.
      06f304e8
    • Pedro Alves's avatar
      Fix double prompt · 49632fd8
      Pedro Alves authored
      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.
      49632fd8