aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
AgeCommit message (Collapse)AuthorFilesLines
2012-03-19Fix spellings of filenames.Doug Evans1-2/+2
2012-03-18 * dg-extract-results.sh: Handle KFAILs.Doug Evans2-2/+10
2012-03-16gdb/Jan Kratochvil2-1/+6
PR symtab/13777 * dwarf2read.c (process_full_comp_unit): Set LOCATIONS_VALID only for GCC >=4.5. gdb/testsuite/ PR symtab/13777 * gdb.dwarf2/dw2-skip-prologue.S (DW_AT_producer): Set it to 4.5.0.
2012-03-16[Ada] Crash when trying to set value of packed array elementJoel Brobecker5-0/+116
Consider the following declaration: type Small is new Integer range 0 .. 2 ** 4 - 1; type Simple_Array is array (1 .. 4) of Small; pragma Pack (Simple_Array); SA : Simple_Array := (1, 2, 3, 4); Trying to change the value of one of the elements in the packed array causes the debugger to crash: (gdb) set sa(3) := 9 [1] 4880 segmentation fault gdb -q foo The circumstances leading to the crash are as follow: . ada_evaluate_subexp creates a value corresponding to "sa(3)". . ada_evaluate_subexp then tries to assign 9 to this value, and for this calls value_assign (via ada_value_assign). . Because the array is packed, the destination value is 3 bits long, and as a result, value_assign uses the parent to determine that element byte address and offset: | if (value_bitsize (toval)) | { | struct value *parent = value_parent (toval); | | changed_addr = value_address (parent) + value_offset (toval); The destination value (corresponding to "sa(3)") was incorrectly created by ada-lang.c:ada_value_primitive_packed_val, because the "parent" was left as NULL. So, when we try to dereference it to get the parent address, GDB crashed. The first part of the fix therefore consists in setting that field. This required the addition of a new "setter" in value.[hc]. It fixes the crash, but is still not sufficient for the assignment to actually work. The second part of the problem came from the fact that value_assign seems to expect the "child"'s address to be equal to the parent's address, with the difference being the offset. Unfortunately, this requirement was not followed by ada_value_primitive_packed_val, so the second part of the fix consisted in fixing that. Still, this was not sufficient, because it caused a regression when trying to perform an aggregate assignment of a packed array of packed record. The key element here is the nesting of packed entities. Looking at the way ada_value_primitive_packed_val creates the value of each sub-component, one can see that the value's offset is set to the offset compared to the start of the parent. This was meant to match what value_primitive_field does as well. So, with our array of records, if the record offset was 2, and if the field we're interested in that record is at offset 1, the record value's offset would be set to 2, and the field value's offset would be set to 1. But the address for both values would be left to the array's address. This is where things start breaking down, because the value_address function for our field value would return the address of the array + 1, instead of + 3. This is what causes the final issue, here, because ada-lang.c's value_assign_to_component needs to compute the offset of the subcomponent compared to the top-level aggregate's start address (the array in our case). And it does so by subtracting the array's address from the sub-component's address. When you have two levels of packed components, and the mid-level component is at an offset of the top-level component, things didn't work, because the component's address was miscomputed (the parent's offset is missing). The fix consists is fixing value_address to match the work done by value_primitive_field (where we ignore the parent's offset). gdb/ChangeLog: * value.h (set_value_parent): Add declaration. * value.c (set_value_parent): New function. (value_address): If VALUE->PARENT is not NULL, then use it as the base address instead of VALUE->LOCATION.address. * ada-lang.c (ada_value_primitive_packed_val): Keep V's address the same as OBJ's address. Adjust V's offset accordingly. Set V's parent. gdb/testsuite/ChangeLog: * gdb.ada/set_pckd_arr_elt: New testcase.
2012-03-16gdb:Gary Benson8-3/+2077
PR breakpoints/10738 * dwarf2read.c (use_deprecated_index_sections): New global. (struct partial_die_info): New member may_be_inlined. (read_partial_die): Set may_be_inlined where appropriate. (add_partial_subprogram): Add partial symbols for partial DIEs that may be inlined. (new_symbol_full): Add inlined subroutines to the current scope. (write_psymtabs_to_index): Bump version number. (dwarf2_read_index): Read only version 6 indices unless use_deprecated_index_sections is set. * linespec.c (symbol_and_data_callback): New structure. (iterate_inline_only): New function. (iterate_over_all_matching_symtabs): New argument "include_inline". If nonzero, also call the callback for symbols representing inlined subroutines. (lookup_prefix_sym): Pass extra argument to the above. (find_function_symbols): Likewise. (add_matching_symbols_to_info): Likewise. * NEWS: Mention that GDB can now set breakpoints on inlined functions. gdb/doc: PR breakpoints/10738 * gdb.texinfo (Inline Functions): Remove the now-unnecessary @item stating that GDB cannot set breakpoints on inlined functions. (Mode Options): Document --use-deprecated-index-sections. (Index Section Format): Document new index section version format. gdb/testsuite: PR breakpoints/10738 * gdb.opt/inline-break.exp: New file. * gdb.opt/inline-break.c: Likewise. * gdb.dwarf2/inline-break.exp: Likewise. * gdb.dwarf2/inline-break.S: Likewise. * gdb.base/annota1.exp: Cope with old .gdb_index warnings. * gdb.base/async-shell.exp: Likewise. * lib/mi-support.exp (library_loaded_re): Likewise.
2012-03-15 * cp-valprint.c (cp_print_value_fields): UseTom Tromey7-7/+17
print_function_pointer_address for vtable slot. gdb/testsuite * gdb.cp/virtfunc2.exp: Update expected output. * gdb.cp/pr9631.exp: Update expected output. * gdb.cp/member-ptr.exp: Update expected output. * gdb.cp/inherit.exp (test_print_mvi_classes): Update expected output. * gdb.cp/casts.exp: Update expected output.
2012-03-15 * gnu-v3-abi.c (struct value_and_voffset): New.Tom Tromey3-0/+57
(hash_value_and_voffset, eq_value_and_voffset) (compare_value_and_voffset, compute_vtable_size) (print_one_vtable, gnuv3_print_vtable): New functions. (init_gnuv3_ops): Initialize 'print_vtable' field. * cp-support.c (info_vtbl_command): New function. (_initialize_cp_support): Add "info vtbl". * cp-abi.h (cplus_print_vtable): Declare. (struct cp_abi_ops) <print_vtable>: New field. * cp-abi.c (cplus_print_vtable): New function. * NEWS: Update. gdb/testsuite * gdb.cp/virtfunc.exp (make_one_vtable_result): New proc. (test_info_vtbl): Likewise. (do_tests): Call test_info_vtbl. * gdb.cp/virtfunc.cc (va): New global. gdb/doc * gdb.texinfo (Debugging C Plus Plus): Document "info vtbl".
2012-03-15gdb/testsuite/Thomas Schwinge14-169/+186
* gdb.dwarf2/dw2-ada-ffffffff.S: Use .4byte instead of .long for describing DWARF data structures. * gdb.dwarf2/dw2-bad-parameter-type.S: Likewise. * gdb.dwarf2/dw2-double-set-die-type.S: Likewise. * gdb.dwarf2/dw2-empty-pc-range.S: Likewise. * gdb.dwarf2/dw2-entry-value.S: Likewise. * gdb.dwarf2/dw2-modula2-self-type.S: Likewise. * gdb.dwarf2/dw2-param-error.S: Likewise. * gdb.dwarf2/dw2-skip-prologue.S: Likewise. * gdb.dwarf2/dw2-stack-boundary.S: Likewise. * gdb.dwarf2/dw4-sig-type-unused.S: Likewise. * gdb.dwarf2/implptr-optimized-out.S: Likewise. * gdb.dwarf2/member-ptr-forwardref.S: Likewise. * gdb.dwarf2/pr11465.S: Likewise.
2012-03-14gdb/Jan Kratochvil2-0/+42
Fix double prompt of 'interpreter-exec mi'. * mi/mi-interp.c (mi_execute_command_input_handler): New prototype. (mi_interpreter_resume): use it. (mi_execute_command_input_handler): New function. * mi/mi-main.c (mi_execute_command): Move prompt printing to mi_execute_command_input_handler. gdb/testsuite/ * gdb.mi/mi2-prompt.exp: New file.
2012-03-14Testcase for: "ax-gdb: Do not treat enums and bools as integers".Joel Brobecker3-0/+96
gdb/testsuite/ChangeLog: * gdb.base/enum_cond.c, gdb.base/enum_cond.exp: New testcase.
2012-03-14testcase for "gdb-ax.c: Add handling of TYPE_CODE_RANGE types"Joel Brobecker5-0/+111
gdb/testsuite/ChangeLog: * gdb.ada/bp_range_type: New testcase.
2012-03-13 * NEWS: Mention symbol-reloading has been deleted.Doug Evans5-14/+7
* symfile.c (symbol_reloading): Delete. (show_symbol_reloading): Delete. (_initialize_symfile): Delete set/show symbol-reloading. doc/ * gdb.texinfo (Help): Change apropos example to use "alias" instead of "reload". (Symbols): Delete docs for set/show symbol-reloading. * gdbint.texinfo (Defining Other Architecture Features): Delete SYMBOL_RELOADING_DEFAULT. * refcard.tex: Delete reference to symbol-reloading. testsuite/ * gdb.base/default.exp: Delete tests for symbol-reloading. * gdb.base/help.exp: Ditto. * gdb.base/setshow.exp: Ditto. * gdb.base/gdb_history: Delete references to symbol-reloading.
2012-03-13gdb/Jan Kratochvil3-0/+99
* common/linux-procfs.c (linux_proc_get_int): New, from linux_proc_get_tgid, change its LWPID type to pid_t, add parameter field. (linux_proc_get_tgid): Only call linux_proc_get_int. (linux_proc_get_tracerpid): New. (linux_proc_pid_has_state): New, from linux_proc_pid_is_zombie. (linux_proc_pid_is_stopped, linux_proc_pid_is_zombie): Only call linux_proc_pid_has_state. * common/linux-procfs.h (linux_proc_get_tracerpid): New declaration. * common/linux-ptrace.c: Include linux-procfs.h and buffer.h. (linux_ptrace_attach_warnings): New. * common/linux-ptrace.h (struct buffer, linux_ptrace_attach_warnings): New declaration. * linux-nat.c: Include exceptions.h, linux-ptrace.h and buffer.h. (linux_nat_attach): New variables ex, buffer, message and message_s. Wrap to_attach by TRY_CATCH and call linux_ptrace_attach_warnings. gdb/gdbserver/ * linux-low.c (linux_attach_lwp_1): New variable buffer. Call linux_ptrace_attach_warnings. gdb/testsuite/ * gdb.base/attach-twice.c: New files. * gdb.base/attach-twice.exp: New files.
2012-03-09 * lib/gdb.exp (gdb_get_line_number): Throw anKeith Seitz5-10/+17
error instead of returning -1. * gdb.base/break.exp: Remove unused variable bp_location5. * gdb.base/hbreak2.exp: Likewise. * gdb.base/sepdebug.exp: Likewise.
2012-03-092012-03-08 Yao Qi <yao@codesourcery.com>Yao Qi3-44/+129
Pedro Alves <palves@redhat.com> Fix PR server/13392. * linux-x86-low.c (amd64_install_fast_tracepoint_jump_pad): Check offset of JMP insn. * tracepoint.c (remove_tracepoint): New. (cmd_qtdp): Call remove_tracepoint when failed to install. 2012-03-08 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> Fix PR server/13392. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Remove kfail. (tracepoint_change_loc_2): Remove kfail. Return if failed to download tracepoints. * gdb.trace/pending.exp (pending_tracepoint_works): Likewise. (pending_tracepoint_resolved_during_trace): Likewise. (pending_tracepoint_installed_during_trace): Likewise. (pending_tracepoint_with_action_resolved): Likewise.
2012-03-08 * gdb.ada/array_bounds.exp: Get breakpoint for lineKeith Seitz3-3/+8
with "START", not "STOP". * gdb.python/py-infthread.exp: Do not continue to line marked "Break here.", which is undefined.
2012-03-082012-03-08 Luis Machado <lgustavo@codesourcery.com>Luis Machado2-24/+23
Revert: 2012-03-03 Jan Kratochvil <jan.kratochvil@redhat.com> Implement testsuite workaround for PR breakpoints/13781. * gdb.cp/mb-templates.exp: New loop with variable $workaround. (set breakpoint condition-evaluation host): New conditional command.
2012-03-08gdb/Jan Kratochvil2-0/+23
Fix CU relative vs. absolute DIE offsets. * dwarf2loc.h (dwarf2_fetch_die_location_block): Rename parameter offset to offset_in_cu. * dwarf2read.c (process_enumeration_scope): Add CU offset to TYPE_OFFSET. (dwarf2_fetch_die_location_block): Rename parameter offset to offset_in_cu. New variable offset, add CU offset to OFFSET_IN_CU. gdb/testsuite/ Fix CU relative vs. absolute DIE offsets. * gdb.dwarf2/dw2-op-call.S: New compilation unit preceding the existing one.
2012-03-08gdb/testsuite/Jan Kratochvil2-1/+13
Fix false FAIL on distros with relro linkage as default. * gdb.reverse/solib-precsave.exp: Try to compile the test using -Wl,-z,norelro first.
2012-03-06New Ada testcase (bp_on_var.exp).Joel Brobecker5-0/+119
gdb/testsuite/ChangeLog: * gdb.ada/bp_on_var: New testcase.
2012-03-06New Ada testcase (bp_enum_homonym).Joel Brobecker5-0/+133
gdb/testsuite/ChangeLog: * gdb.ada/bp_enum_homonym: New testcase.
2012-03-06gdb/testsuite/Yao Qi2-1/+9
* gdb.trace/ftrace.exp (test_fast_tracepoints): Run test on target x86_64-*-* and i?86-*-*. Set up KFAIL for gdb/13808.
2012-03-05 * gdb.ada/operator_bp.exp: Clear debug-file-directory.Tom Tromey3-0/+11
* gdb.ada/mi_task_arg.exp: Clear debug-file-directory.
2012-03-05 * jv-valprint.c (java_value_print): Correctly compute 'obj_addr'.Tom Tromey2-0/+5
gdb/testsuite * gdb.java/jprint.java (jprint.main): Keep 'x' live.
2012-03-04gdb/testsuite/Yao Qi2-0/+9
* gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Catch error messages for KFAIL.
2012-03-03gdb/testsuite/Jan Kratochvil2-0/+38
* gdb.ada/arrayidx.exp: Call get_compiler_info. New variable old_gcc. (print one_two_three, indexes off, print few_reps, indexes off) (print many_reps, indexes off, print empty, indexes off) (print one_two_three, print few_reps, print many_reps, print empty): Call setup_xfail if $gcc_old.
2012-03-03gdb/Jan Kratochvil2-13/+30
* breakpoint.c (set_condition_evaluation_mode): Set CONDITION_EVALUATION_MODE unconditionally. gdb/testsuite/ Implement testsuite workaround for PR breakpoints/13781. * gdb.cp/mb-templates.exp: New loop with variable $workaround. (set breakpoint condition-evaluation host): New conditional command.
2012-03-03gdb/testsuite/Jan Kratochvil2-21/+24
Code cleanup. * gdb.cp/mb-templates.exp: New variables executable. Use it for binfile. use clean_restart. Replace gdb_expect by gdb_test_multiple. Replace GDB restart by kill and delete_breakpoints. Replace breakpoint number 1 by $bpnum. Four times.
2012-03-03gdb:Yao Qi2-14/+25
* common/agent.c (agent_look_up_symbols): Add one parameter 'arg'. * common/agent.h: Update declaration. * inf-child.c (inf_child_use_agent): New. (inf_child_can_use_agent): New. (inf_child_target): Initialize fields `to_use_agent' and `to_can_use_agent'. * agent.c (agent_new_objfile): New. (_initialize_agent): Add agent_new_objfile to new_objfile observer. * linux-nat.c (linux_child_static_tracepoint_markers_by_strid): New. (linux_target_install_ops): Initialize field `to_static_tracepoint_markers_by_strid'. * remote.c (free_current_marker): Move it to ... * tracepoint.c (free_current_marker): ... here. New. (cleanup_target_stop): New. * tracepoint.h: Declare free_current_marker. * NEWS: Add one entry about `info static-tracepoint-marker'. gdb/gdbserver: * tracepoint.c (tracepoint_look_up_symbols): Update call to agent_look_up_symbols. gdb/testsuite: * gdb.trace/strace.exp: run strace_info_marker in linux native gdb.
2012-03-03gdb/testsuite/Jan Kratochvil2-1/+19
Setup KFAIL for PR server/13796. * gdb.base/disp-step-syscall.exp (single step over vfork): Setup KFAIL.
2012-03-02New Ada testcase for breakpoints on operators.Joel Brobecker5-0/+324
gdb/testsuite/ChangeLog: * gdb.ada/operator_bp: New testcase.
2012-03-02Testcase: "info locals" with Ada renamings.Joel Brobecker5-0/+103
gdb/testsuite/ChangeLog: * gdb.ada/info_locals_renaming: New testcase.
2012-03-02 * gdb.base/nextoverexit.c: New file.Tom Tromey3-0/+61
* gdb.base/nextoverexit.exp: New file.
2012-03-02gdb/testsuite/Edjunior Barbosa Machado2-1/+6
2012-03-02 Edjunior Machado <emachado@linux.vnet.ibm.com> * gdb.arch/altivec-abi.exp (altivec_abi_tests): Remove obsolete parameter.
2012-03-01 gdb/Maciej W. Rozycki2-1/+6
* features/mips-dsp.xml: New file. * features/mips64-dsp.xml: New file. * features/mips-dsp-linux.xml: New file. * features/mips64-dsp-linux.xml: New file. * features/Makefile (WHICH): Add mips-dsp-linux and mips64-dsp-linux. (mips-dsp-expedite, mips64-dsp-expedite): New variables. * features/mips-dsp-linux.c: New file. * features/mips64-dsp-linux.c: New file. * regformats/mips-dsp-linux.dat: New file. * regformats/mips64-dsp-linux.dat: New file. * mips-linux-nat.c (mips_linux_register_addr): Handle DSP registers. (mips64_linux_register_addr): Likewise. (mips64_linux_regsets_fetch_registers): Likewise. (mips64_linux_regsets_store_registers): Likewise. (mips64_linux_fetch_registers): Update call to mips64_linux_regsets_fetch_registers. (mips64_linux_store_registers): Update call to mips64_linux_regsets_store_registers. (mips_linux_read_description): Probe for DSP registers. (_initialize_mips_linux_nat): Call initialize_tdesc_mips_dsp_linux and initialize_tdesc_mips64_dsp_linux. * mips-linux-tdep.c (supply_gregset, mips64_supply_gregset): Remove padding of no longer used embedded register slots. * mips-linux-tdep.h (DSP_BASE, DSP_CONTROL): New macros. (MIPS_RESTART_REGNUM): Redefine enum value. * mips-tdep.c (mips_generic_reg_names): Remove trailing null strings. (mips_tx39_reg_names): Likewise. (mips_linux_reg_names): New array of register names for Linux targets. (mips_register_name): Check for a null pointer in mips_processor_reg_names and return an empty string. (mips_register_type): Exclude embedded registers for the IRIX and Linux ABIs. (mips_pseudo_register_type): Likewise. Use dynamic numbers to refer to FP registers, LO, HI, BadVAddr, Cause and PC. Handle DSP registers. (mips_stab_reg_to_regnum): Handle DSP accumulators. (mips_dwarf_dwarf2_ecoff_reg_to_regnum): Likewise. (mips_gdbarch_init): Likewise. Initialize internal register indices for the Linux ABI. Use dynamic numbers to refer to registers, as applicable, while parsing the target description. * mips-tdep.h (struct mips_regnum): Add dspacc/dspctl offsets. gdb/doc/ * gdb.texinfo (MIPS Features): Add org.gnu.gdb.mips.dsp. gdb/gdbserver/ * linux-low.h (linux_target_ops): Add regset_bitmap member. * linux-low.c (use_linux_regsets): New macro. [!HAVE_LINUX_REGSETS] (regsets_fetch_inferior_registers): Likewise. [!HAVE_LINUX_REGSETS] (regsets_store_inferior_registers): Likewise. (linux_register_in_regsets): New function. (usr_fetch_inferior_registers): Skip registers covered by regsets. (usr_store_inferior_registers): Likewise. (usr_fetch_inferior_registers): New macro. (usr_store_inferior_registers): Likewise. (linux_fetch_registers): Handle mixed regset/non-regset targets. (linux_store_registers): Likewise. * linux-mips-low.c (init_registers_mips_dsp_linux): New prototype. (init_registers_mips64_dsp_linux): Likewise. (init_registers_mips_linux): New macro. (init_registers_mips_dsp_linux): Likewise. (mips_dsp_num_regs): Likewise. (DSP_BASE, DSP_CONTROL): New fallback macros. (mips_base_regs): New macro. (mips_regmap): Use it. Fix the size. (mips_dsp_regmap): New variable. (mips_dsp_regset_bitmap): Likewise. (mips_arch_setup): New function. (mips_cannot_fetch_register): Use the_low_target.regmap rather than mips_regmap. (mips_cannot_store_register): Likewise. (the_low_target): Update .arch_setup, .num_regs and .regmap initializers. Add .regset_bitmap initializer. * linux-arm-low.c (the_low_target): Add .regset_bitmap initializer. * linux-bfin-low.c (the_low_target): Likewise. * linux-cris-low.c (the_low_target): Likewise. * linux-crisv32-low.c (the_low_target): Likewise. * linux-ia64-low.c (the_low_target): Likewise. * linux-m32r-low.c (the_low_target): Likewise. * linux-m68k-low.c (the_low_target): Likewise. * linux-ppc-low.c (the_low_target): Likewise. * linux-s390-low.c (the_low_target): Likewise. * linux-sh-low.c (the_low_target): Likewise. * linux-sparc-low.c (the_low_target): Likewise. * linux-tic6x-low.c (the_low_target): Likewise. * linux-x86-low.c (the_low_target): Likewise. * linux-xtensa-low.c (the_low_target): Likewise. * configure.srv <mips*-*-linux*>: Add mips-dsp-linux.o and mips64-dsp-linux.o to srv_regobj. Add mips-dsp-linux.xml, mips64-dsp-linux.xml, mips-dsp.xml and mips64-dsp.xml to srv_xmlfiles. * Makefile.in (mips-dsp-linux.o, mips-dsp-linux.c): New targets. (mips64-dsp-linux.o, mips64-dsp-linux.c): Likewise. gdb/testsuite/ * gdb.xml/tdesc-regs.exp: Add "mips-dsp.xml" to the list of MIPS core registers.
2012-03-01 * gdb.base/hbreak2.exp: New test for "hbreak" and "thbreak".Maciej W. Rozycki2-0/+610
2012-03-012012-03-01 Pedro Alves <palves@redhat.com>Pedro Alves2-0/+41
PR gdb/13767 gdb/ * frame.c (read_frame_register_unsigned): New. * frame.h (read_frame_register_unsigned): Declare. * i387-tdep.c (print_i387_status_word): New parameter `status_p'. Handle it. (print_i387_control_word): New parameter `control_p'. Handle it. (i387_print_float_info): Handle unavailable float registers. gdb/testsuite/ * gdb.trace/unavailable.exp (gdb_unavailable_floats): New. (gdb_collect_globals_test): Call it.
2012-03-01 * gdb.cp/method2.exp: Output of overload menu is nowKeith Seitz4-157/+239
alphabetized. Update tests for "break A::method". * gdb.cp/ovldbreak.exp: Use gdb_get_line_number instead of hard-coding them. Overload menu is alphabetized: rewrite to accommodate. Unset variables LINE and TYPES which are used in other tests. Compute the output of "info break". Update the breakpoint table after all breakpoints are deleted. (continue_to_bp_overloaded): Rename ACTUALS to ARGUMENT and compute ACTUALS and the method body based on parameters. Update expected output accordingly. * gdb.cp/ovldbreak.cc (foo::overload1arg): Reformat and add unique comments to allow the use of gdb_get_line_number. * gdb.cp/method2.exp: Use prepare_for_testing and cleanup some Tcl syntax. * gdb.cp/ovldbreak.exp: Likewise.
2012-03-01 * gdb.base/help.exp (help show user): Update expected resultKeith Seitz2-1/+6
for new doc string changes (add "non-python").
2012-03-01 * NEWS: Mention new python command class gdb.COMMAND_USER.Doug Evans2-0/+23
* cli/cli-cmds.c (show_user): Print error when used on a python command. (init_cli_cmds): Update documentation strings for "show user" and "set/show max-user-call-depth" to clarify that it does not apply to python commands. * python/py-cmd.c (cmdpy_init): Treat class_user as a valid class in error check. (gdbpy_initialize_commands): Add COMMAND_USER as a constant in gdb python api. * top.c (execute_command): Only execute a user-defined command as a legacy macro if c->user_commands is set. doc/ * gdb.texinfo (Commands In Python): Put example python macro in COMMAND_USER category rather than COMMAND_OBSCURE. Document gdb.COMMAND_USER. (User-defined Commands): Update documentation to clarify "set/show max-user-call-depth" and "show user" don't apply to python commands. Update documentation to clarify "help user-defined" may also include python commands defined as COMMAND_USER. testsuite/ * gdb.python/py-cmd.exp: Add test to verify that python commands can be put in the user-defined category and that the commands appear in "help user-defined".
2012-02-29[Ada] avoid error message pollution with uninitialized tagged variableJoel Brobecker5-0/+121
Consider the following function... 3 procedure Foo is 4 I : Integer := Ident (10); 5 Obj : Base; 6 begin 7 Obj.X := I; 8 Do_Nothing (Obj.X'Address); 9 end Foo; ... where type "Base" is defined as a plain tagged record. If the user stops execution before "Obj" gets initialized (for example, by inserting a breakpoint "on" the function - or in other words, by inserting a breakpoint using the function name as the location), one might get the following of output if you try printing the value of obj: (gdb) p obj object size is larger than varsize-limit object size is larger than varsize-limit object size is larger than varsize-limit $1 = object size is larger than varsize-limit (x => 4204154) Same thing with "info locals": (gdb) info locals i = 0 obj = object size is larger than varsize-limit (x => 4204154) We have also seen different error messages such as "Cannot read memory at 0x...". The error happens because we are trying to read the dispatch table of a tagged type variable before it gets initialized. So the errors might legitimately occur, and are supposed to be be contained. However, the way things are written in ada-lang.c:ada_tag_name, although the exception is in fact contained, the error message still gets to be printed out. This patch prevents this from happening by eliminating the use of catch_errors, and using a TRY_CATCH block instead. Doing this removed the need to use functions specifically fitted for catch_errors, and thus some other simplifications could me made. In the end, the code got reorganized a bit to better show the logic behind it, as well as the common patterns. gdb/ChangeLog: * ada-lang.c (struct tag_args): Delete. (ada_get_tsd_type): Function body moved up in source file. (ada_tag_name_1, ada_tag_name_2): Delete. (ada_get_tsd_from_tag): New function. (ada_tag_name_from_tsd): New function. (ada_tag_name): Use a TRY_CATCH block instead of catch_errors to determine the tag name. gdb/testsuite/ChangeLog: * gdb.ada/tagged_not_init: New testcase.
2012-02-29[Ada] print packed arrays indexed by enumerated typeJoel Brobecker6-2/+113
Consider the following declarations (a packed array indexed by an enumerated type): type Color is (Black, Red, Green, Blue, White); type Full_Table is array (Color) of Boolean; pragma Pack (Full_Table); Full : Full_Table := (False, True, False, True, False); GDB is unable to print the index values correctly. It prints the enumeration's underlying value instead of the enumeration name: (gdb) p full $1 = (0 => false, true, false, true, false) (gdb) p full'first $2 = 0 And yet, it is capable of printing the correct type description: (gdb) ptype full type = array (black .. white) of boolean <packed: 1-bit elements> To get to the real index type, one has to follow the parallel XA type. We already do this for normal arrays. We can do it for this packed array as well. gdb/ChangeLog: * ada-lang.c (constrained_packed_array_type): If there is a parallel XA type, use it to determine the array index type. gdb/testsuite/ChangeLog: * gdb.ada/arrayidx.exp: Adjust expected output for p_one_two_three. * gdb.ada/enum_idx_packed: New testcase.
2012-02-29[Ada] Handle reference to array descriptorsJoel Brobecker5-0/+113
This patch is to help handle aliased array variables, such as: type Bounded is array (Integer range <>) of Integer; function New_Bounded (Low, High : Integer) return Bounded; BT : aliased Bounded := New_Bounded (Low => 1, High => 3); In that case, the compiler describes variable "BT" as a reference to a thin pointer, and GDB is unable to print its value: (gdb) p bt $1 = The problems starts when ada_value_print deconstructs the struct value into contents and address in order to call val_print. It turns out in this case that "bt" is not an lval. In the debug information, this variable's location is described as: .uleb128 0xd # (DIE (0xe0) DW_TAG_variable) .ascii "bt\0" # DW_AT_name [...] .byte 0x6 # DW_AT_location .byte 0x91 # DW_OP_fbreg .sleb128 -56 .byte 0x6 # DW_OP_deref .byte 0x23 # DW_OP_plus_uconst .uleb128 0x8 .byte 0x9f # DW_OP_stack_value So, when ada_value_print passes the bt's (value) address, it passes in effect a meaningless address. The problem continues shortly after when ada_val_print_1 re-creates the value from the contents and address. The value has become an lval_memory, with a null address. As a result, we trigger a memory error later on, while trying to read the array bounds in order to transform our value into a simple array. To avoid the problem entirely, the fix is to coerce references before transforming array descriptors into simple arrays. gdb/ChangeLog: * ada-valprint.c (ada_val_print_1): If our value is a reference to an array descriptor, dereference it before converting it to a simple array. gdb/testsuite/ChangeLog: * gdb.ada/aliased_array: New testcase.
2012-02-29[Ada] whatis not printing array type name for value from historyJoel Brobecker5-0/+115
Consider the following declaration: type Full_Table is array (Color) of Integer; Full : Full_Table := (144, 233, 377, 610, 987); The debugger correctly prints the type name of variable "full": (gdb) whatis full type = pck.full_table But is unable to do so when using the value history: (gdb) print full $1 = (144, 233, 377, 610, 987) (gdb) whatis $ !!! -> type = array (black .. white) of integer This is because the evaluation creates a "fixed" version of the array type, and that "fixed" version is missing a type name. As a result, whatis falls back to describing the type (a la ptype) instead of printing the type name. gdb/ChangeLog: * ada-lang.c (to_fixed_array_type): Set result's type name. gdb/testsuite/ChangeLog: * gdb.ada/whatis_array_val: New testcase.
2012-02-29gdb/Jan Kratochvil2-2/+19
Fix disp-step-syscall.exp: fork: single step over fork. * i386-linux-tdep.c (-i386_linux_get_syscall_number): Rename to ... (i386_linux_get_syscall_number_from_regcache): ... here, new function comment, change parameters gdbarch and ptid to regcache. Remove parameter regcache, initialize gdbarch from regcache here. (i386_linux_get_syscall_number, i386_linux_displaced_step_copy_insn): New functions. (i386_linux_init_abi): Install i386_linux_displaced_step_copy_insn instead. * i386-tdep.c (i386_syscall_p): Check also for 'sysenter' and 'syscall'. Make the 'int' check more strict. gdb/testsuite/ Fix disp-step-syscall.exp: fork: single step over fork. * gdb.base/disp-step-syscall.exp (syscall_insn): Anchor it by whitespaces. (single step over $syscall): Remove its check. (single step over $syscall final pc): New check.
2012-02-29gdb/testsuite/Jan Kratochvil3-73/+146
Support processors without SSSE3. * gdb.reverse/i386-sse-reverse.c (sse_test): Move pabsb, pabsw and pabsd into ... (ssse3_test): ... a new function. (main): Call ssse3_test. * gdb.reverse/i386-sse-reverse.exp: New variable end_ssse3_test. Update expected values everywhere. (reverse-step to pabsd, verify xmm0 after reverse pabsd) (verify xmm1 after reverse pabsd, verify xmm2 after reverse pabsd) (reverse-step to pabsw, verify xmm0 after reverse pabsw) (verify xmm1 after reverse pabsw, verify xmm2 after reverse pabsw) (reverse-step to pabsb, verify xmm0 after reverse pabsb) (verify xmm1 after reverse pabsb, verify xmm2 after reverse pabsb): Move these tests lower. (set breakpoint at end of ssse3_test, continue to end of ssse3_test) (verify xmm0 at end of ssse3_test, verify xmm1 at end of ssse3_test) (verify xmm2 at end of ssse3_test, continue to end of ssse3_test #2): New tests.
2012-02-29gdb/gdbserver:Yao Qi3-0/+205
2012-02-29 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * linux-low.c (linux_wait_1): Call unsuspend_all_lwps when `step_over_finished' is true. gdb/testsuite: 2012-02-29 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * gdb.trace/trace-mt.c: New * gdb.trace/trace-mt.exp: New.
2012-02-28gdb/testsuite/Thomas Schwinge5-58/+68
* gdb.base/annota1.exp: Use gdb_get_line_number for retrieving line numbers instead of hardcoding them. * gdb.base/annota1.c: Provide suitable markers. * gdb.base/annota3.exp: Use gdb_get_line_number for retrieving line numbers instead of hardcoding them. * gdb.base/annota3.c: Provide suitable markers.
2012-02-28gdb/testsuite/Thomas Schwinge6-18/+8
* gdb.base/annota1.c [__sh__]: Remove any special-casing. * gdb.base/annota3.c: Likewise. * gdb.base/sigall.c: Likewise. * gdb.base/signals.c: Likewise. * gdb.reverse/sigall-reverse.c: Likewise.
2012-02-27 * gdb.cp/breakpoint.exp (test_breakpoint): Fix the runto_mainMaciej W. Rozycki2-1/+6
failure return path.