aboutsummaryrefslogtreecommitdiff
path: root/gdb
AgeCommit message (Collapse)AuthorFilesLines
2017-05-30btrace: Remove constant arguments.Tim Wiederhake2-47/+51
2017-05-30btrace: Use function segment index in insn iterator.Tim Wiederhake4-29/+50
Remove FUNCTION pointer in struct btrace_insn_iterator and use an index into the list of function segments instead.
2017-05-30btrace: Use function segment index in call iterator.Tim Wiederhake4-119/+101
Remove FUNCTION pointer in struct btrace_call_iterator and use an index into the list of function segments instead.
2017-05-30btrace: Add btinfo to instruction interator.Tim Wiederhake3-0/+12
This will serve as the access path to the vector of function segments once the FUNCTION pointer in struct btrace_insn_iterator is removed.
2017-05-30btrace: Transfer ownership of pointers.Tim Wiederhake2-48/+66
Directly insert new btrace_function pointers into the vector and have the vector own these pointers. This allows us to later retrieve these objects by their number directly after creation whereas at the moment we have to wait until the vector is fully populated. This requires to pull btrace_thread_info through different functions but cleans up the code for freeing the trace.
2017-05-30btrace: Use std::vector in struct btrace_thread_information.Tim Wiederhake3-13/+18
2017-05-30Fix NEWS formatting in GDB 8.0 sectionSimon Marchi2-16/+21
Change the GDB 8.0 section of the NEWS file to try to follow this order: * Functional changes * Added and removed configurations and targets * New commands * New options * MI changes In particular, there were two "New commands" sections. gdb/ChangeLog: * NEWS (Changes in GDB 8.0): Remove extra empty line. Move "Removed targets and native configurations" up. Merge duplicate "New commands" sub-sections. Add "New options" sub-sections.
2017-05-30gdb.base/watch-cond-infcall.exp: Don't run if target doesn't support infcallsSimon Marchi2-0/+10
This test requires calling a function in the inferior, and therefore it doesn't make sense to run it if the target doesn't support calling functions from GDB. gdb/testsuite/ChangeLog: * gdb.base/watch-cond-infcall.exp: Don't run if target doesn't support function calls from GDB.
2017-05-26Add regcache raw_supply_integer and raw_collect_integer.Alan Hayward7-69/+213
Use these to replace instances of MAX_REGISTER_SIZE. * defs.h (copy_integer_to_size): New declaration. * findvar.c (copy_integer_to_size): New function. (do_cint_test): New selftest function. (copy_integer_to_size_test): Likewise. (_initialize_findvar): Likewise. * mips-fbsd-tdep.c (mips_fbsd_supply_reg): Use raw_supply_integer. (mips_fbsd_collect_reg): Use raw_collect_integer. * mips-linux-tdep.c (supply_32bit_reg): Use raw_supply_integer. (mips64_fill_gregset): Use raw_collect_integer (mips64_fill_fpregset): Use raw_supply_integer. * regcache.c (regcache::raw_supply_integer): New function. (regcache::raw_collect_integer): Likewise. * regcache.h: (regcache::raw_supply_integer): New declaration. (regcache::raw_collect_integer): Likewise.
2017-05-24Add unit test to gdbarch methods register_to_value and value_to_registerYao Qi6-0/+205
This patch adds one unit test for gdbarch methods register_to_value and value_to_register. The test pass different combinations of {regnu, type} to gdbarch_register_to_value and gdbarch_value_to_register. In order to do the test, add a new function create_new_frame to create a fake frame. It can be improved after we converted frame_info to class. In order to isolate regcache (from target_ops operations on writing registers, like target_store_registers), the sub-class of regcache in the test override raw_write. Also, in order to get the right regcache from get_thread_arch_aspace_regcache, the sub-class of regcache inserts itself to current_regcache. Suppose I incorrectly modified the size of buffer as below, @@ -1228,7 +1228,7 @@ ia64_register_to_value (struct frame_info *frame, int regnum, int *optimizedp, int *unavailablep) { struct gdbarch *gdbarch = get_frame_arch (frame); - gdb_byte in[MAX_REGISTER_SIZE]; + gdb_byte in[1]; /* Convert to TYPE. */ if (!get_frame_register_bytes (frame, regnum, 0, build GDB with "-fsanitize=address" and run unittest.exp, asan can detect such error ==2302==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff98193870 at pc 0xbd55ea bp 0x7fff981935a0 sp 0x7fff98193598 WRITE of size 16 at 0x7fff98193870 thread T0 #0 0xbd55e9 in frame_register_unwind(frame_info*, int, int*, int*, lval_type*, unsigned long*, int*, unsigned char*) /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1119 #1 0xbd58c8 in frame_register(frame_info*, int, int*, int*, lval_type*, unsigned long*, int*, unsigned char*) /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1147 #2 0xbd6e25 in get_frame_register_bytes(frame_info*, int, unsigned long, int, unsigned char*, int*, int*) /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1427 #3 0x70080a in ia64_register_to_value /home/yao/SourceCode/gnu/gdb/git/gdb/ia64-tdep.c:1236 #4 0xbf570e in gdbarch_register_to_value(gdbarch*, frame_info*, int, type*, unsigned char*, int*, int*) /home/yao/SourceCode/gnu/gdb/git/gdb/gdbarch.c:2619 #5 0xc05975 in register_to_value_test /home/yao/SourceCode/gnu/gdb/git/gdb/gdbarch-selftests.c:131 Or, even if GDB is not built with asan, GDB just crashes. *** stack smashing detected ***: ./gdb terminated Aborted (core dumped) gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * Makefile.in (SFILES): Add gdbarch-selftests.c. (COMMON_OBS): Add gdbarch-selftests.o. * frame.c [GDB_SELF_TESTS] (create_new_frame): New function. * frame.h [GDB_SELF_TESTS] (create_new_frame): Declare. * gdbarch-selftests.c: New file. * regcache.h (regcache) <~regcache>: Mark it virtual if GDB_SELF_TEST. <raw_write>: Likewise.
2017-05-24Move current_regcache to regcache::current_regcacheYao Qi3-24/+52
This patches moves global variable current_regcache to a class regcache static variable (protected) so that the unit test I add in the following patch can access it (by means of extending class regcache in unit test). gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * regcache.c (current_regcache): Change it to regcache::current_regcache. (regcache_observer_target_changed): Update. (regcache_thread_ptid_changed): Make it a regcache static method. (regcache_thread_ptid_changed): Update. (class regcache_access): New. (current_regcache_test): Update. (_initialize_regcache): Update. * regcache.h: Include forward_list. (regcache): Declare regcache_thread_ptid_changed and declare registers_changed_ptid as friend.
2017-05-24Get register contents by register_size instead of TYPE_LENGTHYao Qi3-2/+11
We should use register_size to get register contents instead of TYPE_LENGTH. gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * i387-tdep.c (i387_register_to_value): Use register_size instead of TYPE_LENGTH. * m68k-tdep.c (m68k_register_to_value): Likewise.
2017-05-24Restrict i387_convert_register_pYao Qi2-2/+8
gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * i387-tdep.c (i387_convert_register_p): Return false if type code isn't TYPE_CODE_FLT.
2017-05-24Restrict alpha_convert_register_pYao Qi2-18/+16
This patch restricts alpha_convert_register_p from "TYPE_LENGTH (type) != 8" to "TYPE_LENGTH (type) == 4", because, - we have check "TYPE_LENGTH (valtype) == 4" in alpha_register_to_value and alpha_value_to_register, - alpha lds and sts instruction access 4 bytes, - comments "It might need to convert the [float] register into the corresponding [integer] type (see Alpha)" and integer is 4-byte on alpha, I think it is the right restrict condition to "TYPE_LENGTH (valtype) == 4". gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * alpha-tdep.c (alpha_convert_register_p): Return true if type length is 4. (alpha_register_to_value): Remove type length check. (alpha_value_to_register): Likewise.
2017-05-24Restrict ia64_convert_register_pYao Qi2-0/+6
gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * ia64-tdep.c (ia64_convert_register_p): Check type's code is TYPE_CODE_FLT.
2017-05-24Restrict m68k_convert_register_pYao Qi2-12/+9
We need to convert register if the type is float. Suppose we get a value from float point register, but its type is integer, we don't have to convert. This case may not exist in real code, but exist in my unit test case. warning: Cannot convert floating-point register value to non-floating-point type. Self test failed: arch m68k: self-test failed at gdb/git/gdb/findvar.c:1072 ok = gdbarch_register_to_value (gdbarch, frame, regnum, type, buf.data (), &optim, &unavail); 1072: SELF_CHECK (ok); gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * m68k-tdep.c (m68k_convert_register_p): Check type's code is TYPE_CODE_FLT or not.
2017-05-24Use XCNEW gdbarch_tdepYao Qi17-16/+35
This patch uses XCNEW gdbarch_tdep instead of XNEW. gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * alpha-tdep.c (alpha_gdbarch_init): Use XCNEW instead of XNEW. * avr-tdep.c (avr_gdbarch_init): Likewise. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * cris-tdep.c (cris_gdbarch_init): Likewise. * ft32-tdep.c (ft32_gdbarch_init): Likewise. * lm32-tdep.c (lm32_gdbarch_init): Likewise. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * m68hc11-tdep.c (m68hc11_gdbarch_init): Likewise. * mep-tdep.c (mep_gdbarch_init): Likewise. * microblaze-tdep.c (microblaze_gdbarch_init): Likewise. * mips-tdep.c (mips_gdbarch_init): Likewise. * mn10300-tdep.c (mn10300_gdbarch_init): Likewise. * moxie-tdep.c (moxie_gdbarch_init): Likewise. * msp430-tdep.c (msp430_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * v850-tdep.c (v850_gdbarch_init): Likewise.
2017-05-24Clear GDB internal state after each unit testYao Qi3-0/+14
GDB has some global variables, like sentinel_frame, current_thread_arch, and etc, we need to reset them after each unit tests. gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * selftest-arch.c (tests_with_arch): Call registers_changed and reinit_frame_cache. * selftest.c (run_self_tests): Likewise.
2017-05-24Use disassemble.c:disassembler select rs6000 disassemblerYao Qi2-14/+5
Nowadays, rs6000 disassembler is selected in different ways in opcodes and gdb, opcodes: case bfd_arch_rs6000: if (mach == bfd_mach_ppc_620) disassemble = print_insn_big_powerpc; else disassemble = print_insn_rs6000; break; gdb: if (arch == bfd_arch_rs6000) set_gdbarch_print_insn (gdbarch, print_insn_rs6000); else set_gdbarch_print_insn (gdbarch, gdb_print_insn_powerpc); I am not sure which one is the right one. However, such selection should be done in one place instead of two. gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * rs6000-tdep.c (gdb_print_insn_powerpc): Remove. (rs6000_gdbarch_init): Don't call set_gdbarch_print_insn.
2017-05-24Use disassemble.c:disassembler select rl78 disassemblerYao Qi2-3/+5
This patch changes rl78 to let disassble.c:disassembler select disassembler. rl78_get_disassembler doesn't handle the case that abfd is NULL, so this patch also fix it. gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * rl78-tdep.c (rl78_gdbarch_init): Don't call set_gdbarch_print_insn. opcodes: 2017-05-24 Yao Qi <yao.qi@linaro.org> * rl78-dis.c (rl78_get_disassembler): If parameter abfd is NULL, set cpu to E_FLAG_RL78_ANY_CPU.
2017-05-24Use disassemble.c:disassembler select h8300 disassemblerYao Qi2-4/+5
opcodes/disassble.c:disassembler select h8300 disassembler like this, if (mach == bfd_mach_h8300h || mach == bfd_mach_h8300hn) disassemble = print_insn_h8300h; else if (mach == bfd_mach_h8300s || mach == bfd_mach_h8300sn || mach == bfd_mach_h8300sx || mach == bfd_mach_h8300sxn) disassemble = print_insn_h8300s; else disassemble = print_insn_h8300; which is the same as what gdb/h8300-tdpe.c does, switch (info.bfd_arch_info->mach) { case bfd_mach_h8300: ... set_gdbarch_print_insn (gdbarch, print_insn_h8300); case bfd_mach_h8300h: case bfd_mach_h8300hn: ... set_gdbarch_print_insn (gdbarch, print_insn_h8300h); case bfd_mach_h8300s: case bfd_mach_h8300sn: ... set_gdbarch_print_insn (gdbarch, print_insn_h8300s); so we can leave disassble.c:disassembler doing the selection. gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * h8300-tdep.c (h8300_gdbarch_init): Don't call set_gdbarch_print_insn.
2017-05-24Delegate opcodes to select disassembler in GDBYao Qi39-124/+73
This patch changes GDB to use disassembler selected by opcodes in default, so that we don't have to duplicate the selection logic again in GDB side. For example, gdb/score-tdep.c has static int score_print_insn (bfd_vma memaddr, struct disassemble_info *info) { if (info->endian == BFD_ENDIAN_BIG) return print_insn_big_score (memaddr, info); else return print_insn_little_score (memaddr, info); } and opcodes/disassemble.c has the same logic, case bfd_arch_score: if (big) disassemble = print_insn_big_score; else disassemble = print_insn_little_score; This patch removes the logic in GDB and calls opcodes/disassemble.c:disassembler in default to select disassembler. gdb: 2017-05-24 Yao Qi <yao.qi@linaro.org> * alpha-tdep.c (alpha_gdbarch_init): Don't call set_gdbarch_print_insn. * arc-tdep.c (arc_gdbarch_init): Likewise. * arch-utils.c: include dis-asm.h. (default_print_insn): New function. * arch-utils.h (default_print_insn): Declare. * avr-tdep.c (avr_gdbarch_init): Don't call set_gdbarch_print_insn. * bfin-tdep.c (bfin_gdbarch_init): Likewise. * cris-tdep.c (cris_delayed_get_disassembler): Remove. (cris_gdbarch_init): Don't call set_gdbarch_print_insn. * frv-tdep.c (frv_gdbarch_init): Likewise. * ft32-tdep.c (ft32_gdbarch_init): Likewise. * gdbarch.sh (print_insn): Use default_print_insn. * gdbarch.c: Regenerated. * hppa-tdep.c (hppa_gdbarch_init): Likewise. * iq2000-tdep.c (iq2000_gdbarch_init): Likewise. * lm32-tdep.c (lm32_gdbarch_init): Likewise. * m32c-tdep.c (m32c_gdbarch_init): Likewise. * m32r-tdep.c (m32r_gdbarch_init): Likewise. * m68hc11-tdep.c (gdb_print_insn_m68hc11): Remove. (m68hc11_gdbarch_init): Don't call set_gdbarch_print_insn. * m68k-tdep.c (m68k_gdbarch_init): Likewise. * m88k-tdep.c (m88k_gdbarch_init): Likewise. * microblaze-tdep.c (microblaze_gdbarch_init): Likewise. * mn10300-tdep.c (mn10300_gdbarch_init): Likewise. * moxie-tdep.c (moxie_gdbarch_init): Likewise. * msp430-tdep.c (msp430_gdbarch_init): Likewise. * mt-tdep.c (mt_gdbarch_init): Likewise. * nds32-tdep.c (nds32_gdbarch_init): Likewise. * nios2-tdep.c (nios2_print_insn): Remove. (nios2_gdbarch_init): Don't call set_gdbarch_print_insn. * rx-tdep.c (rx_gdbarch_init): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * score-tdep.c (score_print_insn): Remove. (score_gdbarch_init): Don't call set_gdbarch_print_insn. * sh-tdep.c (sh_gdbarch_init): Likewise. * sh64-tdep.c (sh64_gdbarch_init): Likewise. * sparc-tdep.c (sparc32_gdbarch_init): Likewise. * tic6x-tdep.c (tic6x_print_insn): Remove. (tic6x_gdbarch_init): Don't call set_gdbarch_print_insn. * tilegx-tdep.c (tilegx_gdbarch_init): Likewise. * v850-tdep.c (v850_gdbarch_init): Likewise. * vax-tdep.c (vax_gdbarch_init): Likewise. * xstormy16-tdep.c (xstormy16_gdbarch_init): Likewise. * xtensa-tdep.c (xtensa_gdbarch_init): Likewise.
2017-05-23Use mips_regnum instead of constants for FreeBSD/mips register operations.John Baldwin2-13/+26
gdb/ChangeLog: * mips-fbsd-tdep.c (MIPS_PC_REGNUM): Remove. (MIPS_FP0_REGNUM): Remove. (MIPS_FSR_REGNUM): Remove. (mips_fbsd_supply_fpregs): Use mips_regnum. (mips_fbsd_supply_gregs): Likewise. (mips_fbsd_collect_fpregs): Likewise. (mips_fbsd_collect_gregs): Likewise.
2017-05-23Cleanups to FreeBSD/mips native register operations.John Baldwin2-11/+21
Compare against the "raw" PC register number instead of the cooked register number when determining if a register was handled by PT_GETREGS. Previously the register fetch/store operations only tried PT_GETREGS to fetch any individual register. The result was that fetching or storing an individual register not covered by PT_GETREGS (such as floating point registers) did not work. While here, remove an early exit to simplify the code flow from the PT_GETREGS / PT_SETREGS case, and add a getfpregs_supplies similar to getregs_supplies to describe the registers supplied by PT_GETFPREGS and PT_SETFPREGS. gdb/ChangeLog: * mips-fbsd-nat.c (getregs_supplies): Fix upper bound comparison. (getpfpregs_supplies): New function. (mips_fbsd_fetch_inferior_registers): Remove early exit and use getfpregs_supplies. (mips_fbsd_store_inferior_registers): Likewise.
2017-05-22gdb: Document vMustReplyEmpty remote packetAndrew Burgess2-0/+17
Add mention of the vMustReplyEmpty to the remote serial protocol documentation. It is important that this packet be treated in the same fashion as any other unknown 'v' packet, and I have tried to reflect this in the description of the packet, it is not simply the case that we _must_ return the empty string for this packet. As the intention is that we should treat this packet as unknown then an argument could be made that we should not document it, however, for someone implementing a gdbserver from scratch, seeing an undocumented packet arrive from gdb is confusing, and will probably cause them to have to read the code in order to check how this packet should be handled, which is not ideal. gdb/doc/ChangeLog: * gdb.texinfo (Packets): Document vMustReplyEmpty packet.
2017-05-22gdb: Add John Baldwin as FreeBSD MaintainerPedro Alves2-0/+6
gdb/ChangeLog: 2017-05-22 Pedro Alves <palves@redhat.com> * MAINTAINERS (Host/Native): Add John Baldwin as FreeBSD maintainer.
2017-05-22Add PPC_MAX_REGISTER_SIZEAlan Hayward8-29/+50
gdb/ * ppc-linux-nat.c (fetch_register): Use PPC_MAX_REGISTER_SIZE. (store_register): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Likewise. (get_decimal_float_return_value): Likewise. (do_ppc_sysv_return_value): Likewise. (ppc64_sysv_abi_push_integer): Likewise. (ppc64_sysv_abi_push_freg): Likewise. (ppc64_sysv_abi_return_value_base): Likewise. (ppc64_sysv_abi_return_value): Likewise. * rs6000-aix-tdep.c (rs6000_push_dummy_call): Likewise. * rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise. * rs6000-nat.c: Likewise. * rs6000-tdep.c (rs6000_register_to_value): Likewise. (rs6000_value_to_register): Likewise. * ppc-tdep.h (PPC_MAX_REGISTER_SIZE): Add.
2017-05-21Print Rust unsized array types a bit more nicelyTom Tromey5-3/+82
It's a bit difficult to create an unsized array type in Rust, but if you do, right now ptype will show something like "[u8; ]". It really should print "[u8]", though, which is what this patch implements. This is part of PR 21466. Built and regtested on x86-64 Fedora 25. I'm checking this in. ChangeLog 2017-05-21 Tom Tromey <tom@tromey.com> PR rust/21466: * rust-lang.c (rust_print_type) <TYPE_CODE_ARRAY>: Print unsized arrays as "[T]", not "[T; ]". testsuite/ChangeLog 2017-05-21 Tom Tromey <tom@tromey.com> PR rust/21466: * gdb.rust/unsized.exp: New file. * gdb.rust/unsized.rs: New file.
2017-05-19Use watchpoint's language when re-parsing expressionTom Tromey18-9/+142
PR rust/21484 notes that watch -location does not work with Rust: (gdb) watch -location a syntax error in expression, near `) 0x00007fffffffe0f4'. update_watchpoint tries to tell gdb that the new expression it creates has C syntax: /* The above expression is in C. */ b->language = language_c; However, update_watchpoint doesn't actually use this language when re-parsing the expression. Originally I was going to fix this by saving and restoring the language in update_watchpoint, but this regressed gdb.dlang/watch-loc.exp, because the constructed expression actually has D syntax (specifically the name is not parseable by C). Next I looked at directly constructing an expression, and not relying on the parser at all; but it seemed to me that upon a re-set, we'd want to reparse the type, and there is no existing API to do this correctly. So, in the end I made a hook to let each language choose what expression to use. I made all the languages other than Rust use the C expression, because that is the status quo ante. However, this is probably not truly correct. After this patch, at least, it is easy to correct by someone who knows the language(s) in question. Regtested by the buildbot. ChangeLog 2017-05-19 Tom Tromey <tom@tromey.com> PR rust/21484: * rust-lang.c (exp_descriptor_rust): New function. (rust_language_defn): Use it. * p-lang.c (pascal_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * language.h (struct language_defn) <la_watch_location_expression>: New member. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * go-lang.c (go_language_defn): Update. * f-lang.c (f_language_defn): Update. * d-lang.c (d_language_defn): Update. * c-lang.h (c_watch_location_expression): Declare. * c-lang.c (c_watch_location_expression): New function. (c_language_defn, cplus_language_defn, asm_language_defn) (minimal_language_defn): Use it. * breakpoint.c (watch_command_1): Call la_watch_location_expression. * ada-lang.c (ada_language_defn): Update. testsuite/ChangeLog 2017-05-19 Tom Tromey <tom@tromey.com> PR rust/21484: * gdb.rust/watch.exp: New file. * gdb.rust/watch.rs: New file.
2017-05-19Fix tui compilation with Solaris libcurses: clear define (PR tui/21482)Rainer Orth2-0/+14
On both mainline and the 8.0 branch, gdb compilation fails on Solaris 10 with the native libcurses like this: In file included from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/gdb_curses.h:42: 0, from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-data.h:2 6, from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c :31: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c: In function `CORE_A DDR tui_disassemble(gdbarch*, tui_asm_line*, CORE_ADDR, int)': /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c:71:19: error: `class string_file' has no member named `wclear'; did you mean `clear'? gdb_dis_out.clear (); ^ /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-disasm.c:78:19: error: `class string_file' has no member named `wclear'; did you mean `clear'? gdb_dis_out.clear (); ^ make[2]: *** [Makefile:1927: tui-disasm.o] Error 1 It turned out this happens because <curses.h> has #define clear() wclear(stdscr) This can be avoided by defining NOMACROS, which the patch below does. ncurses potentially has a similar problem, which can be avoided by defining NCURSES_NOMACROS. PR tui/21482 * gdb_curses.h (NOMACROS): Define. (NCURSES_NOMACROS): Define.
2017-05-19Fix tui compilation with Solaris libcurses: non-const last arg to mvwaddstr ↵Rainer Orth4-5/+15
(PR tui/21482) On both mainline and the 8.0 branch, gdb compilation fails on Solaris 10 with the native libcurses in gdb/tui for several instances of the same problem: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c: In function `void tui_erase_source_content(tui_win_info*, int)': /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c:257:18: error: invalid conversion from `const char*' to `char*' [-fpermissive] no_src_str); ^ In file included from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/gdb_curses.h:42:0, from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-data.h:26, from /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/tui/tui-winsource.c:33: /vol/gcc-7/lib/gcc/sparc-sun-solaris2.10/7.1.0/include-fixed/curses.h:699:12: note: initializing argument 4 of `int mvwaddstr(WINDOW*, int, int, char*)' extern int mvwaddstr(WINDOW *, int, int, char *); ^~~~~~~~~ make[2]: *** [Makefile:1927: tui-winsource.o] Error 1 Unlike ncurses, <curses.h> declares extern int mvwaddstr(WINDOW *, int, int, char *); i.e. the last arg is char *, not const char *. The patch fixes this by casting the last arg to mvwaddstr to char *, as was recently done on mainline in a newterm() call (the only difference between 8.0 and mainline gdb/tui). * tui/tui-windata.c (tui_erase_data_content): Cast last mvwaddstr arg to char *. * tui/tui-wingeneral.c (box_win): Likewise. * tui/tui-winsource.c (tui_erase_source_content): Likewise. (tui_show_source_line): Likewise. (tui_show_exec_info_content): Likewise.
2017-05-19gdb: fix TYPE_CODE_ARRAY handling in sparc targetsVladimir Mezentsev3-19/+105
gdb has a special type (TYPE_CODE_ARRAY) to support the gcc extension (https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html). TYPE_CODE_ARRAY is handled incorrectly for both (32- and 64-bit) modes on Sparc machines. Tested on sparc64-linux-gnu and sparc-solaris (32- and 64-bit mode). 6 tests ( from gdb/testsuite/gdb.base/gnu_vector.exp) failed on sparc64-Linux and on sparc-Solaris in 32- and 64-bit mode. Now all these tests passed. gdb/testsuite/gdb.base/gnu_vector.exp has 117 different cases for small (and not small) arrays and structures. No regressions. gdb/ChangeLog: 2017-05-19 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> * sparc-tdep.c (sparc_structure_return_p) (sparc_arg_on_registers_p): New functions. (sparc32_store_arguments): Use them. * sparc64-tdep.c (sparc64_16_byte_align_p) (sparc64_store_floating_fields, sparc64_extract_floating_fields): Handle TYPE_CODE_ARRAY.
2017-05-18Fix test failure with Rust 1.18 and 1.19Tom Tromey2-4/+8
With Rust 1.18 and 1.19, I saw some test suite failures. They were all of the same form -- Box seems to be qualified in the output now, like: print box_some $64 = core::option::Option<alloc::boxed::Box<u8>>::Some(0x7ffff6c21018 "\001\000") ... where the test was expecting Option<Box<u8>>. This patch fixes the problem in a way that should work with earlier versions of Rust. gdb/testsuite/ChangeLog 2017-05-18 Tom Tromey <tom@tromey.com> * gdb.rust/simple.exp: Allow Box to be qualified.
2017-05-18Expect prompt after no FPU warningThomas Preud'homme2-5/+9
2017-05-18 Thomas Preud'homme <thomas.preudhomme@arm.com> gdb/testsuite/ * gdb.base/float.exp: Expect GDB prompt for targets without FPU.
2017-05-18gdb.base/fileio.c: Fix several -Wmaybe-uninitialized warningsPedro Alves2-5/+10
src/gdb/testsuite/gdb.base/fileio.c: In function ‘test_write’: src/gdb/testsuite/gdb.base/fileio.c:158:5: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized] printf ("write 1: ret = %d, errno = %d\n", ret, errno); ^ gdb/ChangeLog: 2017-05-18 Pedro Alves <palves@redhat.com> * gdb.base/fileio.c (test_write, test_read, test_close) (test_fstat): Don't print 'ret' in the fail path.
2017-05-18gdb.base/fileio.c: Fix several -Wreturn-type warningsPedro Alves3-26/+34
All the "test_" functions warn like: src/gdb/testsuite/gdb.base/fileio.c: In function ‘test_close’: src/gdb/testsuite/gdb.base/fileio.c:280:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ Nothing looks at the return of these functions, so just make them return void. While at it, "()" is not the same as "(void)" in C - fix that too. gdb/ChangeLog: 2017-05-18 Pedro Alves <palves@redhat.com> * gdb.base/fileio.c (stop, test_open, test_write, test_read) (test_lseek, test_close, test_stat, test_fstat, test_isatty) (test_system, test_rename, test_unlink, test_time): Change prototypes. * gdb.base/fileio.exp (stop_msg): Adjust.
2017-05-18gdb.base/fileio.exp: Remove nowarningsPedro Alves3-2/+12
... and quiet -Wnonnull in a different way. gdb/testsuite/ChangeLog: 2017-05-18 Pedro Alves <palves@redhat.com> * gdb.base/fileio.c (null_str): New global. (test_stat): Use it. * gdb.base/fileio.exp: Remove nowarnings.
2017-05-17Add nowarnings in gdb.base/fileio.expYao Qi2-1/+5
I see the following warning in gdb.base/fileio.c, testsuite/gdb.base/fileio.c:297:3: warning: null argument where non-null required (argument 1) [-Wnonnull] ret = stat (NULL, &st); ^ This patch adds "nowarnings" to the list passed to gdb_compile. gdb/testsuite: 2017-05-17 Yao Qi <yao.qi@linaro.org> * gdb.base/fileio.exp: Pass nowarnings to gdb_compile.
2017-05-17Add alias command to cmd_list_elementYao Qi6-15/+48
When we add alias command, we call add_alias_cmd and pass the alias name and command name. This implicitly requires the command and its prefix commands are already added to cmdlist. This may not be true, for example, add_com_alias ("tty", "set inferior-tty", class_alias, 0); "inferior-tty" command is added to setlist, but setlist may not be added to cmdlist (It depends on the order of related _initialize_XXX functions called) so that we can't find "set inferior-tty" from cmdlist. This patch fixes this problem by passing cmd_list_element of "inferior-tty" to add_alias_cmd, so that cmd_list_element of "inferior-tty" doesn't have to be reachable from cmdlist at that moment. gdb: 2017-05-17 Yao Qi <yao.qi@linaro.org> * cli/cli-decode.c (add_alias_cmd): New function. * command.h (add_alias_cmd): Declare. * infcmd.c (_initialize_infcmd): Don't call add_com_alias, instead call add_alias_cmd. gdb/testsuite: 2017-05-17 Simon Marchi <simon.marchi@ericsson.com> * gdb.base/set-inferior-tty.exp (test_set_inferior_tty): Add argument command. (top-level): Invoke test_set_inferior_tty.
2017-05-17nat_extra_makefile_frag -> nat_makefile_fragPedro Alves5-10/+19
gdb/ChangeLog: 2017-05-17 Pedro Alves <palves@redhat.com> * Makefile.in (nat_extra_makefile_frag): Rename to ... (nat_makefile_frag): ... this. All references updated. * configure.ac: Likewise. * configure.nat: Likewise. Enhance comments. * configure: Regenerate.
2017-05-15Fix gdb procfs.c compilation on SolarisRainer Orth2-2/+7
Prompted by the creation of the gdb 8.0 branch, I tried to build it on x86_64-pc-solaris2.12, but failed: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c: In function `target_ops* procfs_target()': /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:186:27: error: invalid conversion from `void (*)(target_ops*, char*, char*, char**, int)' to `void (*)(target_ops*, const char*, const string&, char**, int) {aka void (*)(target_ops*, const char*, const std::__cxx11::basic_string<char>&, char**, int)}' [-fpermissive] t->to_create_inferior = procfs_create_inferior; ^~~~~~~~~~~~~~~~~~~~~~ /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c: At global scope: /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:125:13: warning: `void procfs_create_inferior(target_ops*, char*, char*, char**, int)' declared `static' but never defined [-Wunused-function] static void procfs_create_inferior (struct target_ops *, char *, ^~~~~~~~~~~~~~~~~~~~~~ /vol/src/gnu/gdb/gdb-8.0-branch/local/gdb/procfs.c:4529:1: warning: `void procfs_create_inferior(target_ops*, const char*, const string&, char**, int)' defined but not used [-Wunused-function] procfs_create_inferior (struct target_ops *ops, const char *exec_file, ^~~~~~~~~~~~~~~~~~~~~~ This can easily be fixed by the following patch. * procfs.c (procfs_create_inferior): Change prototype to match definition.
2017-05-13Avoid compiler warning in MinGW buildEli Zaretskii2-1/+6
gdb: 2017-05-13 Eli Zaretskii <eliz@gnu.org> * tui/tui.c (tui_enable): Cast "unknown" to 'char *' to avoid a C++ compiler warning.
2017-05-12Avoid exponential behavior in rust_evaluate_subexpTom Tromey2-8/+13
The STRUCTOP_STRUCT case in rust_evaluate_subexp would evaluate its LHS, and then, if it did not need Rust-specific treatment, it would back up and re-evaluate the entire STRUCTOP_STRUCT part of the expression using evaluate_subexp_standard. This yields exponential behavior and causes some expressions to evaluate extremely slowly. The fix is to simply do the needed work inline. This is PR rust/21483. ChangeLog 2017-05-12 Tom Tromey <tom@tromey.com> PR rust/21483: * rust-lang.c (rust_evaluate_subexp) <STRUCTOP_STRUCT>: Don't recurse, just call value_struct_elt directly.
2017-05-12Fix rust_dump_subexp_bodyTom Tromey2-2/+8
rust_dump_subexp_body was not correct in a couple of cases. While debugging the bug I was really interested in, this caused a crash. This patch fixes the problems. No test case because, IIRC there generally aren't tests for expression dumping. ChangeLog 2017-05-12 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_dump_subexp_body) <STRUCTOP_ANONYMOUS, OP_RUST_ARRAY>: Fix.
2017-05-12Replace "return" with "break"Tom Tromey2-1/+5
This replaces a "return" with a "break" in rust_print_subexp, for consistency. ChangeLog 2017-05-12 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_print_subexp): Replace "return" with "break".
2017-05-09Use std::forward_list for current_regcacheYao Qi2-45/+32
gdb: 2017-05-09 Yao Qi <yao.qi@linaro.org> * regcache.c: Include <forward_list>. (struct regcache_list): Remove. (current_regcache): Update. (get_thread_arch_aspace_regcache): Update for std::forward_list. (regcache_thread_ptid_changed): Likewise. (registers_changed_ptid): Likewise. (current_regcache_size): Likewise.
2017-05-09Add current_regcache unit testYao Qi2-1/+81
This patch adds a unit test to current_regcache, to make sure it is correctly updated by get_thread_arch_aspace_regcache and registers_changed_ptid. gdb: 2017-05-09 Yao Qi <yao.qi@linaro.org> * regcache.c [GDB_SELF_TEST]: Include selftest.h. (current_regcache_size): New function. (current_regcache_test): New function. (_initialize_regcache) [GDB_SELF_TEST]: Register the unit test.
2017-05-08Remove some uses of MAX_REGISTER_SIZE from mips-tdep.cAlan Hayward2-3/+11
gdb/ * mips-tdep.c (mips_o32_return_value): Remove unused buffer. (print_gp_register_row): Use get_frame_register_value.
2017-05-08Remove some uses of MAX_REGISTER_SIZE from mips-linux-tdep.cAlan Hayward2-14/+10
gdb/ * mips-linux-tdep.c (mips_supply_gregset): Use raw_supply_zeroed. (mips_supply_fpregset): Likewise. (mips64_supply_gregset): Likewise.
2017-05-08Remove some uses of MAX_REGISTER_SIZE uses from mn10300-linux-tdep.cAlan Hayward2-12/+10
gdb/ * mn10300-linux-tdep.c (am33_supply_gregset_method): Use regcache->raw_supply_zeroed.