C++ class type is returned, fix incorrect enclosing type / embedded
offset. If internal variable is returned, allocate new internalvar
value using value_of_internalvar.
* NEWS: Document changes in behavior of "print x = 0" and similar
expressions.
Fix step_resume_breakpoint unsaved during an infcall.
* gdbthread.h (struct thread_control_state): Move here field
step_resume_breakpoint ...
(struct thread_info): ... from here.
* infrun.c (save_infcall_control_state): Reset
control.step_resume_breakpoint to NULL.
(restore_infcall_control_state, discard_infcall_control_state): Delete
control.step_resume_breakpoint.
* arm-linux-tdep.c, infrun.c, thread.c: Update all the references to
the moved field.
gdb/testsuite/
Fix step_resume_breakpoint unsaved during an infcall.
* gdb.base/step-resume-infcall.exp: New file.
* gdb.base/step-resume-infcall.c: New file.
Rename and move inferior_thread_state and inferior_status.
* gdbthread.h (struct thread_control_state): New struct, move fields
step_range_start, step_range_end, step_frame_id, step_stack_frame_id,
trap_expected, proceed_to_finish, in_infcall, step_over_calls,
stop_step and stop_bpstat here from struct thread_info.
(struct thread_suspend_state): New struct, move field stop_signal here
from struct thread_info.
(struct thread_info): Move the fields above from this struct.
* inferior.h: Move the inferior_thread_state and inferior_status
declarations comment to their definitions at infrun.c.
(struct inferior_control_state): New struct, move field stop_soon from
struct inferior here.
(struct inferior_suspend_state): New empty struct.
(struct inferior): New fields control and suspend. Move out field
stop_soon.
* infrun.c (struct inferior_thread_state): Rename to ...
(infcall_suspend_state): ... here. Replace field stop_signal by
fields thread_suspend and inferior_suspend.
(save_inferior_thread_state): Rename to ...
(save_infcall_suspend_state): ... here. New variable inf. Update the
code for new fields.
(restore_inferior_thread_state): Rename to ...
(restore_infcall_suspend_state): ... here. New variable inf. Update
the code for new fields.
(do_restore_inferior_thread_state_cleanup): Rename to ...
(do_restore_infcall_suspend_state_cleanup): ... here.
(make_cleanup_restore_inferior_thread_state): Rename to ...
(make_cleanup_restore_infcall_suspend_state): ... here.
(discard_inferior_thread_state): Rename to ...
(discard_infcall_suspend_state): ... here.
(get_inferior_thread_state_regcache): Rename to ...
(get_infcall_suspend_state_regcache): ... here.
(struct inferior_status): Rename to ...
(struct infcall_control_state): ... here. Replace fields
step_range_start, step_range_end, step_frame_id, step_stack_frame_id,
trap_expected, proceed_to_finish, in_infcall, step_over_calls,
stop_step, stop_bpstat and stop_soon by fields thread_control and
inferior_control.
(save_inferior_status): Rename to ...
(save_infcall_control_state): ... here. Update the code for new
fields.
(restore_inferior_status): Rename to ...
(restore_infcall_control_state): ... here. Update the code for new
fields.
(do_restore_inferior_status_cleanup): Rename to ...
(do_restore_infcall_control_state_cleanup): ... here.
(make_cleanup_restore_inferior_status): Rename to ...
(make_cleanup_restore_infcall_control_state): ... here.
(discard_inferior_status): Rename to ...
(discard_infcall_control_state): ... here.
* alpha-tdep.c, breakpoint.c, dummy-frame.c, dummy-frame.h,
exceptions.c, fbsd-nat.c, gdbthread.h, infcall.c, infcmd.c,
inferior.c, inferior.h, infrun.c, linux-nat.c, mi/mi-interp.c,
mips-tdep.c, procfs.c, solib-irix.c, solib-osf.c, solib-spu.c,
solib-sunos.c, solib-svr4.c, thread.c, windows-nat.c: Update all the
references to the moved fields and renamed functions.
bfd_uses_spe_extensions should only be used when BFD has been built
with ELF support. The typical way of checking that in GDB is to use
the HAVE_ELF macro.
gdb/ChangeLog:
* rs6000-tdep.c (bfd_uses_spe_extensions): Use bfd_elf_get_obj_attr_int
only if HAVE_ELF is defined.
PR python/12212
* python/py-inferior.c (find_thread_object): Check if PIDGET
returns 0.
2010-11-23 Phil Muldoon <pmuldoon@redhat.com>
PR python/12212
* gdb.python/python.exp: Check that selected_thread raises an
error when no inferior is loaded.
A recent change in check_typedef caused the following regression,
considering:
type String_Access is access String;
S1 : String_Access := null;
Trying to print S1, we get:
(gdb) print s1
$1 = (string) (null)
The type name is wrong. We were expecting:
(gdb) print s1
$1 = (string_bug.string_access) (null)
The extensive comment in this patch explains how pointers to arrays
are encoded when the array is a "fat pointer". What happened is
that the change in check_typedef broke a type-equality test that
we were performing. The test really was on the fringe, but it
turns out that, for what we're doing, we're really only interested
in the main-type portion of the type.
The patch adjust the check accordingly.
gdb/ChangeLog:
* ada-lang.c (ada_to_fixed_type): Expand function documentation.
Return the original type if the main type portions match rather
than when the type themselves match.
We have a variant record whose value is defined as follow:
type Discriminant_Record (Num1, Num2,
Num3, Num4 : Natural) is record
Field1 : My_Record_Array (1 .. Num2);
Field2 : My_Record_Array (Num1 .. 10);
Field3 : My_Record_Array (Num1 .. Num2);
Field4 : My_Record_Array (Num3 .. Num2);
Field5 : My_Record_Array (Num4 .. Num2);
end record;
Dire : Discriminant_Record (1, 7, 3, 0);
However, we're trying to print "Dire" before it is elaborated.
This is common if one breaks on a function and then starts doing
"info locals" for instance.
What happens is that GDB reads bogus values for fields Num1 to
Num4, and deduces a bogus (ginormouos) size for component
"Field1". The length is so large that it then later causes
an overflow in the overall record length computation. Things
go downhill from there, because length(field1) > length(record).
So, when after we've fetched the value of the record based on
the computed size, we crash trying to access unallocated memory
when accessing field1...
The first fix we can do is to check the size of the field
against the maximum object size. If it exceeds that size,
then we know the record will also exceed that size...
gdb/ChangeLog:
* ada-lang.c (ada_template_to_fixed_record_type_1):
For dynamic fields, check the field size against the maximum
object size.
On mips-irix, the debugger has trouble stepping over the following
line of code:
S: Shape'Class := R; <<<<---- STOP here
Here is what happens:
(gdb) n
warning: GDB can't find the start of the function at 0x7fff2bd8.
GDB is unable to find the start of the function at 0x7fff2bd8
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
This problem is most likely caused by an invalid program counter or
stack pointer.
However, if you think GDB should simply search farther back
from 0x7fff2bd8 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
0x7fff2bd8 in ?? ()
The program does in fact jump to this code location, which is a trampoline
located on the stack (there is an implicit call to a routine internally
generated by the Ada expander). As it is on the stack, GDB is naturally
unable to find the bounds of the current function, or any debugging
information, and is thus unable to continue.
This patch adds support for this sort of trampoline.
gdb/ChangeLog:
* mips-irix-tdep.c (mips_irix_n32_stack_tramp_frame_init): New
function.
(mips_irix_n32_stack_tramp_frame): New static global.
(mips_irix_init_abi): Add mips_irix_n32_stack_tramp_frame to
list of unwinder.
Type symbols that are used to decode the Ada task control block may be
duplicated in any unit that uses a tasking feature; an Ada lookup of
these symbols would collect all the duplicated instances and could
provoke the load of a huge amount of debug symbols in the process.
However, when decoding the task information, we are only interested in
one instance; and we have the full name of the symbol anyway. So use
a C lookup instead of an Ada lookup.
2010-11-05 Jerome Guitton <guitton@adacore.com>
* ada-tasks.c (get_tcb_types_info): Use C lookups to get
ATCB symbols.
When trying to resolve an incomplete type, if there is no complete
version of that type available, GDB can go in an infinite loop.
This is because ada_check_typedef makes a recursive call to itself,
in an attempt to make sure that the returned type is never a typedef.
However, when no complete type is found, the current logic causes us
to keep going indefinitely through the same path...
This patch fixes the problem by performing the recursive call to
ada_check_typedef only when a TYPE_CODE_TYPDEF layer needs to be
stripped.
gdb/ChangeLog:
* ada-lang.c (ada_check_typedef): Call ada_check_typedef only
if type1 is a typedef.
This is a new routine that is being generated by the expander in
the context of controlled types. This patch adds it to the list of such
routines so that the debugger does not show it when selecting the first
"user" frame (when switching tasks for instance).
gdb/ChangeLog:
* ada-lang.h (ADA_KNOWN_AUXILIARY_FUNCTION_NAME_PATTERNS): Add
"_finalizer" to the list.
gdb/ChangeLog:
* ada-typeprint.c (print_array_type): Fix formatting in comment.
(print_selected_record_field_types): Fix formatting in function
documentation.
A new-line was missing at the end of the output of the `show ravenscar
task-switching' command. For instance:
(gdb) show ravenscar task-switching
Support for Ravenscar task/thread switching is enabled(gdb)
This patch fixes it.
gdb/ChangeLog:
* ravenscar-thread.c (show_ravenscar_task_switching_command):
Add missing '\n' in output.
The GNAT Ravenscar implementation has recently been enhanced to allow
programs using that runtime to run on multi-cpu systems. One of the
changes that were made is that the name of the symbol we use to
determine which task is the currently-running task has changed.
This patch enhances the debugger to use the new name, and fallback on
the old name if not found (this is for compatibility with older versions
of the compiler/runtime).
gdb/ChangeLog:
* ravenscar-thread.c (running_thread_name): Change value.
(read_thread_id): Remove advance declaration.
(get_running_thread_msymbol): New function.
(has_ravenscar_runtime): Use get_running_thread_msymbol to
compute msym_running_thread.
(get_running_thread_id): Renames read_thread_id. Slight modifications
to not take any argument anymore, using get_running_thread_msymbol
to determine which symbol to use instead.
(ravenscar_running_thread): Use get_running_thread_id instead of
read_thread_id.
* ada-lang.c (modify_general_field): Remove.
(make_array_descriptor): Replace all modify_general_field calls by
modify_field.
* value.c (modify_field): Update comment. New variable bytesize.
Normalize BITPOS. Initialize BYTESIZE, use it.
Code cleanup.
* dwarf2read.c (alloc_one_comp_unit): Rename prototype to ...
(init_one_comp_unit): ... this one.
(prepare_one_comp_unit): New prototype.
(dw2_require_line_header, process_psymtab_comp_unit): Use
init_one_comp_unit.
(process_psymtab_comp_unit): Use prepare_one_comp_unit.
(load_partial_comp_unit): Remove variable attr. Use
init_one_comp_unit with xmalloc. Use prepare_one_comp_unit.
(load_full_comp_unit): Use init_one_comp_unit with xmalloc. Use
prepare_one_comp_unit.
(read_signatured_type): Remove variable attr. Use init_one_comp_unit.
Use prepare_one_comp_unit.
(alloc_one_comp_unit): Rename to ...
(init_one_comp_unit): ... here and remove there calloc, new parameter
cu.
(prepare_one_comp_unit): New function.
* python/py-breakpoint.c (BPPY_REQUIRE_VALID): Check if bp is
NULL.
(BPPY_SET_REQUIRE_VALID): Ditto.
(bpnum_is_valid): Delete function.
(bppy_get_visibility): New function.
(bppy_new): Parse for, and validate internal keyword. Pass
internal keyword to breakpoint or watchpoint functions.
(build_bp_list): New function.
(gdbpy_breakpoints): Rewrite. Use build_bp_list and
iterate_over_breakpoints.
(gdbpy_breakpoint_created): Rewrite. Do not store breakpoints in a
look-aside vector.
(gdbpy_breakpoint_deleted): Rewrite, defer breakpoint management
to internal breakpoint chain.
* breakpoint.c (set_breakpoint_number): New function.
(breakpoint_1): Check if breakpoint number is more than zero.
(set_raw_breakpoint_without_location): Set py_bp_object to NULL.
(create_breakpoint_sal): Take a new parameter called internal.
Call set_breakpoint_number with internal parameter. Do not
mention internal breakpoints. All callers updated.
(create_breakpoint): Ditto.
(create_breakpoints_sal): Ditto.
(watch_command_1): Ditto.
(watch_command_wrapper): Take a new parameter called internal.
All callers updated.
(rwatch_command_wrapper): Ditto.
(awatch_command_wrapper): Ditto.
(save_breakpoints): Update breakpoint save condition check.
(iterate_over_breakpoints): New function.
* breakpoint.h: Add conditional python includes. Add py_bp_object
and comment to struct breakpoint. Update all callers.
* defs.h: Add PyObject definition for GDB builds without Python.
2010-11-11 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Breakpoints In Python): Document "internal"
parameter, and visible attribute.
2010-11-11 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp: Add internal watchpoint and
breakpoint tests.
value_change_enclosing_type. All callers updated.
* value.h (set_value_enclosing_type): Update.
* valops.c (value_full_object): Always return a copy if we need to
make changes to the input value.
* breakpoint.c (watch_command_1): Get a pointer of the lazy
version of the expression's value, even if reading the value from
memory fails. When creating a -location watchpoint, get the
value's address from the lazy value pointer.
gdb/testsuite/
* gdb.base/watchpoint.exp: Test "watch -location" with an
innacessible location.
* infrun.c (restore_inferior_thread_state): Use
discard_inferior_thread_state to free the data.
(discard_inferior_thread_state): xfree also siginfo_data.
New command "set directories".
* NEWS: Document them.
* source.c (set_directories_command): New function.
(show_directories_1): Renamed from show_directories.
All callers updated.
(show_directories_command): New function.
(_initialize_source): Install "directories" as a set/show
variable instead of just a show command.
doc/
* gdb.texinfo (Source Path): Document "set directories".
testsuite/
* gdb.base/help.exp: Update expected output.
* gdb.python/py-parameter.exp: New file.
2010-11-04 Sami Wagiaalla <swagiaal@redhat.com>
* gdbtypes.h: Create struct rank.
Convert all 'BADNESS' macros to const struct rank declarations.
(sum_ranks): New function.
(compare_ranks): New function.
* valops.c (find_oload_champ): Updated.
(classify_oload_match): Use compare_ranks.
Improved comments.
(compare_parameters): Use compare_ranks.
* gdbtypes.c: Initialize 'BADNESS' constants.
(sum_ranks): New function.
(compare_ranks): New function.
(compare_badness): Use compare_ranks.
(rank_function): Use global constants instead of literals.
(rank_one_type): Ditto.
Return struct rank.
Use sum_ranks.
I noticed that some variables are only used inside one side of
an if/else blob. So I moved these variables inside that block for
better clarity.
gdb/ChangeLog:
* ada-valprint.c (ada_val_print_array): Move variables `eltlen'
and `len' declaration and computation inside block where they
are being used.
This patch should fix the following regression:
(gdb) print my_table
-$1 = ()
-(gdb) PASS: gdb.ada/null_array.exp: print my_table
+$1 = (warning: unable to get bounds of array, assuming null array
+)
+(gdb) FAIL: gdb.ada/null_array.exp: print my_table
The problem was introduced by a change in val_print_array_elements
which removed a check for the case where the array's high bound
is smaller than the array's low bound (empty array).
This change restores the check and forces the len to zero in that case.
Looking at the patch that caused the regression, I suspect that we may
have other parts that might have been broken (non-zero array low bound?).
gdb/ChangeLog:
* valprint.c (val_print_array_elements): Put back handling of
empty arrays.
* dwarf2read.c (read_array_type): Read the DW_AT_byte_size from the
DIE and set the length of the type.
* gdbtypes.h (get_array_bounds): Move here from valprint.h.
* gdbtypes.c (get_array_bounds): Move here from valprint.c and
return 0 if the corresponding bounds of the type are undefined.
* valprint.h (get_array_bounds): Move declaration to gdbtypes.h.
* valprint.c (get_array_bounds): Move implementation to gdbtypes.c.
(val_print_array_elements): Use get_array_bounds to compute the number
of array elements instead of dividing the length of the array by the
length of the element types.
* valarith.c (vector_binop): Likewise.
* valops.c (value_cast): Likewise.
* c-valprint.c (c_val_print): Likewise.
* c-typeprint.c (c_type_print_varspec_suffix): Likewise.
gdb/testsuite:
* gdb.base/gnu_vector.exp: Adjust expect messages.
enable pretty-printer, disable pretty-printer.
* NEWS: Mention them.
* data-directory/Makefile.in (PYTHON_FILES): Add gdb/printing.py,
gdb/command/__init__.py, gdb/command/pretty_printers.py.
* python/lib/gdb/__init__.py: Install pretty-printer commands.
* python/lib/gdb/printing.py: New file.
* python/lib/gdb/command/__init__.py: New file.
* python/lib/gdb/command/pretty_printers.py: New file.
doc/
* gdb.texinfo (Pretty Printing): Expand into three sections,
introduction, example, and commands.
(Python API): Delete section Disabling Pretty-Printers, merge into
Selecting Pretty-Printers.
(Writing a Pretty-Printer): New section. Move the pretty-printer
example here, and reformat to match python coding style. Add a second
example using the gdb.printing module.
(Python modules): Add gdb.printing.
testsuite/
* gdb.python/py-pp-maint.c: New file.
* gdb.python/py-pp-maint.exp: New file.
* gdb.python/py-pp-maint.py: New file.
(gdb_init): Add a comment regarding initialize_all_files.
Call finish_python_initialization at the end.
* python/python.h (finish_python_initialization): Declare.
* python/python.c (finish_python_initialization): New function.
(_initialize_python): Move python-implemented initialization there
and call it.
(GdbMethods): Use #ifdef HAVE_PYTHON for consistency.
Revert:
2010-10-17 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <pedro@codesourcery.com>
* gdbthread.h (currently_stepping): New declaration.
* infrun.c (currently_stepping): Remove the forward declaration.
(currently_stepping): Make it global.
* linux-nat.c (resume_callback) <lp->stopped && lp->status == 0>: New
variables tp and step, initialized them. Pass STEP to to_resume.
Print also possibly "PTRACE_SINGLESTEP" if STEP. Initialize LP->STEP.
* remote.c (currently_stepping_callback): New.
(remote_vcont_resume)
<ptid_equal (ptid, minus_one_ptid) || ptid_is_pid (ptid)>:
New variable tp. Call currently_stepping_callback and step such
thread.
gdb/testsuite/
Revert:
2010-10-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.threads/sigstep-threads.exp: New file.
* gdb.threads/sigstep-threads.c: New file.
There were two types of errors, mostly compiler warnings:
1. _FILE_OFFSET_BITS being redefined in pyconfig.h;
This is a problem we're familiar with, having seen similar
issues on GNU/Linux systems. I used a similar solution.
2. GCC 4.5 complains that calls to PyEval_InitThreads and
PyEval_ReleaseLock have no effect. This is because our Python
is built without thread support, leading us to use the dummy
#define in python-internal.h which just gets replaced by `0'.
Since this function returns void (checked versions 2.4 and 2.7),
I simply removed the 0.
gdb/ChangeLog:
python/python-internal.h (_FILE_OFFSET_BITS): Undefine.
(PyEval_InitThreads): Remove duplicate. Define as nothing.
(PyEval_ReleaseLock): Define as nothing.
This change gets rid of an ARI warning which was recently introduced
by one of our changes.
gdb/ChangeLog:
* dictionary.c (dict_hash): Move assignment out of if condition.
recursively invoke make for install-only.
* data-directory/Makefile.in: Add FLAGS_TO_PASS variable.
(install): Pass FLAGS_TO_PASS when recursively make install-only.
gdbserver/
* Makefile.in: Add FLAGS_TO_PASS variable.
(install): Remove dependency of install-only and recursively
invoke make for install-only.
2010-10-19 Sami Wagiaalla <swagiaal@redhat.com>
* gdbtypes.h: Introduce BOOL_PTR_CONVERSION_BADNESS.
* gdbtypes.c (rank_one_type): Use BOOL_PTR_CONVERSION_BADNESS
for conversion.
Make all other conversions illegal.
2010-10-19 Sami Wagiaalla <swagiaal@redhat.com>
* gdb.cp/converts.exp: Test pointer to bool conversion.
Test pointer to long conversion.
* gdb.cp/oranking.exp: Removed relevant kfail.
* valprint.c (val_print_string): Pass 'encoding' to
LA_PRINT_STRING.
gdb/testsuite
* gdb.python/py-prettyprint.exp (run_lang_tests): Test encoding
argument to lazy_string.
* gdb.python/py-prettyprint.py (pp_ls_encoding): New global.
(pp_ls.to_string): Use it.
* gdb.python/py-prettyprint.c (main): Move declarations to top.
Add "estring2" local.
Fix the `stopped language detection' testcase for gcc-4.5.
* dwarf2read.c (read_partial_die): Set also LANGUAGE_OF_MAIN.
* symfile.c (set_initial_language): Move variable filename to a more
inner block. Prefer LANGUAGE_OF_MAIN.
* symtab.c (language_of_main): New variable.
(set_main_name): Always reset LANGUAGE_OF_MAIN.
* symtab.h (language_of_main): New declaration.
* infrun.c (follow_exec): Replace symbol_file_add_main by
symbol_file_add with SYMFILE_DEFER_BP_RESET, set_initial_language and
breakpoint_re_set.
* m32r-rom.c (m32r_load, m32r_upload_command): Use parameter 0 for
clear_symtab_users.
* objfiles.c (free_all_objfiles): Likewise.
* remote-m32r-sdi.c (m32r_load): Likewise.
* solib-som.c (som_solib_create_inferior_hook): Likewise.
* symfile.c (new_symfile_objfile): New comment for add_flags. Call
clear_symtab_users with ADD_FLAGS.
(reread_symbols): Use parameter 0 for clear_symtab_users.
(clear_symtab_users): New parameter add_flags. Do not call
breakpoint_re_set if SYMFILE_DEFER_BP_RESET.
(clear_symtab_users_cleanup): Use parameter 0 for clear_symtab_users.
* symtab.h (clear_symtab_users): New parameter add_flags.
gdb/testsuite/
* gdb.base/pie-execl.exp: New file.
* gdb.base/pie-execl.c: New file.
PR exp/12117
* gdbtypes.c (check_typedef): Clean up function comment.
Keep track of instance flags as we strip typedefs and create a new
type to preserve them if necessary.
* gdbtypes.h (type) <instance_flags>: Extend the comment.
gdb/testsuite/
PR exp/12117
* gdb.cp/ptype-cv-cp.cc: New file.
* gdb.cp/ptype-cv-cp.exp: New file.
2010-10-14 Sami Wagiaalla <swagiaal@redhat.com>
* gdbtypes.h: Create BASE_PTR_CONVERSION_BADNESS.
* gdbtypes.c (rank_one_type): Move type comparison code out of here
to...
(types_equal): ...here. And changed it as follows:
Outside of typedefs type must be of the same TYPE_CODE.
When compairing two pointers or references they are equal if their
targets are equal.
Correct pointer conversions.
2010-10-14 Sami Wagiaalla <swagiaal@redhat.com>
* gdb.cp/converts.cc: New test program.
* gdb.cp/converts.exp: New test.
* gdb.cp/overload.exp: Added test for void* vs int*.
* gdb.cp/overload.exp: Ditto.
* gdb.cp/oranking.exp: Removed related kfail.
* python/py-breakpoint.c (bppy_set_condition): New comment.
* python/py-cmd.c (cmdpy_function): Call also gdbpy_print_stack for
failed PyUnicode_Decode.
(cmdpy_completer): Skip element for failed
python_string_to_host_string.
(cmdpy_init): Return -1 on failed python_string_to_host_string.
* python/py-frame.c (frapy_read_var): Extend the function comment.
* python/py-function.c (fnpy_init): Return -1 on failed
python_string_to_host_string.
* python/py-inferior.c (infpy_read_memory, infpy_write_memory): Extend
the function comment.
(infpy_search_memory): Extend the function comment. Remove the
PyErr_SetString call on already set error state.
* python/py-param.c (set_parameter_value): Extend the function
comment. Return -1 on failed python_string_to_host_string, twice.
(set_attr): Extend the function comment.
(compute_enum_values): Extend the function comment. New variable
back_to. Protect self->enumeration by BACK_TO cleanups. Return 0 on
failed python_string_to_host_string.
(get_doc_string): Call gdbpy_print_stack on failed
python_string_to_host_string.
(parmpy_init): Extend the function comment.
* python/py-prettyprint.c (pretty_print_one_value): Likewise.
(gdbpy_get_display_hint, print_children): Call gdbpy_print_stack on
failed python_string_to_host_string.
* python/py-value.c (valpy_new, valpy_getitem, valpy_call)
(valpy_binop, valpy_richcompare): Extend the function comment.
* python/python.c
(struct python_env) <error_type, error_value, error_traceback>: New
fields.
(restore_python_env): Handle PyErr_Occurred. Call PyErr_Restore.
(ensure_python_env): Call PyErr_Fetch.
* varobj.c (update_dynamic_varobj_children): Call gdbpy_print_stack on
failed convert_value_from_python.
(value_get_print_value): Call gdbpy_print_stack on failed
python_string_to_target_python_string.
gdb/testsuite/
* gdb.python/py-error.exp: New file.
* gdb.python/py-error.py: New file.
2010-10-12 Sami Wagiaalla <swagiaal@redhat.com>
* gdbtypes.c (do_is_ancestor): New function.
(is_ancestor): Use do_is_ancestor.
(is_public_ancestor): Use do_is_ancestor.
Fix attaching to re-prelinked executables on ppc64.
* solib-svr4.c (svr4_exec_displacement): New variable plt2_asect,
initialize it, try to adjust FILESZ field by it.
(thumb_instruction_changes_pc): Likewise.
(thumb2_instruction_changes_pc): Likewise.
(thumb_analyze_prologue): Handle 32-bit Thumb instructions during
prologue parsing. Improved support for optimized code.
(thumb_scan_prologue): Do not reply on line-number information,
use same heuristics as arm_scan_prologue insead.
(skip_prologue_function): Accept functions
"__tls_get_addr" and "__aeabi_read_tp".
symbol_table and index_table_slots to symbol_table_slots.
All uses updated.
(create_symbol_hash_table): Renamed from create_index_table.
All callers updated.
(add_indices_to_cpool): Rename arg index_table to symbol_hash_table.
(write_hash_table): Rename local index_table to symbol_hash_table.
(addrmap_foreach): Declare.
* addrmap.c (struct addrmap_funcs): New member foreach.
(addrmap_foreach): New function.
(addrmap_fixed_foreach): New function.
(addrmap_fixed_funcs): Update.
(struct mutable_foreach_data): New struct.
(addrmap_mutable_foreach_worker): New function.
(addrmap_mutable_foreach): New function.
(addrmap_mutable_funcs): Update.
Several changes to dict_hash from Adacore's local version were inadvertantly
left out of the last change to that function. These changes conservatively
cause dict_hash to revert to msymbol_hash_iw in more cases where the symbol
being hashed is known not to be Ada-encoded. This avoids a few cases where
the function hashes large groups of names with similar prefixes to the same
value.
Changelog:
gdb/
* dictionary.c (dict_hash): Revert to msymbol_hash_iw in
more cases.
This is a clean-up of some of our symbol-lookup machinery to pull some
kludgy Ada-specific definitions out of psymtab.c. In place of
map_ada_symtabs and ada_lookup_partial_symbol, we have a method
map_matching_symbols, which searches through all symbol tables and
partial symbol tables looking for a symbol that matches according to
a matching function that is passed as a parameter. This requires some
care, because partial symbol tables speed up searches by binary search,
while full symbol tables use hashing. To call map_matching_symbols, therefore,
you may need to supply both a matching function that is compatible with the
dictionary hash function and an ordering relation that is compatible with
strcmp_iw, which is used to order partial symbol tables.
Having added this general routine to psymtab.c, we use it in ada-lang.c
to rework add_non_local_symbols (now renamed add_nonlocal_symbols).
Changelog:
gdb/
* ada-lang.c (full_match): Declare.
(ada_match_name): Rename to match_name (we should avoid prefixing static
symbols with "ada_").
(match_name): New name for ada_match_name.
(struct ada_psym_data): Remove and replace with...
(struct match_data): User data for map_matching_symbols.
(ada_add_psyms): Remove.
(aux_add_nonlocal_symbols): New function, used as callback for
map_matching_symbols.
(compare_names): Ordering function adopted from strcmp_iw for Ada-encoded
symbols.
(ada_add_non_local_symbols): Rename to add_nonlocal_symbols.
(add_nonlocal_symbols): Renamed from ada_add_non_local_symbols.
Rework to use map_matching_symbols instead of map_ada_symtabs.
(ada_lookup_symbol_list): Use add_nonlocal_symbols.
* psymtab.c: Include dependency on dictionary.h.
(match_partial_symbol): New function.
(ada_lookup_partial_symbol): Remove.
(map_block): New function, auxiliary to map_matching_symbols_psymtab.
(map_matching_symbols_psymtab): New function.
(psym_functions): Replace map_ada_symtabs with map_matching_symbols_psymtab.
* symfile.h: Replace map_ada_symtabs definition with map_matching_symbols.
This patch allows Ada to speed up symbol lookup by using the facilities
in dictionary.[ch] for hashed lookups. First, we generalize dictionary
search to allow clients to specify any matching function compatible with
the hashing function. Next, we modify the hashing algorithm so that symbols
that wild-match a name hash to the same value. Finally, we modify Ada
symbol lookup to use these facilities.
Because this patch touches on a hashing algorithm used by other
languages, I took the precaution of doing a speed test on a list of
about 12000 identifiers (repeatedly inserting all of them into a table
and then doing a lookup on a million names at random, thus testing the
speed of the hashing algorithm and how well it distributed names).
There was actually a slight speedup, probably as a result of open-
coding some of the tests in msymbol_hash_iw. By design, the revised
hashing algorithm produces the same results as the original on most
"normal" C identifiers.
We considered augmenting the dictionary interface still further by allowing
different hashing algorithms for different dictionaries, based on the
(supposed) language of the symbols in that dictionary. While this produced
better isolation of the changes to Ada programs, the additional flexibility
also complicated the dictionary interface. I'd prefer to keep things
simple for now.
Tested w/o regressions on Linux i686.
ChangeLog:
gdb/
* ada-lang.c (ada_match_name): Use new API for wild_match.
(wild_match): Change API to be consistent with that of strcmp_iw;
return 0 for a match, and switch operand order.
(full_match): New function.
(ada_add_block_symbols): Use dict_iter_match_{first,next} for
matching to allow use of hashing.
* dictionary.c (struct dict_vector): Generalize iter_name_first,
iter_name_next ot iter_match_first, iter_match_next.
(iter_name_first_hashed): Replace with iter_match_first_hashed.
(iter_name_next_hashed): Replace with iter_match_next_hashed.
(iter_name_first_linear): Replace with iter_match_first_linear.
(iter_name_next_linear): Replace with iter_match_next_linear.
(dict_iter_name_first): Re-implement to use dict_iter_match_first.
(dict_iter_name_next): Re-implement to use dict_iter_match_next.
(dict_iter_match_first): New function.
(dict_iter_match_next): New function.
(dict_hash): New function.
* dictionary.h (dict_iter_match_first, dict_iter_match_next): Declare.
* psymtab.c (ada_lookup_partial_symbol): Use new wild_match API.
* Makefile.in (XML_SYSCALL_DIR, XML_SYSCALL_FILES): Moved to
data-directory/Makefile.in.
(SUBDIRS): Add data-directory.
(all): Remove xml-syscall-copy dependency.
(xml-syscall-copy): Moved to data-directory/Makefile.in as
stamp-syscalls.
(xml-syscall-install): Moved to data-directory/Makefile.in as
install-syscalls.
(install-only): Remove xml-syscall-install dependency.
(all-data-directory): New rule.
(data-directory/Makefile): New rule.
* configure.ac (AC_OUTPUT): Add data-directory/Makefile.
* configure: Regenerate.
* data-directory/Makefile.in: New file.
* python/lib/gdb/__init__.py: New file.
testsuite/
* gdb.base/catch-syscall.exp (do_syscall_tests): Update location
of syscall staging area.
When one of the parameter values in a subprogram calls is an array
whose value does not come from inferior memory, the debugger first
copies the array value in inferior memory. Up to now, the memory
used to hold that copy was taken from the stack (just below the SP),
but this is causing problems on SPARC v9.
So the immediate fix is to follow what C does with arrays and strings,
which is allocate memory on the heap.
gdb/ChangeLog:
* ada-lang.c: #include "value.h".
(ensure_lval): Delete advance declaration. Remove gdbarch and sp
arguments. Implement using value_allocate_space_in_inferior
instead of allocating memory from the stack.
(make_array_descriptor): Remove gdbarch and sp parameters. Update
calls to ensure_lval.
(ada_convert_actual): Remove gdbarch and sp parameters. Update
calls to make_array_descriptor and ensure_lval.
* ada-lang.h (ada_convert_actual): Update declaration.
* infcall.c (value_arg_coerce): Update call to ada_convert_actual.
When a type is marked with pragma Unchecked_Variants, ptype did not print
variants having a single component, since the compiler produces incorrect
debugging output for such cases. With this patch, we special-case these
components so that they print.
Changelog:
* gdb/ada-typeprint.c (print_selected_record_field_types): New function,
incorporating and generalizing print_record_field_types.
(print_record_field_types): Change return value and update comment.
Re-implement using print_selected_record_field_types.
(print_choices): Print "=>" here.
Handle case of unencoded variant branch.
(print_variant_clauses): Reformat comment.
Special-case unencoded variant branch.
This new version of wild_match is comparable in speed to strcmp_iw, and has
the same signature and same return value for equal names.
gdb/ChangeLog:
* ada-lang.c (wild_match): Reimplement.
Change API to eliminate unused length argument, reverse arguments and
make 0 the 'true' return value.
(advance_wild_match): New auxiliary function for wild_match to improve
readability.
(ada_match_name, ada_add_block_symbols): Use new API for wild_match.
* psymtab.c (ada_lookup_partial_symbol, map_ada_symtabs): Use new
API for wild_match.
* symfile.h (map_ada_symtabs): Modify declaration to use new API for
wild_match.
* dwarf2read.c (dw2_map_ada_symtabs): Ditto.
This patch adds handling of the case when a fat pointer has the
P_ARRAY and/or P_BOUNDS fields defined as a stub. In that case,
this stub needs to be resolved.
There are two issues:
. First, making sure that the resolution takes place itself.
That's the change to ada_check_typedef.
. Make sure that the type returned after resolution is not itself
a typedef. This is the change to ada_check_typedef.
gdb/ChangeLog (Jerome Guitton, Joel Brobecker):
* ada-lang.c (desc_bounds): Add handling of the case where
the P_BOUNDS field is a pointer to a stub.
(desc_data_target_type): Same for P_ARRAY field.
(ada_check_typedef): Strip the typedef layers from the type
found by ada_find_any_type.
gdb/ChangeLog:
* sparc-tdep.c (sparc32_frame_align): New function.
(sparc32_gdbarch_init): Set the frame_align gdbarch method.
* sparc64-tdep.c (sparc64_frame_align): New function.
(sparc64_gdbarch_init): Set the frame_align gdbarch method.
* value.c (value_primitive_field): Take 'offset' into account for
packed field.
gdb/testsuite
* gdb.base/anon.exp: New file.
* gdb.base/anon.c: New file.
Fix printing parameters of inlined functions.
* ada-lang.c (is_known_support_routine)
(ada_unhandled_exception_name_addr_from_raise): Provide NULL parameter
for find_frame_funname.
* python/py-frame.c (frapy_name): Likewise.
* stack.c (find_frame_funname): New parameter funcp. Update the
function comment. Fill it in.
(print_frame): New variable func. Initialize it by
find_frame_funname. Print arguments only if FUNC is not NULL. Use
FUNC as the parameter of print_args_stub.
* stack.h (find_frame_funname): New parameter funcp. Remove the
function declaration comment.
gdb/testsuite/
Fix printing parameters of inlined functions.
* gdb.dwarf2/dw2-inline-param.exp: New file.
* gdb.dwarf2/dw2-inline-param-main.c: New file.
* gdb.dwarf2/dw2-inline-param.S: New file.
PR corefiles/12071.
* inferior.c (have_live_inferiors): New variables old_chain, inf and
tp. Iterate INFERIOR_LIST and call target_has_execution.
gdb/testsuite/
PR corefiles/12071.
* gdb.base/corefile.exp (quit with a process, no question: load core)
(quit with a core file): New tests.
Fix GDB crash on inferior calls with self-referencing classes.
* gnu-v3-abi.c (gnuv3_pass_by_reference): Do not call itself on static
member fields.
gdb/testsuite/
Fix GDB crash on inferior calls with self-referencing classes.
* gdb.dwarf2/dw2-cp-infcall-ref-static.exp: New file.
* gdb.dwarf2/dw2-cp-infcall-ref-static-main.c: New file.
* gdb.dwarf2/dw2-cp-infcall-ref-static.S: New file.
* dwarf2read.c (partial_die_info): New fields fixup_called,
linkage_name.
(guess_partial_die_structure_name): Renamed from guess_structure_name.
Move definition next to use. Use linkage_name to determine if class
is in a namespace. All callers updated.
(fixup_partial_die): Return early if already called.
Set fixup_called when done.
(guess_full_die_structure_name): New function.
(determine_prefix): Call it for class/struct/union dies if c++ and
.debug_types section is present and parent is DW_TAG_compile_unit.
This announces the support for debugging Ada programs using
the Ravenscar Profile, as well as documents the new commands
introduced as part of this effort.
gdb/ChangeLog:
* NEWS: Announce Ravenscar Profile support.
gdb/doc/ChangeLog:
* gdb.texinfo (Ravenscar Profile): New node.
gdb/ChangeLog (Jerome Guitton, Joel Brobecker):
* ravenscar-thread.c, ravenscar-thread.h, ravenscar-sparc-thread.c:
New files.
* configure.tgt (sparc-*-*): Add ravenscar-thread.o and
ravenscar-sparc-thread.o to gdb_target_obs.