Commit Graph

132 Commits

Author SHA1 Message Date
Joel Brobecker b18003d168 fix incorrect assumption in gdb.ada/watch_arg
The testcase is assuming that the parameter being watched isn't being
modified. But the way the test program is written, this is not true
at all.  So this changes fixes the code to still reference the variable,
but in a way that does not modify its value.

gdb/testsuite:

        * gdb.ada/watch_arg/pck.ads, gdb.ada/watch_arg/pck.adb: New files.
        * gdb.ada/watch_arg/watch.adb: Adjust code to avoid modification
        of parameter X in procedure Foo.
2011-12-06 14:00:37 +00:00
Joel Brobecker ac1349b75a Make sure all types in gdb.ada/homonym testcase are used...
Otherwise, the compiler does not generate any debug info for them.
This fixes 3 FAILs:

    FAIL: gdb.ada/homonym.exp: ptype local_type_subtype at BREAK_1
    FAIL: gdb.ada/homonym.exp: ptype int_type at BREAK_1
    FAIL: gdb.ada/homonym.exp: ptype local_type_subtype at BREAK_2

gdb/testsuite/ChangeLog:

        * gdb.ada/homonym/pck.ads, gdb.ada/homonym/pck.adb: New files.
        * gdb.ada/homonym/homonym.adb: For use of all types defined
        locally inside both Get_Value subprograms.
2011-12-01 23:16:44 +00:00
Joel Brobecker 1a1d551388 wrong value returned by ada-lang.c:compare_names
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.
2011-11-29 01:00:52 +00:00
Joel Brobecker 22355c9080 read_frame_register_value and big endian arches
The read_frame_register_value function as it was implemented introduced
a regression on big-endian targets. The problem appears when trying to
get the value of an entity stored inside a register, and when the size
of the entity is smaller than the size of the register. In that case,
we were always reading the first N bytes of the register, which is wrong
for big-endian architectures, where we need to read the last N bytes of
the register.

gdb/ChangeLog:

        * findvar.c (read_frame_register_value): Read correct bytes from
        register on big-endian architectures.

gdb/testsuite/ChangeLog:

        * gdb.ada/small_reg_param: New testcase.
2011-11-10 17:14:41 +00:00
Joel Brobecker 6cda5a2082 [Ada] Fix number of lines in -ada-task-info output
When using the new -ada-task-info command with an argument,
the output would say that there are N entries in the returned
table, (where N is the total number of tasks present in the inferior).
But, in fact, the table would only contain at most 1 entry.

This patch fixes this by properly computing the number of
tasks being displayed before giving it to the uiout.

gdb/ChangeLog:

        * ada-tasks.c (print_ada_task_info): Fix computation of
        number of tasks displayed in command output.

gdb/testsuite/ChangeLog:

        * gdb.ada/mi_task_info/task_switch.adb: New file.
        * gdb.ada/mi_task_info.exp: New file.
2011-10-21 18:46:06 +00:00
Joel Brobecker a812315168 [Ada] Re-implement `info tasks' command using ui-out
This is in preparation for providing a GDB/MI equivalent of
the `info tasks' command.  The previous implementation was using
various printf commands to generate the command output, which
does not work at all if we want to use that same code to generate
the result for that new GDB/MI command.

This patch thus re-implements the `info tasks' command (with no
arguments) in a way that makes it GDB/MI friendly.

There is an additional hicup, which is the fact that the `info tasks'
command displays a completely different type of output when a task
ID is given. For instance:

    (gdb) info task 2
    Ada Task: 0x644d20
    Name: my_callee
    Thread: 0
    LWP: 0x5809
    Parent: 1 (main_task)
    Base Priority: 48
    State: Blocked in accept or select with terminate

The above output is better when in CLI mode, but really not
what we want when in GDB/MI mode. In GDB/MI mode, we want to
follow what the `-thread-info' command does when a task-id
is given as an argument, which is to produce the same table,
but with only one element/task in it.

For compatibility as well as practical reasons, we do not want
to change the output of the `info task TASKNO' command when in
CLI mode.  But it's easy to preserve this behavior while providing
the desirable output when in GDB/MI mode.  For this, the function
used to generated the `info tasks' output has been enhanced to take
an argument interpreted as a string. The CLI command knows to never
provide that argument, while the GDB/MI command will pass one if
provided by the user.

gdb/ChangeLog:

        * ada-tasks.c (print_ada_task_info): New function, merging
        short_task_info and info_tasks together.  Reimplement using
        ui-out instead of printing to stdout directly.  Move the code
        building and checking the task list here, instead of leaving it
        in info_tasks_command.
        (info_task): Move the code building and checking the task
        list here, instead of leaving it in info_tasks_command.
        (info_tasks_command): Delete code building and checking
        the task list - moved elsewhere.  Update calls to info_tasks
        and info_task.

One of the minor changes the switch caused is the introduction
of a space between the "current" column, and the task "ID"
column, which wasn't there before.  This matches what we do
in the "info threads" command, so I kept that change.  This
required an adjustment in the testsuite, however...

gdb/testsuite/ChangeLog:

        * gdb.ada/tasks.exp: Make the expected output for
        the `info tasks' tests more resilient to spacing
        changes.
