[Bug ada/24671] New: [ada] printing FAILs with "has unknown type" when using -readnow

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug ada/24671] New: [ada] printing FAILs with "has unknown type" when using -readnow

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24671

            Bug ID: 24671
           Summary: [ada] printing FAILs with "has unknown type" when
                    using -readnow
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ada
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Without readnow (native):
...
(gdb) run ^M
Starting program:
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/access_to_packed_array/foo
^M
^M
Breakpoint 1, foo () at
/data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/access_to_packed_array/foo.adb:20^M
20         Pack.Do_Nothing (Pack.AA); --  BREAK^M
(gdb) print pack.a^M
$1 = (0 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)^M
...

with -readnow (readnow board):
...
(gdb) run ^M
Starting program:
/data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/access_to_packed_array/foo
^M
^M
Breakpoint 1, foo () at
/data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/access_to_packed_array/foo.adb:20^M
20         Pack.Do_Nothing (Pack.AA); --  BREAK^M
(gdb) print pack.a^M
'pack.a' has unknown type; cast it to its declared type^M
...

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug ada/24671] [ada] printing FAILs with "has unknown type" when using -readnow

glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24671

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |brobecker at adacore dot com,
                   |                            |tromey at sourceware dot org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Affected test-cases:
...
FAIL: gdb.ada/access_to_packed_array.exp: print pack.a
FAIL: gdb.ada/access_to_packed_array.exp: print pack.aa
FAIL: gdb.ada/access_to_packed_array.exp: print pack.a(2)
FAIL: gdb.ada/access_to_packed_array.exp: print pack.aa(2)
FAIL: gdb.ada/array_char_idx.exp: ptype char_table
FAIL: gdb.ada/array_char_idx.exp: ptype global_char_table
FAIL: gdb.ada/array_char_idx.exp: Display my_table
FAIL: gdb.ada/array_of_variable_length.exp: ptype pck.a
FAIL: gdb.ada/array_of_variable_length.exp: print pck.a
FAIL: gdb.ada/array_of_variable_length.exp: ptype $
FAIL: gdb.ada/arraydim.exp: ptype global_3dim_for_gdb_testing
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'first
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'last
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'length
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'first(1)
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'last(1)
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'length(1)
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'first(2)
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'last(2)
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'length(2)
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'first(3)
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'last(3)
FAIL: gdb.ada/arraydim.exp: print global_3dim_for_gdb_testing'length(3)
FAIL: gdb.ada/arrayparam.exp: print call_me ("bonjour")
FAIL: gdb.ada/arrayparam.exp: print first after function call
FAIL: gdb.ada/arrayparam.exp: print last after function call
FAIL: gdb.ada/arrayparam.exp: print length after function call
FAIL: gdb.ada/assign_arr.exp: print assign_arr_input.u2 := (0.25,0.5,0.75)
FAIL: gdb.ada/atomic_enum.exp: ptype pck.data_flag
FAIL: gdb.ada/bp_c_mixed_case.exp: p <MixedCaseFunc>, in Ada
FAIL: gdb.ada/call_pn.exp: print last_node_id before calling pn
FAIL: gdb.ada/call_pn.exp: print pn (4321)
FAIL: gdb.ada/call_pn.exp: print last_node_id after calling pn
FAIL: gdb.ada/char_param.exp: print procedure_result before calling same
FAIL: gdb.ada/char_param.exp: print procedure_result after calling same
FAIL: gdb.ada/char_param.exp: call next
FAIL: gdb.ada/char_param.exp: print procedure_result after calling next
FAIL: gdb.ada/complete.exp: p <Exported_Capitalized>
FAIL: gdb.ada/exec_changed.exp: start second
FAIL: gdb.ada/exec_changed.exp: start just first
FAIL: gdb.ada/expr_with_funcall.exp: print something()
FAIL: gdb.ada/expr_with_funcall.exp: print something() + 1
FAIL: gdb.ada/expr_with_funcall.exp: print something() - 2
FAIL: gdb.ada/expr_with_funcall.exp: print something() * 3
FAIL: gdb.ada/expr_with_funcall.exp: print something() / 4
FAIL: gdb.ada/expr_with_funcall.exp: print 1 + something()
FAIL: gdb.ada/expr_with_funcall.exp: print 246 - something()
FAIL: gdb.ada/expr_with_funcall.exp: print 3 * something()
FAIL: gdb.ada/expr_with_funcall.exp: print 496 / something()
FAIL: gdb.ada/expr_with_funcall.exp: print something
FAIL: gdb.ada/expr_with_funcall.exp: print something + 1
FAIL: gdb.ada/expr_with_funcall.exp: print something - 2
FAIL: gdb.ada/expr_with_funcall.exp: print something * 3
FAIL: gdb.ada/expr_with_funcall.exp: print something / 4
FAIL: gdb.ada/expr_with_funcall.exp: print 1 + something
FAIL: gdb.ada/expr_with_funcall.exp: print 246 - something
FAIL: gdb.ada/expr_with_funcall.exp: print 3 * something
FAIL: gdb.ada/expr_with_funcall.exp: print 496 / something
FAIL: gdb.ada/float_param.exp: call set_float(2.0)
FAIL: gdb.ada/float_param.exp: print global_float
FAIL: gdb.ada/float_param.exp: call set_double(1, 3.0)
FAIL: gdb.ada/float_param.exp: print global_double
FAIL: gdb.ada/float_param.exp: call set_long_double(1, global_small_struct,
4.0)
FAIL: gdb.ada/float_param.exp: print global_long_double
FAIL: gdb.ada/fun_renaming.exp: print fun_rename_test_next(1)
FAIL: gdb.ada/funcall_param.exp: p ident (ident (my_parameter))
FAIL: gdb.ada/funcall_ptr.exp: Check that initial value of GA is null
FAIL: gdb.ada/funcall_ptr.exp: call pck.p(0x1234)
FAIL: gdb.ada/funcall_ptr.exp: Check that value of GA is 0x1234
FAIL: gdb.ada/info_addr_mixed_case.exp: info address my_table
FAIL: gdb.ada/info_addr_mixed_case.exp: info address My_Table
FAIL: gdb.ada/info_addr_mixed_case.exp: info address pck.my_table
FAIL: gdb.ada/info_addr_mixed_case.exp: info address Pck.My_Table
FAIL: gdb.ada/interface.exp: print s
FAIL: gdb.ada/iwide.exp: print My_Drawable
FAIL: gdb.ada/iwide.exp: print s_access.all
FAIL: gdb.ada/iwide.exp: print sp_access.all
FAIL: gdb.ada/iwide.exp: print d_access.all
FAIL: gdb.ada/iwide.exp: print dp_access.all
FAIL: gdb.ada/mi_interface.exp: create ggg1 varobj (unexpected output)
FAIL: gdb.ada/mi_interface.exp: list ggg1's children (unexpected output)
FAIL: gdb.ada/minsyms.exp: print integer(some_minsym)
FAIL: gdb.ada/minsyms.exp: print &some_minsym
FAIL: gdb.ada/minsyms.exp: print /x integer(&some_minsym)
FAIL: gdb.ada/notcplusplus.exp: print <symada__cS> before loading symbols from
ver.ads
FAIL: gdb.ada/ptype_array.exp: ptype 2..5
FAIL: gdb.ada/ptype_array.exp: ptype 3..5
FAIL: gdb.ada/ptype_tagged_param.exp: ptype s
FAIL: gdb.ada/ptype_union.exp: ptype global
FAIL: gdb.ada/ptype_union.exp: print global
FAIL: gdb.ada/rec_return.exp: print bar
FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b before
changing its value
FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b after
changing its value
FAIL: gdb.ada/same_enum.exp: print red
FAIL: gdb.ada/str_ref_cmp.exp: print String_Var (1 .. 3) = "Hel"
FAIL: gdb.ada/str_ref_cmp.exp: print String_Var (1 .. 3) = "hel"
FAIL: gdb.ada/sym_print_name.exp: multiple matches for symbol integervar
FAIL: gdb.ada/taft_type.exp: print w.e.all
FAIL: gdb.ada/tagged.exp: ptype obj
FAIL: gdb.ada/tagged.exp: print obj
FAIL: gdb.ada/tagged_access.exp: ptype c.all
FAIL: gdb.ada/tagged_access.exp: ptype c.menu_name
FAIL: gdb.ada/var_rec_arr.exp: print a1
FAIL: gdb.ada/var_rec_arr.exp: print a1(1)
FAIL: gdb.ada/var_rec_arr.exp: print a1(2)
FAIL: gdb.ada/var_rec_arr.exp: print a1(3)
FAIL: gdb.ada/var_rec_arr.exp: print a2
FAIL: gdb.ada/var_rec_arr.exp: print a2(1)
FAIL: gdb.ada/var_rec_arr.exp: print a2(2)
FAIL: gdb.ada/var_rec_arr.exp: print a2(3)
FAIL: gdb.ada/var_rec_arr.exp: ptype a1(1)
FAIL: gdb.ada/watch_minus_l.exp: watch -location pck.global_var
FAIL: gdb.ada/watch_minus_l.exp: continue with watch -location (the program
exited)
...

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug ada/24671] [ada] printing FAILs with "has unknown type" when using -readnow

