Fix regresssion(internal-error) printing subprogram argument (PR gdb/22670)

At <https://sourceware.org/ml/gdb-patches/2017-12/msg00298.html>, Joel
wrote:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider the following code which first declares a tagged type (the
equivalent of a class in Ada), and then a procedure which takes a
pointer (access) to this type's 'Class.

    package Pck is
       type Top_T is tagged record
          N : Integer := 1;
       end record;
       procedure Inspect (Obj: access Top_T'Class);
    end Pck;

Putting a breakpoint in that procedure and then running to it triggers
an internal error:

    (gdb) break inspect
    (gdb) continue
    Breakpoint 1, pck.inspect (obj=0x63e010
    /[...]/gdb/stack.c:621: internal-error: void print_frame_args(symbol*, frame_info*, int, ui_file*): Assertion `nsym != NULL' failed.

What's special about this subprogram is that it takes an access to
what we call a 'Class type, and for implementation reasons, the
compiler adds an extra argument named "objL". If you are curious why,
it allows the compiler for perform dynamic accessibility checks that
are mandated by the language.

If we look at the location where we get the internal error (in
stack.c), we find that we are looping over the symbol of each
parameter, and for each parameter, we do:

    /* We have to look up the symbol because arguments can have
       two entries (one a parameter, one a local) and the one we
       want is the local, which lookup_symbol will find for us.
    [...]
        nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
                              b, VAR_DOMAIN, NULL).symbol;
        gdb_assert (nsym != NULL);

The lookup_symbol goes through the lookup structure, which means the
symbol's linkage name ("objL") gets transformed into a
lookup_name_info object (in block_lookup_symbol), before it gets fed
to the block symbol dictionary iterators.  This, in turn, triggers the
symbol matching by comparing the "lookup" name which, for Ada, means
among other things, lowercasing the given name to "objl".  It is this
transformation that causes the lookup find no matches, and therefore
trip this assertion.

Going back to the "offending" call to lookup_symbol in stack.c, what
we are trying to do, here, is do a lookup by linkage name.  So, I
think what we mean to be doing is a completely literal symbol lookup,
so maybe not even strcmp_iw, but actually just plain strcmp???

In the past, in practice, you could get that effect by doing a lookup
using the C language. But that doesn't work, because we still end up
somehow using Ada's lookup_name routine which transforms "objL".

So, ideally, as I hinted before, I think what we need is a way to
perform a literal lookup so that searches by linkage names like the
above can be performed.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This commit fixes the problem by implementing something similar to
Joel's literal idea, but with some important differences.

I considered adding a symbol_name_match_type::LINKAGE and supporting
searching by linkage name for any language, but the problem with that
is that the dictionaries only work with SYMBOL_SEARCH_NAME, because
that's what is used for hashing.  We'd need separate dictionaries for
hashed linkage names.

So with the current symbol tables infrastructure, it's not literal
linkage names that we want to pass down, but instead literal _search_
names (SYMBOL_SEARCH_NAME, etc.).

However, psymbols have no overload/function parameter info in C++, so
a straight strcmp doesn't work properly for C++ name matching.

So what we do is be a little less aggressive then and add a new
symbol_name_match_type::SEARCH_SYMBOL instead that takes as input a
non-user-input search symbol, and then we skip any decoding/demangling
steps and make:

 - Ada treat that as a verbatim match,
 - other languages treat it as symbol_name_match_type::FULL.

This also fixes the new '"maint check-psymtabs" for Ada' testcase for
me (gdb.ada/maint_with_ada.exp).  I've not removed the kfail yet
because Joel still sees that testcase failing with this patch.
That'll be fixed in follow up patches.

gdb/ChangeLog:
2018-01-05  Pedro Alves  <palves@redhat.com>

	PR gdb/22670
	* ada-lang.c (literal_symbol_name_matcher): New function.
	(ada_get_symbol_name_matcher): Use it for
	symbol_name_match_type::SEARCH_NAME.
	* block.c (block_lookup_symbol): New parameter 'match_type'.  Pass
	it down instead of assuming symbol_name_match_type::FULL.
	* block.h (block_lookup_symbol): New parameter 'match_type'.
	* c-valprint.c (print_unpacked_pointer): Use
	lookup_symbol_search_name instead of lookup_symbol.
	* compile/compile-object-load.c (get_out_value_type): Pass down
	symbol_name_match_type::SEARCH_NAME.
	* cp-namespace.c (cp_basic_lookup_symbol): Pass down
	symbol_name_match_type::FULL.
	* cp-support.c (cp_get_symbol_name_matcher): Handle
	symbol_name_match_type::SEARCH_NAME.
	* infrun.c (insert_exception_resume_breakpoint): Use
	lookup_symbol_search_name.
	* p-valprint.c (pascal_val_print): Use lookup_symbol_search_name.
	* psymtab.c (maintenance_check_psymtabs): Use
	symbol_name_match_type::SEARCH_NAME and SYMBOL_SEARCH_NAME.
	* stack.c (print_frame_args): Use lookup_symbol_search_name and
	SYMBOL_SEARCH_NAME.
	* symtab.c (lookup_local_symbol): Don't demangle the lookup name
	if symbol_name_match_type::SEARCH_NAME.
	(lookup_symbol_in_language): Pass down
	symbol_name_match_type::FULL.
	(lookup_symbol_search_name): New.
	(lookup_language_this): Pass down
	symbol_name_match_type::SEARCH_NAME.
	(lookup_symbol_aux, lookup_local_symbol): New parameter
	'match_type'.  Pass it down.
	* symtab.h (symbol_name_match_type::SEARCH_NAME): New enumerator.
	(lookup_symbol_search_name): New declaration.
	(lookup_symbol_in_block): New 'match_type' parameter.

gdb/testsuite/ChangeLog:
2018-01-05  Joel Brobecker  <brobecker@adacore.com>

	PR gdb/22670
	* gdb.ada/access_tagged_param.exp: New file.
	* gdb.ada/access_tagged_param/foo.adb: New file.
This commit is contained in:
Pedro Alves 2018-01-05 14:04:09 +00:00
parent f98fc17b3a
commit de63c46b54
19 changed files with 271 additions and 31 deletions

View File

@ -1,3 +1,40 @@
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670
* ada-lang.c (literal_symbol_name_matcher): New function.
(ada_get_symbol_name_matcher): Use it for
symbol_name_match_type::SEARCH_NAME.
* block.c (block_lookup_symbol): New parameter 'match_type'. Pass
it down instead of assuming symbol_name_match_type::FULL.
* block.h (block_lookup_symbol): New parameter 'match_type'.
* c-valprint.c (print_unpacked_pointer): Use
lookup_symbol_search_name instead of lookup_symbol.
* compile/compile-object-load.c (get_out_value_type): Pass down
symbol_name_match_type::SEARCH_NAME.
* cp-namespace.c (cp_basic_lookup_symbol): Pass down
symbol_name_match_type::FULL.
* cp-support.c (cp_get_symbol_name_matcher): Handle
symbol_name_match_type::SEARCH_NAME.
* infrun.c (insert_exception_resume_breakpoint): Use
lookup_symbol_search_name.
* p-valprint.c (pascal_val_print): Use lookup_symbol_search_name.
* psymtab.c (maintenance_check_psymtabs): Use
symbol_name_match_type::SEARCH_NAME and SYMBOL_SEARCH_NAME.
* stack.c (print_frame_args): Use lookup_symbol_search_name and
SYMBOL_SEARCH_NAME.
* symtab.c (lookup_local_symbol): Don't demangle the lookup name
if symbol_name_match_type::SEARCH_NAME.
(lookup_symbol_in_language): Pass down
symbol_name_match_type::FULL.
(lookup_symbol_search_name): New.
(lookup_language_this): Pass down
symbol_name_match_type::SEARCH_NAME.
(lookup_symbol_aux, lookup_local_symbol): New parameter
'match_type'. Pass it down.
* symtab.h (symbol_name_match_type::SEARCH_NAME): New enumerator.
(lookup_symbol_search_name): New declaration.
(lookup_symbol_in_block): New 'match_type' parameter.
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670

View File

@ -14412,12 +14412,38 @@ ada_symbol_name_matches (const char *symbol_search_name,
comp_match_res);
}
/* A name matcher that matches the symbol name exactly, with
strcmp. */
static bool
literal_symbol_name_matcher (const char *symbol_search_name,
const lookup_name_info &lookup_name,
completion_match_result *comp_match_res)
{
const std::string &name = lookup_name.name ();
int cmp = (lookup_name.completion_mode ()
? strncmp (symbol_search_name, name.c_str (), name.size ())
: strcmp (symbol_search_name, name.c_str ()));
if (cmp == 0)
{
if (comp_match_res != NULL)
comp_match_res->set_match (symbol_search_name);
return true;
}
else
return false;
}
/* Implement the "la_get_symbol_name_matcher" language_defn method for
Ada. */
static symbol_name_matcher_ftype *
ada_get_symbol_name_matcher (const lookup_name_info &lookup_name)
{
if (lookup_name.match_type () == symbol_name_match_type::SEARCH_NAME)
return literal_symbol_name_matcher;
if (lookup_name.completion_mode ())
return ada_symbol_name_matches;
else

View File

@ -673,12 +673,13 @@ block_iter_match_next (const lookup_name_info &name,
struct symbol *
block_lookup_symbol (const struct block *block, const char *name,
symbol_name_match_type match_type,
const domain_enum domain)
{
struct block_iterator iter;
struct symbol *sym;
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
lookup_name_info lookup_name (name, match_type);
if (!BLOCK_FUNCTION (block))
{

View File

@ -258,6 +258,7 @@ extern struct symbol *block_iter_match_next
extern struct symbol *block_lookup_symbol (const struct block *block,
const char *name,
symbol_name_match_type match_type,
const domain_enum domain);
/* Search BLOCK for symbol NAME in DOMAIN but only in primary symbol table of

View File

@ -198,14 +198,17 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
struct symbol *wsym = NULL;
struct type *wtype;
struct block *block = NULL;
struct field_of_this_result is_this_fld;
if (want_space)
fputs_filtered (" ", stream);
if (msymbol.minsym != NULL)
wsym = lookup_symbol (MSYMBOL_LINKAGE_NAME(msymbol.minsym), block,
VAR_DOMAIN, &is_this_fld).symbol;
{
const char *search_name
= MSYMBOL_SEARCH_NAME (msymbol.minsym);
wsym = lookup_symbol_search_name (search_name, block,
VAR_DOMAIN).symbol;
}
if (wsym)
{

View File

@ -439,7 +439,10 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
block = BLOCKVECTOR_BLOCK (bv, block_loop);
if (BLOCK_FUNCTION (block) != NULL)
continue;
gdb_val_sym = block_lookup_symbol (block, COMPILE_I_EXPR_VAL, VAR_DOMAIN);
gdb_val_sym = block_lookup_symbol (block,
COMPILE_I_EXPR_VAL,
symbol_name_match_type::SEARCH_NAME,
VAR_DOMAIN);
if (gdb_val_sym == NULL)
continue;
@ -466,6 +469,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
gdb_type = check_typedef (gdb_type);
gdb_ptr_type_sym = block_lookup_symbol (block, COMPILE_I_EXPR_PTR_TYPE,
symbol_name_match_type::SEARCH_NAME,
VAR_DOMAIN);
if (gdb_ptr_type_sym == NULL)
error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);

View File

@ -141,7 +141,9 @@ cp_basic_lookup_symbol (const char *name, const struct block *block,
if (global_block != NULL)
{
sym.symbol = lookup_symbol_in_block (name, global_block, domain);
sym.symbol = lookup_symbol_in_block (name,
symbol_name_match_type::FULL,
global_block, domain);
sym.block = global_block;
}
}

View File

@ -1793,6 +1793,7 @@ cp_get_symbol_name_matcher (const lookup_name_info &lookup_name)
{
case symbol_name_match_type::FULL:
case symbol_name_match_type::EXPRESSION:
case symbol_name_match_type::SEARCH_NAME:
return cp_fq_symbol_name_matches;
case symbol_name_match_type::WILD:
return cp_symbol_name_matches;

View File

@ -7489,7 +7489,8 @@ insert_exception_resume_breakpoint (struct thread_info *tp,
CORE_ADDR handler;
struct breakpoint *bp;
vsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym), b, VAR_DOMAIN, NULL);
vsym = lookup_symbol_search_name (SYMBOL_SEARCH_NAME (sym),
b, VAR_DOMAIN);
value = read_var_value (vsym.symbol, vsym.block, frame);
/* If the value was optimized out, revert to the old behavior. */
if (! value_optimized_out (value))

View File

@ -246,15 +246,17 @@ pascal_val_print (struct type *type,
struct symbol *wsym = NULL;
struct type *wtype;
struct block *block = NULL;
struct field_of_this_result is_this_fld;
if (want_space)
fputs_filtered (" ", stream);
if (msymbol.minsym != NULL)
wsym = lookup_symbol (MSYMBOL_LINKAGE_NAME (msymbol.minsym),
block,
VAR_DOMAIN, &is_this_fld).symbol;
{
const char *search_name
= MSYMBOL_SEARCH_NAME (msymbol.minsym);
wsym = lookup_symbol_search_name (search_name, block,
VAR_DOMAIN).symbol;
}
if (wsym)
{

View File

@ -2254,7 +2254,8 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
length = ps->n_static_syms;
while (length--)
{
sym = block_lookup_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
sym = block_lookup_symbol (b, SYMBOL_SEARCH_NAME (*psym),
symbol_name_match_type::SEARCH_NAME,
SYMBOL_DOMAIN (*psym));
if (!sym)
{
@ -2271,7 +2272,8 @@ maintenance_check_psymtabs (const char *ignore, int from_tty)
length = ps->n_global_syms;
while (length--)
{
sym = block_lookup_symbol (b, SYMBOL_LINKAGE_NAME (*psym),
sym = block_lookup_symbol (b, SYMBOL_SEARCH_NAME (*psym),
symbol_name_match_type::SEARCH_NAME,
SYMBOL_DOMAIN (*psym));
if (!sym)
{

View File

@ -616,8 +616,8 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
{
struct symbol *nsym;
nsym = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
b, VAR_DOMAIN, NULL).symbol;
nsym = lookup_symbol_search_name (SYMBOL_SEARCH_NAME (sym),
b, VAR_DOMAIN).symbol;
gdb_assert (nsym != NULL);
if (SYMBOL_CLASS (nsym) == LOC_REGISTER
&& !SYMBOL_IS_ARGUMENT (nsym))
@ -2141,8 +2141,8 @@ iterate_over_block_arg_vars (const struct block *b,
float). There are also LOC_ARG/LOC_REGISTER pairs which
are not combined in symbol-reading. */
sym2 = lookup_symbol (SYMBOL_LINKAGE_NAME (sym),
b, VAR_DOMAIN, NULL).symbol;
sym2 = lookup_symbol_search_name (SYMBOL_SEARCH_NAME (sym),
b, VAR_DOMAIN).symbol;
(*cb) (SYMBOL_PRINT_NAME (sym), sym2, cb_data);
}
}

View File

@ -75,6 +75,7 @@ static int find_line_common (struct linetable *, int, int *, int);
static struct block_symbol
lookup_symbol_aux (const char *name,
symbol_name_match_type match_type,
const struct block *block,
const domain_enum domain,
enum language language,
@ -82,6 +83,7 @@ static struct block_symbol
static
struct block_symbol lookup_local_symbol (const char *name,
symbol_name_match_type match_type,
const struct block *block,
const domain_enum domain,
enum language language);
@ -1773,14 +1775,18 @@ demangle_for_lookup_info::demangle_for_lookup_info
if (without_params != NULL)
{
m_demangled_name = demangle_for_lookup (without_params.get (),
lang, storage);
if (lookup_name.match_type () != symbol_name_match_type::SEARCH_NAME)
m_demangled_name = demangle_for_lookup (without_params.get (),
lang, storage);
return;
}
}
m_demangled_name = demangle_for_lookup (lookup_name.name ().c_str (),
lang, storage);
if (lookup_name.match_type () == symbol_name_match_type::SEARCH_NAME)
m_demangled_name = lookup_name.name ();
else
m_demangled_name = demangle_for_lookup (lookup_name.name ().c_str (),
lang, storage);
}
/* See symtab.h. */
@ -1876,7 +1882,9 @@ lookup_symbol_in_language (const char *name, const struct block *block,
demangle_result_storage storage;
const char *modified_name = demangle_for_lookup (name, lang, storage);
return lookup_symbol_aux (modified_name, block, domain, lang,
return lookup_symbol_aux (modified_name,
symbol_name_match_type::FULL,
block, domain, lang,
is_a_field_of_this);
}
@ -1894,6 +1902,16 @@ lookup_symbol (const char *name, const struct block *block,
/* See symtab.h. */
struct block_symbol
lookup_symbol_search_name (const char *search_name, const struct block *block,
domain_enum domain)
{
return lookup_symbol_aux (search_name, symbol_name_match_type::SEARCH_NAME,
block, domain, language_asm, NULL);
}
/* See symtab.h. */
struct block_symbol
lookup_language_this (const struct language_defn *lang,
const struct block *block)
@ -1915,7 +1933,9 @@ lookup_language_this (const struct language_defn *lang,
{
struct symbol *sym;
sym = block_lookup_symbol (block, lang->la_name_of_this, VAR_DOMAIN);
sym = block_lookup_symbol (block, lang->la_name_of_this,
symbol_name_match_type::SEARCH_NAME,
VAR_DOMAIN);
if (sym != NULL)
{
if (symbol_lookup_debug > 1)
@ -1986,7 +2006,8 @@ check_field (struct type *type, const char *name,
(e.g., demangled name) of the symbol that we're looking for. */
static struct block_symbol
lookup_symbol_aux (const char *name, const struct block *block,
lookup_symbol_aux (const char *name, symbol_name_match_type match_type,
const struct block *block,
const domain_enum domain, enum language language,
struct field_of_this_result *is_a_field_of_this)
{
@ -2015,7 +2036,7 @@ lookup_symbol_aux (const char *name, const struct block *block,
/* Search specified block and its superiors. Don't search
STATIC_BLOCK or GLOBAL_BLOCK. */
result = lookup_local_symbol (name, block, domain, language);
result = lookup_local_symbol (name, match_type, block, domain, language);
if (result.symbol != NULL)
{
if (symbol_lookup_debug)
@ -2097,7 +2118,9 @@ lookup_symbol_aux (const char *name, const struct block *block,
Don't search STATIC_BLOCK or GLOBAL_BLOCK. */
static struct block_symbol
lookup_local_symbol (const char *name, const struct block *block,
lookup_local_symbol (const char *name,
symbol_name_match_type match_type,
const struct block *block,
const domain_enum domain,
enum language language)
{
@ -2112,7 +2135,7 @@ lookup_local_symbol (const char *name, const struct block *block,
while (block != static_block)
{
sym = lookup_symbol_in_block (name, block, domain);
sym = lookup_symbol_in_block (name, match_type, block, domain);
if (sym != NULL)
return (struct block_symbol) {sym, block};
@ -2165,7 +2188,8 @@ lookup_objfile_from_block (const struct block *block)
/* See symtab.h. */
struct symbol *
lookup_symbol_in_block (const char *name, const struct block *block,
lookup_symbol_in_block (const char *name, symbol_name_match_type match_type,
const struct block *block,
const domain_enum domain)
{
struct symbol *sym;
@ -2181,7 +2205,7 @@ lookup_symbol_in_block (const char *name, const struct block *block,
domain_name (domain));
}
sym = block_lookup_symbol (block, name, domain);
sym = block_lookup_symbol (block, name, match_type, domain);
if (sym)
{
if (symbol_lookup_debug > 1)
@ -2370,7 +2394,8 @@ lookup_symbol_via_quick_fns (struct objfile *objfile, int block_index,
bv = COMPUNIT_BLOCKVECTOR (cust);
block = BLOCKVECTOR_BLOCK (bv, block_index);
result.symbol = block_lookup_symbol (block, name, domain);
result.symbol = block_lookup_symbol (block, name,
symbol_name_match_type::FULL, domain);
if (result.symbol == NULL)
error_in_psymtab_expansion (block_index, name, cust);
@ -2483,7 +2508,9 @@ lookup_symbol_in_static_block (const char *name,
domain_name (domain));
}
sym = lookup_symbol_in_block (name, static_block, domain);
sym = lookup_symbol_in_block (name,
symbol_name_match_type::FULL,
static_block, domain);
if (symbol_lookup_debug)
{
fprintf_unfiltered (gdb_stdlog,

View File

@ -60,6 +60,16 @@ enum class symbol_name_match_type
namespace/module/package. */
FULL,
/* Search name matching. This is like FULL, but the search name did
not come from the user; instead it is already a search name
retrieved from a SYMBOL_SEARCH_NAME/MSYMBOL_SEARCH_NAME call.
For Ada, this avoids re-encoding an already-encoded search name
(which would potentially incorrectly lowercase letters in the
linkage/search name that should remain uppercase). For C++, it
avoids trying to demangle a name we already know is
demangled. */
SEARCH_NAME,
/* Expression matching. The same as FULL matching in most
languages. The same as WILD matching in Ada. */
EXPRESSION,
@ -1554,6 +1564,20 @@ extern struct block_symbol lookup_symbol (const char *,
const domain_enum,
struct field_of_this_result *);
/* Find the definition for a specified symbol search name in domain
DOMAIN, visible from lexical block BLOCK if non-NULL or from
global/static blocks if BLOCK is NULL. The passed-in search name
should not come from the user; instead it should already be a
search name as retrieved from a
SYMBOL_SEARCH_NAME/MSYMBOL_SEARCH_NAME call. See definition of
symbol_name_match_type::SEARCH_NAME. Returns the struct symbol
pointer, or NULL if no symbol is found. The symbol's section is
fixed up if necessary. */
extern struct block_symbol lookup_symbol_search_name (const char *search_name,
const struct block *block,
domain_enum domain);
/* A default version of lookup_symbol_nonlocal for use by languages
that can't think of anything better to do.
This implements the C lookup rules. */
@ -1603,6 +1627,7 @@ extern struct block_symbol
extern struct symbol *
lookup_symbol_in_block (const char *name,
symbol_name_match_type match_type,
const struct block *block,
const domain_enum domain);

View File

@ -1,3 +1,9 @@
2018-01-05 Joel Brobecker <brobecker@adacore.com>
PR gdb/22670
* gdb.ada/access_tagged_param.exp: New file.
* gdb.ada/access_tagged_param/foo.adb: New file.
2018-01-05 Pedro Alves <palves@redhat.com>
PR gdb/22670

View File

@ -0,0 +1,40 @@
# Copyright 2017-2018 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check that we can print values of parameters of type 'pointer
# (access) to tagged type'. See PR gdb/22670.
load_lib "ada.exp"
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
return -1
}
clean_restart ${testfile}
if ![runto "foo"] then {
perror "Couldn't run ${testfile}"
return
}
gdb_breakpoint "pck.inspect"
# Continue until we reach the breakpoint, and verify that we can print
# the value of all the parameters.
gdb_test "continue" \
".*Breakpoint $decimal, pck\\.inspect \\(obj=$hex, <objL>=2\\) at .*"

View File

@ -0,0 +1,20 @@
-- Copyright 2017-2018 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
procedure Foo is
begin
Inspect (new Top_T'(N => 2));
end Foo;

View File

@ -0,0 +1,21 @@
-- Copyright 2017-2018 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package body Pck is
procedure Inspect (Obj: access Top_T'Class) is
begin
null;
end Inspect;
end Pck;

View File

@ -0,0 +1,21 @@
-- Copyright 2017-2018 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
package Pck is
type Top_T is tagged record
N : Integer := 1;
end record;
procedure Inspect (Obj: access Top_T'Class);
end Pck;