2011-09-16 19:09:57 +00:00
Joel Brobecker 00eb2c4ae8 bettter display for temporary Ada exception catchpoints
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.
2011-07-01 18:35:36 +00:00
Joel Brobecker d2d43431e8 Fix printing address of packed array
When trying to print the address of a non-packed array, GDB
correctly prints the type name and address:

    (gdb) print &var
    $2 = (access pa.var) 0xbffff1d8

However, it is behaving differently when dealing with a packed
array:

    (gdb) p &var
    (access array (4 .. 8) of boolean <packed: 1-bit elements>) (4 =>
    false, false, false, true, false)

The type description isn't all that bad, but GDB shouldn't be
printing the array value!

This patch fixes the `print` and `ptype` command on packed and
non-packed array.  It also fixes a gdb.ada test to match with
the new ouput.

gdb/ChangeLog (Jean-Charles Delay):

        * ada-typeprint.c (ada_print_type): Fix both PAD type and
        pointer to constrained packed array type output.
        * ada-valprint.c (ada_val_print_1): Fix pointer to constrained
        packed array output.

gdb/testsuite/ChangeLog (Jean-Charles Delay):

        * gdb.ada/packed_array.exp: Fix expected outout.
2011-07-01 18:27:25 +00:00
Joel Brobecker 54ae186fb5 Fix ada array bounds display
Array bounds were not correctly displayed when the SHOW parameter of
print_type functions is set to -1.  This shows up in the following
type of situation, where we have a declaration as follow:

    Anon_Array_Int_Obj : array (1..10) of Integer := (others => 8);

In GDB/MI mode, trying to print the type info for our array object
yields:

    (gdb) -var-create ai 0 Anon_Array_Int_Obj
    (gdb) -var-info-type ai
    ^done,type="array (...) of integer"

The actual bounds are missing.  Contrast this with what happens
when in GDB/CLI mode:

    (gdb) ptype Anon_Array_Int_Obj
    type = array (1 .. 10) of integer

This patch fixes array type printing accordingly. And as it turns
out, it also improves the output for one of the tests already present,
so it shows that it's not just the GDB/MI mode that's affected.

gdb/ChangeLog (Jean-Charles Delay):

	* ada-typeprint.c (print_array_type): removed if condition on show
	being negative for bounds printing.

gdb/testsuite/ChangeLog (Jean-Charles Delay):

	* gdb.ada/packed_array.exp: fixed expected output.
2011-07-01 18:27:12 +00:00
Joel Brobecker 8f17729f21 treat identical enum types as the same type
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.
2011-07-01 18:26:50 +00:00
Joel Brobecker f5aa6869de missing type description for typedef to pointer value
If we evaluate an expression that results in a value that is a typedef
to pointer, then the debugger fails to print the type description
before printing the actual value:

    (gdb) print e.plan(1)
    $1 = 0x0

The expected output is:

    (gdb) print e.plan(1)
    $1 = (access integer) 0x0

gdb/ChangeLog:

        * ada-valprint.c (ada_value_print): Handle typedefs.

gdb/testsuite/ChangeLog:

        * gdb.ada/ptr_typedef: New testcase.
2011-07-01 18:26:22 +00:00
Joel Brobecker 828292f271 variables whose type is a typedef to an array pointer
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.
2011-07-01 18:25:49 +00:00
Joel Brobecker 18920c4226 handle character-based enumeration typedefs
Consider the following type:

   type Char_Enum_Type is ('A', 'B', 'C', 'D');

If the compiler generates a Char_Enum_Type typedef in the debugging
information, the debugger fails in the following case:

   (gdb) p Char_Enum_Type'('B')
   $1 = 66

For our type, the underlying value of 'B' is actually 1, not 66
(ASCII 'B').  We are failing this case because we were not handling
typedef to enum types before.  This patch fixes this.

gdb/ChangeLog:

        * ada-exp.y (convert_char_literal): Handle typedef types.

gdb/testsuite/ChangeLog:

        * gdb.ada/char_enum: New testcase.
