This new testsuite routine allows us to test commands that are not
expected to generate any output.
2010-05-20 Pedro Alves <pedro@codesourcery.com>
Joel Brobecker <brobecker@adacore.com>
* lib/gdb.exp (gdb_test_no_output): New function.
* lib/gdb.ada/arrayidx.exp: Use gdb_test_no_output instead of gdb_test
when testing commands that should produce no output.
Tested on x86_64-linux.
The gdb.ada/watch_arg testcase is testing a situation where we are
leaving the scope where a parameter being watched is defined. The
testcase is a little non-sensical that we're watching a parameter
declared as an "access integer", which in non-Ada terms means
a constant pointer. Doesn't make much sense to watch a constant...
So this patch changes the code a little to use an "in out Integer",
which makes the parameter a non-constant integer, rather than a
constant access Integer. I verified that I could still reproduce
the problem with the original debugger and the modified testcase.
This was motivated by a patch that Sergio is about to submit which
will forbid the user from watching a constant (discussed on IRC)
2010-05-17 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/watch_arg/watch.adb: Rewrite testcase to avoid the
parameter that we want to watch being a constant.
Tested on both sparc-solaris (where the ancient debugger could still
run ;-), and on x86_64-linux.
gdb/ChangeLog:
* parse.c (parse_exp_in_context): When block is not NULL, use
its associated language to parse the expression instead of
the current_language.
gdb/testsuite/ChangeLog:
* gdb.ada/cond_lang: New testcase.
This implements a rudimentary version of the la_print_typedef method
for Ada. Ada usually does not use typedefs, but there is one exception:
pointers to unconstrained arrays. Without this patch, we sometimes
get an error in the "info types" output:
(gdb) info types new_integer_type
All types matching regular expression "new_integer_type":
File foo.adb:
Language not supported.
For now, we treat the typedef as if it did not exist - using the
underlying type instead. This is the right thing to do for most cases,
the only exception being access to array types. Since we already have
a general issue in handling these pointers (we confuse them with fat
pointers), we will enhance ada_print_typedef to handle these pointers
at the same time we address the general issue.
gdb/ChangeLog:
* ada-typeprint.c (ada_print_typedef): New function.
* ada-lang.h (ada_print_typedef): Add declaration.
* ada-lang.c (ada_language_defn): set la_print_typdef field
to ada_print_typedef.
gdb/testsuite/ChangeLog:
* info_types.c, info_types.exp: New files.
Tested on x86_64-linux.
The problem is printing the wrong value for dynamic local variables
when using the "info locals" command. Consider the following code:
procedure Print (I1 : Positive; I2 : Positive) is
type My_String is array (I1 .. I2) of Character;
I : My_String := (others => 'A');
S : String (1 .. I2 + 3) := (others => ' ');
begin
S (I1 .. I2) := String (I); -- BREAK
Put_Line (S);
end Print;
After the debugger stopped at BREAK, we try printing all local variables.
Here is what we get:
(gdb) info locals
i = "["00"]["00"]"
s = "["00"]["00"]["00"]["00"]["00"]["00"]["00"]["00"]"
Curiously, printing their value using the "print" command works:
(gdb) print i
$1 = "AA"
(gdb) print s
$2 = " "
We traced the problem to trying to get the contents of a variable
(call to value_contents) before "fix'ing" it. For those not familiar
with the Ada language support, "fixing" a value consists of swapping
the value's dynamic type with a static version that is appropriate
for our actual value. As a result, the dynamic type was used to
determine the value size, which is zero, and thus the value contents
was empty.
gdb/ChangeLog:
* valprint.c (common_val_print): Fix the value before extracting
its contents.
* ada-lang.c (ada_to_fixed_value): Make this function extern.
* ada-lang.h (ada_to_fixed_value): New function declaration.
* ada-valprint.c (ada_value_print): Use ada_to_fixed_value
to avoid code duplication and fix a bug in the handling of
fixed types contents.
gdb/testsuite/ChangeLog:
* gdb.ada/dyn_loc: New testcase.
gdb/ChangeLog:
From Paul Hilfinger <hilfinger@adacore.com>
* amd64-tdep.c (amd_classify_aggregate): Handle the case of
a record of length <= 16 in which a field straddles the two
eightbytes.
gdb/testsuite/ChangeLog:
* gdb.ada/rec_return: New testcase.
gdb/ChangeLog:
* i386-tdep.h (enum amd64_reg_class): New, moved here from
amd64-tdep.c.
(struct gdbarch_tdep): Add fields call_dummy_num_integer_regs,
call_dummy_integer_regs, and classify.
* amd64-tdep.h (amd64_classify): Add declaration.
* amd64-tdep.c (amd64_dummy_call_integer_regs): New static constant.
(amd64_reg_class): Delete, moved to i386-tdep.h.
(amd64_classify): Make non-static. Move declaration to amd64-tdep.h.
Replace call to amd64_classify by call to tdep->classify.
(amd64_push_arguments): Get the list of registers to use for
passing integer parameters from the gdbarch tdep structure,
rather than using a hardcoded one. Replace calls to amd64_classify
by calls to tdep->classify.
(amd64_push_dummy_call): Get the register number used for
the "hidden" argument from tdep->call_dummy_integer_regs.
(amd64_init_abi): Initialize tdep->call_dummy_num_integer_regs
and tdep->call_dummy_integer_regs. Set tdep->classify.
* amd64-windows-tdep.c: Add include of gdbtypes.h.
(amd64_windows_dummy_call_integer_regs): New static global.
(amd64_windows_classify): New function.
(amd64_windows_init_abi): Initialize tdep->call_dummy_num_integer_regs
tdep->call_dummy_integer_regs and tdep->classify.
gdb/testsuite/ChangeLog:
* gdb.ada/call_pn: New testcase.
* gdb.base/call-ar-st.exp: Set print frame-arguments to "all".
* gdb.ada/ref_param.exp: Set print frame-arguments to "all".
* gdb.ada/lang_switch.exp: Set print frame-arguments to "all".
* valarith.c (value_binop): Add floating-point BINOP_MIN and
BINOP_MAX cases.
For BINOP_EXP, use length and signedness of left operand only for
result, as for shifts.
For integral operands to BINOP_EXP, use new integer_pow and
uinteger_pow functions so as to get full range of results.
(integer_pow): New function.
(uinteger_pow): New function.
2008-01-30 Paul N. Hilfinger <hilfinger@adacore.com>
* gdb.ada/exprs: New test program.
* gdb.ada/exprs.exp: New testcase.