old-cross-binutils/gdb/testsuite/gdb.ada
Joel Brobecker c40cc657bc [Ada] Error adding/subtracting pointer value to/from integral.
When trying to evaluate an expression which adds a pointer and
an integral, the evaluation succeeds if the pointer is on
the left handside of the operator, but not when it is on the right
handside:

    (gdb) p something'address + 0
    $1 = (system.address) 0x613418 <pck.something>
    (gdb) p 0 + something'address
    Argument to arithmetic operation not a number or boolean.

Same issue when doing subtractions:

    (gdb) p something'address - 0
    $2 = (system.address) 0x613418 <pck.something>
    (gdb) p 0 - something'address
    Argument to arithmetic operation not a number or boolean.

This patch enhances the Ada expression evaluator to handle
these two situations.

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <BINOP_ADD>: Add handling
        of the case where the second operand is a pointer.
        <BINOP_SUB>: Likewise.

gdb/testsuite/ChangeLog:

        * gdb.ada/addr_arith: New testcase.

Tested on x86_64-linux.
2014-10-14 14:05:11 -07:00
..
addr_arith [Ada] Error adding/subtracting pointer value to/from integral. 2014-10-14 14:05:11 -07:00
aliased_array
array_bounds
array_char_idx
array_return
array_subscript_addr
arraydim
arrayidx
arrayparam
arrayptr
atomic_enum
bad-task-bp-keyword
bp_enum_homonym
bp_on_var
bp_range_type
bp_reset
call_pn
catch_ex
char_enum
char_param
complete
cond_lang
dot_all
dyn_arrayidx Add gdb.ada/dyn_arrayidx testcase. 2014-04-28 15:48:11 -04:00
dyn_loc
enum_idx_packed
exec_changed
expr_delims
exprs
fixed_cmp
fixed_points
float_param
formatted_ref
frame_args
fullname_bp
fun_addr
fun_in_declare
funcall_param
homonym
info_exc
info_locals_renaming
int_deref
interface
iwide
lang_switch
mi_catch_ex
mi_dyn_arr [varobj] false type-changed status for reference to Ada array 2014-03-28 06:22:24 -07:00
mi_ex_cond
mi_exc_info
mi_interface
mi_task_arg
mi_task_info
mod_from_name
nested
null_array
null_record
O2_float_param
operator_bp
optim_drec
packed_array
packed_tagged
pckd_arr_ren [testsuite/Ada] New testcase for packed array renaming. 2014-03-17 08:45:55 -07:00
pp-rec-component
print_chars
ptr_typedef
ptype_field
ptype_tagged_param
py_range
rdv_wait
rec_return
ref_param
ref_tick_size
same_enum
set_pckd_arr_elt
set_wstr
small_reg_param
start
str_ref_cmp
sym_print_name
taft_type
tagged
tagged_access
tagged_not_init
task_bp
tasks
tick_last_segv
tick_length_array_enum_idx
type_coercion
unc_arr_ptr_in_var_rec
uninitialized_vars
variant_record_packed_array
watch_arg
whatis_array_val
widewide
win_fu_syms
addr_arith.exp [Ada] Error adding/subtracting pointer value to/from integral. 2014-10-14 14:05:11 -07:00
aliased_array.exp
array_bounds.exp
array_char_idx.exp
array_return.exp
array_subscript_addr.exp
arraydim.exp
arrayidx.exp
arrayparam.exp
arrayptr.exp
assign_1.exp
atomic_enum.exp
bad-task-bp-keyword.exp
boolean_expr.exp
bp_enum_homonym.exp
bp_on_var.exp
bp_range_type.exp
bp_reset.exp
call_pn.exp
catch_ex.exp
char_enum.exp
char_param.exp
complete.exp Skip tests on completion and readline when readline lib isn't used 2014-03-26 21:11:08 +08:00
cond_lang.exp
dot_all.exp
dyn_arrayidx.exp Add gdb.ada/dyn_arrayidx testcase. 2014-04-28 15:48:11 -04:00
dyn_loc.exp
enum_idx_packed.exp
exec_changed.exp
expr_delims.exp
exprs.exp
fixed_cmp.exp
fixed_points.exp
float_param.exp
formatted_ref.exp
frame_args.exp
fullname_bp.exp
fun_addr.exp
fun_in_declare.exp
funcall_param.exp
gnat_ada.gpr
homonym.exp
info_exc.exp
info_locals_renaming.exp
info_types.c
info_types.exp
int_deref.exp
interface.exp
iwide.exp
lang_switch.exp
Makefile.in
mi_catch_ex.exp
mi_dyn_arr.exp [varobj] false type-changed status for reference to Ada array 2014-03-28 06:22:24 -07:00
mi_ex_cond.exp
mi_exc_info.exp
mi_interface.exp
mi_task_arg.exp
mi_task_info.exp
mod_from_name.exp
nested.exp
null_array.exp
null_record.exp
O2_float_param.exp
operator_bp.exp
optim_drec.exp
packed_array.exp
packed_tagged.exp
pckd_arr_ren.exp [testsuite/Ada] New testcase for packed array renaming. 2014-03-17 08:45:55 -07:00
pp-rec-component.exp
pp-rec-component.py
print_chars.exp
print_pc.exp
ptr_typedef.exp
ptype_arith_binop.exp
ptype_field.exp
ptype_tagged_param.exp
py_range.exp
rdv_wait.exp
rec_return.exp
ref_param.exp
ref_tick_size.exp
same_enum.exp
set_pckd_arr_elt.exp
set_wstr.exp
small_reg_param.exp
start.exp
str_ref_cmp.exp
sym_print_name.exp
taft_type.exp
tagged.exp
tagged_access.exp
tagged_not_init.exp
task_bp.exp
tasks.exp
tick_last_segv.exp
tick_length_array_enum_idx.exp
type_coercion.exp
unc_arr_ptr_in_var_rec.exp
uninitialized_vars.exp
variant_record_packed_array.exp
watch_arg.exp
whatis_array_val.exp
widewide.exp
win_fu_syms.exp