2011-07-01 18:25:17 +00:00
Pedro Alves 3b48433dfb 2011-05-16 Pedro Alves <pedro@codesourcery.com>
gdb/testsuite/
	* gdb.ada/start.exp: Call untested with the correct test filename.
	* gdb.arch/i386-bp_permanent.exp: Call untested with the correct
	test filename.  Make the test's binary unique.
	* gdb.arch/i386-signal.exp: Call untested with the correct test
	filename.
	* gdb.arch/i386-size-overlap.exp: Ditto.
	* gdb.arch/Makefile.in (EXECUTABLES): Update.
	* gdb.base/gcore-buffer-overflow.exp: Ditto.
	* gdb.cp/call-c.exp: Ditto.
	* gdb.mi/mi-reverse.exp: Call untested with the correct test
	filename.  Make the test's binary unique.
	* gdb.mi/Makefile.in (EXECUTABLES): Update.
	* gdb.python/py-mi.exp: Ditto.
	* gdb.python/Makefile.in (EXECUTABLES): Update.
	* gdb.reverse/i386-precsave.exp: Ditto.
	* gdb.reverse/i387-env-reverse.exp: Call untested with the correct
	test filename.
	* gdb.reverse/i387-stack-reverse.exp: Ditto.
	* gdb.reverse/sigall-precsave.exp: Ditto.  Make the test's binary
	unique.
	* gdb.reverse/sigall-reverse.exp: Call untested with the correct
	test filename.
	* gdb.reverse/Makefile.in (EXECUTABLES): Update.
	* gdb.trace/tfile.exp: Ditto.
2011-05-16 13:56:41 +00:00
Joel Brobecker af57139d01 extend scope of testing in gdb.ada/arrayptr
We add testing of taking a slice of an array access.  And we also
introduce the same amount of testing, but with an access to a
constrained array.

gdb/testsuite/ChangeLog:

        * gdb.ada/arrayptr/foo.adb: Add access to constrained array.
        * gdb.ada/arrayptr.exp: Add new tests.
2011-04-01 17:03:52 +00:00
Joel Brobecker 956a9fb9fb improve Ada exception catchpoint MI notification
This rewrites the code generating the Ada exception catchpoint hit
notification for both the GDB/MI case as well as the non-MI case,
by using the relevant ui_out_* functions to generate the output.
the MI notifications for Ada exception catchpoints now include
the stop reason, and the breakpoint "disp", much like other breakpoint
events do.  It also introduces a new field "exception-name" for
exception catchpoints (excluding "failed assertion catchpoints,
where we just want to know that it was a failed assertion).

gdb/ChangeLog:

        * breakpoint.h (bpdisp_text): Add declaration.
        * breakpoint.c (bpdisp_text): Make non-static.
        * ada-lang.c: #include "mi/mi-common.h".
        (print_it_exception): Rewrite to improve GDB/MI output.

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Ada Exception Information): Document
        the "exception-name" field in the *stopped async record.

gdb/testsuite/ChangeLog:

        * gdb.ada/mi_catch_ex: New testcase.
2011-04-01 16:59:58 +00:00
Jan Kratochvil 20106cfbdb gdb/testsuite/
* gdb.ada/arrayparam.exp (print first after function call): Use
	explicit package name.  Add a comment
	(print lasta after function call): Rename ...
	(print last after function call): ... it and use explicit package
	name.
	(print length after function call): Use explicit package name.
	* gdb.ada/str_ref_cmp.exp (operator = works for strings): New test.
	* gdb.ada/sym_print_name.exp: Change `i' to `integervar'.
	(multiple matches for symbol i): Rename ...
	(multiple matches for symbol integervar): ... it.
	* gdb.ada/sym_print_name/foo.adb (Foo): Change `I' to `IntegerVar'.
	* gdb.ada/sym_print_name/pck.ads (Pck): Likewise.
