This is a minor improvement in ada_find_renaming_symbol: What we were
doing was going from a symbol, get its name, and then search for
renamings. But if the original symbol was already itself a renaming,
then we'd look the symbol up again to return it. Since we had the
symbol in the first place, we shouldn't need to look it up again.
This is what this patch does: Modify ada_find_renaming_symbol to
take a symbol instead of the symbol's (linkage) name, and then updates
the one caller.
gdb/ChangeLog:
* ada-lang.h (ada_find_renaming_symbol): Replace parameter
"name" with "struct symbol *name_sym".
* ada-exp.y (write_var_or_type): Update call to
ada_find_renaming_symbol.
* ada-lang.c (ada_find_renaming_symbol): Replace parameter
"name" with "struct symbol *name_sym". Adjust Implementation
accordingly. Adjust the function documentation.
Consider the following function...
3 procedure Foo is
4 I : Integer := Ident (10);
5 Obj : Base;
6 begin
7 Obj.X := I;
8 Do_Nothing (Obj.X'Address);
9 end Foo;
... where type "Base" is defined as a plain tagged record. If the user
stops execution before "Obj" gets initialized (for example, by inserting
a breakpoint "on" the function - or in other words, by inserting a
breakpoint using the function name as the location), one might get
the following of output if you try printing the value of obj:
(gdb) p obj
object size is larger than varsize-limit
object size is larger than varsize-limit
object size is larger than varsize-limit
$1 = object size is larger than varsize-limit
(x => 4204154)
Same thing with "info locals":
(gdb) info locals
i = 0
obj = object size is larger than varsize-limit
(x => 4204154)
We have also seen different error messages such as "Cannot read
memory at 0x...".
The error happens because we are trying to read the dispatch table
of a tagged type variable before it gets initialized. So the errors
might legitimately occur, and are supposed to be be contained.
However, the way things are written in ada-lang.c:ada_tag_name,
although the exception is in fact contained, the error message still
gets to be printed out.
This patch prevents this from happening by eliminating the use of
catch_errors, and using a TRY_CATCH block instead. Doing this removed
the need to use functions specifically fitted for catch_errors, and
thus some other simplifications could me made. In the end, the code
got reorganized a bit to better show the logic behind it, as well as
the common patterns.
gdb/ChangeLog:
* ada-lang.c (struct tag_args): Delete.
(ada_get_tsd_type): Function body moved up in source file.
(ada_tag_name_1, ada_tag_name_2): Delete.
(ada_get_tsd_from_tag): New function.
(ada_tag_name_from_tsd): New function.
(ada_tag_name): Use a TRY_CATCH block instead of catch_errors
to determine the tag name.
gdb/testsuite/ChangeLog:
* gdb.ada/tagged_not_init: New testcase.
This patch introduces two new functions that will be used to support
the implementation of the ada-varobj effort. The function descriptions
should say it all...
gdb/ChangeLog:
* ada-lang.h (ada_get_decoded_value, ada_get_decoded_type): Add
declaration.
* ada-lang.c (ada_get_decoded_value, ada_get_decoded_type): New
function.
The ada_lookup_symbol_list function has recently been changed to accept
a "full_search" parameter. When null, this parameter instructs the
function to perform a partial search (global and static symbols are not
searched). When doing a partial search, the result should not be saved
into the lookup cache, as the result might be incomplete.
This manifested itself when trying to perform a function call on AVR
after having inserted a breakpoint inside that function:
(gdb) b same
Breakpoint 2 at 0x78: file r.adb, line 5.
(gdb) call same(42)
Breakpoint 2, r.same (i=42) at r.adb:5
5 return I;
The program being debugged stopped while in a function called from GDB.
Evaluation of the expression containing the function
(at 0x0x800068) will be abandoned.
^^^^^^^^^^^^^^^
When the function is done executing, GDB will silently stop.
The expected output for the underlined portion is "(r.same)".
What happens is that the breakpoint command triggers 3 lookups of the
name "same":
1. full search in LABEL_DOMAIN -> no match, cached;
2. full search in VAR_DOMAIN -> 1 match, cached;
3. partial search in VAR_DOMAIN -> no match, cached.
The third lookup therefore causes the results of the partial search
to be cached, thus overriding the result of the full search lookup.
During the following command, the reference to "same" triggers a lookup
of that symbol again. And since GDB CAN find the result of that lookup
in the cache, it returns just that, which is: No match. (wrong!)
As a result, we fallback on the symbol table to resolve the lookup.
And instead of pushing an OP_VAR_VALUE subexpression for symbol "same",
the parser ends up pushing an UNOP_MEMVAL subexpression using the value
of the minimal symbol. This is where being on AVR becomes important:
addresses on AVR are modular types, and if GDB thinks an address is
a data address, it converts it.
This is where one notices the fact that the breakpoint was inserted
at 0x78, and yet GDB says that the function we stopped at is at
0x0x800068...
This patch fixes the problem by making sure we only cache the result
of full searches.
gdb/ChangeLog:
* ada-lang.c (ada_lookup_symbol_list): Only cache the result of
full searches.
Consider the following declarations (a packed array indexed by an
enumerated type):
type Color is (Black, Red, Green, Blue, White);
type Full_Table is array (Color) of Boolean;
pragma Pack (Full_Table);
Full : Full_Table := (False, True, False, True, False);
GDB is unable to print the index values correctly. It prints the
enumeration's underlying value instead of the enumeration name:
(gdb) p full
$1 = (0 => false, true, false, true, false)
(gdb) p full'first
$2 = 0
And yet, it is capable of printing the correct type description:
(gdb) ptype full
type = array (black .. white) of boolean <packed: 1-bit elements>
To get to the real index type, one has to follow the parallel XA type.
We already do this for normal arrays. We can do it for this packed
array as well.
gdb/ChangeLog:
* ada-lang.c (constrained_packed_array_type): If there is a
parallel XA type, use it to determine the array index type.
gdb/testsuite/ChangeLog:
* gdb.ada/arrayidx.exp: Adjust expected output for p_one_two_three.
* gdb.ada/enum_idx_packed: New testcase.
We should always unwrap a value before trying to "fix" it. It is
therefore logical that ada_to_fixed_value would call unwrap_value
before creating the fixed value.
This simplifies the code in ada-lang.c a bit.
gdb/ChangeLog:
* ada-lang.c (ada_to_fixed_value): Call unwrap_value before
creating fixed value.
(ada_value_ind, ada_coerce_ref, assign_component)
(ada_evaluate_subexp): Remove call to unwrap_value before
call to ada_to_fixed_value.
Consider the following declaration:
type Full_Table is array (Color) of Integer;
Full : Full_Table := (144, 233, 377, 610, 987);
The debugger correctly prints the type name of variable "full":
(gdb) whatis full
type = pck.full_table
But is unable to do so when using the value history:
(gdb) print full
$1 = (144, 233, 377, 610, 987)
(gdb) whatis $
!!! -> type = array (black .. white) of integer
This is because the evaluation creates a "fixed" version of
the array type, and that "fixed" version is missing a type name.
As a result, whatis falls back to describing the type (a la ptype)
instead of printing the type name.
gdb/ChangeLog:
* ada-lang.c (to_fixed_array_type): Set result's type name.
gdb/testsuite/ChangeLog:
* gdb.ada/whatis_array_val: New testcase.
Previously, conditions could be associated to Ada exception catchpoints,
but not while creating the exception catchpoint:
(gdb) catch exception first_exception if except_counter = 5
Junk at end of expression
This patch improves the parsing of the command arguments to allow
an "if CONDITION" at the end. All Ada exception catchpoint commands
have been enhanced to support this.
gdb/ChangeLog:
* ada-lang.c (catch_ada_exception_command_split): Add new
argument cond_string. Add support for condition at end of
"catch exception" commands.
(ada_decode_exception_location): Add new argument cond_string.
Update call to catch_ada_exception_command_split.
(create_ada_exception_catchpoint): Add new argument cond_string.
Set the breakpoint condition if needed.
(catch_ada_exception_command): Update call to
ada_decode_exception_location.
(ada_decode_assert_location): Add function documentation.
Add support for condition at end of "catch assert" command.
(catch_assert_command): Update calls to ada_decode_assert_location
and create_ada_exception_catchpoint.
The la_get_symbol_name_match_p language hook was poorly named, as
it suggested that the function should return nonzero if the names
match, whereas it is the exact opposite. This patch therefore
renames the hook and associated typedef, as well some of the code
that uses that hook.
gdb/ChangeLog:
* language.h (symbol_name_cmp_ftype): Renames
symbol_name_match_p_ftype.
(struct language_defn)[la_get_symbol_name_cmp]: Renames
la_get_symbol_name_match_p.
* ada-lang.c (ada_get_symbol_name_cmp): Renames
ada_get_symbol_name_match_p. Update comment.
(ada_language_defn)[la_get_symbol_name_cmp]: Update value.
* linespec.c (struct symbol_matcher_data)[symbol_name_cmp]:
Renames symbol_name_match_p. Update field type.
(iterate_name_matcher, iterate_over_all_matching_symtabs): Adjust.
* c-lang.c, d-lang.c, f-lang.c, jv-lang.c, m2-lang.c, objc-lang.c,
opencl-lang.c, p-lang.c: Replace "la_get_symbol_name_match_p" by
"la_get_symbol_name_cmp" in comments.
* language.c: Likewise.
and fields.name members from char * to const char *. All uses updated.
(struct cplus_struct_type): Change type of fn_fieldlists.name member
from char * to const char *. All uses updated.
(type_name_no_tag): Update.
(lookup_unsigned_typename, lookup_signed_typename): Update.
* gdbtypes.c (type_name_no_tag): Change result type
from char * to const char *. All callers updated.
(lookup_unsigned_typename, lookup_signed_typename): Change type of
name parameter from char * to const char *.
* symtab.h (struct cplus_specific): Change type of demangled_name
member from char * to const char *. All uses updated.
(struct general_symbol_info): Change type of name and
mangled_lang.demangled_name members from char * to const char *.
All uses updated.
(symbol_get_demangled_name, symbol_natural_name): Update.
(symbol_demangled_name, symbol_search_name): Update.
* symtab.c (symbol_get_demangled_name): Change result type
from char * to const char *. All callers updated.
(symbol_natural_name, symbol_demangled_name): Ditto.
(symbol_search_name): Ditto.
(completion_list_add_name): Change type of symname,sym_text,
text,word parameters from char * to const char *.
(completion_list_objc_symbol): Change type of sym_text,
text,word parameters from char * to const char *.
* ada-lang.c (find_struct_field): Change type of name parameter
from char * to const char *.
(encoded_ordered_before): Similarly for N0,N1 parameters.
(old_renaming_is_invisible): Similarly for function_name parameter.
(ada_type_name): Change result type from char * to const char *.
All callers updated.
* ada-lang.h (ada_type_name): Update.
* buildsym.c (hashname): Change type of name parameter
from char * to const char *.
* buildsym.h (hashname): Update.
* dbxread.c (end_psymtab): Change type of include_list parameter
from char ** to const char **.
* dwarf2read.c (determine_prefix): Change result type
from char * to const char *. All callers updated.
* f-lang.c (find_common_for_function): Change type of name, funcname
parameters from char * to const char *.
* f-lang.c (find_common_for_function): Update.
* f-valprint.c (list_all_visible_commons): Change type of funcname
parameters from char * to const char *.
* gdbarch.sh (static_transform_name): Change type of name parameter
and result from char * to const char *.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* i386-sol2-tdep.c (i386_sol2_static_transform_name): Change type
of name parameter from char * to const char *.
* jv-lang.c (java_primitive_type_from_name): Ditto.
(java_demangled_signature_length): Similarly for signature parameter.
(java_demangled_signature_copy): Ditto.
(java_demangle_type_signature): Ditto.
* jv-lang.h (java_primitive_type_from_name): Update.
(java_demangle_type_signature): Update.
* objc-lang.c (specialcmp): Change type of a,b parameters
from char * to const char *.
* p-lang.c (is_pascal_string_type): Change type of arrayname parameter
from char * to const char *. All callers updated.
* p-lang.h (is_pascal_string_type): Update.
* solib-frv.c (find_canonical_descriptor_in_load_object): Change type
of name parameter from char * to const char *.
* sparc-sol2-tdep.c (sparc_sol2_static_transform_name): Ditto.
* utils.c (fprintf_symbol_filtered): Ditto.
* defs.h (fprintf_symbol_filtered): Update.
* sparc-tdep.h (sparc_sol2_static_transform_name): Update.
* stabsread.h (end_psymtab): Update.
* stack.c (find_frame_funname): Change type of funname parameter
from char ** to const char **.
* stack.h (find_frame_funname): Update.
* typeprint.c (type_print): Change type of varstring parameter
from char * to const char *.
* value.h (type_print): Update.
* xcoffread.c (xcoff_start_psymtab): Change type of filename parameter
from char * to const char *. All callers updated.
(xcoff_end_psymtab): Change type of include_list parameter
from char ** to const char **. All callers updated.
(swap_sym): Similarly for name parameter. All callers updated.
* coffread.c (patch_type): Add (char*) cast to xfree parameter.
Use xstrdup.
(process_coff_symbol): Use xstrdup.
* stabsread.c (stabs_method_name_from_physname): Renamed from
update_method_name_from_physname. Change result type from void
to char *. All callers updated.
(read_member_functions): In has_destructor case, store name in objfile
obstack instead of malloc space. In !has_stub case, fix mem leak.
The quick_symbol_functions struct contains a field which is pointer
a function which takes another function, called name_matcher, as
its parameter. This name_matcher currently has 3 arguments, one
of them being the language. This parameter is no longer used, and
thus deleted.
gdb/ChangeLog:
* symfile.h (struct quick_symbol_functions) [expand_symtabs_matching]:
Remove language parameter from name_matcher. Adjust the comment.
* symtab.c (search_symbols_name_matches, expand_partial_symbol_name):
Remove language parameter.
* ada-lang.c (ada_expand_partial_symbol_name): Likewise.
* linespec.c (iterate_name_matcher): Likewise.
* dwarf2read.c (dw2_expand_symtabs_matching): Adjust type of
name_matcher. Adjust call accordingly.
* psymtab.c (expand_symtabs_matching_via_partial): Likewise.
(maintenance_check_symtabs): Adjust type of parameter "fun".
* psymtab.h (maintenance_check_symtabs): Likewise.
This is the meat, where we replace the old la_symbol_name_compare
language method with the new ada_get_symbol_name_match_p.
It fixes the problem when trying to insert a breakpoint on "+".
gdb/ChangeLog:
* language.h (symbol_name_match_p_ftype): New typedef.
(struct language_defn): Replace field la_symbol_name_compare
by la_get_symbol_name_match_p.
* ada-lang.c (ada_get_symbol_name_match_p): New function.
(ada_language_defn): Use it.
* linespec.c (struct symbol_matcher_data): New type.
(iterate_name_matcher): Rewrite.
(iterate_over_all_matching_symtabs): Pass a pointer to
a symbol_matcher_data struct to expand_symtabs_matching
instead of just the lookup name.
* c-lang.c, d-lang.c, jv-lang.c, m2-lang.c, objc-lang.c,
opencl-lang.c, p-lang.c, language.c: Delete field
la_symbol_name_compare, and replace by NULL for new field
la_get_symbol_name_match_p.
* symfile.h (struct quick_symbol_functions): Update comment.
This is just a minor cleanup that reduces a bit the code in ada-lang.c
by using skip_spaces or skip_to_space, instead of doing the skipping
ourselves.
gdb/ChangeLog:
* ada-lang.c: #include "cli/cli-utils.h".
(get_selections): Use skip_spaces.
(ada_get_next_arg): Use skip_spaces and skip_to_space.
(catch_ada_exception_command_split): Use skip_spaces.
(ada_decode_assert_location): Likewise.
... to avoid code duplication.
gdb/ChangeLog:
* ada-lang.c (should_use_wild_match): New function.
(ada_lookup_simple_minsym): Use should_use_wild_match.
Minor simplification. Add comment.
(ada_lookup_symbol_list): Use should_use_wild_match.
Minor simplification.
Consider the following declaration:
package Pck is
task Dummy_Task is
entry Start;
end Dummy_Task;
end Pck;
Inserting a breakpoint on the body of that task does not currently
work:
(gdb) b pck.dummy_task
"pck.dummy_task" is not a function
Make breakpoint pending on future shared library load? (y or [n]) n
What happens here is that the compiler generates two symbols:
(a) Symbol `pck__dummy_task' which is a *variable* referencing
the task;
(b) Symbol `pck__dummy_taskTKB' which is the subprogram implementing
the body of the task.
The symbol lookup only finds the variable before of the TKB suffix in
the subprogram name. This patch fixes the problem by adjusting the
ada-lang.c:is_name_suffix routine to recognize "TKB" suffixes. But
that's not enough, because the search in the symtab is performed via
the block dictionary, using a hashing algorithm. So, for the search
to find `pck__dummy_taskTKB', I had to modify the hashing function
to ignore TKB suffixes as well.
gdb/ChangeLog:
* ada-lang.c (is_name_suffix): Add handling of "TKB" suffixes.
Update function documentation.
* dictionary.c (dict_hash): Ignore "TKB" suffixes in hash
computation.
gdb/testsuite/ChangeLog:
* gdb.ada/task_bp: New testcase.
Field found_sym in add_nonlocal_symbols's struct match_data is
used uninitialized. Rather than adding the initialization of
this field (to zero), we set the entire structure to zero first,
and then set the fields that need to be initialized to non-zero
next.
gdb/ChangeLog:
* ada-lang.c (add_nonlocal_symbols): Initialize data to
all zeros. Remove setting of data.arg_sym to NULL.
The ada-lang module was using a static global called "exception_info"
for all inferiors. But each inferior might be different, and thus
this patch makes this data per-inferior.
gdb/ChangeLog:
* ada-lang.c (struct ada_inferior_data) [exception_info]:
New field.
(exception_info): Delete.
(ada_exception_support_info_sniffer): Get exception_support_info
data from our per-inferior data. Adjust code accordingly.
(ada_unhandled_exception_name_addr_from_raise): Likewise.
(ada_exception_name_addr_1, ada_exception_sym_name): Ditto.
(ada_executable_changed_observer): Delete.
(_initialize_ada_language): Remove call to
observer_attach_executable_changed.
This patch should help the user understand why the debugger is not
able to insert Ada exception catchpoints when the Ada runtime was
stripped of debugging info, as is often the case on many GNU/Linux
distros:
(gdb) catch exception
Your Ada runtime appears to be missing some debugging information.
Cannot insert Ada exception catchpoint in this configuration.
gdb/ChangeLog:
* ada-lang.c (ada_has_this_exception_support): Raise an error
if we could find the Ada exception hook in the Ada runtime,
but no debugging info for that hook.
gdb/testsuite/ChangeLog:
* gdb.ada/catch_ex.exp, gdb.ada/mi_catch_ex.exp: Adjust
expected output for unsupported case.
This patch cleans up a bit the way we detect which type of runtime
the program uses with respect to Ada exceptions. It also removes
an unnecessary check in ada_exception_sal which is already performed
by ada_exception_support_info_sniffer.
Some of the changes are preparation work for detecting the situation
where the Ada runtime is found, but lacking debugging info.
gdb/ChangeLog:
* ada-lang.c (ada_has_this_exception_support): New function,
extracted out of ada_exception_sal and ada_exception_sal.
(ada_exception_support_info_sniffer): Simplify by using
ada_has_this_exception_support.
(ada_exception_sal): Replace unnecessary checks by assertions.
Minor simplifications.
The ada-lang.c:compare_names function returns the wrong value
when the first string starts with the same contents as the second
string, followed by '_' and then some characters that do not make
a symbol name suffix. For instance:
string1 = "generics__test_generics__instance__print"
string2 = "generics__test_generics"
In that case, compare_names (string1, string2) return -1, when
clearly, string1 is greater than string2.
A consequence of this problem is that GDB may fail to lookup
"generics.test_generics" from our partial symtabs, because
partial symbols are ordered by strcmp_iw_ordered:
(gdb) b generics.test_generics
Function "generics.test_generics" not defined.
Make breakpoint pending on future shared library load? (y or [n])
gdb/ChangeLog:
* ada-lang.c (compare_names): Fix wrong return value in case
string1 starts with the same contents as string2, followed
by an underscore that do not start a symbol name suffix.
gdb/testsuite/ChangeLog:
* gdb.ada/fullname_bp: New testcase.
gdb/ChangeLog:
From Andrey Smirnov <andrew.smirnov@gmail.com>:
* ada-lang.c (assign_aggregate): Remove declaration of local
variable `i' which is shadowing another variable with the same
name declared in the outer scope.
This avoids shadowing issues with variables named base_type.
gdb/ChangeLog:
* ada-lang.c (get_base_type): Renames base_type. Adjust all
calls throughout this file.
Implement most breakpoint_ops methods for all breakpoint types,
and move the default handlings to the proper callbacks.
gdb/
* breakpoint.c (update_watchpoint): Always call the breakpoint's
works_in_software_mode method.
(insert_bp_location): Go through breakpoint_ops->insert_location
for software and hardware watchpoints.
(create_internal_breakpoint): Pass bkpt_breakpoint_ops as
breakpoint_ops.
(remove_breakpoint_1): Go through breakpoint_ops->remove_location
for software and hardware watchpoints.
(print_it_typical): Delete.
(print_bp_stop_message): Always call the breakpoint_ops->print_it
method.
(watchpoint_check): Adjust comment.
(bpstat_check_location): Simply always call the breakpoint's
breakpoint_hit method.
(bpstat_stop_status): Always call the breakpoint's check_status
method. Remove special cases for watchpoints and internal event
breakpoints from here (moved to the check_status implementations).
(print_one_breakpoint_location): Assume b->ops is never NULL.
Remove static tracepoint marker id printing from here (moved to
the print_one_detail callback implementation of tracepoints).
(init_bp_location): Assert OPS is never NULL.
(allocate_bp_location): Always call the breakpoint's
allocate_location method, and remove the default code from here.
(free_bp_location): Always call the location's dtor method, and
remove the default code from here.
(init_raw_breakpoint_without_location): Assert OPS is never NULL.
(set_raw_breakpoint_without_location): Add new breakpoint_ops
parameter. Pass it down.
(set_raw_breakpoint): Ditto.
(print_it_catch_fork): Adjust to take a bpstat as argument.
(catch_fork_breakpoint_ops): Install methods.
(print_it_catch_vfork): Adjust to take a bpstat as argument.
(catch_vfork_breakpoint_ops): Install methods.
(dtor_catch_syscall): Call the base dtor.
(print_it_catch_syscall): Adjust to take a bpstat as argument.
(catch_syscall_breakpoint_ops): Install methods.
(dtor_catch_exec): Call the base dtor.
(print_it_catch_exec): Adjust to take a bpstat as argument.
(catch_exec_breakpoint_ops): Install methods.
(hw_breakpoint_used_count, hw_watchpoint_used_count): Always call
the breakpoint's resources_needed method, and remove the default
code from here.
(set_momentary_breakpoint): Pass bkpt_breakpoint_ops as
breakpoint_ops.
(clone_momentary_breakpoint): Clone the original's ops.
(mention): Always call the breakpoint's print_mention method, and
remove the default code from here.
(create_breakpoint_sal): Adjust to pass the ops to
set_raw_breakpoint rather than setting it manually.
(create_breakpoint): Assert ops is never NULL. Adjust to pass the
ops to set_raw_breakpoint_without_location rather than setting it
manually.
(break_command_1): Pass bkpt_breakpoint_ops as breakpoint_ops.
(print_it_ranged_breakpoint): Adjust to take a bpstat as argument.
(ranged_breakpoint_ops): Install methods.
(break_range_command): Adjust to pass the ops to
set_raw_breakpoint rather than setting it manually.
(re_set_watchpoint, breakpoint_hit_watchpoint)
(check_status_watchpoint, resources_needed_watchpoint)
(works_in_software_mode_watchpoint, print_it_watchpoint)
(print_mention_watchpoint, print_recreate_watchpoint): New
functions.
(watchpoint_breakpoint_ops): Install new methods.
(print_it_masked_watchpoint): New function.
(masked_watchpoint_breakpoint_ops): Install new methods.
(watch_command_1): Adjust to pass the right breakpoint_ops to
set_raw_breakpoint_without_location rather than setting it
manually later. Record the current pspace.
(print_it_exception_catchpoint): Adjust to take a bpstat as
argument.
(gnu_v3_exception_catchpoint_ops): Install new methods.
(say_where): New function.
(null_re_set, null_check_status, null_works_in_software_mode)
(null_resources_needed, null_print_one_detail, bp_location_dtor):
New functions.
(bp_location_ops): New global.
(bkpt_dtor, bkpt_allocate_location, bkpt_re_set)
(bkpt_insert_location, bkpt_remove_location, bkpt_breakpoint_hit)
(bkpt_check_status, bkpt_resources_needed)
(bkpt_works_in_software_mode, bkpt_print_it, bkpt_print_mention)
(bkpt_print_recreate): New functions.
(bkpt_breakpoint_ops): New global.
(tracepoint_re_set, tracepoint_insert_location)
(tracepoint_remove_location, tracepoint_breakpoint_hit)
(tracepoint_check_status, tracepoint_works_in_software_mode)
(tracepoint_print_it, tracepoint_print_one_detail)
(tracepoint_print_mention, tracepoint_print_recreate): New
functions.
(tracepoint_breakpoint_ops): New global.
(delete_breakpoint): Always call the breakpoint's dtor method, and
remove the default handling from here.
(breakpoint_re_set_default): Make static.
(breakpoint_re_set_one): Always call the breakpoints re_set
method, and remove the default handling from here.
(trace_command, ftrace_command, strace_command)
(create_tracepoint_from_upload): Pass appropriate breakpoints_ops
to create_breakpoint.
(save_breakpoints): Always call the breakpoint's print_recreate
method, and remove the default handling from here.
* ada-lang.c (dtor_exception): Call the base dtor.
(re_set_exception): Call the base method.
(print_it_exception, print_it_catch_exception): Adjust to take a
bpstat as argument.
(catch_exception_breakpoint_ops): Install methods.
(print_it_catch_exception_unhandled): Adjust to take a bpstat as
argument.
(catch_exception_unhandled_breakpoint_ops): Install methods.
(print_it_catch_assert): Adjust to take a bpstat as argument.
(catch_assert_breakpoint_ops): Install methods.
* breakpoint.h (struct breakpoint_ops): Adjust the print_it method
to take a bpstat as argument.
(enum print_stop_action): Add describing comments to each enum
value.
(breakpoint_re_set_default): Delete declaration.
(null_re_set, null_works_in_software_mode, null_resources_needed)
(null_check_status, null_print_one_detail): Declare.
(bkpt_breakpoint_ops): Declare.
(bkpt_dtor, bkpt_allocate_location, bkpt_re_set)
(bkpt_insert_location, bkpt_remove_location, bkpt_breakpoint_hit)
(bkpt_check_status, bkpt_resources_needed)
(bkpt_works_in_software_mode, bkpt_print_it)
(null_print_one_detail, bkpt_print_mention, bkpt_print_recreate):
Declare.
* mi/mi-cmd-break.c (mi_cmd_break_insert): Adjust to pass
bkpt_breakpoint_ops.
* python/py-breakpoint.c (bppy_init): Ditto.
Temporary catchpoints on Ada exceptions are now displayed as "Temporary
catchpoint" as opposed to just "Catchpoint". This is cosmetic only, but
in line with what's done for other catchpoints as well as breakpoints.
gdb/ChangeLog:
* ada-lang.c (print_it_exception): Print temporary catchpoints
as "Temporary catchpoint".
(print_mention_exception): Likewise.
gdb/testsuite/ChangeLog:
* gdb.ada/catch_ex.exp: Add temporary catchpoint tests.
This is to avoid an unnecessary multiple-choice menu for an
expression involving an enumeral declared in two types, when
the second type is an identical copy of the first type. This
happens in the following situation:
type Color is (Black, Red, Green, Blue, White);
type RGB_Color is new Color range Red .. Blue;
In that case, an implict type is created, and is used as the base
type for type RGB_Color. This base type is a copy of type Color.
We've added some extensive comments explaining the situation and
our approach further.
gdb/ChangeLog:
* ada-lang.c (ada_identical_enum_types_p): New function.
(symbols_are_identical_enums): New function.
(remove_extra_symbols): Do nothing if NSYMS < 2.
Use symbols_are_identical_enums.
gdb/testsuite/ChangeLog:
* gdb.ada/same_enum: New testcase.
If we declare a type as being an access to array type, and then
declare a variable of that type, for instance:
type Some_Array is array [...];
type Array_Access is access all Some_Array;
Table : Array_Access := [...];
The variable "Table" may be defined in the debugging information
as being a typedef to the array pointer type. In the past, it was
defined directly as the array pointer type, but this has been changed
to make sure that the typedef type gets used.
If the typedef type wasn't used, it would allow the compiler to stop
emitting that typedef type when compiling with
-feliminate-unused-debug-types. The removal of this typedef would
be a problem, because GDB relies on the typedef to create symbols
for pointer types, and without it, we would no longer be able to
do "ptype array_access".
This patch helps prevent incorrect output or even crashes when that
extra typedef layer is used.
The testing is already mostly covered by arrayptr.exp, but I still
added a 'ptype' test, just for good measure.
gdb/ChangeLog: (Eric Botcazou)
* ada-lang.c (thin_descriptor_type): Deal with typedefs.
(decode_constrained_packed_array): Likewise.
(ada_evaluate_subexp) <TERNOP_SLICE>: Likewise.
gdb/testsuite/ChangeLog (Joel Brobecker):
* gdb.ada/arrayptr.exp: Add ptype test.
* breakpoint.c (bpstat_stop_status): Call the check_status
breakpoint_ops method.
(print_one_breakpoint_location): Also print the condition for Ada
exception catchpoints.
(allocate_bp_location): New, factored out from
allocate_bp_location.
(allocate_bp_location): Adjust. Call the owner breakpoint's
allocate_location method, if there is one.
(free_bp_location): Call the locations's dtor method, if there is
one.
(init_raw_breakpoint_without_location): New breakpoint_ops
parameter. Use it.
(set_raw_breakpoint_without_location): Adjust.
(init_raw_breakpoint): New breakpoint_ops parameter. Pass it down.
(set_raw_breakpoint): Adjust.
(catch_fork_breakpoint_ops, catch_vfork_breakpoint_ops)
(catch_syscall_breakpoint_ops): Install NULL allocate_location,
re_set and check_status methods.
(init_catchpoint): Don't memset, initialize thread, addr_string
and enable_state. Pass the ops down to init_raw_breakpoint.
(install_catchpoint): Rename to ...
(install_breakpoint): ... this, and make extern.
(create_fork_vfork_event_catchpoint): Adjust.
(catch_exec_breakpoint_ops): Install NULL allocate_location,
re_set and check_status methods.
(create_syscall_event_catchpoint): Adjust.
(ranged_breakpoint_ops, watchpoint_breakpoint_ops)
(masked_watchpoint_breakpoint_ops): Install NULL
allocate_location, re_set and check_status methods.
(catch_exec_command_1): Adjust.
(gnu_v3_exception_catchpoint_ops): Install NULL allocate_location,
re_set and check_status methods.
(create_ada_exception_breakpoint): Rename to ...
(init_ada_exception_breakpoint): ... this. Add a struct
breakpoint parameter, and delete the exp_string, cond_string and
cond parameters. Use init_raw_breakpoint, and don't install or
mention the breakpoint yet. Don't clear breakpoint fields that
init_raw_breakpoint already clears.
(re_set_breakpoint): Delete, split into ...
(breakpoint_re_set_default, prepare_re_set_context): ... these new
functions.
(breakpoint_re_set_one): Call the breakpoint's
breakpoint_ops->re_set implementation, if there's one. Adjust.
* breakpoint.h: Forward declare struct bpstats and struct bp_location.
(struct bp_location_ops): New type.
(struct bp_location): New field `ops'.
(struct breakpoint_ops): New `allocate_location', `re_set' and
`check_status' fields. Make `breakpoint_hit''s description match
reality.
(init_bp_location): Declare.
(breakpoint_re_set_default): Declare.
(create_ada_exception_breakpoint): Rename to ...
(init_ada_exception_breakpoint): ... this. Add a struct
breakpoint parameter, and delete the exp_string, cond_string and
cond parameters.
(install_breakpoint): Declare.
* ada-lang.c: Include exceptions.h.
<Ada exceptions description>: Update.
(struct ada_catchpoint_location): New type.
(ada_catchpoint_location_dtor): New function.
(ada_catchpoint_location_ops): New global.
(ada_catchpoint): New type.
(create_excep_cond_exprs): New function.
(dtor_exception, allocate_location_exception, re_set_exception)
(should_stop_exception, check_status_exception): New functions.
(print_one_exception, print_mention_exception)
(print_recreate_exception): Adjust.
(dtor_catch_exception, allocate_location_catch_exception)
(re_set_catch_exception, check_status_catch_exception): New
functions.
(catch_exception_breakpoint_ops): Install them.
(dtor_catch_exception_unhandled)
(allocate_location_catch_exception_unhandled)
(re_set_catch_exception_unhandled)
(check_status_catch_exception_unhandled): New functions.
(catch_exception_unhandled_breakpoint_ops): Install them.
(dtor_catch_assert, allocate_location_catch_assert)
(re_set_catch_assert, check_status_catch_assert): New functions.
(catch_assert_breakpoint_ops): Install them.
(ada_exception_catchpoint_p): Delete.
(catch_ada_exception_command_split)
(ada_exception_catchpoint_cond_string): Rename exp_string
parameter to excep_string. Adjust.
(ada_parse_catchpoint_condition): Delete.
(ada_exception_sal): Rename the exp_string parameter to
excep_string. Delete the cond_string and cond parameters.
Adjust.
(ada_decode_exception_location): Rename the exp_string parameter
to excep_string. Delete the cond_string and cond parameters.
Adjust.
(create_ada_exception_catchpoint): New function.
(catch_ada_exception_command, ada_decode_assert_location)
(catch_assert_command): Adjust.
* ada-lang.h (ada_exception_catchpoint_p): Delete declaration.
* ada-lang.c: Include arch-utils.h.
(ada_decode_exception_location): Make static.
(catch_ada_exception_command): Moved here from breakpoint.c.
(ada_decode_assert_location): Make static.
(catch_assert_command): Moved here from breakpoint.c.
(_initialize_ada_lang): Install the exception and assert
catchpoint commands here.
* ada-lang.h (ada_decode_exception_location)
(ada_decode_assert_location): Delete declarations.
* breakpoint.c (CATCH_PERMANENT, CATCH_TEMPORARY): Moved to
breakpoint.h.
(create_ada_exception_breakpoint): Make extern.
(catch_ada_exception_command, catch_assert_command): Moved to
ada-lang.c.
(add_catch_command): Make extern.
(_initilize_breakpoint): Don't install the exception and assert
catchpoint commands here.
* breakpoint.h (CATCH_PERMANENT, CATCH_TEMPORARY): Moved from
breakpoint.c
(add_catch_command, create_ada_exception_breakpoint): Declare.
* breakpoint.h (struct breakpoint_ops): New field `dtor'.
(struct breakpoint): Delete field `syscalls_to_be_caught'.
* breakpoint.c (init_raw_breakpoint_without_location): Remove
reference to syscalls_to_be_caught.
(catch_fork_breakpoint_ops, catch_vfork_breakpoint_ops): Install a
NULL `dtor'.
(struct syscall_catchpoint): New type.
(dtor_catch_syscall): New function.
(insert_catch_syscall, remove_catch_syscall)
(breakpoint_hit_catch_syscall, print_one_catch_syscall)
(print_recreate_catch_syscall): Adjust.
(catch_syscall_breakpoint_ops): Install dtor_catch_syscall.
(catch_exec_breakpoint_ops): Install a NULL `dtor'.
(create_syscall_event_catchpoint): Adjust to use init_catchpoint.
(ranged_breakpoint_ops, watchpoint_breakpoint_ops)
(masked_watchpoint_breakpoint_ops)
(gnu_v3_exception_catchpoint_ops): Install a NULL `dtor'.
(delete_breakpoint): Call the `dtor' breakpoint_ops method, if
there is one. Remove references to syscalls_to_be_caught.
(catching_syscall_number): Adjust.
* ada-lang.c (catch_exception_breakpoint_ops)
(catch_exception_unhandled_breakpoint_ops)
(catch_assert_breakpoint_ops): Install a NULL `dtor'.