glaubitz at physik dot fu-berlin.de
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24671

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca,
                   |                            |vries at gcc dot gnu.org

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
This looks related to add_nonlocal_symbols in ada-lang.c, which uses
objfile->sf->qf->map_matching_symbols:
...
  for (objfile *objfile : current_program_space->objfiles ())
    {
      data.objfile = objfile;

      objfile->sf->qf->map_matching_symbols (objfile, lookup_name,
                                             domain, global, callback,
                                             (is_wild_match
                                              ? NULL : compare_names));

      for (compunit_symtab *cu : objfile->compunits ())
        {
          const struct block *global_block
            = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cu), GLOBAL_BLOCK);

          if (ada_add_block_renamings (obstackp, global_block, lookup_name,
                                       domain))
            data.found_sym = 1;
        }
    }

  if (num_defns_collected (obstackp) == 0 && global && !is_wild_match)
    {
      const char *name = ada_lookup_name (lookup_name);
      lookup_name_info name1 (std::string ("<_ada_") + name + '>',
                              symbol_name_match_type::FULL);

      for (objfile *objfile : current_program_space->objfiles ())
        {
          data.objfile = objfile;
          objfile->sf->qf->map_matching_symbols (objfile, name1,
                                                 domain, global, callback,
                                                 compare_names);
        }
    }