2011-03-28 20:07:12 +00:00
Tom Tromey 5dbdd470c7 * gdb.ada/catch_ex.exp: Use explicit gdb_test rather than
gdb_continue_to_end.
2011-03-09 18:41:31 +00:00
Tom Tromey eceb0c5f49 * lib/gdb.exp (inferior_exited_re): Match. leading `['. Wrap in
parentheses.
	(gdb_continue_to_end): Add "allow_extra" parameter.  Use
	$command.
	* gdb.threads/thread-unwindonsignal.exp: Pass "allow_extra"
	argument to gdb_continue_to_end.
	* gdb.threads/interrupted-hand-call.exp: Pass "allow_extra"
	argument to gdb_continue_to_end.
	* gdb.cp/annota3.exp: Fix regex.
	* gdb.cp/annota2.exp: Fix regex.
	* gdb.base/shlib-call.exp: Pass "allow_extra" argument to
	gdb_continue_to_end.
	* gdb.base/call-signal-resume.exp: Revert earlier patch.
	* gdb.ada/tasks.exp: Pass "allow_extra" argument to
	gdb_continue_to_end.
2011-03-09 14:17:05 +00:00
Tom Tromey fda326dd1d gdb
* infrun.c (print_exited_reason): Include inferior id and pid in
	message.
gdb/testsuite
	* lib/opencl.exp (skip_opencl_tests): Update for exit message
	change.
	* lib/mi-support.exp (mi_gdb_test): Update for exit message
	change.
	* lib/gdb.exp (gdb_test_multiple): Update comment.  Update for
	exit message change.
	(skip_altivec_tests): Update for exit message change.
	(skip_vsx_tests): Likewise.
	(gdb_continue_to_end): Likewise.  Add 'command' argument.
	* lib/cell.exp (skip_cell_tests): Update for exit message change.
	* gdb.threads/tls.exp: Update for exit message change.
	* gdb.threads/thread-unwindonsignal.exp: Use
	gdb_continue_to_end.
	* gdb.threads/step.exp (step_it): Update for exit message change.
	(continue_all): Likewise.
	* gdb.threads/print-threads.exp (test_all_threads): Update for
	exit message change.
	* gdb.threads/interrupted-hand-call.exp: Use
	gdb_continue_to_end.
	* gdb.threads/execl.exp: Use gdb_continue_to_end.
	* gdb.python/py-prettyprint.exp (run_lang_tests): Use
	gdb_continue_to_end.
	* gdb.hp/gdb.objdbg/objdbg02.exp: Use gdb_continue_to_end.
	* gdb.hp/gdb.objdbg/objdbg01.exp: Use gdb_continue_to_end.
	* gdb.hp/gdb.defects/solib-d.exp: Update for exit message change.
	* gdb.cp/method.exp: Update for exit message change.
	* gdb.cp/mb-templates.exp: Update for exit message change.
	* gdb.cp/mb-inline.exp: Use gdb_continue_to_end.
	* gdb.cp/annota3.exp: Update for exit message change.
	* gdb.cp/annota2.exp: Update for exit message change.
	* gdb.cell/fork.exp: Use gdb_continue_to_end.
	* gdb.base/term.exp: Update for exit message change.
	* gdb.base/step-test.exp (test_i): Update for exit message change.
	* gdb.base/sigstep.exp (advance): Update for exit message change.
	(advancei): Likewise.
	* gdb.base/siginfo.exp: Update for exit message change.
	* gdb.base/shlib-call.exp: Use gdb_continue_to_end.
	* gdb.base/reread.exp: Use gdb_continue_to_end.
	* gdb.base/langs.exp: Use gdb_continue_to_end.
	* gdb.base/interrupt.exp: Update for exit message change.
	* gdb.base/gdb1555.exp: Update for exit message change.
	* gdb.base/exe-lock.exp: Use gdb_continue_to_end.
	* gdb.base/ending-run.exp: Update for exit message change.
	* gdb.base/chng-syms.exp: Update for exit message change.
	* gdb.base/checkpoint.exp: Update for exit message change.
	* gdb.base/catch-syscall.exp (check_for_program_end): Use
	gdb_continue_to_end.
	(test_catch_syscall_with_wrong_args): Likewise.
	* gdb.base/call-signal-resume.exp: Use gdb_continue_to_end.
	* gdb.base/break-interp.exp (test_ld): Update for exit message
	change.
	* gdb.base/bang.exp: Update for exit message change.
	* gdb.base/attach.exp (do_attach_tests): Use gdb_continue_to_end.
	(do_call_attach_tests): Likewise.
	* gdb.base/a2-run.exp: Update for exit message change.
	* gdb.arch/ppc-dfp.exp: Update for exit message change.
	* gdb.ada/tasks.exp: Use gdb_continue_to_end.
	* gdb.ada/catch_ex.exp: Use gdb_continue_to_end.
2011-03-07 16:03:04 +00:00
Michael Snyder 1d41d745ca 2011-02-22 Michael Snyder <msnyder@vmware.com>
* Makefile.in: Make more clean.
	* gdb.ada/Makefile.in: Ditto.
	* gdb.arch/Makefile.in: Ditto.
	* gdb.asm/Makefile.in: Ditto.
	* gdb.base/Makefile.in: Ditto.
	* gdb.cp/Makefile.in: Ditto.
	* gdb.dwarf2/Makefile.in: Ditto.
	* gdb.java/Makefile.in: Ditto.
	* gdb.mi/Makefile.in: Ditto.
	* gdb.modula2/Makefile.in: Ditto.
	* gdb.python/Makefile.in: Ditto.
	* gdb.server/Makefile.in: Ditto.
	* gdb.stabs/Makefile.in: Ditto.
	* gdb.threads/Makefile.in: Ditto.
	* gdb.trace/Makefile.in: Ditto.
2011-02-22 20:52:49 +00:00
Michael Snyder b97c863c18 2011-02-21 Michael Snyder <msnyder@vmware.com>
* Makefile.in: Update for make clean.
	* gdb.ada/Makefile.in: Ditto.
	* gdb.arch/Makefile.in: Ditto.
	* gdb.asm/Makefile.in: Ditto.
	* gdb.base/Makefile.in: Ditto.
	* gdb.cp/Makefile.in: Ditto.
	* gdb.dwarf2/Makefile.in: Ditto.
	* gdb.java/Makefile.in: Ditto.
	* gdb.mi/Makefile.in: Ditto.
	* gdb.modula2/Makefile.in: Ditto.
	* gdb.python/Makefile.in: Ditto.
	* gdb.server/Makefile.in: Ditto.
	* gdb.stabs/Makefile.in: Ditto.
	* gdb.threads/Makefile.in: Ditto.
	* gdb.trace/Makefile.in: Ditto.
2011-02-22 03:23:20 +00:00
Joel Brobecker 91033e3716 add xfail for "print u_var" test in gdb.ada/packed_array.exp
gdb/testsuite/ChangeLog:

        * gdb.ada/packed_array.exp: Add xfail for "print u_var" if
        the debugger is unable to find the array bounds.
2011-02-21 10:12:14 +00:00
Joel Brobecker e67ad678a1 [Ada] Fix unconstrained packed array size
When ada-lang transforms an array descriptor type (an XUP structure)
into an array type, the size of the array type is computed by using
the element size, and multiplying it by the number of elements in
that array. This does not work, however, for packed arrays, where
the *packed* size in bits needs to be used.

This usually does not cause any problem, because we end up reading
more memory than needed.  However, we have observed on LynxOS
a memory error while trying to read the entire array, because
the larger-than-needed read tried to read past the end of the stack
into inaccessible memory.

This patch fixes the problem by correctly computing the array size
in bytes in the case of packed arrays.

gdb/ChangeLog:

        * ada-lang.c (ada_type_of_array): Fix the size of the array
        in the case of an unconstrained packed array.

gdb/testsuite/ChangeLog:

        * gdb.ada/packed_array: Expand testcase to test printing of
        unconstrained packed array.
2011-02-17 06:42:57 +00:00
Joel Brobecker 2c3e6e2466 new testcase for Ada Wide Wide Characters and Strings
gdb/testsuite/ChangeLog:

        * gdb.ada/widewide: New testcase.
2011-01-14 19:33:19 +00:00
Joel Brobecker 09050809a4 [testsuite/gdb.ada] simplify some testcases by using clean_restart.
gdb/testsuite/ChangeLog:

        * gdb.ada/array_bounds.exp, gdb.ada/array_return.exp,
        gdb.ada/array_subscript_addr.exp, gdb.ada/arrayidx.exp,
        gdb.ada/arrayparam.exp, gdb.ada/arrayptr.exp,
        gdb.ada/atomic_enum.exp, gdb.ada/call_pn.exp,
        gdb.ada/catch_ex.exp, gdb.ada/char_param.exp,
        gdb.ada/complete.exp, gdb.ada/exprs.exp, gdb.ada/fixed_cmp.exp,
        gdb.ada/fixed_points.exp, gdb.ada/formatted_ref.exp,
        gdb.ada/frame_args.exp, gdb.ada/fun_addr.exp,
        gdb.ada/fun_in_declare.exp, gdb.ada/funcall_param.exp,
        gdb.ada/homonym.exp, gdb.ada/int_deref.exp,
        gdb.ada/interface.exp, gdb.ada/lang_switch.exp,
        gdb.ada/mod_from_name.exp, gdb.ada/nested.exp,
        gdb.ada/null_array.exp, gdb.ada/null_record.exp,
        gdb.ada/packed_array.exp, gdb.ada/packed_tagged.exp,
        gdb.ada/print_chars.exp, gdb.ada/print_pc.exp,
        gdb.ada/ptype_field.exp, gdb.ada/ptype_tagged_param.exp,
        gdb.ada/rec_return.exp, gdb.ada/ref_param.exp,
        gdb.ada/ref_tick_size.exp, gdb.ada/start.exp,
        gdb.ada/str_ref_cmp.exp, gdb.ada/sym_print_name.exp,
        gdb.ada/taft_type.exp, gdb.ada/tagged.exp, gdb.ada/tasks.exp,
        gdb.ada/tick_last_segv.exp, gdb.ada/type_coercion.exp,
        gdb.ada/uninitialized_vars.exp,
        gdb.ada/variant_record_packed_array.exp, gdb.ada/watch_arg.exp:
        Simplify by using clean_restart.
2011-01-06 10:35:00 +00:00
Joel Brobecker 8ed5dd9e5e Avoid the use of gdb_start_cmd in gdb.ada/*.exp testcases.
This command does not work when testing with GDBserver.  So this patch
changes the few tests that do not specifically test the `start' command,
and replace calls to gdb_start_cmd with the usual `run LOC' approach.

For the couple of testcases that do really test the `start' command,
do an early return as UNTESTED instead of running this testcase.

