The branch, scox/dyninst has been created at c93a51b7e31702961ecb060b36740dd0390d0a51 (commit) - Log ----------------------------------------------------------------- commit c93a51b7e31702961ecb060b36740dd0390d0a51 Author: Stan Cox Date: Fri Oct 31 16:01:57 2014 -0400 Add a preliminary version of a gdbserver dyninst GDB remote serial server. * Makefile.in: Make CXX and dyninst aware. * configure.ac: Check for basename and dyninst. * configure.srv: Add *-dyninst-linux. * inferiors.h: Rename private to piprivate to avoid CXX complaints. * (linux-aarch64-low.c, linux-arm-low.c, linux-low.c, linux-mips-low.c, linux-x86-low.c, lynx-low.c, thread-db.c): Likewise. * dyninst-low.cc: New. generic rsp packet handling for dyninst rsp server. * dyninst-low.h: New. generic dyninst rsp declarations. * dyninst-x86-low.cc: New. x86 specific dyninst rsp handling. commit e5b470e24ce448a56230137a37d3b17299593041 Author: Nick Clifton Date: Wed Oct 29 20:58:13 2014 +0000 Fixes another memory corruption bug introduced by patches for PR 17512. * elf.c (bfd_section_from_shdr): Fix heap use after free memory leak. commit f60325bea599bab4cb721c6e797bc6b908fa616c Author: Joel Brobecker Date: Wed Oct 29 12:57:04 2014 -0700 Document the GDB 7.8.1 release in gdb/ChangeLog gdb/ChangeLog: GDB 7.8.1 released. commit 9726c3c179e375cc0cc73a593adfaef8ed5735ab Author: Han Shen Date: Wed Oct 29 11:28:46 2014 -0700 Misc about gold for aarch64 backend. The patch does the following things: -- Add support for ifunc. -- Enable safe icf -- Add support for TLSLD relocations R_AARCH64_TLSLD_ADR_PAGE21, R_AARCH64_TLSLD_ADD_LO12_NC, R_AARCH64_TLSLD_MOVW_DTPREL_G1, R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC. (R_AARCH64_TLSLD_MOVW_* are used by LLVM.) -- Add support for TLSLD->TLSLE relaxation. -- Add support for R_AARCH64_LD_PREL_LO19, R_AARCH64_ADR_PREL_LO21. -- Fix 2 encoding bugs in AArch64_relocate_functions::update_movnz. -- Correct TLS relocation properties in gold/aarch64-reloc.def. -- Update testsuite/icf_safe_so_test.cc, testsuite/icf_safe_test.sh. gold/ 2014-10-29 Han Shen Jing Yu * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to Symbol::TLS_REF. * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New method. (Target_aarch64::reloc_needs_plt_for_ifunc): New method. (Target_aarch64::tls_ld_to_le): New method. (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections for 64bit targets. (Output_data_plt_aarch64::irelative_rel_): New data member. (Output_data_plt_aarch64::add_entry): Add irelative entries to plt. (Output_data_plt_aarch64::add_local_ifunc_entry): New method. (Output_data_plt_aarch64::add_relocation): New method. (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative offset. Add got_irelative size to got size. (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long type string with the new typename. (AArch64_relocate_functions::update_adr): Replace parameter x with immed. (AArch64_relocate_functions::update_movnz): Correct wrong val mask. (AArch64_relocate_functions::reloc_common): New method. (AArch64_relocate_funcsions::rela_general): Extract common part out into reloc_common method. (AArch64_relocate_functions::rela_general): Likewise. (AArch64_relocate_functions::pcrela_general): Likewise. (AArch64_relocate_functions::adr): New method. (AArch64_relocate_functions::adrp): Calculate immed before calling update_adr. (AArch64_relocate_functions::adrp): Likewise. (AArch64_relocate_functions::movnz): Cast x to SignedW type when comparing x to 0. Calculate immed from ~x when x < 0. (Target_aarch64::optimize_tls_reloc): Add new cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. (Target_aarch64::possible_function_pointer_reloc): Implement this method. (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update comment. (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. (Target_aarch64::make_plt_entry): Call add_entry with two more parameters. (Target_aarch64::make_local_ifunc_plt_entry): New method. (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19, ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. (Target_aarch64::Relocate::relocate_tls): Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC. * testsuite/icf_safe_so_test.cc: Correct test comment. * testsuite/icf_safe_test.sh: Add AArch64 arch. commit ab917dfb5ae0952c234a9bfa16bb3122fdfaf14c Author: Pedro Alves Date: Wed Oct 29 18:25:27 2014 +0000 This PR shows that GDB can easily trigger an assertion here, in infrun.c: 5392 /* Did we find the stepping thread? */ 5393 if (tp->control.step_range_end) 5394 { 5395 /* Yep. There should only one though. */ 5396 gdb_assert (stepping_thread == NULL); 5397 5398 /* The event thread is handled at the top, before we 5399 enter this loop. */ 5400 gdb_assert (tp != ecs->event_thread); 5401 5402 /* If some thread other than the event thread is 5403 stepping, then scheduler locking can't be in effect, 5404 otherwise we wouldn't have resumed the current event 5405 thread in the first place. */ 5406 gdb_assert (!schedlock_applies (currently_stepping (tp))); 5407 5408 stepping_thread = tp; 5409 } Like: gdb/infrun.c:5406: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed. The way the assertion is written is assuming that with schedlock=step we'll always leave threads other than the one with the stepping range locked, while that's not true with the "next" command. With schedlock "step", other threads still run unlocked when "next" detects a function call and steps over it. Whether that makes sense or not, still, it's documented that way in the manual. If another thread hits an event that doesn't cause a stop while the nexting thread steps over a function call, we'll get here and fail the assertion. The fix is just to adjust the assertion. Even though we found the stepping thread, we'll still step-over the breakpoint that just triggered correctly. Surprisingly, gdb.threads/schedlock.exp doesn't have any test that steps over a function call. This commits fixes that. This ensures that "next" doesn't switch focus to another thread, and checks whether other threads run locked or not, depending on scheduler locking mode and command. There's a lot of duplication in that file that this ends cleaning up. There's more that could be cleaned up, but that would end up an unrelated change, best done separately. This new coverage in schedlock.exp happens to trigger the internal error in question, like so: FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (1) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (3) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (5) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (7) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (9) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next does not change thread (switched to thread 0) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: current thread advanced - unlocked (wrong amount) That's because we have more than one thread running the same loop, and while one thread is stepping over a function call, the other thread hits the step-resume breakpoint of the first, which needs to be stepped over, and we end up in switch_back_to_stepped_thread exactly in the problem case. I think a simpler and more directed test is also useful, to not rely on internal breakpoint magics. So this commit also adds a test that has a thread trip on a conditional breakpoint that doesn't cause a user-visible stop while another thread is stepping over a call. That currently fails like this: FAIL: gdb.threads/next-bp-other-thread.exp: schedlock=step: next over function call (GDB internal error) Tested on x86_64 Fedora 20. gdb/ 2014-10-29 Pedro Alves PR gdb/17408 * infrun.c (switch_back_to_stepped_thread): Use currently_stepping instead of assuming a thread with a stepping range is always stepping. gdb/testsuite/ 2014-10-29 Pedro Alves PR gdb/17408 * gdb.threads/schedlock.c (some_function): New function. (call_function): New global. (MAYBE_CALL_SOME_FUNCTION): New macro. (thread_function): Call it. * gdb.threads/schedlock.exp (get_args): Add description parameter, and use it instead of a global counter. Adjust all callers. (get_current_thread): Use "find current thread" for test message here rather than having all callers pass down the same string. (goto_loop): New procedure, factored out from ... (my_continue): ... this. (step_ten_loops): Change parameter from test message to command to use. Adjust. (list_count): Delete global. (check_result): New procedure, factored out from duplicate top level code. (continue tests): Wrap in with_test_prefix. (test_step): New procedure, factored out from duplicate top level code. (top level): Test "step" in combination with all scheduler-locking modes. Test "next" in combination with all scheduler-locking modes, and in combination with stepping over a function call or not. * gdb.threads/next-bp-other-thread.c: New file. * gdb.threads/next-bp-other-thread.exp: New file. commit 354204061c1eec5cec6e8bab0af164a267b1e67d Author: Pedro Alves Date: Wed Oct 29 18:15:39 2014 +0000 PR 17408 - assertion failure in switch_back_to_stepped_thread This PR shows that GDB can easily trigger an assertion here, in infrun.c: 5392 /* Did we find the stepping thread? */ 5393 if (tp->control.step_range_end) 5394 { 5395 /* Yep. There should only one though. */ 5396 gdb_assert (stepping_thread == NULL); 5397 5398 /* The event thread is handled at the top, before we 5399 enter this loop. */ 5400 gdb_assert (tp != ecs->event_thread); 5401 5402 /* If some thread other than the event thread is 5403 stepping, then scheduler locking can't be in effect, 5404 otherwise we wouldn't have resumed the current event 5405 thread in the first place. */ 5406 gdb_assert (!schedlock_applies (currently_stepping (tp))); 5407 5408 stepping_thread = tp; 5409 } Like: gdb/infrun.c:5406: internal-error: switch_back_to_stepped_thread: Assertion `!schedlock_applies (1)' failed. The way the assertion is written is assuming that with schedlock=step we'll always leave threads other than the one with the stepping range locked, while that's not true with the "next" command. With schedlock "step", other threads still run unlocked when "next" detects a function call and steps over it. Whether that makes sense or not, still, it's documented that way in the manual. If another thread hits an event that doesn't cause a stop while the nexting thread steps over a function call, we'll get here and fail the assertion. The fix is just to adjust the assertion. Even though we found the stepping thread, we'll still step-over the breakpoint that just triggered correctly. Surprisingly, gdb.threads/schedlock.exp doesn't have any test that steps over a function call. This commits fixes that. This ensures that "next" doesn't switch focus to another thread, and checks whether other threads run locked or not, depending on scheduler locking mode and command. There's a lot of duplication in that file that this ends cleaning up. There's more that could be cleaned up, but that would end up an unrelated change, best done separately. This new coverage in schedlock.exp happens to trigger the internal error in question, like so: FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (1) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (3) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (5) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (7) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next to increment (9) (GDB internal error) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: next does not change thread (switched to thread 0) FAIL: gdb.threads/schedlock.exp: schedlock=step: cmd=next: call_function=1: current thread advanced - unlocked (wrong amount) That's because we have more than one thread running the same loop, and while one thread is stepping over a function call, the other thread hits the step-resume breakpoint of the first, which needs to be stepped over, and we end up in switch_back_to_stepped_thread exactly in the problem case. I think a simpler and more directed test is also useful, to not rely on internal breakpoint magics. So this commit also adds a test that has a thread trip on a conditional breakpoint that doesn't cause a user-visible stop while another thread is stepping over a call. That currently fails like this: FAIL: gdb.threads/next-bp-other-thread.exp: schedlock=step: next over function call (GDB internal error) Tested on x86_64 Fedora 20. gdb/ 2014-10-29 Pedro Alves PR gdb/17408 * infrun.c (switch_back_to_stepped_thread): Use currently_stepping instead of assuming a thread with a stepping range is always stepping. gdb/testsuite/ 2014-10-29 Pedro Alves PR gdb/17408 * gdb.threads/schedlock.c (some_function): New function. (call_function): New global. (MAYBE_CALL_SOME_FUNCTION): New macro. (thread_function): Call it. * gdb.threads/schedlock.exp (get_args): Add description parameter, and use it instead of a global counter. Adjust all callers. (get_current_thread): Use "find current thread" for test message here rather than having all callers pass down the same string. (goto_loop): New procedure, factored out from ... (my_continue): ... this. (step_ten_loops): Change parameter from test message to command to use. Adjust. (list_count): Delete global. (check_result): New procedure, factored out from duplicate top level code. (continue tests): Wrap in with_test_prefix. (test_step): New procedure, factored out from duplicate top level code. (top level): Test "step" in combination with all scheduler-locking modes. Test "next" in combination with all scheduler-locking modes, and in combination with stepping over a function call or not. * gdb.threads/next-bp-other-thread.c: New file. * gdb.threads/next-bp-other-thread.exp: New file. commit d3d4baedb6d247c6372678edd15195a1a93c2c6c Author: Pedro Alves Date: Thu Oct 23 17:13:35 2014 +0100 PR python/17372 - Python hangs when displaying help() This is more of a readline/terminal issue than a Python one. PR17372 is a regression in 7.8 caused by the fix for PR17072: commit 0017922d0292d8c374584f6100874580659c9973 Author: Pedro Alves Date: Mon Jul 14 19:55:32 2014 +0100 Background execution + pagination aborts readline/gdb gdb_readline_wrapper_line removes the handler after a line is processed. Usually, we'll end up re-displaying the prompt, and that reinstalls the handler. But if the output is coming out of handling a stop event, we don't re-display the prompt, and nothing restores the handler. So the next input wakes up the event loop and calls into readline, which aborts. ... gdb/ 2014-07-14 Pedro Alves PR gdb/17072 * top.c (gdb_readline_wrapper_line): Tweak comment. (gdb_readline_wrapper_cleanup): If readline is enabled, reinstall the input handler callback. The problem is that installing the input handler callback also preps the terminal, putting it in raw mode and with echo disabled, which is bad if we're going to call a command that assumes cooked/canonical mode, and echo enabled, like in the case of the PR, Python's interactive shell. Another example I came up with that doesn't depend on Python is starting a subshell with "(gdb) shell /bin/sh" from a multi-line command. Tests covering both these examples are added. The fix is to revert the original fix for PR gdb/17072, and instead restore the callback handler after processing an asynchronous target event. Furthermore, calling rl_callback_handler_install when we already have some input in readline's line buffer discards that input, which is obviously a bad thing to do while the user is typing. No specific test is added for that, because I first tried calling it even if the callback handler was still installed and that resulted in hundreds of failures in the testsuite. gdb/ 2014-10-29 Pedro Alves PR python/17372 * event-top.c (change_line_handler): Call gdb_rl_callback_handler_remove instead of rl_callback_handler_remove. (callback_handler_installed): New global. (gdb_rl_callback_handler_remove, gdb_rl_callback_handler_install) (gdb_rl_callback_handler_reinstall): New functions. (display_gdb_prompt): Call gdb_rl_callback_handler_remove and gdb_rl_callback_handler_install instead of rl_callback_handler_remove and rl_callback_handler_install. (gdb_disable_readline): Call gdb_rl_callback_handler_remove instead of rl_callback_handler_remove. * event-top.h (gdb_rl_callback_handler_remove) (gdb_rl_callback_handler_install) (gdb_rl_callback_handler_reinstall): New declarations. * infrun.c (reinstall_readline_callback_handler_cleanup): New cleanup function. (fetch_inferior_event): Install it. * top.c (gdb_readline_wrapper_line) Call gdb_rl_callback_handler_remove instead of rl_callback_handler_remove. (gdb_readline_wrapper_cleanup): Don't call rl_callback_handler_install. gdb/testsuite/ 2014-10-29 Pedro Alves PR python/17372 * gdb.python/python.exp: Test a multi-line command that spawns interactive Python. * gdb.base/multi-line-starts-subshell.exp: New file. commit d1e8523e40ed5094ed7d5b352ac6b0eabf9f690c Author: Dennis Brueni Date: Wed Oct 29 17:17:32 2014 +0000 Thix fixes an obvious coding error that led to a GDB crash on AIX or HPUX. * elf.c (elfcore_write_lwpstatus): fix typo in call to memcpy commit 64b588b51e04a80ac6f9a30817b5247ad1c4790b Author: Nick Clifton Date: Wed Oct 29 16:34:04 2014 +0000 Updated/new translations provided by the Translations Project. commit 6e5d7f393ed899c8e980b238be3cf23ec296e3f6 Author: Pedro Alves Date: Wed Oct 29 11:57:03 2014 +0000 Fix uninitialized value access when very first GDB command entered is While running GDB under Valgrind, I noticed that if the very first command entered is just , GDB accesses an uninitialized value: $ valgrind ./gdb -q -nx ==26790== Memcheck, a memory error detector ==26790== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==26790== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info ==26790== Command: ./gdb -q -nx ==26790== (gdb) ==26790== Conditional jump or move depends on uninitialised value(s) ==26790== at 0x619DFC: command_line_handler (event-top.c:588) ==26790== by 0x7813D5: rl_callback_read_char (callback.c:220) ==26790== by 0x6194B4: rl_callback_read_char_wrapper (event-top.c:166) ==26790== by 0x61988A: stdin_event_handler (event-top.c:372) ==26790== by 0x61847D: handle_file_event (event-loop.c:762) ==26790== by 0x617964: process_event (event-loop.c:339) ==26790== by 0x617A2B: gdb_do_one_event (event-loop.c:403) ==26790== by 0x617A7B: start_event_loop (event-loop.c:428) ==26790== by 0x6194E6: cli_command_loop (event-top.c:181) ==26790== by 0x60F86B: current_interp_command_loop (interps.c:317) ==26790== by 0x610A34: captured_command_loop (main.c:321) ==26790== by 0x60C728: catch_errors (exceptions.c:237) ==26790== (gdb) It's this check here: /* If we just got an empty line, and that is supposed to repeat the previous command, return the value in the global buffer. */ if (repeat && p == linebuffer && *p != '\\') { The problem is that linebuffer's contents were never initialized at this point. gdb/ 2014-10-29 Pedro Alves * event-top.c (command_line_handler): Clear the first byte of linebuffer, when it is first allocated. commit 1e1e619b6b382f9b354d78018ddb73f0070375d2 Author: Pedro Alves Date: Wed Oct 29 14:49:05 2014 +0000 PR tui/16138 is about failure to initialize curses resulting in GDB exiting instead of throwing an error. E.g.: $ TERM=foo gdb (gdb) layout asm Error opening terminal: foo. $ The problem is that we're calling initscr to initialize the screen. As mentioned in http://pubs.opengroup.org/onlinepubs/7908799/xcurses/initscr.html: If errors occur, initscr() writes an appropriate error message to standard error and exits. ^^^^^ Instead, we should use newterm: "A program that needs an indication of error conditions, so it can continue to run in a line-oriented mode if the terminal cannot support a screen-oriented program, would also use this function." After the patch: $ TERM=foo gdb -q -nx (gdb) layout asm Cannot enable the TUI: error opening terminal [TERM=foo] (gdb) And then PR tui/17519 is about GDB not validating whether the terminal has the necessary capabilities when enabling the TUI. If one tries to enable the TUI with TERM=dumb (and e.g., from a shell within emacs), GDB ends up with a clear screen, the cursor is placed at the bottom/right corner of the screen, there's no prompt, typing shows no echo, and there's no indication of what's going on. c-x,a gets you out of the TUI, but it's completely non-obvious. After the patch, we get: $ TERM=dumb gdb -q -nx (gdb) layout asm Cannot enable the TUI: terminal doesn't support cursor addressing [TERM=dumb] (gdb) While at it, I've moved all the tui_allowed_p validation to tui_enable, and expanded the error messages. Previously we'd get: $ gdb -q -nx -i=mi (gdb) layout asm &"layout asm\n" &"TUI mode not allowed\n" ^error,msg="TUI mode not allowed" and: $ gdb -q -nx -ex "layout asm" > foo TUI mode not allowed While now we get: $ gdb -q -nx -i=mi (gdb) layout asm &"layout asm\n" &"Cannot enable the TUI when the interpreter is 'mi'\n" ^error,msg="Cannot enable the TUI when the interpreter is 'mi'" (gdb) and: $ gdb -q -nx -ex "layout asm" > foo Cannot enable the TUI when output is not a terminal Tested on x86_64 Fedora 20. gdb/ 2014-10-29 Pedro Alves PR tui/16138 PR tui/17519 * tui/tui-interp.c (tui_is_toplevel): Delete global. (tui_allowed_p): Delete function. * tui/tui.c: Include "interps.h". (tui_enable): Don't use tui_allowed_p. Error out here with detailed error messages if the TUI is the top level interpreter, or if output is not a terminal. Use newterm instead of initscr, and error out if initializing the terminal fails. Also error out if the terminal doesn't support cursor addressing. * tui/tui.h (tui_allowed_p): Delete declaration. commit 551cb6a52d99c04055afed182479a8780a15f4a1 Author: Pedro Alves Date: Wed Oct 29 11:58:12 2014 +0000 TUI: don't let exceptions escape while handling readline key bindings I noticed that with: $ TERM=dumb ./gdb -q -nx Cannot enable the TUI: terminal doesn't support cursor addressing [TERM=dumb] (gdb) The next key the user types is silently eaten. The problem is that we're throwing an exception while in a readline callback that isn't prepared for that: (top-gdb) bt #0 tui_enable () at /home/pedro/gdb/mygit/build/../src/gdb/tui/tui.c:388 #1 0x000000000051f47b in tui_rl_switch_mode (notused1=1, notused2=1) at /home/pedro/gdb/mygit/build/../src/gdb/tui/tui.c:101 #2 0x0000000000768d6f in _rl_dispatch_subseq (key=1, map=0xd069c0 , got_subseq=0) at /home/pedro/gdb/mygit/build/../src/readline/readline.c:774 #3 0x0000000000768acb in _rl_dispatch_callback (cxt=0x1ce6190) at /home/pedro/gdb/mygit/build/../src/readline/readline.c:686 #4 0x000000000078120b in rl_callback_read_char () at /home/pedro/gdb/mygit/build/../src/readline/callback.c:170 #5 0x0000000000619445 in rl_callback_read_char_wrapper (client_data=0x0) at /home/pedro/gdb/mygit/build/../src/gdb/event-top.c:166 #6 0x000000000061981b in stdin_event_handler (error=0, client_data=0x0) at /home/pedro/gdb/mygit/build/../src/gdb/event-top.c:372 #7 0x000000000061840e in handle_file_event (data=...) at /home/pedro/gdb/mygit/build/../src/gdb/event-loop.c:762 #8 0x00000000006178f5 in process_event () at /home/pedro/gdb/mygit/build/../src/gdb/event-loop.c:339 #9 0x00000000006179bc in gdb_do_one_event () at /home/pedro/gdb/mygit/build/../src/gdb/event-loop.c:403 #10 0x0000000000617a0c in start_event_loop () at /home/pedro/gdb/mygit/build/../src/gdb/event-loop.c:428 Here, in _rl_dispatch_subseq: 769 770 rl_executing_keymap = map; 771 772 rl_dispatching = 1; 773 RL_SETSTATE(RL_STATE_DISPATCHING); 774 (*map[key].function)(rl_numeric_arg * rl_arg_sign, key); 775 RL_UNSETSTATE(RL_STATE_DISPATCHING); 776 rl_dispatching = 0; 777 778 /* If we have input pending, then the last command was a prefix 779 command. Don't change the state of rl_last_func. Otherwise, GDB is called from line 774, but longjmp'ing at that point leaves rl_dispatching and RL_STATE_DISPATCHING set. Fix this by wrapping tui_rl_switch_mode in a TRY_CATCH. gdb/ 2014-10-29 Pedro Alves * tui/tui.c (tui_rl_switch_mode): Wrap tui_enable/tui_disable in TRY_CATCH. commit 84eda397bcf3ebea00383e4a6a864af59723dafd Author: Pedro Alves Date: Wed Oct 29 14:23:57 2014 +0000 PR tui/16138, PR tui/17519, and misc failures to initialize the terminal PR tui/16138 is about failure to initialize curses resulting in GDB exiting instead of throwing an error. E.g.: $ TERM=foo gdb (gdb) layout asm Error opening terminal: foo. $ The problem is that we're calling initscr to initialize the screen. As mentioned in http://pubs.opengroup.org/onlinepubs/7908799/xcurses/initscr.html: If errors occur, initscr() writes an appropriate error message to standard error and exits. ^^^^^ Instead, we should use newterm: "A program that needs an indication of error conditions, so it can continue to run in a line-oriented mode if the terminal cannot support a screen-oriented program, would also use this function." After the patch: $ TERM=foo gdb -q -nx (gdb) layout asm Cannot enable the TUI: error opening terminal [TERM=foo] (gdb) And then PR tui/17519 is about GDB not validating whether the terminal has the necessary capabilities when enabling the TUI. If one tries to enable the TUI with TERM=dumb (and e.g., from a shell within emacs), GDB ends up with a clear screen, the cursor is placed at the bottom/right corner of the screen, there's no prompt, typing shows no echo, and there's no indication of what's going on. c-x,a gets you out of the TUI, but it's completely non-obvious. After the patch, we get: $ TERM=dumb gdb -q -nx (gdb) layout asm Cannot enable the TUI: terminal doesn't support cursor addressing [TERM=dumb] (gdb) While at it, I've moved all the tui_allowed_p validation to tui_enable, and expanded the error messages. Previously we'd get: $ gdb -q -nx -i=mi (gdb) layout asm &"layout asm\n" &"TUI mode not allowed\n" ^error,msg="TUI mode not allowed" and: $ gdb -q -nx -ex "layout asm" > foo TUI mode not allowed While now we get: $ gdb -q -nx -i=mi (gdb) layout asm &"layout asm\n" &"Cannot enable the TUI when the interpreter is 'mi'\n" ^error,msg="Cannot enable the TUI when the interpreter is 'mi'" (gdb) and: $ gdb -q -nx -ex "layout asm" > foo Cannot enable the TUI when output is not a terminal Tested on x86_64 Fedora 20. gdb/ 2014-10-29 Pedro Alves PR tui/16138 PR tui/17519 * tui/tui-interp.c (tui_is_toplevel): Delete global. (tui_allowed_p): Delete function. * tui/tui.c: Include "interps.h". (tui_enable): Don't use tui_allowed_p. Error out here with detailed error messages if the TUI is the top level interpreter, or if output is not a terminal. Use newterm instead of initscr, and error out if initializing the terminal fails. Also error out if the terminal doesn't support cursor addressing. * tui/tui.h (tui_allowed_p): Delete declaration. commit 563e8d85161198df8a13de4bc660a047305458c9 Author: Yao Qi Date: Wed Oct 29 21:43:05 2014 +0800 Prepare directory in case test_system fails In gdb.base/fileio.c, some functions may depend on others. For example, test_rename renames a file to one directory which is created in test_system. That is means, if test_system fails, test_rename fails too, which is not a good practise, IMO. In test_system, system ("mkdir -p XX") is used to create directories needed for test_rename. In this patch, we use dejagnu remote_exec proc to create these directories on host. In my gdb testing, mingw32 host and arm-none-eabi target, system ("mkdir -p XX") doesn't work properly (this issue can be addressed separately), and this patch fixes the following fails. FAIL: gdb.base/fileio.exp: Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST FAIL: gdb.base/fileio.exp: Unlink a file FAIL: gdb.base/fileio.exp: Unlinking a file in a directory w/o write access returns EACCES gdb/testsuite: 2014-10-29 Yao Qi * gdb.base/fileio.exp: Make directories on host. commit 0ea4d52e4396f6fdf44e6b0d5a21db17cad41ec7 Author: Yao Qi Date: Wed Oct 29 21:43:05 2014 +0800 Close the file in fileio.exp test I see the following fail in fileio.exp on mingw32 host gdb, rename 1: ret = -1, errno = 13^M ^M Breakpoint 2, stop () at fileio.c:76^M 76 static void stop () {}^M (gdb) FAIL: gdb.base/fileio.exp: Rename a file the test fails to rename a file which is not expected. The previous test test_write doesn't close the file, so the rename fails as a result on Windows. This patch fixes it by closing file in test_write, and the fail goes away. rename 1: ret = 0, errno = 0 OK^M ^M Breakpoint 2, stop () at fileio.c:76^M 76 static void stop () {}^M (gdb) PASS: gdb.base/fileio.exp: Rename a file gdb/testsuite: 2014-10-29 Yao Qi * gdb.base/fileio.c (test_write): Close the file. commit 6041179a7496602f881b6f0a8c0bc3a8f1742cb7 Author: Joel Brobecker Date: Thu Oct 23 08:25:20 2014 -0700 ARM: stricter __stack_chk_guard check during prologue analysis We are trying to insert a breakpoint on line 4 for the following Ada code. 3 procedure STR is 4 XX : String (1 .. Blocks.Sz) := (others => 'X'); -- STOP 5 K : Integer; 6 begin 7 K := 13; The code generated on ARM (-march=armv7-m) starts like this: (gdb) disass str'address Dump of assembler code for function _ada_str: --# Line str.adb:3 0x08000014 <+0>: push {r4, r7, lr} 0x08000016 <+2>: sub sp, #28 0x08000018 <+4>: add r7, sp, #0 0x0800001a <+6>: mov r3, sp 0x0800001c <+8>: mov r4, r3 --# Line str.adb:4 0x0800001e <+10>: ldr r3, [pc, #84] ; (0x8000074 <_ada_str+96>) 0x08000020 <+12>: ldr r3, [r3, #0] 0x08000022 <+14>: str r3, [r7, #20] 0x08000024 <+16>: ldr r3, [r7, #20] [...] When computing the address related to str.adb:4, GDB correctly resolves it to 0x0800001e first, but then considers the next 3 instructions as being part of the prologue because it thinks they are part of stack-protector code. As a result, instead of inserting the breakpoint at line 4, it skips those instruction and consequently the rest of the instructions until the start of the next line, which his line 7. The stack-protector code is expected to start like this... ldr Rn, .Label .... .Lable: .word __stack_chk_guard ... but the implementation actually accepts a sequence where the ldr location points to an address for which there is no symbol. It only aborts if the address points to a symbol which is not __stack_chk_guard. Since the __stack_chk_guard symbol is always expected to exist when used (it lives in .dynsym), this patch fixes the issue by requiring that the ldr gets the address of the __stack_chk_guard symbol. If the address could not be resolved, then it rejects the sequence as being stack-protector code. gdb/ChangeLog: * arm-tdep.c (arm_skip_stack_protector): Return early if address loaded by first "ldr" instruction does not have a corresponding minimal symbol. Update comment. Tested on arm-eabi using AdaCore's testsuite. Tested on arm-linux-gnueabi by Yao as well. commit 6ae274b7dc305ae7cebcf55c5018dab05228235a Author: Yao Qi Date: Wed Oct 29 13:39:16 2014 +0800 Fix skipping stack protector on arm This patch fixes the bug in my patch skipping stack protector https://www.sourceware.org/ml/gdb-patches/2010-12/msg00110.html In my skipping stack protector patch, I misunderstood the constant vs. immediate on instruction encodings, and treated immediate as constant by mistake. The instruction 'ldr Rd, [PC, #immed]' loads the address of __stack_chk_guard to Rd, and #immed is an offset from PC. We should get the __stack_chk_guard from *(pc + #immed). As a result of this mistake, arm_analyze_load_stack_chk_guard returns the wrong address of __stack_chk_guard, and the symbol __stack_chk_guard can't be found. However, we continue to match the following instructions when symbol isn't found, so the code still works. In other words, the code just matches the instruction pattern without checking __stack_chk_guard symbol correctly. Joel's patch makes the heuristics stricter that we stop matching instructions if symbol __stack_chk_guard isn't found. Then the bug is exposed. This patch is to correct the load address computation for ldr instruction, and it fixes some fails in gdb.mi/gdb792.exp on armv4t both arm and thumb mode. Regression tested on arm-linux-gnueabi target with {armv4t, armv7-a} x {marm, mthumb} x {-fstack-protector,-fno-stack-protector} gdb: 2014-10-29 Yao Qi * arm-tdep.c (arm_analyze_load_stack_chk_guard): Compute the loaded address correctly of ldr instruction. commit 5e1b37e7a31f898916d3d5b7e9f6f4f6bf2b50ce Author: Alan Modra Date: Wed Oct 29 09:31:03 2014 +1030 daily update commit 7f5ef60532b466ec7a83a943f36e93e32e30eafe Author: Pedro Alves Date: Tue Oct 28 13:42:11 2014 +0000 PR gdb/12623: non-stop crashes inferior, PC adjustment and 1-byte insns TL;DR - if we step an instruction that is as long as decr_pc_after_break (1-byte on x86) right after removing the breakpoint at PC, in non-stop mode, adjust_pc_after_break adjusts the PC, but it shouldn't. In non-stop mode, when a breakpoint is removed, it is moved to the "moribund locations" list. This is because other threads that are running may have tripped on that breakpoint as well, and we haven't heard about it. When a trap is reported, we check if perhaps it was such a deleted breakpoint that caused the trap. If so, we also need to adjust the PC (decr_pc_after_break). Now, say that, on x86: - a breakpoint was placed at an address where we have an instruction of the same length as decr_pc_after_break on this arch (1 on x86). - the breakpoint is removed, and thus put on the moribund locations list. - the thread is single-stepped. As there's no breakpoint inserted at PC anymore, the single-step actually executes the 1-byte instruction normally. GDB should _not_ adjust the PC for the resulting SIGTRAP. But, adjust_pc_after_break confuses the step SIGTRAP reported for this single-step as being a SIGTRAP for the moribund location of the breakpoint that used to be at the previous PC, and so infrun applies the decr_pc_after_break adjustment incorrectly. The confusion comes from the special case mentioned in the comment: static void adjust_pc_after_break (struct execution_control_state *ecs) { ... As a special case, we could have hardware single-stepped a software breakpoint. In this case (prev_pc == breakpoint_pc), we also need to back up to the breakpoint address. */ if (thread_has_single_step_breakpoints_set (ecs->event_thread) || !ptid_equal (ecs->ptid, inferior_ptid) || !currently_stepping (ecs->event_thread) || (ecs->event_thread->stepped_breakpoint && ecs->event_thread->prev_pc == breakpoint_pc)) regcache_write_pc (regcache, breakpoint_pc); The condition that incorrectly triggers is the "ecs->event_thread->prev_pc == breakpoint_pc" one. Afterwards, the next resume resume re-executes an instruction that had already executed, which if you're lucky, results in the inferior crashing. If you're unlucky, you'll get silent bad behavior... The fix is to remember that we stepped a breakpoint. Turns out the only case we step a breakpoint instruction today isn't covered by the testsuite. It's the case of a 'handle nostop" signal arriving while a step is in progress _and_ we have a software watchpoint, which forces always single-stepping. This commit extends sigstep.exp to cover that, and adds a new test for the adjust_pc_after_break issue. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2014-10-28 Pedro Alves PR gdb/12623 * gdbthread.h (struct thread_info) : New field. * infrun.c (resume) : Set the thread's stepped_breakpoint field. Skip if reverse debugging. Add comment. (init_thread_stepping_state, handle_signal_stop): Clear the thread's stepped_breakpoint field. gdb/testsuite/ 2014-10-28 Pedro Alves PR gdb/12623 * gdb.base/sigstep.c (no_handler): New global. (main): If 'no_handler is true, set the signal handlers to SIG_IGN. * gdb.base/sigstep.exp (breakpoint_over_handler): Add with_sw_watch and no_handler parameters. Handle them. (top level) : Add a test axis for testing with a software watchpoint, and another for testing with the signal handler set to SIG_IGN. * gdb.base/step-sw-breakpoint-adjust-pc.c: New file. * gdb.base/step-sw-breakpoint-adjust-pc.exp: New file. commit abbdbd03db7eea82cadbb418da733991cba91b15 Author: Pedro Alves Date: Tue Oct 28 15:51:30 2014 +0000 Test for PR gdb/17511, spurious SIGTRAP after stepping into+in signal handler I noticed that when I single-step into a signal handler with a pending/queued signal, the following single-steps while the program is in the signal handler leave $eflags.TF set. That means subsequent continues will trap after one instruction, resulting in a spurious SIGTRAP being reported to the user. This is a kernel bug; I've reported it to kernel devs (turned out to be a known bug). I'm seeing it on x86_64 Fedora 20 (Linux 3.16.4-200.fc20.x86_64), and I was told it's still not fixed upstream. This commit extends gdb.base/sigstep.exp to cover this use case, xfailed. Here's what the bug looks like: (gdb) start Temporary breakpoint 1, main () at si-handler.c:48 48 setup (); (gdb) next 50 global = 0; /* set break here */ Let's queue a signal, so we can step into the handler: (gdb) handle SIGUSR1 Signal Stop Print Pass to program Description SIGUSR1 Yes Yes Yes User defined signal 1 (gdb) queue-signal SIGUSR1 TF is not set: (gdb) display $eflags 1: $eflags = [ PF ZF IF ] Now step into the handler -- "si" does PTRACE_SINGLESTEP+SIGUSR1: (gdb) si sigusr1_handler (sig=0) at si-handler.c:31 31 { 1: $eflags = [ PF ZF IF ] No TF yet. But another single-step... (gdb) si 0x0000000000400621 31 { 1: $eflags = [ PF ZF TF IF ] ... ends up with TF left set. This results in PTRACE_CONTINUE trapping after each instruction is executed: (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. 0x0000000000400624 in sigusr1_handler (sig=0) at si-handler.c:31 31 { 1: $eflags = [ PF ZF TF IF ] (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. sigusr1_handler (sig=10) at si-handler.c:32 32 global = 0; 1: $eflags = [ PF ZF TF IF ] (gdb) Note that even another PTRACE_SINGLESTEP does not fix it: (gdb) si 33 } 1: $eflags = [ PF ZF TF IF ] (gdb) Eventually, it gets "fixed" by the rt_sigreturn syscall, when returning out of the handler: (gdb) bt #0 sigusr1_handler (sig=10) at si-handler.c:33 #1 #2 main () at si-handler.c:50 (gdb) set disassemble-next-line on (gdb) si 0x0000000000400632 33 } 0x0000000000400631 : 5d pop %rbp => 0x0000000000400632 : c3 retq 1: $eflags = [ PF ZF TF IF ] (gdb) => 0x0000003b36a358f0 <__restore_rt+0>: 48 c7 c0 0f 00 00 00 mov $0xf,%rax 1: $eflags = [ PF ZF TF IF ] (gdb) si => 0x0000003b36a358f7 <__restore_rt+7>: 0f 05 syscall 1: $eflags = [ PF ZF TF IF ] (gdb) main () at si-handler.c:50 50 global = 0; /* set break here */ => 0x000000000040066b : c7 05 cb 09 20 00 00 00 00 00 movl $0x0,0x2009cb(%rip) # 0x601040 1: $eflags = [ PF ZF IF ] (gdb) The bug doesn't happen if we instead PTRACE_CONTINUE into the signal handler -- e.g., set a breakpoint in the handler, queue a signal, and "continue". gdb/testsuite/ 2014-10-28 Pedro Alves PR gdb/17511 * gdb.base/sigstep.c (handler): Add a few more writes to 'done'. * gdb.base/sigstep.exp (other_handler_location): New global. (advance): Support stepping into the signal handler, and running commands while in the handler. (in_handler_map): New global. (top level): In the advance test, add combinations for getting into the handler with stepping commands, and for running commands in the handler. Add comment descripting the advancei tests. commit 5a4b0ccc20ba30caef53b01bee2c0aaa5b855339 Author: Nick Clifton Date: Tue Oct 28 15:42:56 2014 +0000 More fixes for corrupt binaries crashing the binutils. PR binutils/17512 * elf.c (bfd_section_from_shdr): Allocate and free the recursion detection table on a per-bfd basis. * peXXigen.c (pe_print_edata): Handle binaries with a truncated export table. commit 1df4399f27f8ee817d8eb4c73bba42bb65844303 Author: Pedro Alves Date: Tue Oct 28 13:42:10 2014 +0000 gdb.base/sigstep.exp: cleanup and make it easier to extend Hacking on sigstep.exp, I found it harder to understand and extend than ideal. - GDB is currently not restarted between the different tests/combinations in the file, and some parts of the tests' setup are done on the top level, and shared between tests. It's not trivial to understand which breakpoints each test procedure expects to be set or not set. And it's not trivial to disable parts of the test if you want quickly try out just a subset of the tests (running the whole file takes a bit). - Because GDB is currently not restarted between tests, if some test triggers a ptrace/kernel bug, the following tests may end up with cascading fails. That makes it hard to add a test to cover a kernel bug that isn't fixed yet, with a xfail/kfail. E.g,. note how with kernels with bug gdb/8744 (stepi over sigreturn syscall exits program) the test program exits, and nothing restarts it afterwards... - The manual test message prefix management gets a bit in the way. Nowadays, we have with_test_prefix which makes it simpler. - 'i' is used as parameter name in the various procedures, meaning 'the command the test', which isn't as obvious as it could. This commit addresses all that. gdb/testsuite/ 2014-10-28 Pedro Alves * gdb.base/sigstep.exp: Use build_executable instead of prepare_for_testing. (top level): Move code that starts GDB, runs to main and creates a display to ... (restart): ... this new procedure. (top level): Move backtrace from signal handler test to ... (validate_backtrace): ... this new procedure. (advance, advancei): Rename parameter from 'i' to 'cmd'. Use with_test_prefix. Always restart GDB. (skip_to_handler): Rename parameter from 'i' to 'cmd'. Use with_test_prefix. Always restart GDB. No need to delete breakpoints after the test. (test_skip_handler): Remove prefix parameter. (skip_over_handler, breakpoint_to_handler) (breakpoint_to_handler_entry, breakpoint_over_handler): Rename parameter from 'i' to 'cmd'. Use with_test_prefix. Always restart GDB. No need to delete breakpoints after the test. (top level): Use foreach to call the test procedures with different commands. commit a5b6e449e36bcdb162271707fa145f316053ebbc Author: Pedro Alves Date: Tue Oct 28 14:32:51 2014 +0000 update bug numbers (GNATS -> Bugzilla) in a few signal related tests This makes it easier to find the bugs in Bugzilla. gdb/testsuite/ 2014-10-28 Pedro Alves * gdb.base/sigaltstack.exp: Update to use Bugzilla bug numbers instead of GNATS numbers. * gdb.base/sigbpt.exp: Likewise. * gdb.base/siginfo.exp: Likewise. * gdb.base/sigstep.exp: Likewise. commit 7d1a114c44db3d7055afe48868f939ba95a64b7b Author: Pedro Alves Date: Tue Oct 28 11:35:10 2014 +0000 Workaround remote targets that report an empty list to qfThreadInfo In https://sourceware.org/ml/gdb-patches/2014-10/msg00652.html, Sandra shows a target that was broken by the recent update_thread_list optimization: (gdb) target remote qa8-centos32-cs:10514 ... (gdb) continue Continuing. Cannot execute this command without a live selected thread. (gdb) The error means that the current thread is in "exited" state when the continue command is processed. The root of the problem was found here: > Sending packet: $Hg0#df...Packet received: ... > Sending packet: $?#3f...Packet received: S00 > Sending packet: $qfThreadInfo#bb...Packet received: l > Sending packet: $Hc-1#09...Packet received: > Sending packet: $qC#b4...Packet received: unset This target doesn't really support threads (no thread indication in stop reply packets; no support for qC), but then supports qfThreadInfo, and returns an empty thread list to GDB. See https://sourceware.org/ml/gdb-patches/2014-10/msg00665.html for why the target does that. As remote_update_thread_list deletes threads from GDB's list that are not found in the thread list that the target reports, the result is that GDB deletes the "fake" main thread that GDB added itself. (As that thread is currently selected, it is marked "exited" instead of being deleted straight away.) This commit avoids deleting the main thread in this scenario. gdb/ 2014-10-27 Pedro Alves * remote.c (remote_thread_alive): New, factored out from ... (remote_thread_alive): ... this. (remote_update_thread_list): Bail out before deleting threads if the target returned an empty list, and, the current thread has a magic/fake ptid. commit 708d7d0d11f0f2d776171979aa3479e8e12a38a0 Author: Nick Clifton Date: Tue Oct 28 10:48:14 2014 +0000 This patch fixes a flaw in the SREC parser which could cause a stack overflow and potential secuiryt breach. PR binutils/17510 * srec.c (srec_bad_byte): Increase size of buf to allow for negative values. (srec_scan): Use an unsigned char buffer to hold header bytes. commit 6fb9c0f83252a79b2f1a3f8e75fa117ca7a4d589 Author: Alan Modra Date: Tue Oct 28 09:30:34 2014 +1030 daily update commit e5f8a7cc2d376c81749b6e4a4efc034201cf683c Author: Pedro Alves Date: Mon Oct 27 20:24:59 2014 +0000 stepi/nexti: skip signal handler if "handle nostop" signal arrives I noticed that "si" behaves differently when a "handle nostop" signal arrives while the step is in progress, depending on whether the program was stopped at a breakpoint when "si" was entered. Specifically, in case GDB needs to step off a breakpoint, the handler is skipped and the program stops in the next "mainline" instruction. Otherwise, the "si" stops in the first instruction of the signal handler. I was surprised the testsuite doesn't catch this difference. Turns out gdb.base/sigstep.exp covers a bunch of cases related to stepping and signal handlers, but does not test stepi nor nexti, only step/next/continue. My first reaction was that stopping in the signal handler was the correct thing to do, as it's where the next user-visible instruction that is executed is. I considered then "nexti" -- a signal handler could be reasonably considered a subroutine call to step over, it'd seem intuitive to me that "nexti" would skip it. But then, I realized that signals that arrive while a plain/line "step" is in progress _also_ have their handler skipped. A user might well be excused for being confused by this, given: (gdb) help step Step program until it reaches a different source line. And the signal handler's sources will be in different source lines, after all. I think that having to explain that "stepi" steps into handlers, (and that "nexti" wouldn't according to my reasoning above), while "step" does not, is a sign of an awkward interface. E.g., if a user truly is interested in stepping into signal handlers, then it's odd that she has to either force the signal to "handle stop", or recall to do "stepi" whenever such a signal might be delivered. For that use case, it'd seem nicer to me if "step" also stepped into handlers. This suggests to me that we either need a global "step-into-handlers" setting, or perhaps better, make "handle pass/nopass stop/nostop print/noprint" have have an additional axis - "handle stepinto/nostepinto", so that the user could configure whether handlers for specific signals should be stepped into. In any case, I think it's simpler (and thus better) for all step commands to behave the same. This commit thus makes "si/ni" skip handlers for "handle nostop" signals that arrive while the command was already in progress, like step/next do. To be clear, nothing changes if the program was stopped for a signal, and the user enters a stepping command _then_ -- GDB still steps into the handler. The change concerns signals that don't cause a stop and that arrive while the step is in progress. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2014-10-27 Pedro Alves * infrun.c (handle_signal_stop): Also skip handlers when a random signal arrives while handling a "stepi" or a "nexti". Set the thread's 'step_after_step_resume_breakpoint' flag. gdb/doc/ 2014-10-27 Pedro Alves * gdb.texinfo (Continuing and Stepping): Add cross reference to info on stepping and signal handlers. (Signals): Explain stepping and signal handlers. Add context index entry, and cross references. gdb/testsuite/ 2014-10-27 Pedro Alves * gdb.base/sigstep.c (dummy): New global. (main): Issue a couple writes to the new global. * gdb.base/sigstep.exp (get_next_pc, test_skip_handler): New procedures. (skip_over_handler): Use test_skip_handler. (top level): Call skip_over_handler for stepi and nexti too. (breakpoint_over_handler): Use test_skip_handler. (top level): Call breakpoint_over_handler for stepi and nexti too. commit bf67003b4567600ed3022a439207ac8f26454f91 Author: Nick Clifton Date: Mon Oct 27 18:05:37 2014 +0000 This fixes more seg-faults in tools like "strings" and "objdump" when presented with corrupt binaries. PR binutils/17512 * elf.c (bfd_section_from_shdr): Detect and warn about ELF binaries with a group of sections linked by the string table indicies. * peXXigen.c (pe_print_edata): Detect out of range rvas and entry counts for the Export Address table, Name Pointer table and Ordinal table. commit 7e1e19887abd24aeb15066b141cdff5541e0ec8e Author: Nick Clifton Date: Mon Oct 27 14:45:06 2014 +0000 Fix a seg-fault in strings and other binutuils when parsing a corrupt PE executable with an invalid value in the NumberOfRvaAndSizes field of the AOUT header. PR binutils/17512 * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Handle corrupt binaries with an invalid value for NumberOfRvaAndSizes. commit 493a33860c71cac998f1a56d6d87d6faa801fbaa Author: Nick Clifton Date: Mon Oct 27 12:43:16 2014 +0000 This patch closes a potential security hole in applications that use the bfd library to parse binaries containing maliciously corrupt section group headers. PR binutils/17510 * elf.c (setup_group): Improve handling of corrupt group sections. commit 763905a3ad8f98d33bd9319790a8d53904554265 Author: Yao Qi Date: Mon Oct 27 16:37:38 2014 +0800 Fix trace file fails on powerpc64 I see the following fails on powerpc64-linux, (gdb) target tfile tfile-basic.tf^M warning: Uploaded tracepoint 1 has no source location, using raw address^M Tracepoint 1 at 0x10012358^M Created tracepoint 1 for target's tracepoint 1 at 0x10012358.^M (gdb) PASS: gdb.trace/tfile.exp: target tfile tfile-basic.tf info trace^M Num Type Disp Enb Address What^M 1 tracepoint keep y 0x0000000010012358 ^M installed on target^M (gdb) FAIL: gdb.trace/tfile.exp: info tracepoints on trace file -target-select tfile tfile-basic.tf^M =thread-group-started,id="i1",pid="1"^M =thread-created,id="1",group-id="i1"^M &"warning: Uploaded tracepoint 1 has no source location, using raw address\n"^M =breakpoint-created,bkpt={number="1",type="tracepoint",disp="keep",enabled="y", addr="0x0000000010012358",at="",thread-groups=["i1"], times="0",installed="y",original-location="*0x10012358"}^M ~"Created tracepoint 1 for target's tracepoint 1 at 0x10012358.\n"^M ^connected^M (gdb) ^M FAIL: gdb.trace/mi-traceframe-changed.exp: tfile: select trace file These fails are caused by writing function descriptor address into trace file instead of function address. This patch is to teach tfile.c to write function address on powerpc64 target. With this patch applied, fails in tfile.exp and mi-traceframe-changed.exp are fixed. Is it OK? gdb/testsuite: 2014-10-27 Yao Qi * gdb.trace/tfile.c (adjust_function_address) [__powerpc64__ && _CALL_ELF != 2]: Get function address from function descriptor. commit 71e396f920e593494b8d57114d32e2c07f823781 Author: Luis Machado Date: Mon Oct 27 08:57:58 2014 -0200 Fix ARM machine state testcase failures When running GDB's reverse debugging testsuite against a few ARM multilibs, i noticed failures in the machinestate* testcases. Further investigation showed that push and pop instruction encodings A1 and A2 were not being handled properly, thus we missed saving important contents from registers and memory. When going backwards, such contents were not restored and thus we ended up with a corrupted state that did not correspond to the real values we had at a particular point in time. Attached is a patch that fixes around 36 failures for both gdb.reverse/machinestate.exp and gdb.reverse/machinestate-precsave.exp testcases, making them fully pass. This is for both armv7 and armv4. I still see failures for armv4 thumb though, so it needs a bit more investigation. I see no regressions due to this patch for armv7, armv7 thumb, armv4 and armv4 thumb. gdb/ChangeLog: * arm-tdep.c (INSN_S_L_BIT_NUM): Document. (arm_record_ld_st_imm_offset): Reimplement to cover all load/store cases for ARM opcode 010. (arm_record_ld_st_multiple): Reimplement to cover all load/store cases for ARM opcode 100. commit 3aee438bbb1634e6e6e3ae60fe8479ae7172b014 Author: Doug Evans Date: Sun Oct 26 16:46:52 2014 -0700 symtab.c (lookup_symbol_aux_local): Fix typo in comment. gdb/ChangeLog: * symtab.c (lookup_symbol_aux_local): Fix typo in comment. commit 4744af9bf6a84c89f2e3987e40dd533651f2e731 Author: Alan Modra Date: Mon Oct 27 09:30:40 2014 +1030 daily update commit f88cb4b683ffe4722fcee751c2b046ceb807deed Author: Doug Evans Date: Sun Oct 26 13:53:58 2014 -0700 Rename parameter "kind" to "block_index" in quick lookup functions. gdb/ChangeLog: * symfile.h (struct quick_symbol_functions) : Rename parameter "kind" to "block_index". * symtab.c (error_in_psymtab_expansion): Rename parameter "kind" to "block_index". (lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Ditto. commit a023a30fb494294f739b3414a28d11da8c298d3f Author: Doug Evans Date: Sun Oct 26 12:26:20 2014 -0700 * block.h (ALL_BLOCK_SYMBOLS): Fix comment. gdb/ChangeLog: * block.h (ALL_BLOCK_SYMBOLS): Fix comment. commit 4c35218eab6ed3b4c5ddd454809820f09030480f Author: Doug Evans Date: Sun Oct 26 11:36:59 2014 -0700 block.c (allocate_block): Use OBSTACK_ZALLOC instead of obstack_alloc. gdb/ChangeLog: * block.c (allocate_block): Use OBSTACK_ZALLOC instead of obstack_alloc. commit f08e8df3ab2f98b68c6cba6dc9ff5ae2ff3ecb6c Author: Doug Evans Date: Sun Oct 26 10:42:26 2014 -0700 Move block_found decl to symtab.h. gdb/ChangeLog: * parser-defs.h (block_found): Move decl from here ... * symtab.h (block_found): ... to here. commit cf901d3bbac471a581776dbe88dd838d96a894c0 Author: Doug Evans Date: Sun Oct 26 09:35:53 2014 -0700 Clean up some function comments in symtab.[ch]. gdb/ChangeLog: * symtab.h (struct field_of_this_result): Fix typo in comment. (lookup_symbol_in_language): Move function comment here. (lookup_symbol): Improve function comment. (basic_lookup_symbol_nonlocal): Ditto. (lookup_symbol_static, lookup_symbol_global): Ditto. (lookup_symbol_aux_block): Ditto. (lookup_language_this): Add function comment. (lookup_static_symbol_aux): Explicitly mark as extern. Improve function comment. (lookup_block_symbol): Improve function comment. (lookup_struct): Fix capitalization in function comment. (lookup_transparent_type): Add function comment. (lookup_global_symbol_from_objfile): Explicitly mark as extern. Improve function comment. (lookup_objfile_from_block): Add function comment. * symtab.c (lookup_symbol_in_language): Update function comment. (lookup_symbol, lookup_language_this): Ditto. (lookup_static_symbol_aux, lookup_objfile_from_block): Ditto. (lookup_symbol_aux_block, lookup_global_symbol_from_objfile): Ditto. (basic_lookup_symbol_nonlocal): Ditto. (lookup_symbol_static, lookup_symbol_global): Ditto. (lookup_transparent_type, lookup_block_symbol): Ditto. commit ff6c39cf9cea7cdb925557493408808da2bf6e15 Author: Doug Evans Date: Sat Oct 25 22:22:47 2014 -0700 symtab.c: forward decl cleanup gdb/ChangeLog: * symtab.c (types_info): Delete forward decl. (functions_info, variables_info, sources_info): Ditto. (_initialize_symtab): Rewrite forward decl to use initialize_file_ftype. commit ec201f0cd1e6a0804822981fd7e25c99a3b39fd0 Author: Doug Evans Date: Sat Oct 25 22:07:54 2014 -0700 symtab.c (lookup_symbol_aux_quick): Set block_found upon success. gdb/ChangeLog: * symtab.c (lookup_symbol_aux_quick): Set block_found upon success. commit ca040673e070391c8e5c35a12ef6b33fe03128ad Author: Doug Evans Date: Sat Oct 25 21:46:00 2014 -0700 Remove second (nested) copy of local var child_die. gdb/ChangeLog: * dwarf2read.c (process_structure_scope): Remove second (nested) copy of local var child_die. commit 9667818c4eba346667b7dbc772a07ed10e8b5629 Author: Alan Modra Date: Sun Oct 26 09:30:31 2014 +1030 daily update commit f5627833b4c2c11cee56f2556128ae03fa00a031 Author: Alan Modra Date: Sat Oct 25 09:31:03 2014 +1030 daily update commit 6f259a235d01fe7b98c8ad6e8edc06d72074a14a Author: Don Breazeal Date: Fri Oct 24 11:36:06 2014 -0700 Follow-fork message printing improvements This commit modifies the code that prints attach and detach messages related to following fork and vfork. The changes include using target_terminal_ours_for_output instead of target_terminal_ours, printing "vfork" instead of "fork" for all vfork-related messages, and using _() for the format strings of all of the messages. We also add a "detach" message for when a fork parent is detached. Previously in this case the only message was notification of attaching to the child. We still do not print any messages when following the parent and detaching the child (the default). The rationale for this is that from the user's perspective the new child was never attached. Note that all of these messages are only printed when 'verbose' is set or when debugging is turned on. The tests gdb.base/foll-fork.exp and gdb.base/foll-vfork.exp were modified to check for the new message. Tested on x64 Ubuntu Lucid, native only. gdb/ChangeLog: * infrun.c (follow_fork_inferior): Update fork message printing to use target_terminal_ours_for_output instead of target_terminal_ours, to use _() for all format strings, to print "vfork" instead of "fork" for vforks, and to add a detach message. (handle_vfork_child_exec_or_exit): Update message printing to use target_terminal_ours_for_output instead of target_terminal_ours, to use _() for all format strings, and to fix some formatting. gdb/testsuite/ChangeLog: * gdb.base/foll-fork.exp (test_follow_fork, catch_fork_child_follow): Check for updated fork messages emitted from infrun.c. * gdb.base/foll-vfork.exp (vfork_parent_follow_through_step, vfork_parent_follow_to_bp, vfork_and_exec_child_follow_to_main_bp, vfork_and_exec_child_follow_through_step): Check for updated vfork messages emitted from infrun.c. commit 09dd9a6907f0929f2b634e57e68f11a008dfbf68 Author: Pedro Alves Date: Fri Oct 17 14:49:04 2014 +0100 Remove Vax Ultrix and VAX BSD support Built and tested on x86_64 Fedora 20, with --enable-targets=all. gdb/ 2014-10-24 Pedro Alves * Makefile.in (ALLDEPFILES): Remove vax-nat.c. * NEWS (Removed targets): Add VAX BSD and VAX Ultrix. * config/vax/vax.mh: Delete. * configure.host: Move vax-*-bsd* and vax-*-ultrix* to the obsolete configurations section. * configure.tgt (vax-*-*): Don't mention 4.2BSD nor Ultrix. * vax-nat.c: Delete file. gdb/testsuite/ 2014-10-24 Pedro Alves * gdb.base/corefile.exp: Remove references to ultrix. * gdb.base/interrupt.exp: Likewise. * gdb.base/whatis.exp: Likewise. * gdb.gdb/selftest.exp: Likewise. * gdb.threads/manythreads.exp: Likewise. * gdb.threads/print-threads.exp: Likewise. * gdb.threads/pthreads.exp:: Likewise. * gdb.threads/schedlock.exp: Likewise. commit 5ab806deff413e90bb2dc988b78857e13dfc1b5b Author: Pedro Alves Date: Fri Oct 24 17:56:29 2014 +0100 NEWS: Clarify removed targets gdb/ 2014-10-24 Pedro Alves * NEWS (Removed targets): Add OS/arch column. commit 3433cfa51f6397231ffe2b2c69298eff89179769 Author: Siva Chandra Date: Thu Oct 16 07:14:13 2014 -0700 Guard a call to TYPE_TARGET_TYPE in gnuv3_pass_by_reference. gdb/ChangeLog: * gnu-v3-abi.c (gnuv3_pass_by_reference): Call TYPE_TARGET_TYPE on the arg type of a constructor only if it is of reference type. gdb/testsuite/ChangeLog: * gdb.cp/non-trivial-retval.cc: Add a test case. * gdb.cp/non-trivial-retval.exp: Add a test. commit 68fcca92b735bb46e38331485ac2e933e5876b83 Author: Jiong Wang Date: Fri Oct 24 11:39:35 2014 +0100 [AArch64] Cortex-A53 erratum 835769 linker workaround 2014-10-22 Tejas Belagod bfd/ * bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter. * bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise. * elfnn-aarch64.c (aarch64_erratum_835769_stub): New. (elf_aarch64_stub_type): Add new type aarch64_stub_erratum_835769_veneer. (elf_aarch64_stub_hash_entry): New fields for erratum 835769. (aarch64_erratum_835769_fix): New data struct to record erratum 835769. (elf_aarch64_link_hash_table: Global flags for 835769. (aarch64_build_one_stub): Add case for 835769. (aarch64_size_one_stub): Likewise. (aarch64_mem_op_p, aarch64_mlxl_p, aarch64_erratum_sequence,erratum_835769_scan): New. Decode and scan functions for erratum 835769. (elf_aarch64_create_or_find_stub_sec): New. (elfNN_aarch64_size_stubs): Look for erratum 835769 and record them. (bfd_elfNN_aarch64_set_options: Set global flag for 835769. (erratum_835769_branch_to_stub_data, make_branch_to_erratum_835769_stub):New. Connect up all the erratum stubs to occurances by branches. (elfNN_aarch64_write_section): New hook. (aarch64_map_one_stub): Output erratum stub symbol. (elfNN_aarch64_size_dynamic_sections): Init mapping symbol information for erratum 835769. (elf_backend_write_section): Define. ld/ * emultempl/aarch64elf.em: Add command-line option for erratum 835769. ld/testsuite/ * ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum 835769 tests. * ld-aarch64/erratum835769.d: New. * ld-aarch64/erratum835769.s: New. commit 79ccd89e582a1159a503813be020d044e070d53f Author: Alan Modra Date: Fri Oct 24 09:30:51 2014 +1030 daily update commit 96ba42336f634f8095ae04abd7cb1cbdab226d24 Author: Sandra Loosemore Date: Thu Oct 23 09:54:15 2014 -0700 Refactoring/cleanup of nios2 opcodes and assembler code. 2014-10-23 Sandra Loosemore include/opcode/ * nios2.h (enum iw_format_type): New. (struct nios2_opcode): Update comments. Add size and format fields. (NIOS2_INSN_OPTARG): New. (REG_NORMAL, REG_CONTROL, REG_COPROCESSOR): New. (struct nios2_reg): Add regtype field. (GET_INSN_FIELD, SET_INSN_FIELD): Delete. (IW_A_LSB, IW_A_MSB, IW_A_SZ, IW_A_MASK): Delete. (IW_B_LSB, IW_B_MSB, IW_B_SZ, IW_B_MASK): Delete. (IW_C_LSB, IW_C_MSB, IW_C_SZ, IW_C_MASK): Delete. (IW_IMM16_LSB, IW_IMM16_MSB, IW_IMM16_SZ, IW_IMM16_MASK): Delete. (IW_IMM26_LSB, IW_IMM26_MSB, IW_IMM26_SZ, IW_IMM26_MASK): Delete. (IW_OP_LSB, IW_OP_MSB, IW_OP_SZ, IW_OP_MASK): Delete. (IW_OPX_LSB, IW_OPX_MSB, IW_OPX_SZ, IW_OPX_MASK): Delete. (IW_SHIFT_IMM5_LSB, IW_SHIFT_IMM5_MSB): Delete. (IW_SHIFT_IMM5_SZ, IW_SHIFT_IMM5_MASK): Delete. (IW_CONTROL_REGNUM_LSB, IW_CONTROL_REGNUM_MSB): Delete. (IW_CONTROL_REGNUM_SZ, IW_CONTROL_REGNUM_MASK): Delete. (OP_MASK_OP, OP_SH_OP): Delete. (OP_MASK_IOP, OP_SH_IOP): Delete. (OP_MASK_IRD, OP_SH_IRD): Delete. (OP_MASK_IRT, OP_SH_IRT): Delete. (OP_MASK_IRS, OP_SH_IRS): Delete. (OP_MASK_ROP, OP_SH_ROP): Delete. (OP_MASK_RRD, OP_SH_RRD): Delete. (OP_MASK_RRT, OP_SH_RRT): Delete. (OP_MASK_RRS, OP_SH_RRS): Delete. (OP_MASK_JOP, OP_SH_JOP): Delete. (OP_MASK_IMM26, OP_SH_IMM26): Delete. (OP_MASK_RCTL, OP_SH_RCTL): Delete. (OP_MASK_IMM5, OP_SH_IMM5): Delete. (OP_MASK_CACHE_OPX, OP_SH_CACHE_OPX): Delete. (OP_MASK_CACHE_RRS, OP_SH_CACHE_RRS): Delete. (OP_MASK_CUSTOM_A, OP_SH_CUSTOM_A): Delete. (OP_MASK_CUSTOM_B, OP_SH_CUSTOM_B): Delete. (OP_MASK_CUSTOM_C, OP_SH_CUSTOM_C): Delete. (OP_MASK_CUSTOM_N, OP_SH_CUSTOM_N): Delete. (OP_, OPX_, OP_MATCH_, OPX_MATCH_): Delete. (OP_MASK_, OP_MASK): Delete. (GET_IW_A, GET_IW_B, GET_IW_C, GET_IW_CONTROL_REGNUM): Delete. (GET_IW_IMM16, GET_IW_IMM26, GET_IW_OP, GET_IW_OPX): Delete. Include nios2r1.h to define new instruction opcode constants and accessors. (nios2_builtin_opcodes): Rename to nios2_r1_opcodes. (bfd_nios2_num_builtin_opcodes): Rename to nios2_num_r1_opcodes. (bfd_nios2_num_opcodes): Rename to nios2_num_opcodes. (NUMOPCODES, NUMREGISTERS): Delete. * nios2r1.h: New file. opcodes/ * nios2-opc.c (nios2_builtin_regs): Add regtype field initializers. (nios2_builtin_opcodes): Rename to nios2_r1_opcodes. Use new MATCH_R1_ and MASK_R1_ macros in initializers. Add size and format initializers. Merge 'b' arguments into 'j'. (NIOS2_NUM_OPCODES): Adjust definition. (bfd_nios2_num_builtin_opcodes): Rename to nios2_num_r1_opcodes. (nios2_opcodes): Adjust. (bfd_nios2_num_opcodes): Rename to nios2_num_opcodes. * nios2-dis.c (INSNLEN): Update comment. (nios2_hash_init, nios2_hash): Delete. (OPCODE_HASH_SIZE): New. (nios2_r1_extract_opcode): New. (nios2_disassembler_state): New. (nios2_r1_disassembler_state): New. (nios2_init_opcode_hash): Add state parameter. Adjust to use it. (nios2_find_opcode_hash): Use state object. (bad_opcode): New. (nios2_print_insn_arg): Add op parameter. Use it to access format. Remove 'b' case. (nios2_disassemble): Remove special case for nop. Remove hard-coded instruction size. gas/ * config/tc-nios2.c (nios2_insn_infoS): Add constant_bits field. (nios2_arg_infoS, nios2_arg_hash, nios2_arg_lookup): Delete. (nios2_control_register_arg_p): Delete. (nios2_coproc_reg): Delete. (nios2_relax_frag): Remove hard-coded instruction size. (md_convert_frag): Use new insn accessor macros. (nios2_diagnose_overflow): Remove hard-coded instruction size. (md_apply_fix): Likewise. (bad_opcode): New. (nios2_parse_reg): New. (nios2_assemble_expression): Remove prev_reloc parameter. Adjust uses and callers. (nios2_assemble_arg_c): New. (nios2_assemble_arg_d): New. (nios2_assemble_arg_s): New. (nios2_assemble_arg_t): New. (nios2_assemble_arg_i): New. (nios2_assemble_arg_u): New. (nios2_assemble_arg_o): New. (nios2_assemble_arg_j): New. (nios2_assemble_arg_l): New. (nios2_assemble_arg_m): New. (nios2_assemble_args): New. (nios2_assemble_args_dst): Delete. (nios2_assemble_args_tsi): Delete. (nios2_assemble_args_tsu): Delete. (nios2_assemble_args_sto): Delete. (nios2_assemble_args_o): Delete. (nios2_assemble_args_is): Delete. (nios2_assemble_args_m): Delete. (nios2_assemble_args_s): Delete. (nios2_assemble_args_tis): Delete. (nios2_assemble_args_dc): Delete. (nios2_assemble_args_cs): Delete. (nios2_assemble_args_ds): Delete. (nios2_assemble_args_ldst): Delete. (nios2_assemble_args_none): Delete. (nios2_assemble_args_dsj): Delete. (nios2_assemble_args_d): Delete. (nios2_assemble_args_b): Delete. (nios2_arg_info_structs): Delete. (NIOS2_NUM_ARGS): Delete. (nios2_consume_arg): Remove insn parameter. Use new macros. Don't check register arguments here. Remove 'b' case. (nios2_consume_separator): Move check for missing separators to... (nios2_parse_args): ...here. Remove special case for optional arguments. (output_insn): Avoid using hard-coded insn size. (output_ubranch): Likewise. (output_cbranch): Likewise. (output_call): Use new macros. (output_addi): Likewise. (output_ori): Likewise. (output_xori): Likewise. (output_movia): Likewise. (md_begin): Remove nios2_arg_info_structs initialization. (md_assemble): Initialize constant_bits field. Use nios2_parse_args instead of looking up parse function in hash table. gdb/ * nios2-tdep.c (nios2_analyze_prologue): Use new instruction field accessors and constants from nios2 opcodes update. (nios2_get_next_pc): Likewise. commit 685e70ae51e312f7cbcfa8943fffceb540d46640 Author: Victor Kamensky Date: Thu Oct 23 11:53:53 2014 +1030 ARM: plt_size functions need to read instructions in right byte order elf32_arm_plt0_size and elf32_arm_plt_size read instructions to determine what is size of PLT entry. However it does not read instruction correctly in case of ARM big endian V7 case. In this case instructions are still kept in little endian order (BE8). * elf32-arm.c (read_code32): New function to read 32 bit arm instruction. (read_code16): New function to read 16 bit thumb instrution. (elf32_arm_plt0_size, elf32_arm_plt_size): Use read_code32 and read_code16 to read instructions. commit 65e84d12a068d72c94e96a569dac915386494e7a Author: Alan Modra Date: Thu Oct 23 09:30:53 2014 +1030 daily update commit f179c51249f2a34eaba50f64152a257513aabcf8 Author: Matthew Fortune Date: Tue Oct 21 11:58:19 2014 +0100 MIPS Documentation fixes gas/ * doc/as.texinfo: Update the MIPS FP ABI descriptions. * doc/c-mips.texi: Spell check and correct throughout. commit 00ac7aa072c90d95615bd1c89c699f0ea5eeae22 Author: Matthew Fortune Date: Fri Oct 17 11:07:17 2014 +0100 Show information about unknown ASEs and extensions in .MIPS.abiflags bfd/ * elfxx-mips.c (print_mips_ases): Print unknown ASEs. (print_mips_isa_ext): Print the value of an unknown extension. binutils/ * readelf.c (print_mips_ases): Print unknown ASEs. (print_mips_isa_ext): Print the value of an unknown extension. include/ * elf/mips.h (AFL_ASE_MASK): Define. commit 60822996412bf596f4f786492b0d787ff82417ec Author: Alan Modra Date: Wed Oct 22 09:30:32 2014 +1030 daily update commit 7bb01e2d7401f2eb8995d445917708209d3ad4bf Author: Maciej W. Rozycki Date: Tue Oct 21 23:06:23 2014 +0100 MIPS/GAS: Correct file option settings with `.insn' This makes sure `HAVE_CODE_COMPRESSION' evaluates correctly when the `.insn' directive is used at the beginning of a source file before any instructions have been produced and that ELF file header's MIPS16 and microMIPS ASE flags are set correctly in the case where no instructions have been produced other than with the said directive. gas/ * config/tc-mips.c (s_insn): Set file options. gas/testsuite/ * gas/mips/insn-opts.d: New test. * gas/mips/insn-opts.s: New test source. * gas/mips/mips.exp: Run the new test. commit 80272b8cb9f78cd97c4655019e7826b6d4c5dd41 Author: Alan Modra Date: Wed Oct 22 08:08:30 2014 +1030 [GOLD] Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7 As for bfd.ld. Refer 2300b5a14 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to thread_starter. commit 55fbd9927b9b6f1f4881cf8585c35029ff4ee153 Author: Andrew Pinski Date: Mon Oct 20 11:39:49 2014 -0700 [AARCH64] Add thunderx support to gas This patch adds -mcpu=thunderx support to gas. OK? Tested with no regressions. ChangeLog: * config/tc-aarch64.c (aarch64_cpus): Add thunderx. * doc/c-aarch64.texi: Document that thunderx is a valid processor name. commit 73242275062071346a7c377aca5e704679f25f82 Author: Alan Modra Date: Tue Oct 21 20:44:38 2014 +1030 Relax ppc64_elf_tls_optimize assertion The code in ppc64_elf_tls_optimize looking at the .toc is only interested in .toc entries that are addresses. .toc can contain more than just an array of addresses, so if we have items that aren't 8-byte aligned, ignore them. * elf64-ppc.c (ppc64_elf_tls_optimize): Ignore relocs against toc entries that aren't a multiple of 8 rather than failing assertion. commit e74211b660791d29be21e11766c5b375f5df59b1 Author: Jan Beulich Date: Tue Oct 21 09:57:41 2014 +0200 gas: avoid bogus warnings in false branches of conditional The construct being added to the cond.s test case otherwise triggered both the "missing closing ..." and the "stray ..." (twice) warnings in _find_end_of_line(). As that code fragments suggests, this is needed to support (include) files that can be used for both assembler .include and compiler #include directives. commit 12e87fac5c760b04eed4f5a5948c2dfd6ec8f6d8 Author: Jan Beulich Date: Tue Oct 21 09:56:38 2014 +0200 ppc: enable msgclr and msgsnd on Power8 According to my reading of the spec it was an oversight for them to not having got enabled when Power8 support got added. commit 28f013d5cb2b60882c73f10eedb26fa5b3b15b2f Author: Jan Beulich Date: Tue Oct 21 09:53:25 2014 +0200 aarch64: move bogus assertion Asserting "idx" to be non-negative when subsequent code handles this case is bogus. In fact the assertion triggers e.g. when mistakenly using the arm32 comment character @ following an instruction. While doing this I also noticed that despite there being local variables "detail" and "idx", not all places where they could be used did actually make use of them, so this is being adjusted at once. Finally, for the code to be slightly more robust, also change comparisons against -1 to such checking for a (non-)negative value. commit 2300b5a1414ecb820aa042a30a08928cfcba620b Author: Alan Modra Date: Tue Oct 21 17:06:01 2014 +1030 Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7 powerpc64 ld builds plt call stubs with a read barrier to provide thread safety on lazy plt updates, necessary on multi-threaded apps with power7 or later weakly ordered memory. gcc-4.9 libgomp introduced more functions that could call pthread_create, which means we have more functions that if referenced in an executable should cause a default of --plt-thread-safe. * elf64-ppc.c (ppc64_elf_size_stubs): Add gcc-4.9 libgomp functions to thread_starter. commit 5c0ac14e47ac99bd6ef80a3eb04e80806f07cf58 Author: Alan Modra Date: Tue Oct 21 09:30:53 2014 +1030 daily update commit fab3a15dfb4255e9d5a79536518ccdbed4e66e23 Author: Simon Marchi Date: Mon Oct 20 13:29:36 2014 -0400 Small fixes to the Python API doc First: "Breakpoint.delete" is missing parenthesis. Second: Someone on IRC asked, how come there is no disable() method in the Breakpoint object. It turns out you have to do "bp.enabled = False". Since every normal person would probably search for "disable" in that page if their intent is to disable a python breakpoint, I thought it would be useful if the description contained "disable" so it would be easy to find. The result might seem a bit silly and redundant, so I am open to suggestions. gdb/doc/ChangeLog: * python.texi (Breakpoints In Python): Add parenthesis after Breakpoint.delete. Clarify Breakpoint.enabled description so that it contains "disable". commit 092f880b8e4cacee96e85a885c206e8879e86fec Author: Yao Qi Date: Mon Sep 29 21:37:32 2014 +0800 Rename py-objfile-script-gdb.py.in to py-objfile-script-gdb.py Patch was to fix the problem that py-objfile-script-gdb.py is removed after an in-tree build and test. As a result of the previous patch (we don't remove files copied to host any more), this patch is no longer needed. This patch is to revert it logically. gdb/testsuite: 2014-10-20 Yao Qi * gdb.python/py-objfile-script-gdb.py.in: Rename it to ... * gdb.python/py-objfile-script-gdb.py: New file. * gdb.python/py-objfile-script.exp: Update reference to py-objfile-script-gdb.py.in. Use gdb_remote_donwload instead of remote_download. Remove the dest file. commit acbdb7f355f9dfa851dcff3154944a0d96771b0e Author: Yao Qi Date: Mon Sep 29 20:47:30 2014 +0800 Don't remove files copied to host Nowadays, if we do in-tree build and run tests sequentially, some source files are removed, due to the following pattern: set pi_txt [gdb_remote_download host ${srcdir}/${subdir}/pi.txt] remote_exec host "rm -f $pi_txt" If testing is run sequentially, file ${srcdir}/${subdir}/pi.txt is copied to ${objdir}/${subdir}/pi.txt. However, ${objdir} is ${srcdir} in the in-tree build/test, so the file is coped to itself, as a nop. As a result, the file in source is removed at the end of test. This patch fixes this problem by not removing files copied to host in each test. This patch also addresses the question we've had that why don't we keep files copied to host because they are needed to reproduce certain fails. gdb/testsuite: 2014-10-20 Yao Qi * gdb.base/checkpoint.exp: Don't remove file copied on host. * gdb.base/step-line.exp: Likewise. * gdb.dwarf2/dw2-anonymous-func.exp: Likewise. * gdb.dwarf2/dw2-basic.exp: Likewise. * gdb.dwarf2/dw2-compressed.exp: Likewise. * gdb.dwarf2/dw2-filename.exp: Likewise. * gdb.dwarf2/dw2-intercu.exp: Likewise. * gdb.dwarf2/dw2-intermix.exp: Likewise. * gdb.dwarf2/dw2-producer.exp: Likewise. * gdb.dwarf2/mac-fileno.exp: Likewise. * gdb.python/py-frame-args.exp: Likewise. * gdb.python/py-framefilter.exp: Likewise. * gdb.python/py-mi.exp: Likewise. * gdb.python/py-objfile-script.exp: Likewise * gdb.python/py-pp-integral.exp: Likewise. * gdb.python/py-pp-re-notag.exp: Likewise. * gdb.python/py-prettyprint.exp: Likewise. * gdb.python/py-section-script.exp: Likewise. * gdb.python/py-typeprint.exp: Likewise. * gdb.python/py-xmethods.exp: Likewise. * gdb.stabs/weird.exp: Likewise. * gdb.xml/tdesc-regs.exp: Likewise. commit c6ecbe44d87c71dc97f5d305c47cc3f7d4510e57 Author: Alan Modra Date: Mon Oct 20 09:30:41 2014 +1030 daily update commit 28153fd32137e4f1f081f3477c5b76e0bb387f44 Author: Doug Evans Date: Sun Oct 19 13:36:54 2014 -0700 Fix some comments to say minus_one_ptid instead of PID == -1. gdb/ChangeLog: * gdbthread.h (set_running): Fix comment. (set_executing, finish_thread_state): Fix comment. commit fc9b8e475d13b13e6cac1441aef649ce45929111 Author: Doug Evans Date: Sat Oct 18 21:24:47 2014 -0700 linux-nat.c (linux_nat_wait_1): Make local prev_mask non-static. gdb/ChangeLog: linux-nat.c (linux_nat_wait_1): Make local prev_mask non-static. commit 5bb926bae5e049e61d409fc5a0985082c9997eab Author: Alan Modra Date: Sun Oct 19 09:30:47 2014 +1030 daily update commit bd286a290bbfe7039cf9fe0291ab9b1f20937e52 Author: Kwok Cheung Yeung Date: Sat Oct 18 21:45:36 2014 +0100 Fix the gdb.dwarf2/dw2-dir-file-name.exp test on MIPS This patch fixes the failures that occur with the gdb.dwarf2/dw2-dir-file-name.exp test on 64-bit MIPS and compressed MIPS ISAs (i.e. MIPS16 and microMIPS). The failures on 64-bit occur because the generated DWARF address information is always 32-bit, which causes the upper 32-bits of addresses to be truncated and causes breakpoints to be set on the wrong address if any of the upper 32-bits are non-zero. I suspect that other 64-bit architectures get away with it because they place all their instructions at a VMA lower than 2^32 by default. This patch causes 64-bit addresses to be generated if a 64-bit target is detected. The failures on MIPS16 and microMIPS occur because the breakpoint address needs to have the LSB set to 1 (used to indicate that the code is compressed). However, the function name is interpreted as a data label, causing GDB to set breakpoints at even addresses. This is fixed by explicitly adding a '.insn' directive (see https://sourceware.org/binutils/docs/as/MIPS-insn.html) after the label on MIPS only. gdb/testsuite/ 2014-10-18 Kwok Cheung Yeung * gdb.dwarf2/dw2-dir-file-name.exp (addr_len): New. (out_cu): Use addr_len for the size of addresses. (out_line): Likewise. Size DW_LNE_set_address instruction according to addr_len. * gdb.dwarf2/dw2-dir-file-name.c (START_INSNS): New. (FUNC): Add START_INSNS to definition. commit 673dc4a0542b54d8da67e53eaaa94ace90085421 Author: Yao Qi Date: Tue Oct 14 15:40:15 2014 +0800 Skip testing argv[0] on target argv[0] isn't available I see the following two fails on arm-none-eabi target, because argv[0] isn't available. print argv[0]^M $1 = 0x1f78 "/dev/null"^M (gdb) FAIL: gdb.base/argv0-symlink.exp: kept file symbolic link name print argv[0]^M $1 = 0x1f78 "/dev/null"^M (gdb) FAIL: gdb.base/argv0-symlink.exp: kept directory symbolic link name My first thought is to check [target_info exists noargs], and skip the test if it returns true. However, noargs is set in gdbserver board files, so argv0-symlink.exp will be skipped on gdbserver board file. The change is too aggressive. When the program is running with gdbserver, argv[1] to argv[N] aren't available, but argv[0] is. Fortunately, argv0-symlink.exp only requires argv[0]. argv0-symlink.exp can be run with gdbserver board file, as what we do now. What we need to check is whether argv[0] is available, so I add a new proc gdb_has_argv0 to do so by starting a program, and check argc/argv[0] to see whether argv[0] is available. Dan fixed the similar problem by checking noargs, which is too strong. https://sourceware.org/ml/gdb-patches/2010-02/msg00398.html as a result, the test is skipped on gdbserver. This patch fixed it too. gdb/testsuite: 2014-10-18 Yao Qi * gdb.base/argv0-symlink.exp: Check argv[0] value if gdb_has_argv0 return true. * gdb.guile/scm-value.exp (test_value_in_inferior): Don't check [target_info exists noargs], check [gdb_has_argv0] instead. * gdb.python/py-value.exp (test_value_in_inferior): Likewise. * lib/gdb.exp (gdb_has_argv0, gdb_has_argv0_1): New procedures. commit b53dfeb26ed06e97fff1e8f469e33637ebdf6624 Author: Alan Modra Date: Sat Oct 18 21:46:48 2014 +1030 PowerPC64 ELFv1 function symbol definition vs LTO and discarded sections When functions are emitted in comdat groups, global symbols defined in duplicates of the group are treated as if they were undefined. That prevents the symbols in the discarded sections from affecting the linker's global symbol hash table or causing duplicate symbol errors. Annoyingly, when gcc emits a function to a comdat group, it does not put *all* of a function's code and data in the comdat group. Typically, constant tables, exception handling info, and debug info are emitted to normal sections outside of the group, which is a perennial source of linker problems due to the special handling needed to deal with the extra-group pieces that ought to be discarded. In the case of powerpc64-gcc, the OPD entry for a function is not put in the group. Since the function symbol is defined on the OPD entry this means we need to handle symbols in .opd specially. To see how this affects LTO in particular, consider the linker testcase PR ld/12942 (1). This testcase links an LTO object file pr12942a.o with a normal (non-LTO) object pr12942b.o. Both objects contain a definition for _Z4testv in a comdat group. On loading pr12942a.o, the linker sees a comdat group (actually linkonce section) for _Z4testv and a weak _Z4testv defined in the IR. On loading pr12942b.o, the linker sees the same comdat group, and thus discards it. However, _Z4testv is a weak symbol defined in .opd, not part of the group, so this weak symbol overrides the weak IR symbol. On (re)loading the LTO version of pr12942a.o, the linker sees another weak _Z4testv, but this one does not override the value we have from pr12942b.o. The result is a linker complaint about "`_Z4testv' ... defined in discarded section `.group' of tmpdir/pr12942b.o". * elf64-ppc.c (ppc64_elf_add_symbol_hook): If function code section for function symbols defined in .opd is discarded, let the symbol appear to be undefined. (opd_entry_value): Ensure the result section is that for the function code section in the same object as the OPD entry. commit a841bdf5d3bfb9c687f938be7388597db2e461de Author: Alan Modra Date: Sat Oct 18 11:10:53 2014 +1030 Fix PR17493, attempted output of *GAS `reg' section* symbol The write.c change is to make gas report an error if reg_section symbols should leak in future. The tc-i386.c change is the real fix. Note that the error isn't the most helpful, "redefined symbol cannot be used on reloc", but I'm not inclined to improve what is really an internal gas error. reg_section symbols shouldn't leak.. gas/ PR 17493 * write.c (adjust_reloc_syms): Don't allow symbols in reg_section to be reduced to reg_section section symbol. * gas/config/tc-i386.c (i386_finalize_immediate): Reject all reg_section immediates. gas/testsuite/ * gas/i386/inval-equ-2.l: Adjust. commit 998a69f46a3770d0f26aec080fcac4865c689739 Author: Andreas Schwab Date: Sat Oct 18 10:30:54 2014 +0200 * configure.tgt (targ_extra_obj) [aarch64*-*]: Define. commit aed56ec5f279e3849810e19f7d4b7fc0fe6ac528 Author: Cary Coutant Date: Fri Oct 17 16:22:55 2014 -0700 Add "typename" keyword to satisfy GCC 4.2. gold/ * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub): Add "typename" keyword. commit bf97b6dd05d086f6e68854d4861afc1f3f593380 Author: Alan Modra Date: Sat Oct 18 09:30:32 2014 +1030 daily update commit 0b6be415509b6dc5de80cb4e151b4a7439734b53 Author: Jose E. Marchesi Date: Wed Oct 15 08:46:54 2014 +0200 opcodes, elf: annotate instructions with HWCAP2_VIS3B. This patch annotates the following SPARC instructions as VIS3B instructions: ldx *, %efsr, fpadd64, fpsub64, fpcmpule8, fpcmpune8, fpcmpugt8, fpcmpueq8. It also improves the documentation of the VIS3B capability in several headers. Tested in sparc64-unknown-linux-gnu and sparc-unknown-linux-gnu. No visible regressions. opcodes/ChangeLog: 2014-10-17 Jose E. Marchesi * sparc-opc.c (sparc-opcodes): Annotate several instructions with the HWCAP2_VIS3B hwcap. include/opcodes/ChangeLog: 2014-10-17 Jose E. Marchesi * sparc.h (HWCAP2_VIS3B): Documentation improved. include/elf/ChangeLog: 2014-10-17 Jose E. Marchesi * sparc.h (ELF_SPARC_HWCAP2_VIS3B): Documentation improved. commit d9490cd487215bb3cd28b4235efbb97fed840197 Author: Jose E. Marchesi Date: Fri Oct 17 21:56:41 2014 +0200 opcodes: fix several misplaced hwcap entries. This patch fixes the hwcap entries in `sparc-opcodes' (which were incorrectly located in the flags field) for the following instructions: wr r,r,%sys_tick wr r,i,%sys_tick wr r,r,%sys_tick_cmpr wr r,i,%sys_tick_cmpr edge8n edge8ln edge16n edge16ln edge32n edge32ln bmask bshuffle siam Tested in sparc-unknown-linux-gnu and sparc64-unknown-linux-gnu. No visible regressions. opcodes/ChangeLog: 2014-10-17 Jose E. Marchesi * sparc-opc.c (sparc-opcodes): Fix several misplaced hwcap entries. commit 8bd978587880bff236f2b3c20df703c88899be5f Author: Matthew Fortune Date: Fri Oct 17 20:25:09 2014 +0100 Fix bad @value references in MIPS documentation gas/ * doc/c-mips.texi: Fix bad @value references. commit 4ffbba72f39aa4a8c6833618b9fd552df33ca69a Author: Doug Evans Date: Fri Oct 17 11:12:17 2014 -0700 New python event "clear_objfiles". If one is watching new_objfile events in python, it helps to know when the list of objfiles is cleared. This patch adds a new clear_objfiles event to support this. This patch is all just cut-n-paste-n-tweak derived from the new_objfiles event. gdb/ChangeLog: * NEWS: Mention new event gdb.clear_objfiles. * python/py-event.h (emit_clear_objfiles_event): Clear * python/py-events.h (events_object): New member clear_objfiles. * python/py-evts.c (gdbpy_initialize_py_events): Add clear_objfiles event. * python/py-inferior.c (python_new_objfile): If objfile is NULL, emit clear_objfiles event. * python/py-newobjfileevent.c (create_clear_objfiles_event_object): New function. (emit_clear_objfiles_event): New function. (clear_objfiles): New event. * python/python-internal.h (gdbpy_initialize_clear_objfiles_event): Declare. * python/python.c (_initialize_python): Call gdbpy_initialize_clear_objfiles_event. gdb/doc/ChangeLog: * python.texi (Events In Python): Document clear_objfiles event. gdb/testsuite/ChangeLog: * gdb.python/py-events.exp: Update expected output for clear_objfiles event. * gdb.python/py-events.py: Add clear_objfiles event. commit d096d8c11e4ab306d45e8dca811db2fa33e933a8 Author: Doug Evans Date: Fri Oct 17 10:57:26 2014 -0700 Add gdb.Objfile.progspace attribute. gdb/ChangeLog: * NEWS: Mention new gdb.Objfile.progspace attribute. * python/py-objfile.c (objfpy_get_progspace): New function. (objfile_getset): New entry for "progspace". gdb/doc/ChangeLog: * python.texi (Objfiles In Python): Document new progspace attribute. gdb/testsuite/ChangeLog: * gdb.python/py-objfile.exp: Test progspace attribute. commit a80db0157c31d3f0fbb37ea40384b11041429a2f Author: Luis Machado Date: Fri Oct 17 11:28:17 2014 -0300 Fix mingw32 failures due to incorrect directory separator in pattern Some testcases, mostly gdb.reverse ones, assume the presence of a '/' directory separator before the source file name. This is incorrect for mingw32 hosts, generating false failures for those tests. I attempted to catch most of the occurrences of the pattern ".*/$srcfile" and replaced them with ".*$srcfile". The latter is used elsewhere in the testsuite. The resulting patch is attached. I also see other occurrences of the same assumption throughout the testsuite, but usually they are arguments for function calls and i seem to recall either the test harness or GDB deals with those paths properly. gdb/testsuite: 2014-10-17 Luis Machado * gdb.guile/scm-breakpoint.exp: Do not assume any directory separators when matching source file paths. * gdb.python/py-breakpoint.exp: Likewise. * gdb.reverse/break-precsave.exp: Likewise. * gdb.reverse/break-reverse.exp: Likewise. * gdb.reverse/consecutive-precsave.exp: Likewise. * gdb.reverse/finish-precsave.exp: Likewise. * gdb.reverse/finish-reverse-bkpt.exp: Likewise. * gdb.reverse/finish-reverse.exp: Likewise. * gdb.reverse/i386-precsave.exp: Likewise. * gdb.reverse/i387-env-reverse.exp: Likewise. * gdb.reverse/i387-stack-reverse.exp: Likewise. * gdb.reverse/machinestate-precsave.exp: Likewise. * gdb.reverse/machinestate.exp: Likewise. * gdb.reverse/sigall-precsave.exp: Likewise. * gdb.reverse/solib-precsave.exp: Likewise. * gdb.reverse/step-precsave.exp: Likewise. * gdb.reverse/until-precsave.exp: Likewise. * gdb.reverse/watch-precsave.exp: Likewise. * gdb.reverse/watch-reverse.exp: Likewise. commit b22089abcba7cc3be26a9ab7d60e01299ac13ea0 Author: Yao Qi Date: Fri Aug 15 11:28:39 2014 +0800 Copy xml files to host When I run test with board file local-remote-host-native.exp, I see the following warning, $ make check RUNTESTFLAGS="--host_board=local-remote-host-native --target_board=local-remote-host-native tdesc-arch.exp HOST_DIR=/tmp/foo/" (gdb) set tdesc filename ../../../../git/gdb/testsuite/gdb.xml/trivial.xml^M warning: Could not open "../../../../git/gdb/testsuite/gdb.xml/trivial.xml" (gdb) quit^ because "${srcdir}/gdb.xml/trivial.xml" doesn't exist on host. This patch is to copy trivial.xml to host and the warning goes away. (gdb) set tdesc filename /tmp/foo/trivial.xml^M (gdb) quit^ tdesc-regs.exp has the similar problem that single-reg.xml may not exist on host at all, and it should be copied to host too. gdb/testsuite: 2014-10-17 Yao Qi * lib/gdb.exp (gdb_skip_xml_test): Copy trivial.xml to host. * gdb.xml/tdesc-regs.exp: Copy single-reg.xml to host. commit 6c4486e63f7583ed85a0c72841f6ccceebbf858e Author: Pedro Alves Date: Fri Oct 17 13:31:26 2014 +0100 PR gdb/17471: Repeating a background command makes it foreground When we repeat a command, by just pressing , the input from the previous command is reused for the new command invocation. When an execution command strips the "&" out of its incoming argument string, to detect background execution, we poke a '\0' directly to the incoming argument string. Combine both, and a repeat of a background command loses the "&". This is actually only visible if args other than "&" are specified (e.g., "c 1&" or "next 2&" or "c -a&"), as in the special case of "&" alone (e.g. "c&") doesn't actually clobber the incoming string. Fix this by making strip_bg_char return a new string instead of poking a hole in the input string. New test included. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2014-10-17 Pedro Alves PR gdb/17471 * infcmd.c (strip_bg_char): Change prototype and rewrite. Now returns a copy of the input. (run_command_1, continue_command, step_1, jump_command) (signal_command, until_command, advance_command, finish_command) (attach_command): Adjust and install a cleanup to free the stripped args. gdb/testsuite/ 2014-10-17 Pedro Alves PR gdb/17471 * gdb.base/bg-execution-repeat.c: New file. * gdb.base/bg-execution-repeat.exp: New file. commit 0ff33695eeedf3c2e8cdec8690ae4a10a66b3389 Author: Pedro Alves Date: Fri Oct 17 13:31:25 2014 +0100 PR gdb/17300: Input after "c -a" crashes readline/GDB If all threads in the target were already running when the user does "c -a", nothing puts the inferior's terminal settings in effect and removes stdin from the event loop, which we must when running a foreground command. The result is that user input afterwards crashes readline/gdb: (gdb) start Temporary breakpoint 1 at 0x4005d4: file continue-all-already-running.c, line 23. Starting program: continue-all-already-running Temporary breakpoint 1, main () at continue-all-already-running.c:23 23 sleep (10); (gdb) c -a& Continuing. (gdb) c -a Continuing. p 1 readline: readline_callback_read_char() called with no handler! Aborted (core dumped) $ Backtrace: Program received signal SIGABRT, Aborted. 0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig); (top-gdb) p 1 $1 = 1 (top-gdb) bt #0 0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x0000003b36a36f68 in __GI_abort () at abort.c:89 #2 0x0000000000784aa9 in rl_callback_read_char () at readline/callback.c:116 #3 0x0000000000619181 in rl_callback_read_char_wrapper (client_data=0x0) at gdb/event-top.c:167 #4 0x0000000000619557 in stdin_event_handler (error=0, client_data=0x0) at gdb/event-top.c:373 #5 0x000000000061814a in handle_file_event (data=...) at gdb/event-loop.c:763 #6 0x0000000000617631 in process_event () at gdb/event-loop.c:340 #7 0x00000000006176f8 in gdb_do_one_event () at gdb/event-loop.c:404 #8 0x0000000000617748 in start_event_loop () at gdb/event-loop.c:429 #9 0x00000000006191b3 in cli_command_loop (data=0x0) at gdb/event-top.c:182 #10 0x000000000060f538 in current_interp_command_loop () at gdb/interps.c:318 #11 0x0000000000610701 in captured_command_loop (data=0x0) at gdb/main.c:323 #12 0x000000000060c3f5 in catch_errors (func=0x6106e6 , func_args=0x0, errstring=0x9002c1 "", mask=RETURN_MASK_ALL) at gdb/exceptions.c:237 #13 0x0000000000611bff in captured_main (data=0x7fffffffd780) at gdb/main.c:1151 #14 0x000000000060c3f5 in catch_errors (func=0x610afe , func_args=0x7fffffffd780, errstring=0x9002c1 "", mask=RETURN_MASK_ALL) at gdb/exceptions.c:237 #15 0x0000000000611c28 in gdb_main (args=0x7fffffffd780) at gdb/main.c:1159 #16 0x000000000045ef97 in main (argc=5, argv=0x7fffffffd888) at gdb/gdb.c:32 (top-gdb) Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2014-10-17 Pedro Alves PR gdb/17300 * infcmd.c (continue_1): If continuing all threads in the foreground, make sure the inferior's terminal settings are put in effect. gdb/testsuite/ 2014-10-17 Pedro Alves PR gdb/17300 * gdb.base/continue-all-already-running.c: New file. * gdb.base/continue-all-already-running.exp: New file. commit 6fdebc3d1c54d2202f7637e7345fe6d25c7ed93b Author: Pedro Alves Date: Fri Oct 17 13:31:25 2014 +0100 PR gdb/17472: With annotations, input while executing in the foreground crashes readline/GDB Jan caught an intermittent GDB crash with the annota1.exp test: Starting program: .../gdb/testsuite/gdb.base/annota1 ^M [...] FAIL: gdb.base/annota1.exp: run until main breakpoint (timeout) [...] readline: readline_callback_read_char() called with no handler!^M ERROR: Process no longer exists All we need to is to continue the inferior in the foreground, and type a command while the inferior is running. E.g.: (gdb) set annotate 2 ▒▒pre-prompt (gdb) ▒▒prompt c ▒▒post-prompt Continuing. ▒▒starting ▒▒frames-invalid *inferior is running now* p 1 readline: readline_callback_read_char() called with no handler! Aborted (core dumped) $ When we run a foreground execution command we call target_terminal_inferior to stop GDB from processing input, and to put the inferior's terminal settings in effect. Then we tell readline to hide the prompt with display_gdb_prompt, which clears readline's input callback too. When the target stops, we call target_terminal_ours, which re-installs stdin in the event loop, and then we redisplay the prompt, reinstalling the readline callbacks. However, when annotations are in effect, the "frames-invalid" annotation code calls target_terminal_ours after 'resume' had already called target_terminal_inferior: (top-gdb) bt #0 0x000000000056b82f in annotate_frames_invalid () at gdb/annotate.c:219 #1 0x000000000072e6cc in reinit_frame_cache () at gdb/frame.c:1705 #2 0x0000000000594bb9 in registers_changed_ptid (ptid=...) at gdb/regcache.c:612 #3 0x000000000064cca1 in target_resume (ptid=..., step=1, signal=GDB_SIGNAL_0) at gdb/target.c:2136 #4 0x00000000005f57af in resume (step=1, sig=GDB_SIGNAL_0) at gdb/infrun.c:2263 #5 0x00000000005f6051 in proceed (addr=18446744073709551615, siggnal=GDB_SIGNAL_DEFAULT, step=1) at gdb/infrun.c:2613 And then once we hide the prompt and remove readline's input handler callback, we're in a bad state. We end up with the target running supposedly in the foreground, but with stdin still installed on the event loop. Any input then calls into readline, which aborts because no rl_linefunc callback handler is installed: Program received signal SIGABRT, Aborted. 0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig); (top-gdb) bt #0 0x0000003b36a35877 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x0000003b36a36f68 in __GI_abort () at abort.c:89 During symbol reading, debug info gives source 9 included from file at zero line 0. During symbol reading, debug info gives command-line macro definition with non-zero line 19: _STDC_PREDEF_H 1. #2 0x0000000000784a25 in rl_callback_read_char () at src/readline/callback.c:116 #3 0x0000000000619111 in rl_callback_read_char_wrapper (client_data=0x0) at src/gdb/event-top.c:167 #4 0x00000000006194e7 in stdin_event_handler (error=0, client_data=0x0) at src/gdb/event-top.c:373 #5 0x00000000006180da in handle_file_event (data=...) at src/gdb/event-loop.c:763 #6 0x00000000006175c1 in process_event () at src/gdb/event-loop.c:340 #7 0x0000000000617688 in gdb_do_one_event () at src/gdb/event-loop.c:404 #8 0x00000000006176d8 in start_event_loop () at src/gdb/event-loop.c:429 #9 0x0000000000619143 in cli_command_loop (data=0x0) at src/gdb/event-top.c:182 #10 0x000000000060f4c8 in current_interp_command_loop () at src/gdb/interps.c:318 #11 0x0000000000610691 in captured_command_loop (data=0x0) at src/gdb/main.c:323 #12 0x000000000060c385 in catch_errors (func=0x610676 , func_args=0x0, errstring=0x900241 "", mask=RETURN_MASK_ALL) at src/gdb/exceptions.c:237 #13 0x0000000000611b8f in captured_main (data=0x7fffffffd7b0) at src/gdb/main.c:1151 #14 0x000000000060c385 in catch_errors (func=0x610a8e , func_args=0x7fffffffd7b0, errstring=0x900241 "", mask=RETURN_MASK_ALL) at src/gdb/exceptions.c:237 #15 0x0000000000611bb8 in gdb_main (args=0x7fffffffd7b0) at src/gdb/main.c:1159 #16 0x000000000045ef57 in main (argc=3, argv=0x7fffffffd8b8) at src/gdb/gdb.c:32 The fix is to make the annotation code call target_terminal_inferior again after printing, if the inferior's settings were in effect. While at it, when we're doing output only, instead of target_terminal_ours, we should call target_terminal_ours_for_output. The latter doesn't actually remove stdin from the event loop, and also leaves SIGINT forwarded to the target. New test included. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2014-10-17 Pedro Alves PR gdb/17472 * annotate.c (annotate_breakpoints_invalid): Use target_terminal_our_for_output instead of target_terminal_ours. Give back the terminal to the target. (annotate_frames_invalid): Likewise. gdb/testsuite/ 2014-10-17 Pedro Alves PR gdb/17472 * gdb.base/annota-input-while-running.c: New file. * gdb.base/annota-input-while-running.exp: New file. commit 5842f62aad5c20dbb3511208efbc40a8d638b6d3 Author: Pedro Alves Date: Fri Oct 17 13:31:25 2014 +0100 Make common code handle target_terminal_* idempotency I found a place that should be giving back the terminal to the target, but only if the target was already owning it. So I need to add a getter for who owns the terminal. The trouble is that several places/target have their own globals to track this state: - inflow.c:terminal_is_ours - remote.c:remote_async_terminal_ours_p - linux-nat.c:async_terminal_is_ours - go32-nat.c:terminal_is_ours While one might think of adding a new target_ops method to query this, conceptually, this state isn't really part of a particular target_ops. Considering multi-target, the core shouldn't have to ask all targets to know whether it's GDB that owns the terminal. There's only one GDB (or rather, only one top level interpreter). So what this comment does is add a new global that is tracked by the core instead. A subsequent pass may later remove the other globals. Tested on x86_64 Fedora 20, native and gdbserver. gdb/ 2014-10-17 Pedro Alves * target.c (enum terminal_state): New enum. (terminal_state): New global. (target_terminal_init): New function. (target_terminal_inferior): Skip if inferior already owns the terminal. (target_terminal_ours, target_terminal_ours_for_output): New functions. * target.h (target_terminal_init): Convert to function prototype. (target_terminal_ours_for_output): Convert to function prototype and tweak comment. (target_terminal_ours): Convert to function prototype and tweak comment. * windows-nat.c (do_initial_windows_stuff): Call target_terminal_init instead of child_terminal_init_with_pgrp. commit 3f7308212cefe5cd958b29e0b9e92d92c4dbe941 Author: Hans-Peter Nilsson Date: Fri Oct 17 13:10:18 2014 +0200 Fix ld tests with sysroot=/ and --enable-targets=all and test --print-sysroot * ld-scripts/sysroot-prefix.exp: Log $ld_sysroot. Handle sysroot == "/" as a separate sysroot-configuration with separable test-types. (sysroot_prefix_tests): Include all existing sysroot tests in sysroot == "/" tests except exclude those where a --sysroot option is not specified. * lib/ld-lib.exp (check_sysroot_available): Rewrite to use --print-sysroot instead of relying on error code from using --sysroot=... Also, set $ld_sysroot. The reason we exclude not just the failing "full-path =-prefixed without" but also the passing "plain =-prefixed without but -Lpath" for sysroot == "/" is that for the latter to succeed, we have to make assumptions about the system not having a /sysroot directory or assumptions about its contents etc. When passing --enable-targets=all --enable-64-bit-bfd (the latter not required for a "64-bit-host" of course) the ld --help output got too much to handle for poor tcl (or maybe dejagnu is to blame) and remote_exec exited with an error, so the configuration being tested was mishandled as being a sysroot-less configuration. Using --version instead of --help would work too, but the new --print-sysroot option calls for nominal coverage, so why not use that instead. commit c1e29d6622533257267e6dd136a34f9785edfb28 Author: Hans-Peter Nilsson Date: Fri Oct 17 13:07:09 2014 +0200 Implement --print-sysroot in ld. * ldlex.h (enum option_values): Add entry OPTION_PRINT_SYSROOT. * lexsup.c (ld_options): Add entry for --print-sysroot. (parse_args) : Print sysroot and exit early. commit cb9322a80e3a92aceb7e325ab34f2a15edbae05a Author: Hans-Peter Nilsson Date: Fri Oct 17 13:06:56 2014 +0200 Implement --print-sysroot in ld. * ldlex.h (enum option_values): Add entry OPTION_PRINT_SYSROOT. * lexsup.c (ld_options): Add entry for --print-sysroot. (parse_args) : Print sysroot and exit early. commit 32a8097ba5dd6ddb71c0fb2fccbac262c371846a Author: Pedro Alves Date: Fri Oct 17 11:18:59 2014 +0100 Delete Tru64 support This commit does most of the mechanical removal. IOW, the easy part. procfs.c isn't touched beyond removing a couple obvious bits that are guarded by a couple macros defined in config/alpha/nm-osf3.h. Going beyond that for procfs.c & co would be a harder excision that potentially affects Solaris. Some comments in the generic alpha code ABIs that may still be relevant and I wouldn't know what to do with them. That can always be done on a separate pass, preferably by someone who can test on alpha. A couple other spots have references to OSF/Tru64 and related files being removed, but it felt like removing them would make things worse, not better. We can revisit those when we next need to touch that code. I didn't remove a reference to osf in testsuite/lib/future.exp, as I believe that code is imported from DejaGNU. Built and tested on x86_64 Fedora 20, with --enable-targets=all. Tested that building for --target=alpha-osf3 on x86_64 Fedora 20 fails with: checking for default auto-load directory... $debugdir:$datadir/auto-load checking for default auto-load safe-path... $debugdir:$datadir/auto-load *** Configuration alpha-unknown-osf3 is obsolete. *** Support has been REMOVED. make[1]: *** [configure-gdb] Error 1 make[1]: Leaving directory `build-osf' make: *** [all] Error 2 gdb/ 2014-10-17 Pedro Alves * Makefile.in (ALL_64_TARGET_OBS): Remove alpha-osf1-tdep.o. (HFILES_NO_SRCDIR): Remove config/alpha/nm-osf3.h. (ALLDEPFILES): Remove alpha-nat.c, alpha-osf1-tdep.c and solib-osf.c. * NEWS: Mention that support for alpha*-*-osf* has been removed. * ada-lang.h [__alpha__ && __osf__] (ADA_KNOWN_RUNTIME_FILE_NAME_PATTERNS): Delete. * alpha-nat.c, alpha-osf1-tdep.c: Delete files. * alpha-tdep.c (alpha_gdbarch_init): Remove reference to GDB_OSABI_OSF1. * config/alpha/alpha-osf3.mh, config/alpha/nm-osf3.h: Delete files. * config/djgpp/fnchange.lst (config/alpha/alpha-osf1.mh) (config/alpha/alpha-osf2.mh, config/alpha/alpha-osf3.mh): Delete. * configure: Regenerate. * configure.ac: Remove references to osf. * configure.host: Handle alpha*-*-osf* in the obsolete hosts section. Remove all other references to osf. * configure.tgt: Add alpha*-*-osf* to the obsolete targets section. Remove all other references to osf. * dec-thread.c: Delete file. * defs.h (GDB_OSABI_OSF1): Delete. * inferior.h (START_INFERIOR_TRAPS_EXPECTED): New unconditionally defined. * osabi.c (gdb_osabi_names): Delete "OSF/1". * procfs.c (procfs_debug_inferior) [PROCFS_DONT_TRACE_FAULTS]: Delete code. (unconditionally_kill_inferior) [PROCFS_NEED_CLEAR_CURSIG_FOR_KILL]: Delete code. * solib-osf.c: Delete file. gdb/testsuite/ 2014-10-17 Pedro Alves * gdb.base/callfuncs.exp: emove references to osf. * gdb.base/sigall.exp: Likewise. * gdb.gdb/selftest.exp: Likewise. * gdb.hp/gdb.base-hp/callfwmall.exp: Likewise. * gdb.mi/non-stop.c: Likewise. * gdb.mi/pthreads.c: Likewise. * gdb.reverse/sigall-precsave.exp: Likewise. * gdb.reverse/sigall-reverse.exp: Likewise. * gdb.threads/pthreads.c: Likewise. * gdb.threads/pthreads.exp: Likewise. gdb/doc/ 2014-10-17 Pedro Alves * gdb.texinfo (Ada Tasks and Core Files): Delete mention of Tru64. (SVR4 Process Information): Delete mention of OSF/1. commit 80134cf5b3ca1f75a96af1856fdaad29ad1f57aa Author: Pedro Alves Date: Fri Oct 17 11:05:06 2014 +0100 Fix build without libexpat clear_threads_listing_context is used for thread listing methods other than the xml based, but it's only defined when HAVE_LIBEXPAT is defined. gdb/ 2014-10-17 Pedro Alves * remote.c (clear_threads_listing_context): Move higher up, out of the HAVE_LIBEXPAT guard. commit 7a3517ffebf218c8f34ce2eaea40ab042ce33f9f Author: Yao Qi Date: Fri Oct 10 21:17:11 2014 +0800 Don't check target_info exists noargs in commands.exp I am confused by the noargs checking at each proc in commands.exp, if [target_info exists noargs] { verbose "Skipping progvar_simple_while_test because of noargs." return } gdb_test_no_output "set args 5" "set args in progvar_simple_while_test" if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't # currently support it. Bash value variable to be what we want. gdb_test "p value=5" ".*" "set value to 5 in progvar_simple_if_test #2" They are conflicting to me. If the argument passing can't be done on the target, we skip this test, why do we still have to set value below? On the other hand, the test case is compiled with -DFAKEARGV, it doesn't get anything from argv[1], why do we need to skip it if noargs is true? I don't find any useful clues from the git log, as the code is quite old, predating import to sourceware cvs. However, I find something useful from the ChangeLog. Thu Jul 20 13:28:36 1995 Jeffrey A. Law ..... * gdb.base/commands.exp: Protect tests which need arguments with $noargs conditionals. Mon Apr 21 13:38:58 1997 Fred Fish * gdb.base/run.c: Use FAKEARGV to build test executable that does not require a command line arg, since most simulators don't currently support passing such an arg into the simulated program. * gdb.base/commands.exp: Change tests to insert the proper value as the arg to the first recursive factorial call. Change compilation line to define FAKEARGV at compile time. Jeff added noargs checking as argument is passed to the inferior. Then, I presume Fred wanted to run this test on simulators which don't support argument passing, and change the code not get input from argv. (I guess) noargs wasn't set in simulator board files at that moment. Since Fred changed test to set input by gdb, instead of getting input from argv, the test should be able to run on target doesn't support argument passing, such as simulator and gdbserver. This patch is to remove these checks to noargs and "set args". I run commands.exp with these board files, and no fail is found - unix and native-gdbserver - arm-none-eabi with qemu - gdbserver on arm-linux-gnueabi with qemu gdb/testsuite: 2014-10-17 Yao Qi * gdb.base/commands.exp (gdbvar_complex_if_while_test): Don't check 'target_info exists noargs'. (test_command_prompt_position): Likewise. (progvar_simple_if_test): Don't check 'target_info exists noargs'. Remove "set args". (progvar_simple_while_test): Likewise. (progvar_complex_if_while_test): Likewise. (if_while_breakpoint_command_test): Likewise. (infrun_breakpoint_command_test): Likewise. (breakpoint_command_test): Likewise. (watchpoint_command_test): Likewise. (bp_deleted_in_command_test): Likewise. (temporary_breakpoint_commands): Likewise. commit 48cfaa5c1d550990cc8910fb9e1d80c6a0225c23 Author: Alan Modra Date: Fri Oct 17 09:31:12 2014 +1030 daily update commit 5af04e20f6333dc224d1668dcd433d7c8ca84e71 Author: Joel Brobecker Date: Tue Oct 14 12:47:43 2014 -0400 Use strtod instead of strtold in libiberty/d-demangle.c strtold is currently used to decode templates which have a floating-point value encoded inside; but this routine is not available on some systems, such as Solaris 2.9 for instance. This patch fixes the issue by replace the use of strtold by strtod. It reduces a bit the precision, but it should still remain acceptable in most cases. libiberty/ChangeLog: * d-demangle.c: Replace strtold with strtod in global comment. (strtold): Remove declaration. (strtod): New declaration. (dlang_parse_real): Declare value as double instead of long double. Replace call to strtold by call to strtod. Update format in call to snprintf. ----------------------------------------------------------------------- hooks/post-receive -- Repository for Project Archer.