aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-10-21MIPS/GAS: Correct file option settings with `.insn'Maciej W. Rozycki6-0/+56
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.
2014-10-22[GOLD] Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7Alan Modra2-0/+11
As for bfd.ld. Refer 2300b5a14 * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to thread_starter.
2014-10-21[AARCH64] Add thunderx support to gasAndrew Pinski2-0/+2
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.
2014-10-21Relax ppc64_elf_tls_optimize assertionAlan Modra2-1/+9
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.
2014-10-21gas: avoid bogus warnings in false branches of conditionalJan Beulich5-7/+36
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.
2014-10-21ppc: enable msgclr and msgsnd on Power8Jan Beulich5-2/+15
According to my reading of the spec it was an oversight for them to not having got enabled when Power8 support got added.
2014-10-21aarch64: move bogus assertionJan Beulich2-12/+20
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.
2014-10-21Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7Alan Modra2-0/+11
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.
2014-10-21daily updateAlan Modra1-1/+1
2014-10-20Small fixes to the Python API docSimon Marchi2-2/+9
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".
2014-10-20Rename py-objfile-script-gdb.py.in to py-objfile-script-gdb.pyYao Qi3-3/+10
Patch <https://sourceware.org/ml/gdb-patches/2011-07/msg00225.html> 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 <yao@codesourcery.com> * 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.
2014-10-20Don't remove files copied to hostYao Qi23-62/+33
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 <yao@codesourcery.com> * 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.
2014-10-20daily updateAlan Modra1-1/+1
2014-10-19Fix some comments to say minus_one_ptid instead of PID == -1.Doug Evans2-3/+8
gdb/ChangeLog: * gdbthread.h (set_running): Fix comment. (set_executing, finish_thread_state): Fix comment.
2014-10-18linux-nat.c (linux_nat_wait_1): Make local prev_mask non-static.Doug Evans2-1/+5
gdb/ChangeLog: linux-nat.c (linux_nat_wait_1): Make local prev_mask non-static.
2014-10-19daily updateAlan Modra1-1/+1
2014-10-18Fix the gdb.dwarf2/dw2-dir-file-name.exp test on MIPSKwok Cheung Yeung3-9/+34
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 <kcy@codesourcery.com> * 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.
2014-10-18Skip testing argv[0] on target argv[0] isn't availableYao Qi5-10/+141
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 <yao@codesourcery.com> * 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.
2014-10-18PowerPC64 ELFv1 function symbol definition vs LTO and discarded sectionsAlan Modra2-43/+70
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.
2014-10-18Fix PR17493, attempted output of *GAS `reg' section* symbolAlan Modra5-8/+21
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.
2014-10-18* configure.tgt (targ_extra_obj) [aarch64*-*]: Define.Andreas Schwab2-0/+5
2014-10-17Add "typename" keyword to satisfy GCC 4.2.Cary Coutant2-1/+6
gold/ * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub): Add "typename" keyword.
2014-10-18daily updateAlan Modra1-1/+1
2014-10-17opcodes, elf: annotate instructions with HWCAP2_VIS3B.Jose E. Marchesi6-14/+23
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 <jose.marchesi@oracle.com> * sparc-opc.c (sparc-opcodes): Annotate several instructions with the HWCAP2_VIS3B hwcap. include/opcodes/ChangeLog: 2014-10-17 Jose E. Marchesi <jose.marchesi@oracle.com> * sparc.h (HWCAP2_VIS3B): Documentation improved. include/elf/ChangeLog: 2014-10-17 Jose E. Marchesi <jose.marchesi@oracle.com> * sparc.h (ELF_SPARC_HWCAP2_VIS3B): Documentation improved.
2014-10-17opcodes: fix several misplaced hwcap entries.Jose E. Marchesi2-13/+18
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 <jose.marchesi@oracle.com> * sparc-opc.c (sparc-opcodes): Fix several misplaced hwcap entries.
2014-10-17Fix bad @value references in MIPS documentationMatthew Fortune2-1/+5
gas/ * doc/c-mips.texi: Fix bad @value references.
2014-10-17New python event "clear_objfiles".Doug Evans14-7/+126
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.
2014-10-17Add gdb.Objfile.progspace attribute.Doug Evans7-0/+43
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.
2014-10-17Fix mingw32 failures due to incorrect directory separator in patternLuis Machado20-125/+148
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 <lgustavo@codesourcery.com> * 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.
2014-10-17Copy xml files to hostYao Qi3-3/+14
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 <yao@codesourcery.com> * lib/gdb.exp (gdb_skip_xml_test): Copy trivial.xml to host. * gdb.xml/tdesc-regs.exp: Copy single-reg.xml to host.
2014-10-17PR gdb/17471: Repeating a background command makes it foregroundPedro Alves5-53/+224
When we repeat a command, by just pressing <ret>, 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 <palves@redhat.com> 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 <palves@redhat.com> PR gdb/17471 * gdb.base/bg-execution-repeat.c: New file. * gdb.base/bg-execution-repeat.exp: New file.
2014-10-17PR gdb/17300: Input after "c -a" crashes readline/GDBPedro Alves5-0/+135
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 <captured_command_loop>, 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 <captured_main>, 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 <palves@redhat.com> 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 <palves@redhat.com> PR gdb/17300 * gdb.base/continue-all-already-running.c: New file. * gdb.base/continue-all-already-running.exp: New file.
2014-10-17PR gdb/17472: With annotations, input while executing in the foreground ↵Pedro Alves7-2/+202
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<ret> 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 <captured_command_loop>, 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 <captured_main>, 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 <palves@redhat.com> 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 <palves@redhat.com> PR gdb/17472 * gdb.base/annota-input-while-running.c: New file. * gdb.base/annota-input-while-running.exp: New file.
2014-10-17Make common code handle target_terminal_* idempotencyPedro Alves4-14/+81
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 <palves@redhat.com> * 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.
2014-10-17Fix ld tests with sysroot=/ and --enable-targets=all and test --print-sysrootHans-Peter Nilsson3-23/+40
* 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.
2014-10-17Implement --print-sysroot in ld.Hans-Peter Nilsson1-0/+7
* ldlex.h (enum option_values): Add entry OPTION_PRINT_SYSROOT. * lexsup.c (ld_options): Add entry for --print-sysroot. (parse_args) <OPTION_PRINT_SYSROOT>: Print sysroot and exit early.
2014-10-17Implement --print-sysroot in ld.Hans-Peter Nilsson2-0/+8
* ldlex.h (enum option_values): Add entry OPTION_PRINT_SYSROOT. * lexsup.c (ld_options): Add entry for --print-sysroot. (parse_args) <OPTION_PRINT_SYSROOT>: Print sysroot and exit early.
2014-10-17Delete Tru64 supportPedro Alves33-1838/+72
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 <palves@redhat.com> * 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 <palves@redhat.com> * 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 <palves@redhat.com> * gdb.texinfo (Ada Tasks and Core Files): Delete mention of Tru64. (SVR4 Process Information): Delete mention of OSF/1.
2014-10-17Fix build without libexpatPedro Alves2-15/+20
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 <palves@redhat.com> * remote.c (clear_threads_listing_context): Move higher up, out of the HAVE_LIBEXPAT guard.
2014-10-17Don't check target_info exists noargs in commands.expYao Qi2-61/+16
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 <law@rtl.cygnus.com> ..... * gdb.base/commands.exp: Protect tests which need arguments with $noargs conditionals. Mon Apr 21 13:38:58 1997 Fred Fish <fnf@cygnus.com> * 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 <yao@codesourcery.com> * 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.
2014-10-17daily updateAlan Modra1-1/+1
2014-10-16Use strtod instead of strtold in libiberty/d-demangle.cJoel Brobecker2-5/+14
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.
2014-10-16Darwin: sanitize %gs and %fs values.Tristan Gingold2-0/+15
Some Darwin kernels return values out of bounds for gs and fs segments. With this commit, they are masked to avoid garbage. gdb/ChangeLog: * i386-darwin-nat.c (i386_darwin_fetch_inferior_registers) (i386_darwin_store_inferior_registers): Sanitize gs and fs values on amd64.
2014-10-16Fix 17492, ld segfault with --oformat=binaryAlan Modra11-39/+62
PR 17492 * elf32-arm.c (elf32_arm_add_symbol_hook): Only set has_gnu_symbols on ELF output bfd. * elf32-i386.c (elf_i386_add_symbol_hook): Likewise. * elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise. * elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise. * elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise. * elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise. * elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise. * elf64-x86-64.c (elf_x86_64_add_symbol_hook): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise. * elf-s390-common.c (elf_s390_add_symbol_hook): Likewise. Handle STB_GNU_UNIQUE too.
2014-10-16Don't check noargs in remotetimeout.expYao Qi2-5/+4
The condition [target_info exists noargs] is checked when remotetimeout.exp was added https://sourceware.org/ml/gdb-patches/2005-02/msg00052.html noargs means GDB does not support argument passing for inferior, rather than doesn't support argument passing to GDB. remotetimeout.exp passes -l to GDB only, doesn't pass any arguments to the inferior. This patch is to remove such unnecessary checking, and remotetimeout.exp then can be run with native-gdbserver board file. gdb/testsuite: 2014-10-16 Yao Qi <yao@codesourcery.com> * gdb.base/remotetimeout.exp: Remove noargs checking.
2014-10-16PR17488, powerpc64-linux-ld segfaultAlan Modra4-66/+75
For binary ouput, we don't have an ELF bfd output so can't access elf_elfheader. The elf64-ppc.c changes are really just a tidy, triggered by looking at all places where the abiversion bits are accessed. bfd/ * elf64-ppc.c (ppc64_elf_before_check_relocs): Do .opd processing even when output is not ppc64 ELF. Remove redundant tests on type of input bfd. ld/ PR 17488 * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Don't attempt to access ELF header e_flags when not ppc64 ELF output.
2014-10-16daily updateAlan Modra1-1/+1
2014-10-15Here we have the patch for gold aarch64 backend to support relaxation.Han Shen3-78/+2189
In short relaxation is the linker's generation of stubs that fixes the out-of-range jumps/branches in the original object file. With this implementation, we are able to link a 456MB aarch64 application. Tested: 1) Build natively on x86_64 and aarch64 machines. 2) Pass unit tests regarding relaxation.
2014-10-15DEC threads: Simplify updating the thread listPedro Alves2-72/+33
Seems to me that we can simplify DEC thread's target_update_thread_list implementation, avoiding the need to build the array of GDB threads. I have no way to test this, but then again support for Tru64 is about to be removed. Pushing anyway to have the last version in git be the cleanest one should start from, if this file turns out to be resurrected in the future. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * dec-thread.c (dec_thread_count_gdb_threads) (dec_thread_add_gdb_thread): Delete. (dec_thread_update_thread_list): Delete. (dec_thread_find_new_threads): Rename to ... (dec_thread_update_thread_list): ... this. Delete GDB-size threads that are no longer found in dec_thread_list. (resync_thread_list): Delete. (dec_thread_wait): Call dec_thread_update_thread_list instead of resync_thread_list.
2014-10-15remote: get rid of all the T packets when syncing the thread listPedro Alves3-4/+50
This commit avoids the prune_threads call in the remote target's target_update_thread_list's implementation, eliminating all the "thread alive" RSP traffic (one packet per thread) whenever we fetch the thread list. IOW, this: Sending packet: $Tp2141.2150#82...Packet received: OK Sending packet: $Tp2141.214f#b7...Packet received: OK Sending packet: $Tp2141.2141#82...Packet received: OK ... more T packets; it's one per previously known live thread ... Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n Becomes: Sending packet: $qXfer:threads:read::0,fff#03...Packet received: l<threads>\n<thread id="p2141.2141" core="2"/>\n<thread id="p2141.214f" core="1"/>\n<thread id="p2141.2150" core="2"/>\n</threads>\n Tested on x86_64 Fedora 20, native gdbserver: - tests the qXfer:threads:read method. Tested on x86_64 Fedora 20, native gdbserver with qXfer:threads:read force-disabled in gdbserver: - So that GDB falls back to the qfThreadInfo/qsThreadInfo method. And also manually smoked tested force disabling both qXfer:threads:read and qfThreadInfo/qsThreadInfo in gdbserver. gdb/ 2014-10-15 Pedro Alves <palves@redhat.com> * gdbthread.h (ALL_NON_EXITED_THREADS_SAFE): New macro. * remote.c (remote_update_thread_list): Skip calling prune_threads if any thread listing method is supported, and instead walk over the set of remote threads listed, deleting those that are not found in GDB's thread list.