gdb/testsuite/ChangeLog:

	Add marker to be used as anchor for inserting breakpoints.
	* gdb.ada/null_record/null_record.adb: Add "-- START" comment.
	* gdb.ada/start/dummy.adb, gdb.ada/uninitialized_vars/parse.adb:
	Likewise.

	Remove uses of gdb_start_cmd.
	* gdb.ada/null_record.exp: Remove use of gdb_start_cmd.
	* gdb.ada/print_pc.exp, gdb.ada/uninitialized_vars.exp: Ditto.

	Do not run testcase if testing with GDBserver.
	* gdb.ada/exec_changed.exp, gdb.ada/start.exp: Abort as untested
	if testing with GDBserver.
2011-01-06 10:33:38 +00:00
Joel Brobecker 368a124fc4 Add copyright header to some Ada files (testsuite)
gdb/testsuite/ChangeLog:

 	* gdb.ada/complete/foo.adb, gdb.ada/complete/pck.adb,
 	gdb.ada/complete/pck.ads, gdb.ada/print_chars/foo.adb: Add
 	copyright header.
2011-01-06 06:27:44 +00:00
Jan Kratochvil de1eb2f973 gdb/testsuite/
* gdb.ada/gnat_ada.gpr: Fix copyright comment line regression by 2011.
2011-01-02 07:32:34 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Joel Brobecker 9e87a40907 [Ada] print null array pointer as `0x0' rather than `(null)'
Trying to print a variable defined as an access to an unconstrained
array:

       type String_Access is access String;
       S1 : String_Access;

