Fix internal warning when "gdb -p xxx"

ps -e | grep a.out
28886 pts/12   00:00:00 a.out
gdb -p 28886
Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x0000003b0ccbc970 in __nanosleep_nocancel () from /lib64/libc.so.6
../../binutils-gdb/gdb/cleanups.c:265: internal-warning: restore_my_cleanups has found a stale cleanup
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)

The backtrace of this issue:
(gdb) bt
    file=0x8b0c10 "s' failed.", line=265, fmt=0x8b0c38 "nutils-gdb/gdb/cleanups.c",
    ap=0x7fff803e3ed8) at ../../binutils-gdb/gdb/utils.c:748
    fmt=0x8b0c38 "nutils-gdb/gdb/cleanups.c", ap=0x7fff803e3ed8)
    at ../../binutils-gdb/gdb/utils.c:799
    string=0x8b0c38 "nutils-gdb/gdb/cleanups.c") at ../../binutils-gdb/gdb/utils.c:809
    at ../../binutils-gdb/gdb/cleanups.c:265
    at ../../binutils-gdb/gdb/cleanups.c:276
    at ../../binutils-gdb/gdb/exceptions.c:142
    at ../../binutils-gdb/gdb/exceptions.c:203
    command=0x5d5fb8 <attach_command_continuation_free_args+18>, arg=0x7fff803e525b "2914",
    from_tty=1, mask=RETURN_MASK_ALL) at ../../binutils-gdb/gdb/exceptions.c:549
---Type <return> to continue, or q <return> to quit---
    func_args=0x7fff803e4280, errstring=0x8cf2e4 "/local/bin", mask=RETURN_MASK_ALL)
    at ../../binutils-gdb/gdb/exceptions.c:522

This is a new issue.  It is introduced by commit https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=8bc2fe488957946d2cdccda3ce8d4f39e4003ea0
It removed the discard_cleanups (back_to) inside attach_command.
Then restore_my_cleanups will throw a internal_warning.

https://sourceware.org/ml/gdb-patches/2014-03/msg00374.html

2014-03-21  Hui Zhu  <hui@codesourcery.com>
	    Pedro Alves  <palves@redhat.com>

	* darwin-nat.c (darwin_pid_to_exec_file): Change xmalloc to
	static buffer.
	* fbsd-nat.c (fbsd_pid_to_exec_file): Ditto.
	* linux-nat.c (linux_child_pid_to_exec_file): Ditto.
	* nbsd-nat.c (nbsd_pid_to_exec_file): Ditto.
Fix internal warning when "gdb -p xxx"

The issue that was fixed by b4ab256ded5020a82ff7ce8dc485e7882fc5b6a7
can not be found in regression test.
Update attach.exp to test it.

https://sourceware.org/ml/gdb-patches/2014-03/msg00438.html

2014-03-21  Hui Zhu  <hui@codesourcery.com>

	* gdb.base/attach.exp (do_command_attach_tests): New.
Remove fixme of packet "k" from doc
https://sourceware.org/ml/gdb-patches/2014-03/msg00324.html

2014-03-21  Pedro Alves  <palves@redhat.com>
	    Stan Shebs  <stan@codesourcery.com>
	    Hui Zhu  <hui@codesourcery.com>

	* gdb.texinfo (Packets): Add anchor to "? packet".
	Remove fixme and update introduction of "k packet".
	Add anchor to "vKill packet".
normal_stop: Extend and clarify comment.

Explain better why we skip saying "Switching to ..." in non-stop mode.

gdb/
2014-03-21  Pedro Alves  <palves@redhat.com>

	* infrun.c (normal_stop): Extend comment.
Add support to the Xtensa target for creating trampolines for out-of-range branches.

    * tc-xtensa.c (xtensa_check_frag_count, xtensa_create_trampoline_frag)
    (xtensa_maybe_create_trampoline_frag, init_trampoline_frag)
    (find_trampoline_seg, search_trampolines, get_best_trampoline)
    (check_and_update_trampolines, add_jump_to_trampoline)
    (dump_trampolines): New function.
    (md_parse_option): Add cases for --[no-]trampolines options.
    (md_assemble, finish_vinsn, xtensa_end): Add call to
    xtensa_check_frag_count.
    (xg_assemble_vliw_tokens): Add call to
    xtensa_maybe_create_trampoline_frag.
    (xtensa_relax_frag): Relax fragments with RELAX_TRAMPOLINE state.
    (relax_frag_immed): Relax jump instructions that cannot reach its
    target.
    * tc-xtensa.h (xtensa_relax_statesE::RELAX_TRAMPOLINE): New relax
    state.

    * as.texinfo: Document --[no-]trampolines command-line options.
    * c-xtensa.texi: Document trampolines relaxation and command line
    options.

    * frags.c (get_frag_count, clear_frag_count): New function.
    (frag_alloc): Increment totalfrags counter.
    * frags.h (get_frag_count, clear_frag_count): New function.

    * all.exp: Add test for trampoline relaxation.
    * trampoline.d: Trampoline relaxation expected dump.
    * trampoline.s: Trampoline relaxation test source.
2014-03-21  Christopher Faylor  <me.binutils2014@cgf.cx>

	* ld.texinfo: Document change in handling of --enable-auto-image-base.
	* emultempl/pe.em (pe_auto_image_base): Set to default base.
	(gld_${EMULATION_NAME}_list_options): Change usage message to reflect
	optional --enable-auto-image-base argument.
	(gld${EMULATION_NAME}_handle_option): Handle optional
	--enable-auto-image-base argument.
	(compute_dll_image_base): Eliminate constant.  Use pe_auto_image_base.
daily update
gdb.threads/thread-specific.exp: Fix uninitialized variable references

This fixes:

FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout)
ERROR: tcl error sourcing .../gdb/testsuite/gdb.threads/thread-specific.exp.
ERROR: can't read "this_breakpoint": no such variable
    while executing
"gdb_test_multiple "info breakpoint $this_breakpoint" "info on bp" {
    -re ".*stop only in thread (\[0-9\]*).*$gdb_prompt $" {
        set this_thread $expe..."
    (file ".../gdb/testsuite/gdb.threads/thread-specific.exp" line 108)
    invoked from within
"source .../gdb/testsuite/gdb.threads/thread-specific.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.threads/thread-specific.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""

and then:

FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout)
UNTESTED: gdb.threads/thread-specific.exp: info on bp
ERROR: tcl error sourcing .../gdb/testsuite/gdb.threads/thread-specific.exp.
ERROR: can't read "this_thread": no such variable
    while executing
"gdb_test {print $_thread} ".* = $this_thread" "thread var at break""
    (file ".../gdb/testsuite/gdb.threads/thread-specific.exp" line 119)
    invoked from within
"source .../gdb/testsuite/gdb.threads/thread-specific.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.threads/thread-specific.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name""

Final results:

FAIL: gdb.threads/thread-specific.exp: continue to thread-specific breakpoint (timeout)
UNTESTED: gdb.threads/thread-specific.exp: info on bp
UNTESTED: gdb.threads/thread-specific.exp: thread var at break

Of course the first failure best wasn't there, but failing that the script
shouldn't crash.

	* gdb.threads/thread-specific.exp: Handle the lack of usable
	$this_breakpoint and $this_thread.