...

There are 3 types of quick functions (excluding debug_sym_quick_functions):
...
const struct quick_symbol_functions psym_functions;
const struct quick_symbol_functions dwarf2_gdb_index_functions;
const struct quick_symbol_functions dwarf2_debug_names_functions;
...

Normally we use psym_functions, and qf->map_matching_symbols is implemented by
psym_map_matching_symbols.

When using -readnow, we use dwarf2_gdb_index_functions instead, and
qf->map_matching_symbols is implemented by dw2_map_matching_symbols, which
doesn't do anything:
...
static void
dw2_map_matching_symbols
  (struct objfile *objfile,
   const lookup_name_info &name, domain_enum domain,
   int global,
   gdb::function_view<symbol_found_callback_ftype> callback,
   symbol_compare_ftype *ordered_compare)
{
  /* Currently unimplemented; used for Ada.  The function can be called if the  
     current language is Ada for a non-Ada objfile using GNU index.  As Ada    
     does not look for non-Ada symbols this function should just return.  */
}
...

Note: even if we force dwarf2_initialize_objfile to use
dw_index_kind::DEBUG_NAMES when encountering -readnow, that doesn't help either
because we basically hit the same problem in
dw2_debug_names_map_matching_symbols:
...
static void
dw2_debug_names_map_matching_symbols
  (struct objfile *objfile,
   const lookup_name_info &name, domain_enum domain,
   int global,
   gdb::function_view<symbol_found_callback_ftype> callback,
   symbol_compare_ftype *ordered_compare)
{
  struct dwarf2_per_objfile *dwarf2_per_objfile
    = get_dwarf2_per_objfile (objfile);

  /* debug_names_table is NULL if OBJF_READNOW.  */
  if (!dwarf2_per_objfile->debug_names_table)
    return;
...

So, AFAIU, it seems the root cause is that add_nonlocal_symbols does not tap
into the normal, full symtabs.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug ada/24671] [ada] printing FAILs with "has unknown type" when using -readnow

Sourceware - gdb-prs mailing list
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24671

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
posted patch:
https://sourceware.org/pipermail/gdb-patches/2020-March/166945.html

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug ada/24671] [ada] printing FAILs with "has unknown type" when using -readnow

Sourceware - gdb-prs mailing list
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24671

--- Comment #4 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <[hidden email]>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1aa98955b19676497f89112a0962f24f359ce761

commit 1aa98955b19676497f89112a0962f24f359ce761
Author: Tom de Vries <[hidden email]>
Date:   Thu Apr 2 08:58:38 2020 +0200

    [gdb/ada] Fix -readnow FAILs

    When running test-case gdb.ada/access_to_packed_array we have:
    ...
    (gdb) print pack.a^M
    $1 = (0 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)^M
    ...
    but with target board readnow.exp, we have instead:
    ...
    (gdb) print pack.a^M
    'pack.a' has unknown type; cast it to its declared type^M
    ...

    The symbol is normally found by the map_matching_symbols call in
    ada-lang.c:add_nonlocal_symbols:
    ...
      for (objfile *objfile : current_program_space->objfiles ())
        {
          data.objfile = objfile;

          objfile->sf->qf->map_matching_symbols (objfile, lookup_name,
                                                 domain, global, callback,
                                                 (is_wild_match
                                                  ? NULL : compare_names));
    ...
    which maps onto psym_map_matching_symbols.

    Function psym_map_matching_symbols iterates over all the partial symtabs,
    and:
    - if not expanded, searches in the partial symtab:
      - if not found, continues to the next
      - if found, expands into full symtab
    - searches in the full symtab

    However, with -readnow the call maps onto dw2_map_matching_symbols instead,
    which is unimplemented, and consequently no symbol is found.

    Fix this by detecting -readnow in dw2_map_matching_symbols, and handling
that
    appropriately given that partial symtabs are not present, and full symtabs
    are: iterate over all the symtabs and search them.

    Tested on x86_64-linux, with native and target board -readnow.

    This removes 217 FAILs with board -readnow.

    gdb/ChangeLog:

    2020-04-02  Tom de Vries  <[hidden email]>

            PR ada/24671
            * dwarf2/read.c (dw2_map_matching_symbols): Handle -readnow.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug ada/24671] [ada] printing FAILs with "has unknown type" when using -readnow

Sourceware - gdb-prs mailing list
In reply to this post by glaubitz at physik dot fu-berlin.de
https://sourceware.org/bugzilla/show_bug.cgi?id=24671

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch committed, marking resolved-fixed.

--
You are receiving this mail because:
You are on the CC list for the bug.