If that variable is null, then GDB prints its value in an odd way:

    (gdb) print S1
    $1 = (string_bug.string_access) (null)
                                    ^^^^^^

This patch changes the debugger behavior to print the pointer using
the same output we'd use for any null pointer:

    (gdb) print S1
    $1 = (string_bug.string_access) 0x0

It also adds an assert, helping us verify an assumption.

gdb/ChangeLog:

        * ada-valprint.c (ada_val_print_1): Print null array pointers as
        `0x0' rather than `(null)'.  Add assertion.

gdb/testsuite/ChangeLog:

        * gdb.ada/arrayptr/foo.adb: Add new local variable Null_String.
        * gdb.ada/arrayptr.exp: Add test printing that new variable.
2010-12-29 08:02:59 +00:00
Joel Brobecker 720d1a4025 [Ada] do not print arrays as array pointers
This patch enhances the debugger to distinguish between fat pointers
that represent either: array types, or array access types.  In the latter
case, the object/type is encoded as a typedef type pointing to the fat
pointer.

The first part of the change is to adjust ada_check_typedef to avoid
stripping the typedef layer when it points to a fat pointer.  The rest
of the patch is adjustments required in various places to deal with
the fact that the type is uses might now be a typedef.

gdb/ChangeLog:

        * ada-lang.h (ada_coerce_to_simple_array): Add declaration.
        * ada-lang.c (ada_typedef_target_type): New function.
        (desc_base_type): Add handling of fat pointer typedefs.
        (ada_coerce_to_simple_array): Make non-static.
        (decode_packed_array_bitsize): Add handling of fat pointer typedefs.
        Add assertion.
        (ada_template_to_fixed_record_type_1, ada_to_fixed_type)
        (ada_check_typedef): Add handling of fat pointer typedefs.
        (ada_evaluate_subexp) [OP_FUNCALL]: Likewise.
        * ada-typeprint.c (ada_print_type): Add handling of fat pointer
        typedefs.
        * ada-valprint.c (ada_val_print_1): Convert fat pointers that are not
        array accesses to simple arrays rather than simple array pointers.
        (ada_value_print): In the case of array descriptors, do not print
        the value type description unless it is an array access.

gdb/testsuite/ChangeLog:

        * gdb.ada/lang_switch.exp: Correct expected parameter value.

gdb/doc/ChangeLog:

        * gdb.texinfo (Ada Glitches): Remove paragraph describing the
        occasional case where the debugger prints an array address
        instead of the array itself.
2010-12-29 08:01:32 +00:00
Jan Kratochvil 03eb1c79d4 gdb/testsuite/
* gdb.ada/null_array.exp (print my_table): Call get_compiler_info and
	check test_compiler_info.
