aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-05-07x86: Replace AddrPrefixOp0 with AddrPrefixOpRegH.J. Lu6-17/+35
This patch replaces AddrPrefixOp0 with AddrPrefixOpReg to indicate that the size of register operand is controlled by the address size prefix. This will be used by Intel MOVDIRI and MOVDIR64B instructions later. gas/ * config/tc-i386.c (process_suffix): Check addrprefixopreg instead of addrprefixop0. opcodes/ * i386-gen.c (opcode_modifiers): Replace AddrPrefixOp0 with AddrPrefixOpReg. * i386-opc.h (AddrPrefixOp0): Renamed to ... (AddrPrefixOpReg): This. (i386_opcode_modifier): Rename addrprefixop0 to addrprefixopreg. * i386-opc.tbl: Replace AddrPrefixOp0 with AddrPrefixOpReg.
2018-05-07Add -Wduplicated-condTom Tromey5-3/+15
This adds -Wduplicated-cond to warnings.m4. This caught one bug. I tried adding -Wduplicated-branches as well, but it results in some spurious failures from code like this in cgen.h: #define CGEN_ATTR_TYPE(n) \ struct { unsigned int bool_; \ CGEN_ATTR_VALUE_TYPE nonbool[(n) ? (n) : 1]; } This will trigger a warning if passed n==1, which seems like a perfectly valid thing to do; and there were other issues like this as well. ChangeLog 2018-05-07 Tom Tromey <tom@tromey.com> * configure: Rebuild. * warning.m4 (AM_GDB_WARNINGS): Add -Wduplicated-cond. gdbserver/ChangeLog 2018-05-07 Tom Tromey <tom@tromey.com> * configure: Rebuild.
2018-05-07Fix decoding of ARM VFP instructionsTom Tromey2-2/+9
-Wduplicated-cond pointed out that arm_record_vfp_data_proc_insn checks "opc1 == 0x0b" twice. I filed this a while ago as PR tdep/20362. Based on the ARM instruction manual at https://www.scss.tcd.ie/~waldroj/3d1/arm_arm.pdf, I think the instruction decoding in this function has two bugs. First, opc1 is computed as: opc1 = bits (arm_insn_r->arm_insn, 20, 23); [...] opc1 = opc1 & 0x04; This means that tests like: else if (opc1 == 0x01) can never be true. In the ARM manual, "opc1" corresponds to these bits: name bit r 20 q 21 D 22 p 23 ... where the D bit is not used for VFP instruction decoding. So, I believe this code should use ~0x04 instead. Second, VDIV is recognized by the bits "pqrs" being equal to "1000". This tranlates to opc1 == 0x08 -- not 0x0b. Note that pqrs==1001 is an undefined encoding, which is probably why opc2 is not checked here; this code doesn't seem to really deal with undefined encodings in general, so I've left that as is. I don't have an ARM machine or any reasonable way to test this. ChangeLog 2018-05-07 Tom Tromey <tom@tromey.com> PR tdep/20362: * arm-tdep.c (arm_record_vfp_data_proc_insn): Properly mask off D bit. Use correct value for VDIV.
2018-05-07Cleanup ppc code dealing with opcode dumps.Peter Bergner7-85/+82
include/ * opcode/ppc.h (powerpc_num_opcodes): Change type to unsigned. (vle_num_opcodes): Likewise. (spe2_num_opcodes): Likewise. opcodes/ * ppc-opc.c (powerpc_num_opcodes): Likewise. (vle_num_opcodes): Likewise. (spe2_num_opcodes): Likewise. * ppc-dis.c (disassemble_init_powerpc) <powerpc_opcd_indices>: Rewrite initialization loop. (disassemble_init_powerpc) <vle_opcd_indices>: Likewise. (disassemble_init_powerpc) <spe2_opcd_indices>: Likewise. Initialize only once. gas/ * config/tc-ppc.c (ppc_setup_opcodes) <powerpc_opcodes>: Rewrite code to dump the entire opcode table. (ppc_setup_opcodes) <spe2_opcodes>: Likewise. (ppc_setup_opcodes) <vle_opcodes>: Likewise. Fix calculation of opcode index.
2018-05-07Bug 23142, SIGSEGV in is_strip_sectionAlan Modra2-5/+10
PR 23142 * objcopy.c (group_signature): Don't accept groups that use a symbol table other than the one we've read.
2018-05-07Replace uses of strncmp with memcmpAlan Modra3-8/+18
Avoids gcc pr85623 for these calls. * cofflink.c (_bfd_coff_link_input_bfd): Use memcmp rather than strncmp when checking for ".bf" special symbol. * prXXigen.c (_bfd_XXi_swap_scnhdr_out): Make pe_required_section_flags section name a char array, remove sentinal known_sections entry, and adjust loop over known_sections to suit. Use memcmp rather than strncmp.
2018-05-06gas/i386/xmmhi32.d: Also allow dir32 relocationH.J. Lu2-42/+46
Also allow dir32 relocation to support mingw targets. * testsuite/gas/i386/xmmhi32.d: Also allow dir32 relocation.
2018-05-06i386: Append ".p2align 4,0" to gas testsH.J. Lu9-0/+23
Append ".p2align 4,0" to i386 assembler tests to support mingw targets. * testsuite/gas/i386/avx512f-plain.s: Append ".p2align 4,0". * testsuite/gas/i386/avx512vl-plain.s: Likewise. * testsuite/gas/i386/bnd.s: Likewise. * testsuite/gas/i386/stN.s: Likewise. * testsuite/gas/i386/avx512f-plain.l: Updated. * testsuite/gas/i386/avx512vl-plain.l: Likewise. * testsuite/gas/i386/bnd.l: Likewise. * testsuite/gas/i386/stN.l: Likewise.
2018-05-07Automatic date update in version.inGDB Administrator1-1/+1
2018-05-06Automatic date update in version.inGDB Administrator1-1/+1
2018-05-04Add -Wimplicit-fallthroughTom Tromey5-3/+15
This adds -Wimplicit-fallthrough to the set of default warnings. 2018-05-04 Tom Tromey <tom@tromey.com> * configure: Rebuild. * warning.m4 (AM_GDB_WARNINGS): Add -Wimplicit-fallthrough. gdbserver/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * configure: Rebuild.
2018-05-04Add a missing break in record_linux_system_callTom Tromey2-0/+6
This adds a "break" at the end of the RECORD_SYS_RECVFROM case in record_linux_system_call. This seemed correct to me. 2018-05-04 Tom Tromey <tom@tromey.com> * linux-record.c (record_linux_system_call) <case RECORD_SYS_RECVFROM>: Add "break".
2018-05-04Add missing "breaks"Tom Tromey3-0/+9
This adds a "break" to a couple of spots where it was erroneously omitted. I think these are the two (potential) real bugs caught by this series. 2018-05-04 Tom Tromey <tom@tromey.com> * mi/mi-main.c (mi_cmd_trace_frame_collected) <REGISTERS_FORMAT>: Add missing "break". * mi/mi-cmd-stack.c (mi_cmd_stack_list_locals) <NO_FRAME_FILTERS>: Add missing "break".
2018-05-04Add two fall-through comments in rs6000-tdep.cTom Tromey2-0/+7
This adds two fall-through comments in rs6000-tdep.c. I looked at the PPC instruction manual and convinced myself that this was correct. And, this isn't a semantic change. However, close review would still be good. 2018-05-04 Tom Tromey <tom@tromey.com> * rs6000-tdep.c (ppc_process_record_op4) (ppc_process_record_op63): Add fall-through comment.
2018-05-04Add fall-through comment to i386-tdep.cTom Tromey2-0/+5
This adds a fall-through comment in i386-tdep.c. I was not sure what to do here, so I elected to preserve the status quo. In review, John Baldwin pointed out that: "I believe this is correct based on the diff that added the special cases for xgetbv and xsetbv as previously ldgt and lidt were treated the same". gdb/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * i386-tdep.c (i386_process_record): Add fall-through comment.
2018-05-04Add a fall-through comment to stabsread.cTom Tromey2-0/+6
This adds a fall-through comment to stabsread.c. I skimmed the stabs manual a bit and it seems that 'p' and 'P' are similar enough that this makes sense. Also, stabs is mostly deprecated, and the code has been this way for a long time, so it seemed safest to keep the status quo. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * stabsread.c (define_symbol) <case 'p'>: Add fall-through comment.
2018-05-04Fix "obvious" fall-through warningsTom Tromey6-0/+16
This patch fixes the subset of -Wimplicit-fallthrough warnings that I considered obvious. In most cases it was obvious from context that falling through was desired; here I added the appropriate comment. In a couple of cases it seemed clear that a "break" was missing. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * riscv-tdep.c (riscv_isa_xlen): Add fall-through comment. * utils.c (can_dump_core) <LIMIT_CUR>: Add fall-through comment. * eval.c (fetch_subexp_value) <MEMORY_ERROR>: Add fall-through comment. * d-valprint.c (d_val_print) <TYPE_CODE_STRUCT>: Add fall-through comment. * coffread.c (coff_symtab_read) <C_LABEL>: Add fall-through comment.
2018-05-04Add missing ATTRIBUTE_NORETURNsTom Tromey2-1/+5
This patch adds a missing ATTRIBUTE_NORETURN. This lets -Wimplicit-fallthrough recognize that a given case does not fall through. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * dwarf2loc.c (unimplemented): Add ATTRIBUTE_NORETURN.
2018-05-04Fix "fall through" commentsTom Tromey21-24/+63
This patch updates existing "fall through" comments so that they can be recognized by gcc's -Wimplicit-fallthrough comment-parsing heuristic. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * s390-tdep.c (s390_process_record): Fix fall-through comments. * xcoffread.c (scan_xcoff_symtab): Move comment later. * symfile.c (section_is_mapped): Fix fall-through comment. * stabsread.c (define_symbol, read_member_functions): Fix fall-through comment. * s390-linux-tdep.c (s390_process_record): Fix fall-through comment. * remote.c (remote_wait_as): Fix fall-through comment. * p-exp.y (yylex): Fix fall-through comment. * nat/x86-dregs.c (x86_length_and_rw_bits): Fix fall-through comment. * msp430-tdep.c (msp430_gdbarch_init): Fix fall-through comment. * mdebugread.c (parse_partial_symbols): Fix fall-through comment. * jv-exp.y (yylex): Fix fall-through comment. * go-exp.y (lex_one_token): Fix fall-through comment. * gdbtypes.c (get_discrete_bounds, rank_one_type): Fix fall-through comment. * f-exp.y (yylex): Fix fall-through comment. * dwarf2read.c (process_die): Fix fall-through comments. * dbxread.c (process_one_symbol): Fix fall-through comment. * d-exp.y (lex_one_token): Fix fall-through comment. * cp-name-parser.y (yylex): Fix fall-through comment. * coffread.c (coff_symtab_read): Fix fall-through comment. * c-exp.y (lex_one_token): Fix fall-through comment. * arm-tdep.c (arm_decode_miscellaneous): Fix fall-through comment. * arch/arm.c (arm_instruction_changes_pc): Fix fall-through comment.
2018-05-05Automatic date update in version.inGDB Administrator1-1/+1
2018-05-04Let gdb.execute handle multi-line commandsTom Tromey8-32/+123
This changes the Python API so that gdb.execute can now handle multi-line commands, like "commands" or "define". ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22730: * NEWS: Mention gdb.execute change. * gdbcmd.h (execute_control_command): Don't declare. * python/python.c (execute_gdb_command): Use read_command_lines_1, execute_control_commands, execute_control_commands_to_string. * cli/cli-script.h (execute_control_commands) (execute_control_commands_to_string): Declare. (execute_control_command): Add from_tty parameter. * cli/cli-script.c (execute_control_commands) (execute_control_commands_to_string): New functions. (execute_user_command): Use execute_control_commands. (execute_control_command_1): Add "from_tty" parameter. Update. (execute_control_command): Likewise. testsuite/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22730: * gdb.python/python.exp: Test multi-line execute.
2018-05-04Allow breakpoint commands to be set from PythonTom Tromey7-3/+75
This changes the Python API so that breakpoint commands can be set by writing to the "commands" attribute. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22731: * NEWS: Mention that breakpoint commands are writable. * python/py-breakpoint.c (bppy_set_commands): New function. (breakpoint_object_getset) <"commands">: Use it. doc/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22731: * python.texi (Breakpoints In Python): Mention that "commands" is writable. testsuite/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR python/22731: * gdb.python/py-breakpoint.exp: Test setting breakpoint commands.
2018-05-04Use function_view in cli-script.cTom Tromey7-74/+79
This changes some functions in cli-script.c to use function_view rather than a function pointer and closure argument. This simplifies the code a bit and is useful in a subsequent patch. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * tracepoint.c (actions_command): Update. * mi/mi-cmd-break.c (mi_command_line_array) (mi_command_line_array_cnt, mi_command_line_array_ptr) (mi_read_next_line): Remove. (mi_cmd_break_commands): Update. * cli/cli-script.h (read_command_lines, read_command_lines_1): Use function_view. * cli/cli-script.c (get_command_line): Update. (process_next_line): Use function_view. Constify. (recurse_read_control_structure, read_command_lines) (read_command_lines_1): Change argument types to function_view. (do_define_command, document_command): Update. * breakpoint.h (check_tracepoint_command): Don't declare. * breakpoint.c (check_tracepoint_command): Remove. (commands_command_1, create_tracepoint_from_upload): Update.
2018-05-04Allow defining a user command inside a user commandTom Tromey6-12/+75
PR gdb/11750 concerns defining a command inside a user commnad, like: define outer define inner echo hi\n end end This patch adds this capability to gdb. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR gdb/11750: * cli/cli-script.h (enum command_control_type) <define_control>: New constant. * cli/cli-script.c (multi_line_command_p): Handle define_control. (build_command_line, execute_control_command_1) (process_next_line): Likewise. (do_define_command): New function, extracted from define_command. (define_command): Use it. testsuite/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR gdb/11750: * gdb.base/define.exp: Test defining a user command inside a user command. * gdb.base/commands.exp (define_if_without_arg_test): Test "define".
2018-05-04Constify prompt argument to read_command_linesTom Tromey5-15/+23
The prompt argument to read_command_lines can be const. This patch makes this change, and also removes some fixed-sized buffers in favor of using string_printf. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * tracepoint.c (actions_command): Update. * cli/cli-script.h (read_command_lines): Update. * cli/cli-script.c (read_command_lines): Constify prompt_arg. (MAX_TMPBUF): Remove define. (define_command): Use string_printf. (document_command): Likewise. * breakpoint.c (commands_command_1): Update.
2018-05-04Make print_command_trace varargsTom Tromey4-14/+21
I noticed some code in execute_control_command_1 that could be simplified by making print_command_trace a printf-like function. This patch makes this change. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * top.c (execute_command): Update. * cli/cli-script.h (print_command_lines): Now varargs. * cli/cli-script.c (print_command_lines): Now varargs. (execute_control_command_1) <case while_control, case if_control>: Update.
2018-05-04Use counted_command_line everywhereTom Tromey12-243/+183
Currently command lines are reference counted using shared_ptr only when attached to breakpoints. This patch changes gdb to use shared_ptr in commands as well. This allows for the removal of copy_command_lines. Note that the change to execute_user_command explicitly makes a new reference to the command line. This will be used in a later patch. This simplifies struct command_line based on the observation that a given command can have at most two child bodies: an "if" can have both "then" and "else" parts. Perhaps the names I've chosen for the replacements here are not very good -- your input requested. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * tracepoint.c (all_tracepoint_actions): Rename from all_tracepoint_actions_and_cleanup. Change return type. (actions_command, encode_actions_1, encode_actions) (trace_dump_actions, tdump_command): Update. * remote.c (remote_download_command_source): Update. * python/python.c (gdbpy_eval_from_control_command) (python_command, python_interactive_command): Update. * mi/mi-cmd-break.c (mi_cmd_break_commands): Update. * guile/guile.c (guile_command) (gdbscm_eval_from_control_command, guile_command): Update. * compile/compile.c (compile_code_command) (compile_print_command, compile_to_object): Update. * cli/cli-script.h (struct command_lines_deleter): New. (counted_command_line): New typedef. (struct command_line): Add constructor, destructor. <body_list>: Remove. <body_list_0, body_list_1>: New members. (command_line_up): Remove typedef. (read_command_lines, read_command_lines_1, get_command_line): Update. (copy_command_lines): Don't declare. * cli/cli-script.c (build_command_line): Use "new". (get_command_line): Return counted_command_line. (print_command_lines, execute_user_command) (execute_control_command_1, while_command, if_command): Update. (realloc_body_list): Remove. (process_next_line, recurse_read_control_structure): Update. (read_command_lines, read_command_lines_1): Return counted_command_line. (free_command_lines): Use "delete". (copy_command_lines): Remove. (define_command, document_command, show_user_1): Update. * cli/cli-decode.h (struct cmd_list_element) <user_commands>: Now a counted_command_line. * breakpoint.h (counted_command_line): Remove typedef. (breakpoint_set_commands): Update. * breakpoint.c (check_no_tracepoint_commands) (validate_commands_for_breakpoint): Update. (breakpoint_set_commands): Change commands to be a counted_command_line. (commands_command_1, update_dprintf_command_list) (create_tracepoint_from_upload): Update.
2018-05-04Allocate cmd_list_element with newTom Tromey3-55/+62
This adds a constructor and destructor to cmd_list_element and changes it to be allocated with new. This will be useful in a subsequent patch. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * cli/cli-decode.h (cmd_list_element): New constructor. (~cmd_list_element): New destructor. (struct cmd_list_element): Add initializers. * cli/cli-decode.c (do_add_cmd): Use "new". (delete_cmd): Use "delete".
2018-05-04aarch64: PR 19806: watchpoints: false negatives + PR 20207 contiguous onesJan Kratochvil14-128/+657
Some unaligned watchpoints were currently missed. On old kernels as specified in kernel RFE: aarch64: ptrace: BAS: Support any contiguous range (edit) https://sourceware.org/bugzilla/show_bug.cgi?id=20207 after this patch some other unaligned watchpoints will get reported as false positives. With new kernels all the watchpoints should work exactly. There may be a regresion that it now less merges watchpoints so that with multiple overlapping watchpoints it may run out of the 4 hardware watchpoint registers. But as discussed in the original thread GDB needs some generic watchpoints merging framework to be used by all the target specific code. Even current FSF GDB code does not merge it perfectly. Also with the more precise watchpoints one can technically merge them less. And I do not think it matters too much to improve mergeability only for old kernels. Still even on new kernels some better merging logic would make sense. There remains one issue: kernel-4.15.14-300.fc27.armv7hl FAIL: gdb.base/watchpoint-unaligned.exp: continue FAIL: gdb.base/watchpoint-unaligned.exp: continue (gdb) continue Continuing. Unexpected error setting watchpoint: Invalid argument. (gdb) FAIL: gdb.base/watchpoint-unaligned.exp: continue But that looks as a kernel bug to me. (1) It is not a regression by this patch. (2) It is unrelated to this patch. gdb/ChangeLog 2018-05-04 Jan Kratochvil <jan.kratochvil@redhat.com> Pedro Alves <palves@redhat.com> PR breakpoints/19806 and support for PR external/20207. * NEWS: Mention Aarch64 watchpoint improvements. * aarch64-linux-nat.c (aarch64_linux_stopped_data_address): Fix missed watchpoints and PR external/20207 watchpoints. * nat/aarch64-linux-hw-point.c (kernel_supports_any_contiguous_range): New. (aarch64_watchpoint_offset): New. (aarch64_watchpoint_length): Support PR external/20207 watchpoints. (aarch64_point_encode_ctrl_reg): New parameter offset, new asserts. (aarch64_point_is_aligned): Support PR external/20207 watchpoints. (aarch64_align_watchpoint): New parameters aligned_offset_p and next_addr_orig_p. Support PR external/20207 watchpoints. (aarch64_downgrade_regs): New. (aarch64_dr_state_insert_one_point): New parameters offset and addr_orig. (aarch64_dr_state_remove_one_point): Likewise. (aarch64_handle_breakpoint): Update caller. (aarch64_handle_aligned_watchpoint): Likewise. (aarch64_handle_unaligned_watchpoint): Support addr_orig and aligned_offset. (aarch64_linux_set_debug_regs): Remove const from state. Call aarch64_downgrade_regs. (aarch64_show_debug_reg_state): Print also dr_addr_orig_wp. * nat/aarch64-linux-hw-point.h (DR_CONTROL_LENGTH): Rename to ... (DR_CONTROL_MASK): ... this. (struct aarch64_debug_reg_state): New field dr_addr_orig_wp. (unsigned int aarch64_watchpoint_offset): New prototype. (aarch64_linux_set_debug_regs): Remove const from state. * utils.c (align_up, align_down): Move to ... * common/common-utils.c (align_up, align_down): ... here. * utils.h (align_up, align_down): Move to ... * common/common-utils.h (align_up, align_down): ... here. gdb/gdbserver/ChangeLog 2018-05-04 Jan Kratochvil <jan.kratochvil@redhat.com> Pedro Alves <palves@redhat.com> * linux-aarch64-low.c (aarch64_stopped_data_address): Likewise. gdb/testsuite/ChangeLog 2018-05-04 Jan Kratochvil <jan.kratochvil@redhat.com> Pedro Alves <palves@redhat.com> PR breakpoints/19806 and support for PR external/20207. * gdb.base/watchpoint-unaligned.c: New file. * gdb.base/watchpoint-unaligned.exp: New file.
2018-05-04gdb: Make test names unique in gdb.base/maint.expAndrew Burgess2-16/+15
Add prefixes or suffixes to some test names to make them unique. Replace a send_gdb/gdb_expect with a gdb_test, and make the test name unique. Remove test of 'help maint' as this is already covered by a later call to test_prefix_command_help. Removed test of 'help maint info' and add a new call to test_prefix_command_help instead. gdb/testsuite/ChangeLog: * gdb.base/maint.exp: Make test names unique, use test_prefix_command_help to test 'help maint info', and remove repeated test of 'help maint'.
2018-05-04(SPARC/LEON) fix incorrect array return value printed by "finish"Joel Brobecker2-24/+51
Consider the code in the gdb.ada/array_return.exp testcase, which defines a function returning an array of 2 integers: type Data_Small is array (1 .. 2) of Integer; function Create_Small return Data_Small; When doing a "finish" from inside function Create_Small, we expect GDB to tell us that the return value was "(1, 1)". However, it currently prints the wrong value: (gdb) finish Run till exit from #0 pck.create_small () at /[...]/pck.adb:5 p () at /[...]/p.adb:10 10 Large := Create_Large; Value returned is $1 = (0, 0) This is a regression which I traced back to the following commit... | commit 1933fd8ee01ad2e74a9c6341bc40f54962a8f889 | Date: Fri May 19 03:06:19 2017 -0700 | Subject: gdb: fix TYPE_CODE_ARRAY handling in sparc targets ... which, despite what the subject says, is not really about TYPE_CODE_ARRAY handling, which is a bit of an implementation detail, but about the GNU vectors extension. The author of the patch equated TYPE_CODE_ARRAY with vectors, which is not correct. Vectors are TYPE_CODE_ARRAY types with the TYPE_VECTOR flag set. So at the very minimum, the patch should have been checking for both TYPE_CODE_ARRAY and TYPE_VECTOR. But, that's not the only thing that did not seem right to me. When looking at the ABI, and at the summary of the implementation in GCC of the calling conventions for that architecture: size argument return value small integer <4 int. reg. int. reg. word 4 int. reg. int. reg. double word 8 int. reg. int. reg. _Complex small integer <8 int. reg. int. reg. _Complex word 8 int. reg. int. reg. _Complex double word 16 memory int. reg. vector integer <=8 int. reg. FP reg. vector integer >8 memory memory float 4 int. reg. FP reg. double 8 int. reg. FP reg. long double 16 memory memory _Complex float 8 memory FP reg. _Complex double 16 memory FP reg. _Complex long double 32 memory FP reg. vector float any memory memory aggregate any memory memory The nice thing about the patch above is that it nicely factorized the code that determines how arguments are passed/returns. The bad news is that the implementation, particularly for the handling of arrays and vectors, doesn't seem to match the summary above. Hence, the regression we observed. So what I did was review and re-implement some of the predicate functions according to the summary above. Because dejagnu crashes all our Solaris machines real bad, I can't run the dejagnu testsuite there. So what I did was test the patch with AdaCore's testsuite against leon3-elf, no regression. I verified that this fixes the regression above while at the same time still passing gdb.base/gnu_vector.exp (I transposed that testcase to our testsuite), which is the testcase that was cited in the commit above as seeing some FAIL->PASS improvements. This patch also removes one assertion... gdb_assert (sparc_integral_or_pointer_p (type) || (TYPE_CODE (type) == TYPE_CODE_ARRAY && len <= 8)); ... because that assertion is really the "negative" of the other conditions written in the same "if, else if, else [assert]" block in this function. To me, this assertion forces us to maintain two versions of the same code, and is an unnecessary burden. In particular, the above is not the correct condition, and the ABI summary table above shows that we need a more complex condition to describe the situations where we expect arguments to be passed by register. gdb/ChangeLog: * sparc-tdep.c (sparc_structure_return_p): Re-implement to match the ABI as summarized in GCC's gcc/config/sparc/sparc.c. (sparc_arg_by_memory_p): Renamed from sparc_arg_on_registers_p. Re-implement to match the ABI as summarized in GCC's gcc/config/sparc/sparc.c. All callers updated. (sparc32_store_arguments): Remove assertion.
2018-05-04Minor cleanups in printcmd.cTom Tromey2-7/+6
This changes decode_format to use skip_spaces, and changes printcmd.c not to include tui.h, which apparently is not needed. 2018-05-04 Tom Tromey <tom@tromey.com> * printcmd.c: Don't include tui.h. (decode_format): Use skip_spaces.
2018-05-04Use previous count when 'x' command is repeatedTom Tromey4-0/+28
About the 'x' command, the manual says: If you use <RET> to repeat the 'x' command, the repeat count N is used again; the other arguments default as for successive uses of 'x'. However, PR gdb/22619 points out that this does not work. This patch fixes the problem. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR gdb/22619: * printcmd.c (last_count): New global. (x_command): Use saved count when repeating. testsuite/ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> PR gdb/22619: * gdb.base/long_long.exp (gdb_test_long_long): Add test for repeat behavior.
2018-05-04Remove do_closedir_cleanupTom Tromey4-32/+31
This removes both copies of do_closedir_cleanup in favor of a new unique_ptr specialization. Tested by the buildbot, though I'm not sure that these code paths are exercised there. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * nto-procfs.c (do_closedir_cleanup): Remove. (procfs_pidlist): Use gdb_dir_up. * procfs.c (do_closedir_cleanup): Remove. (proc_update_threads): Use gdb_dir_up. * common/filestuff.h (struct gdb_dir_deleter): New. (gdb_dir_up): New typedef.
2018-05-04Remove cleanup from print_mention_exceptionTom Tromey2-5/+7
This removes a cleanup from print_mention_exception by using string_printf. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * ada-lang.c (print_mention_exception): Use std::string.
2018-05-04Return std::string from ada_exception_catchpoint_cond_stringTom Tromey2-22/+19
This changes ada_exception_catchpoint_cond_string to return a std::string, allowing for the removal of a cleanup in create_excep_cond_exprs. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * ada-lang.c (create_excep_cond_exprs): Update. (ada_exception_catchpoint_cond_string): Use std::string.
2018-05-04Remove cleanup from old_renaming_is_invisibleTom Tromey2-28/+12
This removes a cleanup from ada-lang.c by changing xget_renaming_scope to return a std::string. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * ada-lang.c (xget_renaming_scope): Return std::string. (old_renaming_is_invisible): Update.
2018-05-04Use gdb_bfd_ref_ptr in target_bfdTom Tromey2-4/+7
I noticed that target_bfd was using manual reference counting for the BFD it held. This patch changes it to use gdb_bfd_ref_ptr instead. Tested by the buildbot. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * bfd-target.c (target_bfd::m_bfd): Now a gdb_bfd_ref_ptr. (target_bfd::target_bfd, target_bfd::~target_bfd): Update.
2018-05-04[spu] Fix build breakUlrich Weigand2-2/+6
gdb/ChangeLog: 2018-05-04 Ulrich Weigand <uweigand@de.ibm.com> * spu-linux-nat.c (spu_linux_nat_target::wait): Fix syntax error.
2018-05-04Remove a cleanup from remote.cTom Tromey2-23/+24
This removes a cleanup from remote.c by using std::string to construct the qSupported packet. Tested by the buildbot. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * remote.c (remote_query_supported_append): Change type. (remote_check_symbols): Update.
2018-05-04gdb/testsuite: Handle targets with lots of registersAndrew Burgess2-2/+27
In gdb.base/maint.exp a test calls 'maint print registers'. If the target has lots of registers this may overflow expect's buffers, causing the test to fail. After this commit we process the output line at a time until we get back to the GDB prompt, this should prevent buffer overrun while still testing that the command works as required. gdb/testsuite/ChangeLog: * gdb.base/maint.exp: Process output from 'maint print registers' line at a time.
2018-05-04configure uses incorrect link order when testing libpythonPaul Pluzhnikov4-16/+22
References: https://stackoverflow.com/a/49868387 https://sourceware.org/bugzilla/show_bug.cgi?id=11420 Configure uses "gcc -o conftest -g ... conftest.c -ldl -lncurses -lm -ldl ... -lpthread ... -lpython2.7" when deciding whether give libpython is usable. That of course is the wrong link order, and only works for shared libraries (mostly by accident), and only on some systems. gdb/ChangeLog: PR gdb/11420 * configure.ac: Prepend libpython. * python/python-config.py: Likewise. * configure: Regenerate.
2018-05-04gdb/testsuite: Fix broken regexp in gdbstub caseAndrew Burgess2-1/+10
When $use_gdb_stub is true then, when we start an MI target there's a regexp to match GDB's startup pattern. Unfortunately the pattern is broken, and we're also missing a timeout case in the match list (which would have helped point out that the regexp was broken). The changes to the regexp are: 1. Remove '${run_match}' prefix, the issued command doesn't include '${run_prefix}' so expecting '${run_match}' is wrong. 2. Replaced '\\n' with '\\\\n' in order to match literal '\n' in GDBs output (that is, match a backslash followed by 'n', not a newline character). 3. Replaced a '.' (matching any character) with '\.' to match a '.' and moved the '\.' into the correct place in the regexp. 4. Replaced '\r\n' with '[\r\n]+' to match the end of a line. This change isn't esential, but matches the other end of line patterns within this regexp. Here's an example of the output that the regexp should match taken from a testfile log, the first line is the command sent to GDB, and the remaining lines are the response from GDB: jump *_start &"jump *_start\n" ~"Continuing at 0x10074.\n" ^running *running,thread-id="all" (gdb) gdb/testsuite/ChangeLog: * lib/mi-support.exp (mi_run_cmd_full): Fix regexp and add a timeout.
2018-05-04-Wstringop-truncation warningsAlan Modra17-62/+106
This patch is aimed at silencing gcc8 -Wstringop-truncation warnings. Unfortunately adding __attribute__ ((__nonstring)) doesn't work in a number of the places patched here, (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85643) so if you have recent glibc headers installed you'll need to configure binutils with --disable-werror to compile using gcc8 or gcc9. include/ * ansidecl.h: Import from gcc. * coff/internal.h (struct internal_scnhdr): Add ATTRIBUTE_NONSTRING to s_name. (struct internal_syment): Add ATTRIBUTE_NONSTRING to _n_name. bfd/ * elf-linux-core.h (struct elf_external_linux_prpsinfo32_ugid32), (struct elf_external_linux_prpsinfo32_ugid16), (struct elf_external_linux_prpsinfo64_ugid32), (struct elf_external_linux_prpsinfo64_ugid16): Add ATTRIBUTE_NONSTRING to pr_fname and pr_psargs fields. Remove GCC diagnostic pragmas. Move comment to.. * elf.c (elfcore_write_prpsinfo): ..here. Indent nested preprocessor directives. * elf32-arm.c (elf32_arm_nabi_write_core_note): Add ATTRIBUTE_NONSTRING to data. * elf32-ppc.c (ppc_elf_write_core_note): Likewise. * elf32-s390.c (elf_s390_write_core_note): Likewise. * elf64-s390.c (elf_s390_write_core_note): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_write_core_note): Likewise. * elf64-x86-64.c (elf_x86_64_write_core_note): Add GCC diagnostic pragmas. * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Use strnlen to avoid false positive gcc-8 warning. gas/ * config/obj-evax.c (shorten_identifier): Use memcpy in place of strncpy. * config/obj-macho.c (obj_mach_o_make_or_get_sect): Ensure segname and sectname fields are NUL terminated.
2018-05-04ppc: Fix warning messages when IBM and IEEE long double are mixedTulio Magno Quites Machado Filho2-2/+7
When IBM long double is used, the .gnu_attribute 4 is set to 1 | (1 * 4). IEEE long double sets the same .gnu_attribute to 1 | (3 * 4). * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Fix the order of arguments when warning about different long double types.
2018-05-03Fix typo in Makefile.am to make it agree with Makefile.in.Jim Wilson2-1/+5
ld/ * Makefile.am (earmelfb_linux_fdpiceabi.c): Fix typo in dependencies.
2018-05-04Automatic date update in version.inGDB Administrator1-1/+1
2018-05-03Use flex's -t option instead of --stdoutSimon Marchi2-1/+5
As reported in https://sourceware.org/ml/gdb-patches/2018-05/msg00042.html some old versions of flex (2.5.4) don't support the --stdout switch. Use -t, which is an alias. gdb/ChangeLog: * Makefile.in (%.c: %.l): Use -t instead of --stdout.
2018-05-03gdb/testsuite: Filter out some registers for riscvAndrew Burgess2-0/+15
On riscv the cycle counter, and instructions retired counter CSRs are read only, this causes problems in the gdb.base/callfuncs.exp test, as the values in these CSRs change after an inferior call, the check that no target registers have been modified then fails. Luckily the test already has a mechanism in place for filtering out registers that are modified (and can't be restored) by an inferior call, so this commit adds the problem registers into this list for riscv. In the future we may end up needing to filter out more CSRs, but right now, for the targets I have access too, these are the only ones causing problems. gdb/testsuite/ChangeLog: * gdb.base/callfuncs.exp (fetch_all_registers): Add riscv register filter pattern.
2018-05-03BFD: Prevent writing the MIPS _gp_disp symbol into symbol tablesSimon Atanasyan13-37/+76
The _gp_disp is a magic symbol, always implicitly defined by the linker. It does not make a sense to write it into symbol tables for output files. Moreover, now if the linker gets a version script, the _gp_disp symbol gets zero version definition index. The zero index means[1]: "The symbol is local, not available outside the object." But the _gp_disp symbol has GLOBAL binding. That confuses some tools like for example the LLD linker when they get such files as inputs. This patch fixes the problem - it prevents writing the _gp_disp symbol in regular and dynamic symbol tables. This was tested by running LD test suite on a mipsel-linux board. References: [1] "Linux Standard Base Specification", Section "10.7.2 Symbol Version Table", p. 32 2018-05-03 Simon Atanasyan <simon@atanasyan.com> bfd/ * elf32-mips.c: (elf32_mips_fixup_symbol): New function. (elf_backend_fixup_symbol): New macro. * elfxx-mips.c: (mips_elf_output_extsym): Discard _gp_disp handling. (_bfd_mips_elf_finish_dynamic_symbol): Likewise. ld/ * testsuite/ld-mips-elf/gp-disp-sym.d: New test. * testsuite/ld-mips-elf/gp-disp-sym.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new test. * testsuite/ld-mips-elf/mips16-pic-2.ad: Update for _gp_disp symbol removal. * testsuite/ld-mips-elf/mips16-pic-2.nd: Likewise. * testsuite/ld-mips-elf/pic-and-nonpic-3a.dd: Likewise. * testsuite/ld-mips-elf/tlslib-o32-hidden.got: Likewise. * testsuite/ld-mips-elf/tlslib-o32-ver.got: Likewise. * testsuite/ld-mips-elf/tlslib-o32.got: Likewise.