aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2016-09-21MIPS/testsuite: mips16-thunks: Use `standard_output_file'Maciej W. Rozycki2-5/+9
Correct a commit 2151ccc56c74 ("Always organize test artifacts in a directory hierarchy") regression causing: Running .../gdb/testsuite/gdb.arch/mips16-thunks.exp ... gdb compile failed, Assembler messages: Fatal error: can't create .../gdb/testsuite/gdb.arch/mips16-thunks-inmain.o: No such file or directory gdb compile failed, Assembler messages: Fatal error: can't create .../gdb/testsuite/gdb.arch/mips16-thunks-main.o: No such file or directory gdb compile failed, mips-mti-linux-gnu-gcc: error: .../gdb/testsuite/gdb.arch/mips16-thunks-inmain.o: No such file or directory mips-mti-linux-gnu-gcc: error: .../gdb/testsuite/gdb.arch/mips16-thunks-main.o: No such file or directory UNSUPPORTED: gdb.arch/mips16-thunks.exp: No MIPS16 support in the toolchain. by using `standard_output_file' to construct output file names throughout. gdb/testsuite/ * gdb.arch/mips16-thunks.exp: Use `standard_output_file' throughout.
2016-09-21Keep reserved bits in CPSR on writeYao Qi4-2/+23
In patch https://sourceware.org/ml/gdb-patches/2016-04/msg00529.html I cleared reserved bits when reading CPSR. It makes a problem that these bits (zero) are written back to kernel through ptrace, and it changes the state of the processor on some recent kernel, which is unexpected. In this patch, I keep these reserved bits when write CPSR back to hardware. gdb: 2016-09-21 Yao Qi <yao.qi@linaro.org> * aarch32-linux-nat.c (aarch32_gp_regcache_collect): Keep bits 20 to 23. gdb/gdbserver: 2016-09-21 Yao Qi <yao.qi@linaro.org> * linux-aarch32-low.c (arm_fill_gregset): Keep bits 20 to 23.
2016-09-20Avoid -Wduplicated-cond warnings in gdb/pythonTom Tromey3-0/+11
I tried building gdb with -Wduplicated-cond. This patch fixes the simpler issue that was found. In Python 3, "int" and "long" are synonyms, so code like: else if (PyLong_Check (obj)) ... else if (PyInt_Check (obj)) .... will trigger this warning. The fix is to conditionalize the PyInt_Check branches on Python 2. Tested by rebuilding, with both version of Python, on x86-64 Fedora 24. 2016-09-20 Tom Tromey <tom@tromey.com> * python/py-value.c (convert_value_from_python): Make PyInt_Check conditional on Python 2. * python/py-arch.c (archpy_disassemble): Make PyInt_Check conditional on Python 2.
2016-09-20ppc: Fix record support of Store String Word instructionsEdjunior Barbosa Machado2-3/+12
gdb/ChangeLog 2016-09-20 Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com> * rs6000-tdep.c (ppc_process_record_op31): Fix record of Store String Word instructions.
2016-09-20Use 'event_ptid' instead of 'resume_ptid' on startup_inferior (fix for ↵Sergio Durigan Junior2-2/+8
regression on my last commit) Pedro pointed out a regression happening on gdb.mi/mi-exec-run.exp, and as it turned out, this was a thinko when dealing with some events on startup_inferior. Basically, one needs to pass 'event_ptid' to target_mourn_inferior, but I mistakenly passed 'resume_ptid'. This commit fixes it. Built and regtested on BuildBot, now with fixed e-mail notifications! gdb/ChangeLog: 2016-09-20 Sergio Durigan Junior <sergiodj@redhat.com> * fork-inferior.c (startup_inferior): Pass 'event_ptid' instead of 'resume_ptid' to 'target_mourn_inferior'. Fix regression introduced by my last commit.
2016-09-19gdb: Fix build breakage with GCC 4.1 and --disable-nlsPedro Alves3-5/+9
Ref: https://sourceware.org/ml/gdb-patches/2016-09/msg00203.html The std::{min,max} patch caused build failures when configuring GDB with with --disable-nls and using GCC 4.1. The reason is this bit in common/gdb_locale.h: #ifdef ENABLE_NLS ... #else # define gettext(Msgid) (Msgid) ... #endif This causes problems if the <libintl.h> header is first included at any point after "gdb_locale.h". Specifically, the gettext&co declarations in libintl.h: extern char *gettext (__const char *__msgid) __THROW __attribute_format_arg__ (1); end up broken after preprocessing: extern char *(__const char *__msgid) throw () __attribute__ ((__format_arg__ (1))); After the std::min/std::max change to include <algorithm>, this now happens with at least the GCC 4.1 copy of <algorithm>, which includes <libintl.h> via <bits/stl_algobase.h>, <iosfwd>, and <bits/c++locale.h>. The fix is to simply remove the troublesome *gettext and *textdomain macros, leaving only the _ and N_ ones. gdb/ChangeLog: 2016-09-19 Pedro Alves <palves@redhat.com> * common/gdb_locale.h [!ENABLE_NLS] (gettext, dgettext, dcgettext, textdomain, bindtextdomain): Delete macros. * main.c (captured_main) [!ENABLE_NLS]: Skip bintextdomain and textdomain calls.
2016-09-19Consolidate target_mourn_inferior between GDB and gdbserverSergio Durigan Junior20-28/+72
This patch consolidates the API of target_mourn_inferior between GDB and gdbserver, in my continuing efforts to make sharing the fork_inferior function possible between both. GDB's version of the function did not care about the inferior's ptid being mourned, but gdbserver's needed to know this information. Since it actually makes sense to pass the ptid as an argument, instead of depending on a global value directly (which GDB's version did), I decided to make the generic API to accept it. I then went on and extended all calls being made on GDB to include a ptid argument (which ended up being inferior_ptid most of the times, anyway), and now we have a more sane interface. On GDB's side, after talking to Pedro a bit about it, we decided that just an assertion to make sure that the ptid being passed is equal to inferior_ptid would be enough for now, on the GDB side. We can remove the assertion and perform more operations later if we ever pass anything different than inferior_ptid. Regression tested on our BuildBot, everything OK. I'd appreciate a special look at gdb/windows-nat.c's modification because I wasn't really sure what to do there. It seemed to me that maybe I should build a ptid out of the process information there, but then I am almost sure the assertion on GDB's side would trigger. gdb/ChangeLog: 2016-09-19 Sergio Durigan Junior <sergiodj@redhat.com> * darwin-nat.c (darwin_kill_inferior): Adjusting call to target_mourn_inferior to include ptid_t argument. * fork-child.c (startup_inferior): Likewise. * gnu-nat.c (gnu_kill_inferior): Likewise. * inf-ptrace.c (inf_ptrace_kill): Likewise. * infrun.c (handle_inferior_event_1): Likewise. * linux-nat.c (linux_nat_attach): Likewise. (linux_nat_kill): Likewise. * nto-procfs.c (interrupt_query): Likewise. (procfs_interrupt): Likewise. (procfs_kill_inferior): Likewise. * procfs.c (procfs_kill_inferior): Likewise. * record.c (record_mourn_inferior): Likewise. * remote-sim.c (gdbsim_kill): Likewise. * remote.c (remote_detach_1): Likewise. (remote_kill): Likewise. * target.c (target_mourn_inferior): Change declaration to accept new ptid_t argument; use gdb_assert on it. * target.h (target_mourn_inferior): Move function prototype from here... * target/target.h (target_mourn_inferior): ... to here. Adjust it to accept new ptid_t argument. * windows-nat.c (get_windows_debug_event): Adjusting call to target_mourn_inferior to include ptid_t argument. gdb/gdbserver/ChangeLog: 2016-09-19 Sergio Durigan Junior <sergiodj@redhat.com> * server.c (start_inferior): Call target_mourn_inferior instead of mourn_inferior; pass ptid_t argument to it. (resume): Likewise. (handle_target_event): Likewise. * target.c (target_mourn_inferior): New function. * target.h (mourn_inferior): Delete macro.
2016-09-19gdb/s390: Fix build breakage due to std::min/std::max usage without headerPedro Alves2-0/+5
[...] .../gdb/s390-linux-nat.c: In function 'void s390_prepare_to_resume(lwp_info*)': .../gdb/s390-linux-nat.c:703:20: error: 'min' is not a member of 'std' watch_lo_addr = std::min (watch_lo_addr, area->lo_addr); [...] gdb/ChangeLog: 2016-09-18 Pedro Alves <palves@redhat.com> * s390-linux-nat.c: Include <algorithm>.
2016-09-18gdb: Fix std::{min, max}-related build breakage on 32-bit hostsPedro Alves5-5/+13
Building on a 32-bit host fails currently with errors like: .../src/gdb/exec.c: In function ‘target_xfer_status section_table_read_available_memory(gdb_byte*, ULONGEST, ULONGEST, ULONGEST*)’: .../src/gdb/exec.c:801:54: error: no matching function for call to ‘min(ULONGEST, long unsigned int)’ end = std::min (offset + len, r->start + r->length); ^ In file included from /usr/include/c++/5.3.1/algorithm:61:0, from .../src/gdb/exec.c:46: /usr/include/c++/5.3.1/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/5.3.1/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed: .../src/gdb/exec.c:801:54: note: deduced conflicting types for parameter ‘const _Tp’ (‘long long unsigned int’ and ‘long unsigned int’) end = std::min (offset + len, r->start + r->length); ^ In file included from /usr/include/c++/5.3.1/algorithm:61:0, from .../src/gdb/exec.c:46: /usr/include/c++/5.3.1/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare) min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ The problem is that the std::min/std::max function templates use the same type for both parameters. When the argument types are different, the compiler can't automatically deduce which template specialization to pick from the arguments' types. Fix that by specifying the specialization we want explicitly. gdb/ChangeLog: 2016-09-18 Pedro Alves <palves@redhat.com> * breakpoint.c (hardware_watchpoint_inserted_in_range): Explicitly specify the std:min/std::max specialization. * exec.c (section_table_read_available_memory): Likewise. * remote.c (remote_read_qxfer): Likewise. * target.c (simple_verify_memory): Likewise.
2016-09-16Introduce cleanup to restore current_uioutSimon Marchi7-38/+38
Make a globally available cleanup from a pre-existing one in infrun.c. This is used in a following patch. gdb/ChangeLog: * infrun.c (restore_current_uiout_cleanup): Move to ui-out.c. (print_stop_event): Use make_cleanup_restore_current_uiout. * python/python.c (execute_gdb_command): Likewise. * ui-out.c (restore_current_uiout_cleanup): Move from infrun.c. (make_cleanup_restore_current_uiout): New function definition. * ui-out.h (make_cleanup_restore_current_uiout): New function declaration. * utils.c (do_restore_ui_out): Remove. (make_cleanup_restore_ui_out): Remove. * utils.h (make_cleanup_restore_ui_out): Remove.
2016-09-16gdb: Use std::min and std::max throughoutPedro Alves61-170/+296
Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-09-16S390: Hardware breakpoint supportAndreas Arnez4-10/+145
Add hardware breakpoint support for S390 targets. gdb/ChangeLog: * s390-linux-nat.c (PER_BIT, PER_EVENT_BRANCH, PER_EVENT_IFETCH) (PER_EVENT_STORE, PER_EVENT_NULLIFICATION) (PER_CONTROL_BRANCH_ADDRESS, PER_CONTROL_SUSPENSION) (PER_CONTROL_ALTERATION): New macros. (struct s390_debug_reg_state) <break_areas>: New member. (s390_forget_process): Free break_areas as well. (s390_linux_new_fork): Copy break_areas as well. (s390_prepare_to_resume): Install hardware breakpoints. (s390_can_use_hw_breakpoint): Indicate support for hardware breakpoints. (s390_insert_hw_breakpoint, s390_remove_hw_breakpoint): New linux_nat target methods. (_initialize_s390_nat): Register them. gdb/testsuite/ChangeLog: * lib/gdb.exp: No longer skip hardware breakpoint tests on s390.
2016-09-16linux-nat: Add function lwp_is_steppingAndreas Arnez5-0/+30
Add the function lwp_is_stepping which indicates whether the given LWP is currently single-stepping. This is a common interface, usable from native GDB as well as from gdbserver. gdb/gdbserver/ChangeLog: * linux-low.c (lwp_is_stepping): New function. gdb/ChangeLog: * nat/linux-nat.h (lwp_is_stepping): New declaration. * linux-nat.c (lwp_is_stepping): New function.
2016-09-16S390: Enable "maint set show-debug-regs"Andreas Arnez2-0/+60
Implement a new function for dumping the S390 "debug registers" (actually, the PER info) and invoke it at appropriate places. Respect the variable show_debug_regs and make it settable by the user. gdb/ChangeLog: * s390-linux-nat.c (gdbcmd.h): New include. (s390_show_debug_regs): New function. (s390_stopped_by_watchpoint): Call it, if show_debug_regs is set. (s390_prepare_to_resume): Likewise. (_initialize_s390_nat): Register the command "maint set show-debug-regs".
2016-09-16S390: Multi-inferior watchpoint supportAndreas Arnez2-10/+157
Support different sets of watchpoints in multiple inferiors. gdb/ChangeLog: * s390-linux-nat.c (watch_areas): Remove variable. Replace by a member of... (struct s390_debug_reg_state): ...this. New struct. (struct s390_process_info): New struct. (s390_process_list): New variable. (s390_find_process_pid, s390_add_process, s390_process_info_get) (s390_get_debug_reg_state): New functions. (s390_stopped_by_watchpoint): Now access the watch_areas VEC via s390_get_debug_reg_state. (s390_prepare_to_resume): Likewise. (s390_insert_watchpoint): Likewise. (s390_remove_watchpoint): Likewise. (s390_forget_process, s390_linux_new_fork): New linux_nat target methods. (_initialize_s390_nat): Register them.
2016-09-16S390: Migrate watch areas from list to VEC typeAndreas Arnez2-37/+45
For S390, the list of active watchpoints is maintained in a list based at "watch_base". This refactors the list to a vector "watch_areas". gdb/ChangeLog: * s390-linux-nat.c (s390_watch_area): New typedef. Define a VEC. (watch_base): Remove variable. (watch_areas): New variable. (s390_stopped_by_watchpoint): Transform operations on the watch_base list to equivalent operations on the watch_areas VEC. (s390_prepare_to_resume): Likewise. (s390_insert_watchpoint): Likewise. (s390_remove_watchpoint): Likewise.
2016-09-16S390: Avoid direct access to lwp_info structureAndreas Arnez2-24/+48
When using the lwp_info structure, avoid accessing its members directly, and use the advertised function interfaces instead. This is according to the instructions in linux-nat.h and prepares for making some of the code common between gdb and gdbserver. gdb/ChangeLog: * s390-linux-nat.c (s390_prepare_to_resume): Use advertised lwp functions instead of accessing lwp_info structure members. (s390_mark_per_info_changed): New function. (s390_new_thread): Use it. (s390_refresh_per_info_cb): New function. (s390_refresh_per_info): Remove parameter. Refresh all lwps of the current process. (s390_insert_watchpoint): Adjust call to s390_refresh_per_info. (s390_remove_watchpoint): Likewise.
2016-09-16testsuite: Fix false FAIL in gdb.cp/casts.expJan Kratochvil4-15/+60
gcc-6.2.1-1.fc26.x86_64 gdb compile failed, /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc:40:10: error: expected primary-expression before 'int' decltype(int x) ^~~ /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc:40:10: error: expected ')' before 'int' /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc:40:1: error: expected unqualified-id before 'decltype' decltype(int x) ^~~~~~~~ /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc: In function 'int main(int, char**)': /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/casts.cc:59:14: error: expected primary-expression before 'decltype' double y = decltype(2); ^~~~~~~~ 'decltype' is a registered keyword since C++11 which is now a default for GCC. On Thu, 15 Sep 2016 14:06:56 +0200, Pedro Alves wrote: Seems to be exercising the FLAG_SHADOW bits: ... {"__typeof__", TYPEOF, OP_TYPEOF, 0 }, {"__typeof", TYPEOF, OP_TYPEOF, 0 }, {"typeof", TYPEOF, OP_TYPEOF, FLAG_SHADOW }, {"__decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX }, {"decltype", DECLTYPE, OP_DECLTYPE, FLAG_CXX | FLAG_SHADOW }, ... /* This is used to associate some attributes with a token. */ enum token_flag { ... /* If this bit is set, the token is conditional: if there is a symbol of the same name, then the token is a symbol; otherwise, the token is a keyword. */ FLAG_SHADOW = 2 }; So perhaps a better fix is to move that particular test to a separate testcase that force-compiles with -std=c++03. gdb/testsuite/ChangeLog 2016-09-16 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.cp/casts.cc (decltype): Move it ... (main): ... with its call to ... * gdb.cp/casts03.cc: ... a new file. * gdb.cp/casts.exp: Add new file casts03.cc, move decltype test to it.
2016-09-15testsuite: Fix C++11 compilation failure for gdb.cp/m-static.expJan Kratochvil2-0/+7
gcc-6.2.1-1.fc26.x86_64 g++ -std=c++03: no warnings g++: In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79:0: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:34: error: ‘constexpr’ needed for in-class initialization of static data member ‘const float gnu_obj_4::somewhere’ of non-integral type [-fpermissive] static const float somewhere = 3.14159; ^~~~~~~ clang++: In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:22: warning: in-class initializer for static data member of type 'const float' is a GNU extension [-Wgnu-static-float-init] static const float somewhere = 3.14159; ^ ~~~~~~~ 1 warning generated. clang++ -std=c++11: In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:22: error: in-class initializer for static data member of type 'const float' requires 'constexpr' specifier [-Wstatic-float-init] static const float somewhere = 3.14159; ^ ~~~~~~~ /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:3: note: add 'constexpr' static const float somewhere = 3.14159; ^ constexpr 1 error generated. OK for check-in? After the fix out of the 4 combinations above only this one remains non-empty: clang++: In file included from /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.cc:79: /home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.cp/m-static.h:9:22: warning: in-class initializer for static data member of type 'const float' is a GNU extension [-Wgnu-static-float-init] static const float somewhere = 3.14159; ^ ~~~~~~~ 1 warning generated. On Thu, 15 Sep 2016 15:10:50 +0200, Pedro Alves wrote: Hmm, OK, now that I read the test, I think you were right in trying to keep it safe, actually. The .exp file has: if { $non_dwarf } { setup_xfail *-*-* } gdb_test "print test4.everywhere" "\\$\[0-9\].* = 317" "static const int initialized in class definition" if { $non_dwarf } { setup_xfail *-*-* } gdb_test "print test4.somewhere" "\\$\[0-9\].* = 3.14\[0-9\]*" "static const float initialized in class definition" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Added by this: https://sourceware.org/bugzilla/show_bug.cgi?id=11702 https://sourceware.org/ml/gdb-patches/2010-06/msg00677.html https://sourceware.org/ml/gdb-patches/2010-06/txt00011.txt So the new patch would make that highlighted tested above not test what its test message says it is testing. So I now think your original patch is better. Please push that one instead. gdb/testsuite/ChangeLog 2016-09-15 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.cp/m-static.h (gnu_obj_4::somewhere): Use constexpr for C++11.
2016-09-15Update ISA 3.0 / POWER9 gdb tests to match GAS test cases.Peter Bergner3-470/+493
* gdb.arch/powerpc-power.s: Update Power9 instruction tests and sync up the test with tests in gas/testsuite/gas/ppc. * gdb.arch/powerpc-power.exp: Likewise.
2016-09-15testsuite: Disable ccacheJan Kratochvil2-0/+9
There were always various problems with compatibility with ccache: https://bugzilla.redhat.com/show_bug.cgi?id=488863 https://bugzilla.redhat.com/show_bug.cgi?id=759592 https://sourceware.org/ml/gdb-patches/2009-02/msg00397.html IMO in a summary ccache finds more a benefit of faster compilation despite the debug info is no longer exactly the same (as without ccache). Although for example in this case ccache helped to find a real GDB bug: https://sourceware.org/ml/gdb-patches/2015-01/msg00497.html For the GDB testcases ccache has (IMO) no real performance advantage and it just brings heisenbugs - false FAILs - from time to time: Breakpoint 1, main () at gdb/testsuite/gdb.base/vdso-warning.c:21^M 21 return 0;^M (gdb) PASS: gdb.base/vdso-warning.exp: run: startup -> Breakpoint 1, main () at gdb/testsuite/gdb.base/hbreak-unmapped.c:21^M 21 return 0;^M (gdb) FAIL: gdb.base/vdso-warning.exp: run: startup So I find most safe and easy to just disable ccache for all testsuites. gdb/testsuite/ChangeLog 2016-09-15 Jan Kratochvil <jan.kratochvil@redhat.com> * lib/future.exp: Set CCACHE_DISABLE, clear CCACHE_NODISABLE.
2016-09-13Fix for gdb.server/non-existing-program.exp test caseCarl E. Love2-2/+7
The last commit was supposed to have the reference to ptrace () removed. The patch didn't get updated correctly before the commit. This commit fixes the comment as requested gdbserver/ChangeLog 2016-09-06 Carl Love <cel@us.ibm.com> * server.c (start_inferior): Fixed comment, requested comment change didn't get updated correctly. Removed reference to ptrace () call as it is only true on Linux systems.
2016-09-13Fix for gdb.server/non-existing-program.exp test caseCarl E. Love2-2/+12
The test checks to make sure GDB exits cleanly if there is no valid target binary. Currently, ppc and S390 fail on this test. The function target_post_create_inferior () calls linux_post_create_inferior () which calls the architecture specific functions s390_arch_setup () and ppc_arch_setup () which make ptrace calls to access the architecture specific registers. These ptrace calls fail because the process does not exist causing GDB to exit on error. This patch checks to see if the initial ptrace (PTRACE_TRACEME, ...) call returned a status of TARGET_WAITKIND_EXITED indicating the target has already exited. If the target has exited, then the target_post_create_inferior () is not called since there is no inferior to be setup. The test to see if the initial ptrace call succeeded is done after the ptrace (PTRACE_TRACEME, ...) call and the wait for the inferior process to stop, assuming it exists, has occurred. The patch has been tested on X86 64-bit, ppc64 and s390. If fixes the test failures on ppc64 and s390. The test does not fail on X86 64-bit. The patch does not introduce any additional regression failures on any of these three platforms. gdbserver/ChangeLog 2016-09-06 Carl Love <cel@us.ibm.com> * server.c (start_inferior): Do not call function target_post_create_inferior () if the inferior process has already exited.
2016-09-12Fix false FAIL on gdb.base/stap-probe.exp, due to ICF optimizationSergio Durigan Junior2-1/+13
GCC 6's ICF optimization pass is making the declaration of 'm1' and 'm2', on gdb.base/stap-probe.c, to be unified. However, this leads to only one instance of the probe 'two' being created, which causes a failure on the testsuite (which expects a multi-location breakpoint to be inserted on the probe). This patch fixes this failure by declaring a dummy variable on 'm1', and using it as an argument to m1's version of probe 'two'. Since we do not care about the contents of the functions nor about the arguments of each probe 'two', this is OK. gdb/testsuite/ChangeLog: 2016-09-11 Sergio Durigan Junior <sergiodj@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.base/stap-probe.c (m1): New variable 'dummy', necessary to make m1's definition to be different from m2's. Use 'dummy' as an argument for probe 'two'.
2016-09-10Use target_sim_options for sim target.Jon Beniston2-1/+7
2016-09-10 Jon Beniston <jon@beniston.com> * lib/mi-support.exp (mi_gdb_target_load): Use target_sim_options for sim target.
2016-09-09Pass HWCAP to ifunc resolverAndreas Arnez6-4/+46
On various GNU Elf architectures, including AArch64, ARM, s390/s390x, ppc32/64, and sparc32/64, the dynamic loader passes HWCAP as a parameter to each ifunc resolver. Currently there is an open glibc Bugzilla that requests this to be generalized to all architectures: https://sourceware.org/bugzilla/show_bug.cgi?id=19766 And various ifunc resolvers already rely on receiving HWCAP. Currently GDB always calls an ifunc resolver without any arguments; thus the resolver may receive garbage, and based on that, the resolver may decide to return a function that is not suited for the given platform. This patch always passes HWCAP to ifunc resolvers, even on systems where the dynamic loader currently behaves otherwise. The rationale is that (1) the dynamic loader may get adjusted on those systems as well in the future; (2) passing an unused argument should not cause a problem with existing resolvers; and (3) the logic is much simpler without such a distinction. gdb/ChangeLog: * elfread.c (auxv.h): New include. (elf_gnu_ifunc_resolve_addr): Pass HWCAP to ifunc resolver. gdb/testsuite/ChangeLog: * gdb.base/gnu-ifunc-lib.c (resolver_hwcap): New external variable declaration. (gnu_ifunc): Add parameter hwcap. Store it in resolver_hwcap. * gdb.base/gnu-ifunc.c (resolver_hwcap): New global variable. * gdb.base/gnu-ifunc.exp: Add test to verify that the resolver received HWCAP as its argument.
2016-09-08Remove some unneeded casts from remote.cTom Tromey2-4/+9
I happened to notice a few unneeded casts in remote.c. In some cases these are no-ops, and in others these cast away const, but in a context where this is not needed. I'm checking this in under the obvious rule. Tested by rebuilding on x86-64 Fedora 24. 2016-09-08 Tom Tromey <tom@tromey.com> * remote.c (remote_notif_stop_ack, remote_wait_as) (show_remote_cmd): Remove unneeded casts.
2016-09-06new-ui command: gdb internal errors if input is already pendingPedro Alves6-3/+194
I noticed that if input is already pending on the new-ui TTY, gdb internal-errors. E.g., create /dev/pts/2, and type anything there (even just <return> is sufficient). Now start GDB creating a new UI on that TTY, while at the same time, running a synchronous execution command. Something like: $ gdb program -ex "new-ui console /dev/pts/2" -ex "start" Back on /dev/pts/2, we get: (gdb) .../src/gdb/event-top.c:360: internal-error: double prompt A problem internal to GDB has been detected, further debugging may prove unreliable. While the main UI was waiting for "start" to finish, gdb kepts pumping events, including the input fd of the extra console. The problem is that stdin_event_handler doesn't restore the current UI back to what it was, assuming that it's only ever called from the top level event loop. However, in this case, it's being called from the nested event loop from within maybe_wait_sync_command_done. When finally the "start" command is done, we reach the code that prints the prompt in the main UI, just before starting the main event loop. Since now the current UI is pointing at the extra console (by mistake), we find ourselves printing a double prompt on the extra console. This is caught by the assertion that fails, as shown above. Since other event handlers also don't restore the UI (e.g., signal event handlers), I think it's better if whatever is pumping events to take care to restore the UI, if it cares. That's what this patch does. New test included. gdb/ChangeLog: 2016-09-06 Pedro Alves <palves@redhat.com> * top.c (wait_sync_command_done): Don't assume current_ui doesn't change across events. Restore the current UI before returning. (gdb_readline_wrapper): Restore the current UI before returning. gdb/testsuite/ChangeLog: 2016-09-06 Pedro Alves <palves@redhat.com> * gdb.base/new-ui-pending-input.c: New file. * gdb.base/new-ui-pending-input.exp: New file. * gdb.exp (clear_gdb_spawn_id): New procedure. (with_spawn_id): Check whether gdb_spawn_id exists before referencing it. If gdb_spawn_id didn't exist on entry, clear it on exit.
2016-09-06Introduce make_cleanup_restore_current_uiPedro Alves6-8/+27
Just a tidy, no functional changes. gdb/ChangeLog: 2016-09-06 Pedro Alves <palves@redhat.com> * event-top.c (restore_ui_cleanup): Now static. (make_cleanup_restore_current_ui): New function. (switch_thru_all_uis_init): Use it. * infcall.c (call_thread_fsm_should_stop): Use it. * infrun.c (fetch_inferior_event): Use it. * top.c (new_ui_command): Use it. * top.h (restore_ui_cleanup): Delete declaration. (make_cleanup_restore_current_ui): New declaration.
2016-09-06Support 128-bit IEEE floating-point types on Intel and PowerUlrich Weigand8-0/+334
Now that all the prerequisites are in place, this commit finally adds support for handling the __float128 type on Intel and Power, by providing appropriate platform-specific versions of the floatformat_for_type callback. Since at this point we do not yet have any indication in the debug info to distinguish different floating-point formats of the same length, we simply use the type name as hint. Types named "__float128" get the IEEE format. In addition to handling "__float128" itself, we also recognize "_Float128" and (on Power) "_Float64x", as well as the complex versions of those. (As pointed out by Joseph Myers, starting with GCC 7, __float128 is just a typedef for _Float128 -- but it's good to handle this anyway.) A new test case does some simple verification that the format is decoded correctly, using both __float128 and "long double" to make sure using both in the same file still works. Another new test verifies handling of the _FloatN and _FloatNx types supported by GCC 7, as well as the complex versions of those types. Note that this still only supports basic format decoding and encoding. We do not yet support the GNU extension 'g' suffix for __float128 constants. In addition, since all *arithmetic* on floating-point values is still performed in native host "long double" arithmetic, if that format is not able to encode all target __float128 values, we may get incorrect results. (To fix this would require implementing fully synthetic target floating- point arithmetic along the lines of GCC's real.c, presumably using MPFR.) gdb/ChangeLog: * i386-tdep.c (i386_floatformat_for_type): New function. (i386_gdbarch_init): Install it. * ppc-linux-tdep.c (ppc_floatformat_for_type): New function. (ppc_linux_init_abi): Install it. gdb/testsuite/ChangeLog: * gdb.base/float128.c: New file. * gdb.base/float128.exp: Likewise. * gdb.base/floatn.c: Likewise. * gdb.base/floatn.exp: Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06Add gdbarch callback to provide formats for debug info float typesUlrich Weigand10-68/+141
At this point, all TYPE_CODE_FLT types carry their floating-point format, except for those creating from reading DWARF or stabs debug info. Those will be addressed by this commit. The main issue here is that we actually have to determine which floating- point format to use. Currently, we only have the type length as input to this decision. In the future, we may hopefully get --at least in DWARF-- additional information to help disambiguate multiple different formats of the same length. For now, we can still look at the type name as a hint. This decision logic is encapsulated in a gdbarch callback to allow platform-specific overrides. The default implementation use the same logic (compare type length against the various gdbarch_..._bit sizes) that is currently implemented in floatformat_from_length. With this commit, all platforms still use the default logic, so there should be no actual change in behavior. A follow-on commit will add support for __float128 on Intel and Power. Once dwarf2read.c and stabsread.c make use of the new callback to determine floating-point formats, we're now sure every TYPE_CODE_FLT type will always carry its format. The commit therefore adds asserts to verify_floatformat to ensure new code will continue to always provide formats, and removes the code in floatformat_from_type that used to handle types with a NULL TYPE_FLOATFORMAT. gdb/ChangeLog: * gdbarch.sh (floatformat_for_type): New gdbarch callback. * gdbarch.h, gdbarch.c: Re-generate. * arch-utils.h (default_floatformat_for_type): New prototype. * arch-utils.c (default_floatformat_for_type): New function. * doublest.c (floatformat_from_length): Remove. (floatformat_from_type): Assume TYPE_FLOATFORMAT is non-NULL. * gdbtypes.c (verify_floatformat): Require non-NULL format. * dwarf2read.c (dwarf2_init_float_type): New function. (read_base_type): Use it. * stabsread.c (dbx_init_float_type): New function. (read_sun_floating_type): Use it. (read_range_type): Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06Add missing format for built-in floating-point typesUlrich Weigand10-26/+49
Many callers of init_float_type and arch_float_type still pass a NULL floatformat. This commit changes those callers where the floatformat that is supposed to be use is obvious. There are two categories where this is the case: - A number of built-in types are intended to match the platform ABI floating-point types (i.e. types that use gdbarch_float_bit etc.). Those places should use the platform ABI floating-point formats defined via gdbarch_float_format etc. - A number of language built-in types should simply use IEEE floating- point formats, since the language actually defines that this is the format that must be used to implement floating-point types for this language. (This affects Java, Go, and Rust.) The same applies for to the predefined "RS/6000" stabs floating-point built-in types. gdb/ChangeLog: * ada-lang.c (ada_language_arch_info): Use gdbarch-provided platform ABI floating-point formats for built-in types. * d-lang.c (build_d_types): Likewise. * f-lang.c (build_fortran_types): Likewise. * m2-lang.c (build_m2_types): Likewise. * mdebugread.c (basic_type): Likewise. * go-lang.c (build_go_types): Use IEEE floating-point formats for language built-in types as mandanted by the language. * jv-lang.c (build_java_types): Likewise. * rust-lang.c (rust_language_arch_info): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06Remove TYPE_NOSIGN "char" hackUlrich Weigand4-7/+13
init_type (and arch_integer_type) currently use a special hack to set the TYPE_NOSIGN flag if the type name is exactly "char". This commit moves the hack up to the callers of those routines. The special case currently can hit only for types created from dwarf2read, but read_base_type actually implements the "char" check itself, so it is redundant to do it in init_type as well. (Note that stabsread.c and the other type readers always pass NULL as name to init_type, so the special case can never hit for those.) A few other cases create pre-definded types with a hard-coded name of "char"; the commit simply moves setting the TYPE_NOSIGN flag to those places. No functional change intended. gdb/ChangeLog: * gdbtypes.c (init_type): Remove "char" special case. (arch_integer_type): Likewise. (gdbtypes_post_init): Set TYPE_NOSIGN for "char" type. (objfile_type): Likewise. * mdebugread.c (basic_type): Likewise. * stabsread.c (rs6000_builtin_type): Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06Remove obsolete TYPE_FLAG_... valuesUlrich Weigand8-84/+58
Now that init_type no longer takes a FLAGS argument, there is no user of the TYPE_FLAGS_... enum values left. This commit removes them (and all references to them in comments as well). This is mostly a no-op, except for a change to the Python type printer, which attempted to use them before. (As best as I can tell, this wasn't really needed anyway, since it was only used to pretty-print type *instance* flags, which only use the instance flags.) gdb/ChangeLog: * gdbtypes.h (enum type_flag_value): Remove. Remove references to TYPE_FLAG_... in comments throughout. * gdbtypes.c (recursive_dump_type): Do not print TYPE_FLAG_... flags, print the corresponding TYPE_... access macro names. Remove references to TYPE_FLAG_... in comments throughout. * infcall.c: Remove references to TYPE_FLAG_... in comments. * valprint.c: Likewise. * gdb-gdb.py (class TypeFlag): No longer consider TYPE_FLAG_... values, only TYPE_INSTANCE_FLAG_... values. (class TypeFlagsPrinter): Likewise. gdb/testsuite/ChangeLog: * gdb.cp/hang.exp: Remove reference to TYPE_FLAG_STUB in comment. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06Unify init_type and arch_type interface and helpersUlrich Weigand6-317/+388
This adds a number of helper routines for creating objfile-owned types; these correspond 1:1 to the already existing helper routines for creating gdbarch-owned types, and are intended to be used instead of init_type. A shared fragment of init_float_type and arch_float_type is extracted into a separate subroutine verify_subroutine. The commit also brings the interface of init_type in line with the one for arch_type. In particular, this means removing the FLAGS argument; callers now set the required flags directly. (Since most callers use the new helper routines, very few callers actually need to set any additional flags directly any more.) Note that this means all the TYPE_FLAGS_... defined are no longer needed anywhere; they will be removed by a follow-on commit. All users of init_type are changed to use on of the new helpers where possible. No functional change intended. gdb/ChangeLog: * gdbtypes.h (init_type): Remove FLAGS argument. Move OBJFILE argument to first position. (init_integer_type): New prototype. (init_character_type): Likewise. (init_boolean_type): Likewise. (init_float_type): Likewise. (init_decfloat_type): Likewise. (init_complex_type): Likewise. (init_pointer_type): Likewise. * gdbtypes.c (verify_floatflormat): New function. (init_type): Remove FLAGS argument and processing. Move OBJFILE argument to first position. (init_integer_type): New function. (init_character_type): Likewise. (init_boolean_type): Likewise. (init_float_type): Likewise. (init_decfloat_type): Likewise. (init_complex_type): Likewise. (init_pointer_type): Likewise. (arch_float_type): Use verify_floatflormat. (objfile_type): Use init_..._type helpers instead of calling init_type directly. * dwarf2read.c (fixup_go_packaging): Update to changed init_type prototype. (read_namespace_type): Likewise. (read_module_type): Likewise. (read_typedef): Likewise. (read_unspecified_type): Likewise. (build_error_marker_type): Likewise. (read_base_type): Use init_..._type helpers. * mdebugread.c (basic_type): Use init_..._type helpers. (parse_type): Update to changed init_type prototype. (cross_ref): Likewise. * stabsread.c (rs6000_builtin_type): Use init_..._type helpers. (read_sun_builtin_type): Likewise. (read_sun_floating_type): Likewise. (read_range_type): Likewise. Also update to changed init_type prototype. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06Add some missing arch_..._type helpersUlrich Weigand7-30/+56
gdbtypes provides a number of helper routines that can be called instead of using arch_type directly to create a type of a particular kind. This patch adds two additional such routines that have been missing so far, to allow creation of TYPE_CODE_DECFLOAT and TYPE_CODE_POINTER types. The patch also changes a number of places to use the new helper routines instead of calling arch_type directly. No functional change intended. gdb/ChangeLog: * gdbtypes.h (arch_decfloat_type): New prototype. (arch_pointer_type): Likewise. * gdbtypes.c (arch_decfloat_type): New function. (arch_pointer_type): Likewise. (gdbtypes_post_init): Use arch_decfloat_type. * avr-tdep.c (avr_gdbarch_init): Use arch_pointer_type. * ft32-tdep.c (ft32_gdbarch_init): Likewise. * m32c-tdep.c (make_types): Likewise. * rl78-tdep.c (rl78_gdbarch_init): Likewise. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06Fix TYPE_SPECIFIC_FIELD for types created via arch_typeUlrich Weigand2-16/+31
A type's TYPE_SPECIFIC_FIELD is supposed to be initialized as appropriate for the type code. This does happen if the type is created via init_type, but not if it created via arch_type. Fixed by extracting the initialization logic into a new set_type_code routine, which is then called from both places. gdb/ChangeLog: * gdbtypes.c (set_type_code): New function. (init_type, arch_type): Use it. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-06Fix typo in ada_language_arch_infoUlrich Weigand2-1/+6
This fixes a bug introduced by a wrong replacement here: https://sourceware.org/ml/gdb-patches/2007-06/msg00196.html The Ada "long_long_float" type is supposed to correspond to the platform ABI long double type, not double. gdb/ChangeLog: * ada-lang.c (ada_language_arch_info): Use gdbarch_long_double_bit instead of gdbarch_double_bit for "long_long_float". Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-05gdb/: Require a C++ compilerPedro Alves13-190/+51
This removes all support for building gdb & gdbserver with a C compiler from gdb & gdbserver's build machinery. gdb/ChangeLog: 2016-09-05 Pedro Alves <palves@redhat.com> * NEWS: Mention that a C++ compiler is now required. * Makefile.in (COMPILER, COMPILER_CFLAGS): Remove. (COMPILE.pre, CC_LD): Use CXX directly. (INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly. * acinclude.m4: Don't include build-with-cxx.m4. * build-with-cxx.m4: Delete file. * configure.ac: Remove GDB_AC_BUILD_WITH_CXX call. * warning.m4: Assume $enable_build_with_cxx is yes. * configure: Regenerate. gdb/gdbserver/ChangeLog: 2016-09-05 Pedro Alves <palves@redhat.com> * Makefile.in (COMPILER, COMPILER_CFLAGS): Remove. (COMPILE.pre, CC_LD): Use CXX directly. (INTERNAL_CFLAGS_BASE): Use CXXFLAGS directly. * acinclude.m4: Don't include build-with-cxx.m4. * configure.ac: Remove GDB_AC_BUILD_WITH_CXX call. * configure: Regenerate.
2016-09-05Fix PR19927: Avoid unwinder recursion if sniffer uses calls parse_and_evalPedro Alves5-32/+76
This fixes the problem exercised by Kevin's test at: https://sourceware.org/ml/gdb-patches/2016-08/msg00216.html This was originally exposed by the OpenJDK Python-based unwinder. If an unwinder attempts to call parse_and_eval from within its sniffing method, GDB's unwinding machinery enters infinite recursion. However, parse_and_eval is a pretty reasonable thing to call, because Python/Scheme-based unwinders will often need to read globals out of inferior memory. The recursion happens because: - get_current_frame() is called soon after the target stops. - current_frame is NULL, and so we unwind it from the sentinel frame (which is special and has level == -1). - We reach get_prev_frame_if_no_cycle, which does cycle detection based on frame id, and thus tries to compute the frame id of the new frame. - Frame id computation requires an unwinder, so we go through all unwinder sniffers trying to see if one accepts the new frame (the current frame). - the unwinder's sniffer calls parse_and_eval(). - parse_and_eval depends on the selected frame/block, and if not set yet, the selected frame is set to the current frame. - get_current_frame () is called again. current_frame is still NULL, so ... - recurse forever. In Kevin's test at: https://sourceware.org/ml/gdb-patches/2016-08/msg00216.html gdb doesn't recurse forever simply because the Python unwinder contains code to detect and stop the recursion itself. However, GDB goes downhill from here, e.g., by showing the sentinel frame as current frame (note the -1): Breakpoint 1, ccc (arg=<unavailable>) at py-recurse-unwind.c:23 23 } (gdb) bt #-1 ccc (arg=<unavailable>) at py-recurse-unwind.c:23 Backtrace stopped: previous frame identical to this frame (corrupt stack?) That "-1" frame level comes from this: if (catch_exceptions (current_uiout, unwind_to_current_frame, sentinel_frame, RETURN_MASK_ERROR) != 0) { /* Oops! Fake a current frame? Is this useful? It has a PC of zero, for instance. */ current_frame = sentinel_frame; } which is bogus. It's never correct to set the current frame to the sentinel frame. The only reason this has survived so long is that getting here normally indicates something wrong has already happened before and we fix that. And this case is no exception -- it doesn't really matter how precisely we managed to get to that bogus code (it has to do with the the stash), because anything after recursion happens is going to be invalid. So the fix is to avoid the recursion in the first place. Observations: #1 - The recursion happens because we try to do cycle detection from within get_prev_frame_if_no_cycle. That requires computing the frame id of the frame being unwound, and that itself requires calling into the unwinders. #2 - But, the first time we're unwinding from the sentinel frame, when we reach get_prev_frame_if_no_cycle, there's no frame chain at all yet: - current_frame is NULL. - the frame stash is empty. Thus, there's really no need to do cycle detection the first time we reach get_prev_frame_if_no_cycle, when building the current frame. So we can break the recursion by making get_current_frame call a simplified version of get_prev_frame_if_no_cycle that results in setting the current_frame global _before_ computing the current frame's id. But, we can go a little bit further. As there's really no reason anymore to compute the current frame's frame id immediately, we can defer computing it to when some caller of get_current_frame might need it. This was actually how the frame id was computed for all frames before the stash-based cycle detection was added. So in a way, this patch reintroduces the lazy frame id computation, but unlike before, only for the case of the current frame, which turns out to be special. This lazyness, however, requires adjusting gdb.python/py-unwind-maint.exp, because that assumes unwinders are immediately called as side effect of some commands. I didn't see a need to preserve the behavior expected by that test (all it would take is call get_frame_id inside get_current_frame), so I adjusted the test. gdb/ChangeLog: 2016-09-05 Pedro Alves <palves@redhat.com> PR backtrace/19927 * frame.c (get_frame_id): Compute the frame id if not computed yet. (unwind_to_current_frame): Delete. (get_current_frame): Use get_prev_frame_always_1 to get the current frame and assert that that always succeeds. (get_prev_frame_if_no_cycle): Skip cycle detection if returning the current frame. gdb/testsuite/ChangeLog: 2016-09-05 Pedro Alves <palves@redhat.com> PR backtrace/19927 * gdb.python/py-unwind-maint.exp: Adjust tests to not expect that unwinders are immediately called as side effect of "source" or "disable unwinder" commands. * gdb.python/py-recurse-unwind.exp: Remove setup_kfail calls.
2016-09-03Removed redundant line remote-utils.cAkash Trehan2-1/+6
2016-09-02 Akash Trehan <akash.trehan123@gmail.com> gdb/gdbserver/ChangeLog: PR gdb/19495 * remote-utils.c (relocate_instruction): Remove redundant strcpy() call writing data to own_buf.
2016-09-02Handle DW_OP_form_tls_addressTom Tromey6-7/+26
Currently gdb supports DW_OP_GNU_push_tls_address, but not DW_OP_form_tls_address. I think it would be better if the toolchain as a whole moved to using the standard opcode, and the prerequisite to this is getting gdb to recognize it. GCC can sometimes emit DW_OP_form_tls_address for emultls targets. As far as I know, nobody has ever tried this with gdb (since it wouldn't work at all). I don't think there's a major drawback to using a single opcode for all targets, because computing the location of a thread-local is already target specific. This is PR gdb/11616. I don't know how to write a test case for this; though it's worth noting that there aren't explicit tests for DW_OP_GNU_push_tls_address either -- and if I change GCC, these paths will be tested to the same extent they are now. 2016-09-02 Tom Tromey <tom@tromey.com> PR gdb/11616: * dwarf2read.c (decode_locdesc): Handle DW_OP_form_tls_address. * dwarf2loc.c (dwarf2_compile_expr_to_ax): Handle DW_OP_form_tls_address. (locexpr_describe_location_piece): Likewise. * dwarf2expr.h (struct dwarf_expr_context_funcs): Update comment. * dwarf2expr.c (execute_stack_op): Handle DW_OP_form_tls_address. (ctx_no_get_tls_address): Mention DW_OP_form_tls_address. * compile/compile-loc2c.c (struct insn_info): Update comment. (compute_stack_depth_worker): Handle DW_OP_form_tls_address.
2016-09-02[GDBserver] Replace "reinsert_breakpoint" with "single_step_breakpoint"Yao Qi3-89/+90
reinsert_breakpoint is used for software single step, so it is more clear to rename it to single_step_breakpoint. This was pointed out in the review https://sourceware.org/ml/gdb-patches/2016-05/msg00429.html I don't rename "other_breakpoint" in this patch. gdb/gdbserver: 2016-09-02 Yao Qi <yao.qi@linaro.org> * linux-low.c: Replace "reinsert_breakpoints" with "single_step_breakpoints". Replace "reinsert breakpoints" with "single-step breakpoints". * mem-break.c: Likewise. * mem-break.h: Likewise.
2016-09-02Skip floating point tests in return-nodebug.exp if gdb_skip_float_test is trueYao Qi2-0/+10
return-nodebug.exp does the test for various types, but we shouldn't test with floating point type if gdb_skip_float_test returns true. gdb/testsuite: 2016-09-02 Yao Qi <yao.qi@linaro.org> * gdb.base/return-nodebug.exp: Skip the test if skip_float_test is true and $type is "float" or "double".
2016-09-02Detect broken ptrace in gdb_skip_float_testYao Qi12-28/+156
We recently found a ARM kernel ptrace bug http://lists.infradead.org/pipermail/linux-arm-kernel/2016-May/431962.html Details can be found in the comment in gdb_skip_float_test. We can skip floating point tests if the kernel bug is detected. This patch adds more code in gdb_skip_float_test to detect the broken ptrace on arm-linux. Such detection should be done at the beginning of the test, because it starts a fresh GDB, so change the test cases to invoke gdb_skip_float_test at the beginning of test, and use its return value afterwards. Since gdb_skip_float_test becomes a gdb_caching_proc, so it can't have an argument, this patch also removes argument "msg", which isn't useful. gdb/testsuite: 2016-09-02 Yao Qi <yao.qi@linaro.org> * gdb.arch/arm-neon.exp: Skip it if gdb_skip_float_test returns true. * gdb.base/call-ar-st.exp: Invoke gdb_skip_float_test. * gdb.base/call-rt-st.exp: Likewise. * gdb.base/call-sc.exp: Invoke gdb_skip_float_test and use its return value instead of gdb,skip_float_test. * gdb.base/callfuncs.exp: Invoke gdb_skip_float_test. (do_function_calls): Use its return value instead of gdb,skip_float_test. * gdb.base/finish.exp: Likewise. * gdb.base/funcargs.exp: Likewise. * gdb.base/return.exp: Likewise. * gdb.base/return2.exp: Likewise. * gdb.base/varargs.exp: Likewise. * lib/gdb.exp (gdb_skip_float_test): Change it to gdb_caching_proc. Detect the broken ptrace on arm-linux.
2016-09-01Share target_wait prototype between GDB and gdbserverSergio Durigan Junior6-12/+37
This commit moves the target_wait prototype from the GDB-specific target.h header to the common target/target.h header. Then, it creates a compatible implementation of target_wait on gdbserver using the_target->wait, and adjusts the (only) caller (mywait function). Pretty straightforward, no regressions introduced. gdb/gdbserver/ChangeLog: 2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com> * target.c (mywait): Call target_wait instead of the_target->wait. (target_wait): New function. gdb/ChangeLog: 2016-09-01 Sergio Durigan Junior <sergiodj@redhat.com> * target.c (target_wait): Mention that the function's prototype can be found at target/target.h. * target.h (target_wait): Move prototype from here... * target/target.h (target_wait): ... to here.
2016-09-01Use target_continue{,_no_signal} instead of target_resumeSergio Durigan Junior9-31/+60
This commit implements a new function, target_continue, on top of the target_resume function. Then, it replaces all calls to target_resume by calls to target_continue or to the already existing target_continue_no_signal. This is one of the (many) necessary steps needed to consolidate the target interface between GDB and gdbserver. In particular, I am interested in the impact this change will have on the unification of the fork_inferior function (which I have been working on). Tested on the BuildBot, no regressions introduced. gdb/gdbserver/ChangeLog: 2016-09-31 Sergio Durigan Junior <sergiodj@redhat.com> * server.c (start_inferior): New variable 'ptid'. Replace calls to the_target->resume by target_continue{,_no_signal}, depending on the case. * target.c (target_stop_and_wait): Call target_continue_no_signal instead of the_target->resume. (target_continue): New function. gdb/ChangeLog: 2016-09-31 Sergio Durigan Junior <sergiodj@redhat.com> * fork-child.c (startup_inferior): Replace calls to target_resume by target_continue{,_no_signal}, depending on the case. * linux-nat.c (cleanup_target_stop): Call target_continue_no_signal instead of target_resume. * procfs.c (procfs_wait): Likewise. * target.c (target_continue): New function. * target/target.h (target_continue): New prototype.
2016-08-31Fix lwp_suspend/unsuspend imbalance in linux_wait_1Antoine Tremblay2-18/+23
This patch fixes imbalanced lwp_suspend/unsuspend calls caused by the premature choosing of another event for fairness. select_event_lwp would switch the event before a call to unsuspend_all_lwps, thus it would be called with the wrong event. This caused an assertion failure: unsuspend LWP xx, suspended=-1 when testing gdb.threads/non-stop-fair-events.exp with ARM range stepping in GDBServer. This patch moves the switch of event after the unsuspend/unstop calls. No regressions, tested on ubuntu 14.04 ARMv7 and x86. With gdbserver-native. gdb/gdbserver/ChangeLog: * linux-low.c (linux_wait_1): Move event switch after unsuspend_lwps.
2016-08-31Fix a typo in commentYao Qi2-1/+5
This patch replaces "keep things single" with "keep things simple". gdb: 2016-08-31 Yao Qi <yao.qi@linaro.org> * record-full.c (record_full_insert_breakpoint): Fix typo.
2016-08-30Fix order of inferiors in "thread apply all"Andreas Arnez4-1/+15
This inserts missing parentheses in the calculation of the comparison result between two different inferior numbers. The problem was found by Philipp Rudo. gdb/ChangeLog: * thread.c (tp_array_compar): Insert missing parentheses. gdb/testsuite/ChangeLog: * gdb.multi/tids.exp: Test "thread apply all".