2010-11-04 18:52:11 +00:00
Michael Snyder f6978de9f5 2010-06-08 Michael Snyder <msnyder@vmware.com>
* gdb.ada/assign_1.exp: Use ".*" instead of "" as wildcard regexp.
	* gdb.ada/boolean_expr.exp:
	* gdb.ada/frame_args.exp: Ditto.
	* gdb.ada/lang_switch.exp: Ditto.
	* gdb.ada/ptype_arith_binop.exp: Ditto.
	* gdb.ada/ref_param.exp: Ditto.
	* gdb.ada/type_coercion.exp:Ditto.

	* gdb.asm/asm-source.exp: Ditto.

	* gdb.base/attach.exp: Ditto.
	* gdb.base/bitfields2.exp: Ditto.
	* gdb.base/call-signal-resume.exp: Ditto.
	* gdb.base/callfuncs.exp: Ditto.
	* gdb.base/commands.exp: Ditto.
	* gdb.base/dbx.exp: Ditto.
	* gdb.base/default.exp: Ditto.
	* gdb.base/dump.exp: Ditto.
	* gdb.base/exprs.exp: Ditto.
	* gdb.base/freebpcmd.exp: Ditto.
	* gdb.base/interrupt.exp: Ditto.
	* gdb.base/list.exp: Ditto.
	* gdb.base/long_long.exp: Ditto.
	* gdb.base/maint.exp: Ditto.
	* gdb.base/ptype.exp: Ditto.
	* gdb.base/return.exp: Ditto.
	* gdb.base/setshow.exp: Ditto.
	* gdb.base/sigbpt.exp: Ditto.
	* gdb.base/sigrepeat.exp: Ditto.

	* gdb.cp/classes.exp: Ditto.

	* gdb.dwarf2/dw2-restore.exp: Ditto.

	* gdb.gdb/selftest.exp: Ditto.

	* gdb.multi/base.exp: Ditto.
	* gdb.multi/bkpt-multi-exec.exp: Ditto.

	* gdb.python/py-block.exp: Ditto.
	* gdb.python/py-prettyprint.exp: Ditto.
	* gdb.python/py-template.exp: Ditto.

	* gdb.server/ext-attach.exp: Ditto.
	* gdb.server/ext-run.exp: Ditto.
	* gdb.server/server-mon.exp: Ditto.

	* gdb.threads/fork-thread-pending.exp: Ditto.
	* gdb.threads/hand-call-in-threads.exp: Ditto.
	* gdb.threads/interrupted-hand-call.exp: Ditto.
	* gdb.threads/linux-dp.exp: Ditto.
	* gdb.threads/manythreads.exp: Ditto.
	* gdb.threads/print-threads.exp: Ditto.
	* gdb.threads/pthreads.exp: Ditto.
	* gdb.threads/schedlock.exp: Ditto.
	* gdb.threads/thread-unwindonsignal.exp: Ditto.
	* gdb.threads/threadapply.exp: Ditto.
2010-06-10 19:48:20 +00:00
Michael Snyder de7ff7894a 2010-06-08 Michael Snyder <msnyder@vmware.com>
* gdb.ada/exec_changed.exp:
	Use ".*" instead of "" as wildcard regexp.

	* gdb.base/async.exp: Use ".*" instead of "" as wildcard regexp.
	* gdb.base/call-ar-st.exp: Ditto.
	* gdb.base/checkpoint.exp: Ditto.
	* gdb.base/default.exp: Ditto.
	* gdb.base/dump.exp: Ditto.
	* gdb.base/ending-run.exp: Ditto.
	* gdb.base/fileio.exp: Ditto.
	* gdb.base/miscexprs.exp: Ditto.
	* gdb.base/pointers.exp: Ditto.
	* gdb.base/readline.exp: Ditto.
	* gdb.base/reread.exp: Ditto.
	* gdb.base/restore.exp: Ditto.
	* gdb.base/shlib-call.exp: Ditto.
	* gdb.base/valgrind-db-attach.exp: Ditto.
	* gdb.base/volatile.exp: Ditto.
	* gdb.base/watchpoints.exp: Ditto.

	* gdb.cp/classes.exp: Use ".*" instead of "" as wildcard regexp.

	* gdb.python/py-frame.exp: Use ".*" instead of "" as wildcard regexp.
	* gdb.python/py-value.exp: Ditto.

	* gdb.trace/backtrace.exp: Use ".*" instead of "" as wildcard regexp.
	* gdb.trace/circ.exp: Ditto.
	* gdb.trace/collection.exp: Ditto.
	* gdb.trace/packetlen.exp: Ditto.
	* gdb.trace/passc-dyn.exp: Ditto.
	* gdb.trace/report.exp: Ditto.
	* gdb.trace/tfile.exp: Ditto.
	* gdb.trace/tfind.exp: Ditto.
	* gdb.trace/while-dyn.exp: Ditto.
