summaryrefslogtreecommitdiff
path: root/gdb/value.c
Commit message (Collapse)AuthorAgeFilesLines
* [PR tui/14880] Fetch values before comparing their contents.Pedro Alves2013-06-281-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR tui/14880 shows a reproducer that triggers this assertion: int value_available_contents_eq (const struct value *val1, int offset1, const struct value *val2, int offset2, int length) { int idx1 = 0, idx2 = 0; /* This routine is used by printing routines, where we should already have read the value. Note that we only know whether a value chunk is available if we've tried to read it. */ gdb_assert (!val1->lazy && !val2->lazy); (top-gdb) bt #0 internal_error (file=0x88a26c "../../src/gdb/value.c", line=549, string=0x88a220 "%s: Assertion `%s' failed.") at ../../src/gdb/utils.c:844 #1 0x000000000057b9cd in value_available_contents_eq (val1=0x10fa900, offset1=0, val2=0x10f9e10, offset2=0, length=8) at ../../src/gdb/value.c:549 #2 0x00000000004fd756 in tui_get_register (frame=0xd5c430, data=0x109a548, regnum=0, changedp=0x109a560) at ../../src/gdb/tui/tui-regs.c:736 #3 0x00000000004fd111 in tui_check_register_values (frame=0xd5c430) at ../../src/gdb/tui/tui-regs.c:521 #4 0x0000000000501884 in tui_check_data_values (frame=0xd5c430) at ../../src/gdb/tui/tui-windata.c:234 #5 0x00000000004f976f in tui_selected_frame_level_changed_hook (level=1) at ../../src/gdb/tui/tui-hooks.c:222 #6 0x00000000006f0681 in select_frame (fi=0xd5c430) at ../../src/gdb/frame.c:1490 #7 0x00000000005dd94b in up_silently_base (count_exp=0x0) at ../../src/gdb/stack.c:2268 #8 0x00000000005dd985 in up_command (count_exp=0x0, from_tty=1) at ../../src/gdb/stack.c:2280 #9 0x00000000004dc5cf in do_cfunc (c=0xd3f720, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:113 #10 0x00000000004df664 in cmd_func (cmd=0xd3f720, args=0x0, from_tty=1) at ../../src/gdb/cli/cli-decode.c:1888 #11 0x00000000006e43e1 in execute_command (p=0xc7e6c2 "", from_tty=1) at ../../src/gdb/top.c:489 The fix is to fetch the value before comparing the contents. The comment additions to value.h explain why it can't be value_available_contents_eq itself that fetches the contents. Tested on x86_64 Fedora 17. gdb/ 2013-06-28 Pedro Alves <palves@redhat.com> PR tui/14880 * tui/tui-regs.c (tui_get_register): Fetch register value contents before checking whether they're available. * value.c (value_available_contents_eq): Change comment. * value.h (value_available_contents_eq): Expand comment.
* * ada-lang.c (ada_value_primitive_packed_val): Don'tTom Tromey2013-05-061-5/+7
| | | | | | | call value_incref. * value.c (set_value_parent): Incref the new parent and decref the old parent. (value_copy, value_primitive_field): Use set_value_parent.
* Constify strings in tracepoint.c, lookup_cmd and the completers.Pedro Alves2013-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is sort of a continuation of Keith's parse_exp_1 constification patch. It started out by undoing these bits: @@ -754,9 +754,12 @@ validate_actionline (char **line, struct tmp_p = p; for (loc = t->base.loc; loc; loc = loc->next) { - p = tmp_p; - exp = parse_exp_1 (&p, loc->address, + const char *q; + + q = tmp_p; + exp = parse_exp_1 (&q, loc->address, block_for_pc (loc->address), 1); + p = (char *) q; and progressively making more things const upwards, fixing fallout, rinse repeat, until GDB built again (--enable-targets=all). That ended up constifying lookup_cmd/add_cmd and (lots of) friends, and the completers. I didn't try to constify the command hooks themselves, because I know upfront there are commands that write to the command string argument, and I think I managed to stop at a nice non-hacky split point already. I think the only non-really-super-obvious changes are tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions. The rest is just mostly about 'char *' => 'const char *', 'char **'=> 'const char **', and the occasional (e.g., deprecated_cmd_warning) case of 'char **'=> 'const char *', where/when I noticed that nothing actually cares about the pointer to pointer output. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * ada-lang.c (struct add_partial_datum) <text, text0, word>: Make fields const. (ada_make_symbol_completion_list): Make "text0" parameter const. * ax-gdb.c (agent_eval_command_one): Make "exp" parameter const. * breakpoint.c (condition_completer): Make "text" and "word" parameters const. Adjust. (check_tracepoint_command): Adjust to validate_actionline prototype change. (catch_syscall_completer): Make "text" and "word" parameters const. * cli/cli-cmds.c (show_user): Make "comname" local const. (valid_command_p): Make "command" parameter const. (alias_command): Make "alias_prefix" and "command_prefix" locals const. * cli/cli-decode.c (add_cmd): Make "name" parameter const. (add_alias_cmd): Make "name" and "oldname" parameters const. Adjust. No longer make copy of OLDNAME. (add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd) (add_setshow_cmd_full, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd) (delete_cmd, add_info, add_info_alias, add_com, add_com_alias): Make "name" parameter const. (help_cmd): Rename "command" parameter to "arg". New const local "command". (find_cmd): Make "command" parameter const. (lookup_cmd_1): Make "text" parameter pointer to const. Adjust to deprecated_cmd_warning prototype change. (undef_cmd_error): Make "cmdtype" parameter const. (lookup_cmd): Make "line" parameter const. (deprecated_cmd_warning): Change type of "text" parameter to pointer to const char, from pointer to pointer to char. Adjust. (lookup_cmd_composition): Make "text" parameter const. (complete_on_cmdlist, complete_on_enum): Make "text" and "word" parameters const. * cli/cli-decode.h (struct cmd_list_element) <name>: Make field const. * cli/cli-script.c (validate_comname): Make "tem" local const. (define_command): New const local "tem_c". Use it in calls to lookup_cmd. (document_command): Make "tem" and "comfull" locals const. (show_user_1): Make "prefix" and "name" parameters const. * cli-script.h (show_user_1): Make "prefix" and "name" parameters const. * command.h (add_cmd, add_alias_cmd, add_prefix_cmd) (add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1) (deprecated_cmd_warning, lookup_cmd_composition, add_com) (add_com_alias, add_info, add_info_alias, complete_on_cmdlist) (complete_on_enum, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Change prototypes, constifying strings. * completer.c (noop_completer, filename_completer): Make "text" and "prefix" parameters const. (location_completer, expression_completer) (complete_line_internal): Make "text" and "prefix" parameters const and adjust. (command_completer, signal_completer): Make "text" and "prefix" parameters const. * completer.h (noop_completer, filename_completer) (expression_completer, location_completer, command_completer) (signal_completer): Change prototypes. * corefile.c (complete_set_gnutarget): Make "text" and "word" parameters const. * cp-abi.c (cp_abi_completer): Likewise. * expression.h (parse_expression_for_completion): Change prototype. * f-lang.c (f_make_symbol_completion_list): Make "text" and "word" parameters const. * infcmd.c (_initialize_infcmd): Make "cmd_name" local const. * infrun.c (handle_completer): Make "text" and "word" parameters const. * interps.c (interpreter_completer): Make "text" and "word" parameters const. * language.h (struct language_defn) <la_make_symbol_completion_list>: Make "text" and "word" parameters const. * parse.c (parse_exp_1): Move const hack to parse_exp_in_context. (parse_exp_in_context): Rename to ... (parse_exp_in_context_1): ... this. (parse_exp_in_context): Reimplement, with const hack from parse_exp_1. (parse_expression_for_completion): Make "string" parameter const. * printcmd.c (decode_format): Make "string_ptr" parameter pointer to pointer to const char. Adjust. (print_command_1): Make "exp" parameter const. (output_command): Rename to ... (output_command_const): ... this. Make "exp" parameter const. (output_command): Reimplement. (x_command): Adjust. (display_command): Rename "exp" parameter to "arg". New "exp" local, const version of "arg". * python/py-auto-load.c (gdbpy_initialize_auto_load): Make "cmd_name" local const. * python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree call. (cmdpy_completer): Make "text" and "word" parameters const. (gdbpy_parse_command_name): Make "prefix_text2" local const. * python/py-param.c (add_setshow_generic): Make "tmp_name" local const. * remote.c (_initialize_remote): Make "cmd_name" local const. * symtab.c (language_search_unquoted_string): Make "text" and "p" parameters const. Adjust. (completion_list_add_fields): Make "sym_text", "text" and "word" parameters const. (struct add_name_data) <sym_text, text, word>: Make fields const. (default_make_symbol_completion_list_break_on): Make "text" and "word" parameters const. Adjust locals. (default_make_symbol_completion_list) (make_symbol_completion_list, make_symbol_completion_type) (make_symbol_completion_list_fn): Make "text" and "word" parameters const. (make_file_symbol_completion_list): Make "text", "word" and "srcfile" parameters const. Adjust locals. (add_filename_to_list): Make "text" and "word" parameters const. (struct add_partial_filename_data) <text, word>: Make fields const. (make_source_files_completion_list): Make "text" and "word" parameters const. * symtab.h (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type enum type_code) (make_symbol_completion_list_fn make_file_symbol_completion_list) (make_source_files_completion_list): Change prototype. * top.c (execute_command): Adjust to pass pointer to pointer to const char to lookup_cmd, and to deprecated_cmd_warning prototype change. (set_verbose): Make "cmdname" local const. * tracepoint.c (decode_agent_options): Make "exp" parameter const, and adjust. (validate_actionline): Make "line" parameter a pointer to const char, and adjust. (encode_actions_1): Make "action_exp" local const, and adjust. (encode_actions): Adjust. (replace_comma): Delete. (trace_dump_actions): Make "action_exp" and "next_comma" locals const, and adjust. Don't frob the action string while splitting it at commas. Instead, make a copy of each split substring in turn. (trace_dump_command): Adjust to validate_actionline prototype change. * tracepoint.h (decode_agent_options, decode_agent_options) (encode_actions, validate_actionline): Change prototypes. * valprint.h (output_command): Delete declaration. (output_command_const): Declare. * value.c (function_destroyer): Cast const away in xfree call.
* Allow struct 'return' on 32-bit sparc.David S. Miller2013-02-061-9/+19
| | | | | | | | | | | | gdb/ * sparc-tdep.c (sparc32_return_value): Handle writing return value when using RETURN_VALUE_ABI_PRESERVES_ADDRESS. * value.c (struct_return_convention): New function. (using_struct_return): Implement in terms of struct_return_convention. * value.h (struct_return_convention): Declare. * stack.c (return_command): Allow successful overriding of the return value when RETURN_VALUE_ABI_PRESERVES_ADDRESS.
* * value.c (deprecated_set_value_modifiable): Remove.Tom Tromey2013-01-291-5/+0
| | | | * value.h (deprecated_set_value_modifiable): Remove.
* Update years in copyright notice for the GDB files.Joel Brobecker2013-01-011-1/+1
| | | | | | | Two modifications: 1. The addition of 2013 to the copyright year range for every file; 2. The use of a single year range, instead of potentially multiple year ranges, as approved by the FSF.
* gdb/qiyao2012-11-281-0/+1
| | | | | | | | | | | 2012-11-28 Yao Qi <yao@codesourcery.com> * breakpoint.c (_initialize_breakpoint): Call add_alias_cmd to abbreviate 'delete tracepoints' to 'delete tr'. * corefile.c (_initialize_core): Call add_alias_cmd to abbreviate 'set gnutarget' to 'set g'. * value.c (_initialize_values): Call add_alias_cmd to abbreviate 'show convenience' to 'show conv'.
* 2012-11-14 Luis Machado <lgustavo@codesourcery.com>Luis Machado2012-11-141-1/+5
| | | | | | | | | | gdb/ * value.c (value_actual_type): Check for TYPE_CODE_STRUCT target types. gdb/testsuite/ * gdb.mi/mi-var-create-rtti.c: New file. * gdb.mi/mi-var-create-rtti.exp: New file.
* * ada-valprint.c (ada_val_print_1): Eliminate single-usesiddhesh2012-09-251-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | variable LEN. * alpha-tdep.c (alpha_extract_return_value): Use TYPE_LENGTH directly. (alpha_store_return_value): Likewise. * amd64-tdep.c (amd64_classify_aggregate): Likewise. (amd64_push_arguments): Likewise. * ax-gdb.c (gen_trace_static_fields): Likewise. (gen_traced_pop): Likewise. * bfin-tdep.c (bfin_push_dummy_call): Likewise. * breakpoint.c (update_watchpoint): Likewise. * findcmd.c (parse_find_args): Use local variable for type instead of length. * findvar.c (default_read_var_value): Use TYPE_LENGTH directly. * h8300-tdep.c (h8300h_extract_return_value): Likewise. (h8300_store_return_value): Likewise. * i386-darwin-tdep.c (i386_darwin_push_dummy_call): Likewise. Use i386_darwin_arg_type_alignment directly. * infcall.c (call_function_by_hand): Use TYPE_LENGTH directly. * lm32-tdep.c (lm32_push_dummy_call): Likewise. * m68hc11-tdep.c (m68hc11_push_dummy_call): Likewise. (m68hc11_extract_return_value): Likewise. * mep-tdep.c (mep_push_dummy_call): Likewise. * printcmd.c (float_type_from_length): Likewise. * s390-tdep.c (s390_value_from_register): Likewise. * stack.c (read_frame_arg): Likewise. * tracepoint.c (encode_actions_1): Likewise. * valops.c (value_fetch_lazy): Use local variable for type instead of length. Use TYPE_LENGTH directly. * value.c (value_contents_equal): Use TYPE_LENGTH directly.
* * value.c (show_convenience): Tweak comment.Doug Evans2012-08-131-10/+20
| | | | | | | | | | | | (_initialize_values): Mention convenience functions in the help text for "show convenience". doc/ * gdb.texinfo (Convenience Vars): Update text for "show convenience" to include functions. testsuite/ * gdb.base/default.exp: Update expected output of "show convenience".
* * breakpoint.c (condition_completer): New function.Tom Tromey2012-06-131-0/+23
| | | | | | | | (_initialize_breakpoint): Use it. * value.c (complete_internalvar): New function. * value.h (complete_internalvar): Declare. testsuite * gdb.base/condbreak.exp: Add tests for "condition" completion.
* 2012-05-18 Sergio Durigan Junior <sergiodj@redhat.com>sergiodj2012-05-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ada-lang.c: * ada-tasks.c: * ada-varobj.c: * amd64-darwin-tdep.c: * arm-symbian-tdep.c: * arm-tdep.c: * avr-tdep.c: * ax-gdb.c: * bfin-linux-tdep.c: * breakpoint.c: * c-valprint.c: * cli/cli-cmds.c: * coffread.c: * cp-support.c: * cris-tdep.c: * dwarf2-frame-tailcall.c: * dwarf2-frame.c: * dwarf2expr.c: * dwarf2loc.c: * dwarf2read.c: * elfread.c: * eval.c: * expprint.c: * f-valprint.c: * frv-tdep.c: * h8300-tdep.c: * hppa-hpux-tdep.c: * hppa-tdep.c: * hppanbsd-tdep.c: * i386-nto-tdep.c: * i386-tdep.c: * i387-tdep.c: * ia64-tdep.c: * jit.c: * linespec.c: * linux-tdep.c: * lm32-tdep.c: * m2-valprint.c: * m32c-tdep.c: * m32r-rom.c: * m32r-tdep.c: * m68k-tdep.c: * m68klinux-tdep.c: * mi/mi-main.c: * microblaze-tdep.c: * mips-linux-tdep.c: * mips-tdep.c: * mn10300-tdep.c: * p-valprint.c: * parse.c: * ppc-linux-tdep.c: * ppc-sysv-tdep.c: * printcmd.c: * python/py-finishbreakpoint.c: * python/py-inferior.c: * python/py-infthread.c: * python/py-type.c: * python/python.c: * remote-fileio.c: * remote-m32r-sdi.c: * remote-mips.c: * reverse.c: * rl78-tdep.c: * rs6000-aix-tdep.c: * rs6000-tdep.c: * s390-tdep.c: * score-tdep.c: * sh64-tdep.c: * skip.c: * solib-darwin.c: * solib-dsbt.c: * solib-frv.c: * sparc-tdep.c: * spu-multiarch.c: * spu-tdep.c: * stack.c: * symfile.c: * symtab.c: * tic6x-tdep.c: * tracepoint.c: * v850-tdep.c: * valarith.c: * valprint.c: * value.c: * xcoffread.c: * xtensa-tdep.c: * ada-lang.c: * ada-tasks.c: * ada-varobj.c: * amd64-darwin-tdep.c: * arm-symbian-tdep.c: * arm-tdep.c: Delete unused variables.
* gdb/Maciej W. Rozycki2012-05-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * breakpoint.h (bp_location): Add related_address member. * inferior.h (get_return_value): Take a pointer to struct value instead of struct type for the function requested. * value.h (using_struct_return): Likewise. * gdbarch.sh (return_value): Take a pointer to struct value instead of struct type for the function requested. * breakpoint.c (set_breakpoint_location_function): Initialize related_address for bp_gnu_ifunc_resolver breakpoints. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the requested function's address to gdbarch_return_value. * eval.c (evaluate_subexp_standard): Pass the requested function's address to using_struct_return. * infcall.c (call_function_by_hand): Pass the requested function's address to using_struct_return and gdbarch_return_value. * infcmd.c (get_return_value): Take a pointer to struct value instead of struct type for the function requested. (print_return_value): Update accordingly. (finish_command_continuation): Likewise. * stack.c (return_command): Pass the requested function's address to using_struct_return and gdbarch_return_value. * value.c (using_struct_return): Take a pointer to struct value instead of struct type for the function requested. Pass the requested function's address to gdbarch_return_value. * python/py-finishbreakpoint.c (finish_breakpoint_object): New function_value member, replacing function_type. (bpfinishpy_dealloc): Update accordingly. (bpfinishpy_pre_stop_hook): Likewise. (bpfinishpy_init): Likewise. Record the requested function's address. * mips-tdep.c (mips_fval_reg): New enum. (mips_o32_push_dummy_call): For MIPS16 FP doubles do not swap words put in GP registers. (mips_o64_push_dummy_call): Update a comment. (mips_o32_return_value): Take a pointer to struct value instead of struct type for the function requested and use it to check if using the MIPS16 calling convention. Return the designated general purpose registers for floating-point values returned in MIPS16 mode. (mips_o64_return_value): Likewise. * ppc-tdep.h (ppc_sysv_abi_return_value): Update prototype. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * alpha-tdep.c (alpha_return_value): Take a pointer to struct value instead of struct type for the function requested. * amd64-tdep.c (amd64_return_value): Likewise. * amd64-windows-tdep.c (amd64_windows_return_value): Likewise. * arm-tdep.c (arm_return_value): Likewise. * avr-tdep.c (avr_return_value): Likewise. * bfin-tdep.c (bfin_return_value): Likewise. * cris-tdep.c (cris_return_value): Likewise. * frv-tdep.c (frv_return_value): Likewise. * h8300-tdep.c (h8300_return_value): Likewise. (h8300h_return_value): Likewise. * hppa-tdep.c (hppa32_return_value): Likewise. (hppa64_return_value): Likewise. * i386-tdep.c (i386_return_value): Likewise. * ia64-tdep.c (ia64_return_value): Likewise. * iq2000-tdep.c (iq2000_return_value): Likewise. * lm32-tdep.c (lm32_return_value): Likewise. * m32c-tdep.c (m32c_return_value): Likewise. * m32r-tdep.c (m32r_return_value): Likewise. * m68hc11-tdep.c (m68hc11_return_value): Likewise. * m68k-tdep.c (m68k_return_value): Likewise. (m68k_svr4_return_value): Likewise. * m88k-tdep.c (m88k_return_value): Likewise. * mep-tdep.c (mep_return_value): Likewise. * microblaze-tdep.c (microblaze_return_value): Likewise. * mn10300-tdep.c (mn10300_return_value): Likewise. * moxie-tdep.c (moxie_return_value): Likewise. * mt-tdep.c (mt_return_value): Likewise. * ppc-linux-tdep.c (ppc_linux_return_value): Likewise. * ppc-sysv-tdep.c (ppc_sysv_abi_return_value): Likewise. (ppc_sysv_abi_broken_return_value): Likewise. (ppc64_sysv_abi_return_value): Likewise. * ppcnbsd-tdep.c (ppcnbsd_return_value): Likewise. * rl78-tdep.c (rl78_return_value): Likewise. * rs6000-aix-tdep.c (rs6000_return_value): Likewise. * rx-tdep.c (rx_return_value): Likewise. * s390-tdep.c (s390_return_value): Likewise. * score-tdep.c (score_return_value): Likewise. * sh-tdep.c (sh_return_value_nofpu): Likewise. (sh_return_value_fpu): Likewise. * sh64-tdep.c (sh64_return_value): Likewise. * sparc-tdep.c (sparc32_return_value): Likewise. * sparc64-tdep.c (sparc64_return_value): Likewise. * spu-tdep.c (spu_return_value): Likewise. * tic6x-tdep.c (tic6x_return_value): Likewise. * v850-tdep.c (v850_return_value): Likewise. * vax-tdep.c (vax_return_value): Likewise. * xstormy16-tdep.c (xstormy16_return_value): Likewise. * xtensa-tdep.c (xtensa_return_value): Likewise. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. gdb/testsuite/ * gdb.base/return-nodebug.exp: Also test float and double types.
* 2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com>sergiodj2012-04-271-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tom Tromey <tromey@redhat.com> * ax-gdb.c (gen_expr): Clean up code to handle internal variables and to compile agent expressions. * infrun.c (siginfo_make_value): New argument `ignore'. (siginfo_funcs): New struct. (_initialize_infrun): New argument when calling `create_internalvar_type_lazy'. * thread.c (thread_id_make_value): New argument `ignore'. (thread_funcs): New struct. (_initialize_thread): New argument when calling `create_internalvar_type_lazy'. * tracepoint.c (sdata_make_value): New argument `ignore'. (sdata_funcs): New struct. (_initialize_tracepoint): New argument when calling `create_internalvar_type_lazy'. * value.c (make_value): New struct. (create_internalvar_type_lazy): New argument `data'. (compile_internalvar_to_ax): New function. (value_of_internalvar): Properly handling `make_value' case. (clear_internalvar): Likewise. (show_convenience): Adding `TRY_CATCH' block. * value.h (internalvar_make_value): Delete, replace by... (struct internalvar_funcs): ... this. (create_internalvar_type_lazy) <fun>: Delete argument. (create_internalvar_type_lazy) <funcs>, <data>: New arguments. (compile_internalvar_to_ax): New function. * windows-tdep.c (tlb_make_value): New argument `ignore'. (tlb_funcs): New struct. (_initialize_windows_tdep): New argument when calling `create_internalvar_type_lazy'.
* gdb/doc/ChangeLog:xgsa2012-04-141-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2012-04-14 Anton Gorenkov <xgsa@yandex.ru> PR mi/13393 * gdb.texinfo (Print Settings): Extend the description for "set print object". (GDB/MI Variable Objects): Extend the description for -var-create and -var-list-children. gdb/testsuite/ChangeLog: 2012-04-14 Anton Gorenkov <xgsa@yandex.ru> PR mi/13393 * gdb.mi/mi-var-rtti.cc: New file. * gdb.mi/mi-var-rtti.exp: New file. * lib/mi-support.exp (mi_varobj_update_with_child_type_change): New function. (mi_varobj_update_with_type_change): updated to avoid code duplication. gdb/ChangeLog: 2012-04-14 Anton Gorenkov <xgsa@yandex.ru> PR mi/13393 * value.c (value_actual_type): New function. * value.h (value_actual_type): New declaration. * varobj.c (update_type_if_necessary): New function. (varobj_create): Call value_actual_type instead of value_type. (install_dynamic_child): distinct changed and type changed MI variable objects. (update_dynamic_varobj_children): Updated for install_dynamic_child change. All callers updated. (varobj_update): Support for MI variable object type change if the value changed and RTTI is used to determine the type. (create_child_with_value): Call value_actual_type instead of value_type. (adjust_value_for_child_access): Extended with a new parameter which specify whether the given value should be casted to enclosing type. All callers updated.
* [Ada] Crash when trying to set value of packed array elementJoel Brobecker2012-03-161-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * value.c (value_primitive_field): Don't fetch contents forTom Tromey2012-03-051-5/+11
| | | | non-virtual bases.
* 2012-03-01 Pedro Alves <palves@redhat.com>Pedro Alves2012-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * amd64-linux-tdep.c (amd64_linux_record_signal): Make static. * breakpoint.c (create_exception_master_breakpoint, trace_command) (ftrace_command, strace_command): Make static. * d-lang.c (_initialize_d_language): Declare. * dwarf2expr.c (_initialize_dwarf2expr): Declare. * dwarf2loc.c (_initialize_dwarf2loc): * dwarf2read.c (process_psymtab_comp_unit): Make static. * exec.c (exec_get_section_table): Make static. * i386-linux-tdep.c (i386_linux_record_signal): Make static. * infcmd.c (ensure_valid_thread, ensure_not_tfind_mode): Make static. * inferior.c (remove_inferior_command, add_inferior_command) (clone_inferior_command): Make static. * linux-nat.c (linux_nat_thread_address_space) (linux_nat_core_of_thread): Make static. * linux-tdep.c (_initialize_linux_tdep): Declare. * objc-lang.c (_initialize_objc_lang): Declare. * opencl-lang.c (builtin_opencl_type, opencl_language_arch_info): Make static. (_initialize_opencl_language): Declare. * record.c (_initialize_record): Declare. * remote.c (demand_private_info, remote_get_tib_address) (remote_supports_cond_tracepoints) (remote_supports_fast_tracepoints, remote_get_tracepoint_status): Make static. * skip.c (_initialize_step_skip): Declare. * symtab.c (skip_prologue_using_lineinfo): Make static. * tracepoint.c (delete_trace_state_variable) (trace_variable_command, delete_trace_variable_command) (get_uploaded_tsv, find_matching_tracepoint_location) (find_matching_tsv, create_tsv_from_upload, get_traceframe_info): Make static. * value.c (pack_unsigned_long): Make static. * varobj.c (varobj_ensure_python_env): Make static. * windows-tdep.c (_initialize_windows_tdep): Declare. * xml-syscall.c (make_cleanup_free_syscalls_info): Make static.
* * value.c (value_primitive_field): Handle virtual base classes.Tom Tromey2012-03-011-2/+9
|
* gdb/xgsa2012-02-211-3/+27
| | | | | | | | | | | | | | | | | | | * c-valprint.c (c_value_print): Use value_rtti_indirect_type instead of value_rtti_target_type. * eval.c (evaluate_subexp_standard): Use value_rtti_indirect_type instead of value_rtti_target_type. * typeprint.c (whatis_exp): Use value_rtti_indirect_type instead of value_rtti_target_type. * valops.c (value_ind): Extract function readjust_indirect_value_type. (value_rtti_target_type): Rename to ... (value_rtti_indirect_type): ... here and make it indirect. Update function comment. * value.c (readjust_indirect_value_type): New function. (coerce_ref): Support for enclosing type setting for references with readjust_indirect_value_type. * value.h (readjust_value_type): New declaration. (value_rtti_target_type): Rename to ... (value_rtti_indirect_type): ... here.
* Copyright year update in most files of the GDB Project.Joel Brobecker2012-01-041-3/+1
| | | | | | gdb/ChangeLog: Copyright year update in most files of the GDB Project.
* PR python/12533:Tom Tromey2011-12-221-6/+30
| | | | | | | | | | | * value.h (release_value_or_incref): Declare. * value.c (struct value) <released>: New field. (free_all_values, release_value, value_release_to_mark): Update 'released'. (release_value_or_incref): New function. * python/py-value.c (valpy_new): Use release_value_or_incref. (value_to_value_object): Likewise. * varobj.c (install_new_value): Move value_incref earlier.
* * value.c (struct value) <modifiable, lazy, optimized_out,Tom Tromey2011-12-221-35/+38
| | | | | initialized, stack>: Now bitfields. Move to top. <reference_count>: Move earlier.
* gdb/Jan Kratochvil2011-10-131-4/+7
| | | | | | | | | | | Fix internal error regression. * value.c (value_primitive_field): Handle value_optimized_out. Move packed bitfields comment. gdb/testsuite/ Fix internal error regression. * gdb.dwarf2/implptr-optimized-out.S: New file. * gdb.dwarf2/implptr-optimized-out.exp: New file.
* gdb/Jan Kratochvil2011-10-091-7/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Display @entry parameter values even for references. * ada-valprint.c (ada_val_print_1) <TYPE_CODE_REF>: Try also coerce_ref_if_computed. * c-valprint.c (c_val_print) <TYPE_CODE_REF>: Likewise. * dwarf2expr.c (dwarf_block_to_dwarf_reg_deref): New function. (execute_stack_op) <DW_OP_GNU_entry_value>: Add -1 deref_size to the existing push_dwarf_reg_entry_value call. Add new detection calling dwarf_block_to_dwarf_reg_deref. Update the error message. (ctx_no_push_dwarf_reg_entry_value): New parameter deref_size. * dwarf2expr.h (struct dwarf_expr_context_funcs) <push_dwarf_reg_entry_value>: Add new parameter deref_size, describe it in the comment. (ctx_no_push_dwarf_reg_entry_value): Add new parameter deref_size. (dwarf_block_to_dwarf_reg_deref): New declaration. * dwarf2loc.c (dwarf_entry_parameter_to_value): Add new parameter deref_size, describe it in the function comment. New variables data_src and size, fetch the alternative block accoring to DEREF_SIZE. (dwarf_expr_push_dwarf_reg_entry_value): Add new parameter deref_size, describe it in the function comment. Fetch the alternative block accoring to DEREF_SIZE. (entry_data_value_coerce_ref, entry_data_value_copy_closure) (entry_data_value_free_closure, entry_data_value_funcs): New. (value_of_dwarf_reg_entry): New variables checked_type, target_type, outer_val, target_val, val and addr. Try to fetch and create also referenced value content. (pieced_value_funcs): NULL value for coerce_ref. (needs_dwarf_reg_entry_value): Add new parameter deref_size. * f-valprint.c (f_val_print) <TYPE_CODE_REF>: Try also coerce_ref_if_computed. * opencl-lang.c (opencl_value_funcs): NULL value for coerce_ref. * p-valprint.c (pascal_val_print) <TYPE_CODE_REF>: Likewise. * stack.c (read_frame_arg): Compare also dereferenced values. * value.c (value_computed_funcs): Make the parameter v const, use value_lval_const for it. (value_lval_const, coerce_ref_if_computed): New function. (coerce_ref): New variable retval. Call also coerce_ref_if_computed. * value.h (struct lval_funcs): New field coerce_ref. (value_computed_funcs): Make the parameter v const. (value_lval_const, coerce_ref_if_computed): New declarations. gdb/testsuite/ Display @entry parameter values even for references. * gdb.arch/amd64-entry-value.cc (reference, datap, datap_input): New functions. (main): New variables regvar, nodatavarp, stackvar1, stackvar2. Call reference and datap_input. * gdb.arch/amd64-entry-value.exp (reference, breakhere_reference): New breakpoints. (continue to breakpoint: entry_reference: reference) (entry_reference: bt at entry) (continue to breakpoint: entry_reference: breakhere_reference) (entry_reference: bt, entry_reference: ptype regparam) (entry_reference: p regparam, entry_reference: ptype regparam@entry) (entry_reference: p regparam@entry, entry_reference: p &regparam@entry) (entry_reference: p regcopy, entry_reference: p nodataparam) (entry_reference: p nodataparam@entry): New tests.
* 2011-09-02 Pedro Alves <pedro@codesourcery.com>Pedro Alves2011-09-021-2/+12
| | | | | | | | gdb/ * value.c (show_convenience): Catch errors thrown while printing each internal variable. * infrun.c (validate_siginfo_access): New function. (siginfo_value_read, siginfo_value_write): Call it.
* gdb/Jan Kratochvil2011-07-141-7/+10
| | | | | | | | | | | | | | | | | | Code cleanup - constify struct lval_funcs. * dwarf2loc.c (pieced_value_funcs): Make it const. * infrun.c (siginfo_value_funcs): Likewise. * opencl-lang.c (opencl_value_funcs): Likewise. * valops.c (value_assign, value_ind): Make the funcs variable const. * value.c (struct value): Make location.computed.funcs target const. Rearrange the comments. (allocate_computed_value): Make the funcs parameter target const. (value_computed_funcs): Return the funcs target const. (value_free, value_copy, set_value_component_location): Make the funcs variable const. * value.h (allocate_computed_value): Make the funcs parameter target const. (value_computed_funcs): Return the funcs target const. * windows-tdep.c (tlb_value_funcs): Make it const.
* gdb/Jan Kratochvil2011-07-121-0/+12
| | | | | | | | | | Code cleanup making also optimized out values lazy. * dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use allocate_optimized_out_value. Twice. (loclist_read_variable) Use allocate_optimized_out_value. Once. * findvar.c (read_var_value): Likewise. * value.c (allocate_optimized_out_value): New function. * value.h (allocate_optimized_out_value): New declaration.
* * dwarf2read.c (dwarf2_add_field): Constify.Tom Tromey2011-05-181-1/+1
| | | | | | | * value.c (value_static_field): Constify. * gdbtypes.h (struct main_type) <field.field_location.physname>: Now const. * ax-gdb.c (gen_static_field): Constify
* * value.c (value_fn_field): Constify.Tom Tromey2011-05-181-1/+1
| | | | | | | | | | | | | | | | | | * symtab.c (gdb_mangle_name): Constify. * stabsread.c (update_method_name_from_physname): Make 'physname' argument const. * p-typeprint.c (pascal_type_print_method_args): Make arguments const. Use explicit fputc_filtered loop. (pascal_type_print_base): Constify. * p-lang.h (pascal_type_print_method_args): Update. * linespec.c (add_matching_methods): Constify. (add_constructors): Likewise. * jv-typeprint.c (java_type_print_base): Constify. * gdbtypes.h (struct cplus_struct_type) <fn_fieldlist.fn_field.physname>: Now const. * dwarf2read.c (compute_delayed_physnames): Constify. (dwarf2_add_member_fn): Likewise. * c-typeprint.c (c_type_print_base): Constify. Use cleanups.
* gdbTom Tromey2011-05-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR gdb/12617: * value.h (value_from_contents): Declare. * value.c (value_from_contents): New function. * dwarf2read.c (dwarf_stack_op_name): Add new values. (dwarf2_get_die_type): New function. * dwarf2loc.c (dwarf_expr_get_base_type): New function. (allocate_piece_closure): Acquire reference to values. (read_pieced_value): Update for value-based expressions. (write_pieced_value): Likewise. (free_pieced_value_closure): Call value_free as needed. (dwarf2_evaluate_loc_desc_full): Set get_base_type field. Update for value-based expressions. * dwarf2loc.h (dwarf2_get_die_type): Declare. * dwarf2expr.h (struct dwarf_stack_value) <value>: Change type. <get_base_type>: New field. (struct dwarf_expr_piece) <v.value>: Change type. <v.regno>: New field. (struct dwarf_expr_context) <mark>: New field. (dwarf_expr_piece, dwarf_expr_fetch): Update. (dwarf_expr_pop, dwarf_expr_push): Remove. (dwarf_expr_push_address): Declare. * dwarf2expr.c (dwarf_arch_cookie): New global. (struct dwarf_gdbarch_types): New. (dwarf_gdbarch_types_init, dwarf_expr_address_type): New functions. (dwarf_expr_push): Change type of 'value' argument. Update. Now static. (dwarf_expr_push_address): New function. (dwarf_expr_pop): Now static. (dwarf_expr_fetch): Change return type. (dwarf_require_integral): New function. (dwarf_expr_fetch): Simplify. (add_piece): Update. (base_types_equal_p, dwarf_get_base_type, get_unsigned_type): New functions. (execute_stack_op) <sign_ext>: Remove. Use values for DWARF stack. <DW_OP_GNU_const_type, DW_OP_GNU_deref_type, DW_OP_GNU_regval_type, DW_OP_GNU_convert, DW_OP_GNU_reinterpret>: New cases. (_initialize_dwarf2expr): New function. (add_piece): Update. (new_dwarf_expr_context): Set new field. (free_dwarf_expr_context): Call value_free_to_mark. * dwarf2-frame.c (no_base_type): New function. (execute_stack_op): Set get_base_type field. Update. gdb/testsuite * gdb.dwarf2/typeddwarf.S: New file. * gdb.dwarf2/typeddwarf.c: New file. * gdb.dwarf2/typeddwarf.exp: New file.
* 2011-02-24 Michael Snyder <msnyder@vmware.com>Michael Snyder2011-02-271-1/+54
| | | | | | | | | | | | | * value.c (value_from_history_ref): New function. * value.h (value_from_history_ref): Export. * cli/cli-utils.c (get_number_trailer): Use value_from_history_ref to parse value history references. * cli/cli-utils.h (get_number_trailer): Update comment. 2011-02-24 Michael Snyder <msnyder@vmware.com> * gdb.base/break.exp: Add tests for delete breakpoints using convenience variables and value history references.
* gdb/Pedro Alves2011-02-161-11/+24
| | | | | | | * value.c (value_contents_copy_raw): Extend describing comment. Assert that the destination contents we're overwriting are wholly available. * value.h (value_contents_copy): Extend describing comment.
* * value.c (value_available_contents_eq): Remove redundant localPedro Alves2011-02-161-15/+6
| | | | | | variables. Fix available contents comparision. * value.h (value_available_contents_eq): Extend describing comment.
* 2011-02-14 Michael Snyder <msnyder@vmware.com>Michael Snyder2011-02-141-1/+1
| | | | | | | | | | | | * command.h (enum command_class): New class 'no_set_class', for "show" commands without a corresponding "set" command. * value.c (_initialize_values): Use 'no_set_class' for "show values". * copying.c (_initialize_copying): Ditto for "show copying" and "show warranty". * cli/cli-cmds.c (init_cli_cmds): Ditto for "show commands" and "show version". * cli/cli-setshow.c (cmd_show_list): Skip "show" commands for which there is no corresponding "set" command (eg. "show copying").
* * value.c (mark_value_bytes_unavailable): Fix indexing the `bef'Pedro Alves2011-02-141-1/+1
| | | | range.
* * value.c (value_bits_valid, value_bits_synthetic_pointer):Pedro Alves2011-02-141-2/+2
| | | | No longer handle NULL values.
* gdb/Pedro Alves2011-02-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * exceptions.h (NOT_AVAILABLE_ERROR): New error. * value.c: Include "exceptions.h". (require_available): Throw NOT_AVAILABLE_ERROR instead of a generic error. * cp-abi.c: Include gdb_assert.h. (baseclass_offset): Add `embedded_offset' and `val' parameters. Assert the method is implemented. Wrap NOT_AVAILABLE_ERROR errors. * cp-abi.h (baseclass_offset): Add `embedded_offset' and `val' parameters. No longer returns -1 on error. (struct cp_abi_ops) <baseclass_offset>: Add `embedded_offset' and `val' parameters. * cp-valprint.c: Include exceptions.h. (cp_print_value): Handle NOT_AVAILABLE_ERROR errors when fetching the baseclass_offset. Handle unavailable base classes. Use val_print_invalid_address. * p-valprint.c: Include exceptions.h. (pascal_object_print_value): Handle NOT_AVAILABLE_ERROR errors when fetching the baseclass_offset. No longer expect baseclass_offset returning -1. Handle unavailable base classes. Use val_print_invalid_address. * valops.c (dynamic_cast_check_1): Rename `contents' parameter to `valaddr' parameter, and change its type to gdb_byte pointer. Add `embedded_offset' and `val' parameters. Adjust. (dynamic_cast_check_2): Rename `contents' parameter to `valaddr' parameter, and change its type to gdb_byte pointer. Add `embedded_offset' and `val' parameters. Adjust. No longer expect baseclass_offset returning -1. (value_dynamic_cast): Use value_contents_for_printing rather than value_contents. Adjust. (search_struct_field): No longer expect baseclass_offset returning -1. (search_struct_method): If reading memory from the target is necessary, wrap it in a new value to pass to baseclass_offset. No longer expect baseclass_offset returning -1. (find_method_list): No longer expect baseclass_offset returning -1. Use value_contents_for_printing rather than value_contents. * valprint.c (val_print_invalid_address): New function. * valprint.h (val_print_invalid_address): Declare. * gdbtypes.c (is_unique_ancestor_worker): New `embedded_offset' and `val' parameters. No longer expect baseclass_offset returning -1. Adjust. * gnu-v2-abi.c: Include "exceptions.h". (gnuv2_baseclass_offset): Add `embedded_offset' and `val' parameters. Handle unavailable memory. Recurse through gnuv2_baseclass_offset directly, rather than through baseclass_offset. No longer returns -1 on not found, instead throw an error. * gnu-v3-abi.c (gnuv3_baseclass_offset): Add `embedded_offset' and `val' parameters. Adjust. gdb/testsuite/ * gdb.trace/unavailable.cc (class Base, class Middle, class Derived): New types. (derived_unavail, derived_partial, derived_whole): New globals. (virtual_partial): New global. (virtualp): Point at virtual_partial. * gdb.trace/unavailable.exp (gdb_collect_globals_test): Add tests related to unavailable vptr.
* gdb/testsuite/Pedro Alves2011-02-141-0/+13
| | | | | | | | | | | | | | * gdb.trace/unavailable.cc (struct Virtual): New. (virtualp): New global pointer. * gdb.trace/unavailable.exp (gdb_collect_globals_test): Test printing a pointer to an object whose type has a vtable, with print object on. gdb/ * value.h (value_entirely_available): Declare. * value.c (value_entirely_available): New function. * c-valprint.c (c_value_print): Don't try fetching the pointer's real type if the pointer is unavailable.
* gdb/Pedro Alves2011-02-141-7/+65
| | | | | | | | | | | | | | | | | | | | | | * value.h (value_contents_copy, value_contents_copy_raw): Declare. * value.c (value_contents_copy_raw, value_contents_copy): New functions. (value_primitive_field): Use value_contents_copy_raw instead of memcpy. * valops.c (value_fetch_lazy): Use value_contents_copy instead of memcpy. (value_array, value_slice): Ditto. * valarith.c (value_subscripted_rvalue): Use value_contents_copy_raw instead of memcpy. gdb/testsuite/ * gdb.trace/unavailable.exp (gdb_collect_globals_test): Add new tests for building arrays from unavailable values, subscripting non-memory rvalue unvailable arrays, and accessing fields or baseclasses of non-lazy unavailable values, * gdb.trace/unavailable.cc (small_struct, small_struct_b): New struct types. (g_smallstruct, g_smallstruct_b): New globals.
* gdb/Pedro Alves2011-02-141-23/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * value.h (unpack_bits_as_long): Delete declaration. (unpack_value_bits_as_long): Declare. (unpack_value_field_as_long): Declare. (value_field_bitfield): Declare. * value.c (unpack_bits_as_long): Rename to... (unpack_value_bits_as_long_1): ... this. Add embedded_offset and value parameters. Return the extracted result in a new output parameter. If the value contents are unavailable, return false, otherwise return true. (unpack_value_bits_as_long): New. (unpack_field_as_long): Rename to... (unpack_value_field_as_long_1): ... this. Add embedded_offset and Add embedded_offset and value parameters. Return the extracted result in a new output parameter. If the value contents are unavailable, return false, otherwise return true. (unpack_value_field_as_long): New. (unpack_field_as_long_1): New. (unpack_field_as_long): Reimplement as wrapper around unpack_value_field_as_long_1. (value_field_bitfield): New function. * valops.c (value_fetch_lazy): When fetching a bitfield, use unpack_value_bits_as_long. Mark the value as unavailable, if it is unavailable. * jv-valprint.c (java_print_value_fields): Use value_field_bitfield. * p-valprint.c (pascal_object_print_value_fields): Use value_field_bitfield. * cp-valprint.c (cp_print_value_fields): Use value_field_bitfield.
* * value.c (get_internalvar_integer): Also return the int value ofPedro Alves2011-02-141-10/+13
| | | | | TYPE_CODE_INT INTERNALVAR_VALUE values. (set_internalvar): Don't special case TYPE_CODE_INT.
* gdb/Pedro Alves2011-02-141-26/+0
| | | | | | | | | * value.c (struct internalvar) <enum internalvar_kind>: Remove INTERNALVAR_POINTER. <pointer>: Delete. (value_of_internalvar): Remove INTERNALVAR_POINTER handling. (set_internalvar): Remove special TYPE_CODE_PTR handling. (preserve_one_internalvar): Remove INTERNALVAR_POINTER handling.
* gdb/Pedro Alves2011-02-141-0/+101
| | | | | | | | | | | | * value.h (value_available_contents_eq): Declare. * value.c (find_first_range_overlap): New function. (value_available_contents_eq): New function. * valprint.c (val_print_array_elements): Use value_available_contents_eq. * ada-valprint.c (val_print_packed_array_elements): Use value_available_contents_eq. * jv-valprint.c (java_value_print): Use value_available_contents_eq.
* Base support for <unavailable> value contents.Pedro Alves2011-02-141-1/+294
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | gdb/ * value.h (value_bytes_available): Declare. (mark_value_bytes_unavailable): Declare. * value.c (struct range): New struct. (range_s): New typedef. (ranges_overlap): New function. (range_lessthan): New function. (ranges_contain_p): New function. (struct value) <unavailable>: New field. (value_bytes_available): New function. (mark_value_bytes_unavailable): New function. (require_not_optimized_out): Constify parameter. (require_available): New function. (value_contents_all, value_contents): Require all bytes be available. (value_free): Free `unavailable'. (value_copy): Copy `unavailable'. * valprint.h (val_print_unavailable): Declare. * valprint.c (valprint_check_validity): Rename `offset' parameter to `embedded_offset'. If printing a scalar, check whether the value chunk is available. (val_print_unavailable): New. (val_print_scalar_formatted): Check whether the value is available. * python/py-prettyprint.c (apply_val_pretty_printer): Refuse pretty-printing unavailable values.
* * cp-valprint.c (cp_print_value): Treat the 'skip' local asPedro Alves2011-01-251-1/+8
| | | | | | | | | | boolean. Make sure to always pass a value that matches the contents buffer to callees. Preserve `address' for following iterations. * value.c (value_contents_for_printing_const): New. (value_address): Constify value argument. * value.h (value_contents_for_printing_const): Declare. (value_address): Constify value argument.
* gdb/Jan Kratochvil2011-01-121-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | Make value allocations more lazy. * ada-lang.c (coerce_unspec_val_to_type): Use allocate_value_lazy instead of allocate_value and set_value_lazy when possible. * dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Use allocate_value_lazy instead of allocate_value and set_value_lazy. * findvar.c (value_of_register_lazy): Likewise. (read_var_value): Remove V preallocation, call just check_typedef in advance. Move allocate_value to LOC_CONST, LOC_LABEL, LOC_CONST_BYTES. Use allocate_value_lazy in LOC_STATIC, LOC_ARG, LOC_REF_ARG, LOC_LOCAL, LOC_BLOCK. Set ADDR instead of set_value_address and break in LOC_BLOCK. Use allocate_value_lazy and remove lval_memory set in LOC_REGPARM_ADDR. Use allocate_value_lazy in LOC_UNRESOLVED and LOC_OPTIMIZED_OUT. Add setting lval_memory at the end, remove set_value_lazy there. * valarith.c (value_subscripted_rvalue): Use allocate_value_lazy instead of allocate_value and set_value_lazy when possible. * valops.c (value_fetch_lazy): Do nop for value_optimized_out VAL. * value.c (allocate_computed_value): Use allocate_value_lazy instead of allocate_value and set_value_lazy. (value_from_contents_and_address): Use allocate_value_lazy instead of allocate_value and set_value_lazy when possible.
* 2011-01-11 Michael Snyder <msnyder@vmware.com>Michael Snyder2011-01-121-19/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ui-file.c: Comment cleanup, mostly periods and spaces. * ui-file.h: Ditto. * ui-out.c: Ditto. * ui-out.h: Ditto. * utils.c: Ditto. * v850-tdep.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * value.h: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vax-tdep.c: Ditto. * vec.c: Ditto. * vec.h: Ditto. * version.h: Ditto. * windows-nat.c: Ditto. * windows-tdep.c: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xml-support.c: Ditto. * xstormy16-tdep.c: Ditto. * xtensa-tdep.c: Ditto. * xtensa-tdep.h: Ditto.
* 2011-01-11 Michael Snyder <msnyder@vmware.com>Michael Snyder2011-01-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | * arm-tdep.c: Internationalization. * c-lang.c: Ditto. * charset.c: Ditto. * fork-child.c: Ditto. * nto-procfs.c: Ditto. * ppc-sysv-tdep.c: Ditto. * procfs.c: Ditto. * remote-mips.c: Ditto. * remote.c: Ditto. * rs6000-nat.c: Ditto. * rs6000-tdep.c: Ditto. * target.c: Ditto. * valops.c: Ditto. * value.c: Ditto. * xml-support.c: Ditto. * mi/mi-cmd-break.c: Ditto. * mi/mi-cmd-var.c: Ditto. * mi/mi-interp.c: Ditto. * mi/mi-main.c: Ditto.
* 2011-01-05 Michael Snyder <msnyder@vmware.com>Michael Snyder2011-01-051-13/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.