2010-06-08 22:58:03 +00:00
Michael Snyder 6acb16a293 2010-05-25 Michael Snyder <msnyder@vmware.com>
* gdb.ada/formatted_ref.exp: Replace send_gdb with gdb_test.

	* gdb.asm/asm-source.exp: Replace send_gdb with gdb_test.

	* gdb.base/a2-run.exp: Replace send_gdb with gdb_test.
	* gdb.base/all-bin.exp: Replace send_gdb with gdb_test.
	* gdb.base/annota1.exp: Replace send_gdb with gdb_test.
	* gdb.base/annota3.exp: Replace send_gdb with gdb_test.
	* gdb.base/assign.exp: Replace send_gdb with gdb_test.
	* gdb.base/attach.exp: Replace send_gdb with gdb_test.
	* gdb.base/bitfields.exp: Replace send_gdb with gdb_test.
	* gdb.base/bitfields2.exp: Replace send_gdb with gdb_test.
	* gdb.base/bitops.exp: Replace send_gdb with gdb_test.
2010-05-26 18:05:25 +00:00
Joel Brobecker a7b75dfda1 lib/gdb.exp: New gdb_test_no_output function.
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.
2010-05-20 19:18:58 +00:00
Joel Brobecker c81c812a7a make parameter being watched is a non-constant.
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.
2010-05-17 21:32:57 +00:00
Joel Brobecker 0cce5bd9dd Use breakpoint location to parse condition over current language.
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.
2010-05-17 17:23:33 +00:00
Joel Brobecker be9425454f "unsupported language" error in info types when using Ada.
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.
2010-04-20 22:38:02 +00:00
Joel Brobecker 0c3acc0923 Wrong value printed by info locals for dynamic object.
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.
2010-04-20 22:26:57 +00:00
Joel Brobecker dadf0e9c7a * gdb.ada/ptype_tagged_param: New testcase. 2010-02-09 13:16:33 +00:00
Joel Brobecker e4e2711a4a amd64 - function returning record with field straddling 2 registers
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.
2010-01-29 14:39:04 +00:00
Joel Brobecker ba581dc13b amd64: Integer parameters in function calls on Windows.
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.
2010-01-29 05:19:23 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Joel Brobecker d53a7b30c1 * Makefile.in gdb.ada/gnat_ada.gpr, gdb.base/gcore-buffer-overflow.c,
gdb.base/gcore-buffer-overflow.exp, gdb.base/source-error.gdb,
        gdb.base/watch_thread_num.c, gdb.java/jprint.java,
        gdb.mi/mi-async.exp, gdb.modula2/unbounded-array.exp,
        gdb.modula2/unbounded1.c: Update copyright header.
2009-12-20 11:55:25 +00:00
Nathan Sidwell ec3c07fc0f * lib/gdb.exp (gdb_compile_test): New.
(skip_ada_tests, skip_java_tests): New.
	(gdb_compile): Use gdb_compile_test for f77.
	* lib/ada.exp (gdb_compile_ada): Use gdb_compile_test to record result.
	* lib/java.exp (compile_java_from_source): Remove runtests check,
	use gdb_compile_test to record result.
	* gdb.ada/packed_array.exp, gdb.ada/fixed_points.exp,
	gdb.ada/exec_changed.exp, gdb.ada/start.exp,
	gdb.ada/watch_arg.exp, gdb.ada/null_record.exp,
	gdb.ada/array_return.exp, gdb.ada/arrayidx.exp,
	gdb.mi/mi-var-child-f.exp, gdb.fortran/types.exp,
	gdb.fortran/array-element.exp, gdb.fortran/subarray.exp,
	gdb.fortran/derived-type.exp, gdb.fortran/exprs.exp,
	gdb.java/jmisc.exp, gdb.java/jmisc1.exp, gdb.java/jprint.exp,
	gdb.java/jv-print.exp, gdb.java/jmain.exp: Add language skip,
	adjust gdb_compile invocations.
2009-11-10 10:16:10 +00:00
Joel Brobecker 8ac055f849 * gdb.ada/variant_record_packed_array: New testcase. 2009-06-23 16:46:11 +00:00
Joel Brobecker f8a8dce68f * gdb.base/funcargs.exp: Set print frame-arguments to "all".
* 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".
2009-04-01 22:08:03 +00:00
Joel Brobecker 02d9a9cebf * gdb.ada/tasks: New testcase. 2009-03-31 16:48:49 +00:00