[Bug symtab/25256] New: maint check-psymtab: Inline function only found in psymtab

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

[Bug symtab/25256] New: maint check-psymtab: Inline function only found in psymtab

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

            Bug ID: 25256
           Summary: maint check-psymtab: Inline function only found in
                    psymtab
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: minor
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider test-case inline.c:
...
static inline int
foo (void)
{
  return 0;
}

int
main (void)
{
  return foo ();
}
...

Compiled at -O2, with debug info:
...
$ gcc -O2 inline.c -g
...

When calling maint check-psymtab in this executable, we get:
...
$ gdb a.out
Reading symbols from a.out...
(gdb) maint check-psymtab
Static symbol `foo' only found in inline.c psymtab
...

Expanding all symtabs does not help:
...
(gdb) maint expand-symtabs
(gdb) maint check-psymtab
Static symbol `foo' only found in inline.c psymtab
...

The docs for 'maint check-psymtabs' state:
...
maint check-psymtabs

    Check the consistency of currently expanded psymtabs versus symtabs.
    Use this to check, for example, whether a symbol is in one but not
    the other.
...

This suggests that there is a consistency problem between symtabs and psymtabs
that needs to be fixed.

Otherwise, if this is expected behaviour, 'maint check-psymtabs' either:
- shouldn't be reporting it as an inconsistency, or,
- it should be reporting the reason for the inconsistency.

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

[Bug symtab/25256] maint check-psymtab: Inline function only found in psymtab

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
I ran into this with target board cc-with-dwz and test-case
gdb.ada/maint_with_ada.exp:
...
(gdb) maintenance check-psymtabs
Static symbol `__gthread_active_p' only found in  psymtab
Static symbol `next_fde' only found in  psymtab
Static symbol `get_cie' only found in  psymtab
Static symbol `read_sleb128' only found in  psymtab
Static symbol `read_uleb128' only found in  psymtab
Static symbol `size_of_encoded_value' only found in  psymtab
Static symbol `__gthread_active_p' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `next_fde' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `get_cie' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_sleb128' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_uleb128' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `size_of_encoded_value' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `uw_identify_context' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `uw_frob_return_addr' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `uw_advance_context' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_SetSpColumn' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `extract_cie_info' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `x86_64_fallback_frame_state' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_GRByValue' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_SetGRValue' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_SetGRPtr' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_GetGRPtr' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_GetPtr' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_IsExtendedContext' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_SetSignalFrame' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_IsSignalFrame' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_8s' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_8u' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_4s' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_4u' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_2s' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_2u' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_1s' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_1u' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_pointer' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_Get_Unwind_Context_Reg_Val' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_Get_Unwind_Word' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `__gthread_once' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `read_encoded_value' only found in ../../../libgcc/unwind-dw2.c
psymtab
(gdb) FAIL: gdb.ada/maint_with_ada.exp: maintenance check-psymtabs
...

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

[Bug symtab/25256] maint check-psymtab: Inline function only found in psymtab

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=25256

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> I ran into this with target board cc-with-dwz and test-case
> gdb.ada/maint_with_ada.exp:

Using this patch:
...
diff --git a/gdb/testsuite/gdb.ada/maint_with_ada.exp
b/gdb/testsuite/gdb.ada/maint_with_ada.exp
index 6c1bac2c4ca..b50a63cfca5 100644
--- a/gdb/testsuite/gdb.ada/maint_with_ada.exp
+++ b/gdb/testsuite/gdb.ada/maint_with_ada.exp
@@ -31,6 +31,7 @@ clean_restart ${testfile}
 gdb_breakpoint "adainit"
 gdb_breakpoint "Var_Arr_Typedef"
 gdb_breakpoint "Do_Nothing"
+gdb_test_no_output "maint expand-symtabs"

 gdb_test_no_output "maintenance check-psymtabs"

...

I managed to reproduce it without cc-with-dwz :
...
(gdb) maintenance check-psymtabs
Static symbol `_Unwind_Find_registered_FDE' only found in
../../../libgcc/unwind-dw2-fde-dip.c psymtab
Static symbol `binary_search_mixed_encoding_fdes' only found in
../../../libgcc/unwind-dw2-fde-dip.c psymtab
Static symbol `binary_search_single_encoding_fdes' only found in
../../../libgcc/unwind-dw2-fde-dip.c psymtab
Static symbol `binary_search_unencoded_fdes' only found in
../../../libgcc/unwind-dw2-fde-dip.c psymtab
Static symbol `init_object' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `end_fde_sort' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `fde_merge' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `fde_split' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `fde_insert' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `start_fde_sort' only found in
../../../libgcc/unwind-dw2-fde-dip.c psymtab
Static symbol `get_fde_encoding' only found in
../../../libgcc/unwind-dw2-fde-dip.c psymtab
Static symbol `__gthread_mutex_unlock' only found in
../../../libgcc/unwind-dw2-fde-dip.c psymtab
Static symbol `__gthread_mutex_lock' only found in
../../../libgcc/unwind-dw2-fde-dip.c psymtab
Static symbol `__gthread_active_p' only found in
../../../libgcc/unwind-dw2-fde-dip.c psymtab
Static symbol `last_fde' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `next_fde' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `get_cie' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `read_sleb128' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `read_uleb128' only found in ../../../libgcc/unwind-dw2-fde-dip.c
psymtab
Static symbol `uw_identify_context' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `uw_frob_return_addr' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `uw_advance_context' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_SetSpColumn' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `extract_cie_info' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `x86_64_fallback_frame_state' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_GRByValue' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_SetGRValue' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_SetGRPtr' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_GetGRPtr' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_GetPtr' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `_Unwind_IsExtendedContext' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_SetSignalFrame' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_IsSignalFrame' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_8s' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_8u' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_4s' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_4u' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_2s' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_2u' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_1s' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_1u' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_pointer' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_Get_Unwind_Context_Reg_Val' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `_Unwind_Get_Unwind_Word' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `__gthread_once' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `__gthread_active_p' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `next_fde' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `get_cie' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_encoded_value' only found in ../../../libgcc/unwind-dw2.c
psymtab
Static symbol `read_sleb128' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `read_uleb128' only found in ../../../libgcc/unwind-dw2.c psymtab
Static symbol `size_of_encoded_value' only found in
../../../libgcc/unwind-dw2.c psymtab
Static symbol `__udivmodti4' only found in ../../../libgcc/libgcc2.c psymtab
Static symbol `personality_body' only found in raise-gcc.c psymtab
Static symbol `continue_unwind' only found in raise-gcc.c psymtab
Static symbol `setup_to_install' only found in raise-gcc.c psymtab
Static symbol `get_action_description_for' only found in raise-gcc.c psymtab
Static symbol `is_handled_by' only found in raise-gcc.c psymtab
Static symbol `exception_class_eq' only found in raise-gcc.c psymtab
Static symbol `get_call_site_action_for' only found in raise-gcc.c psymtab
Static symbol `get_region_description_for' only found in raise-gcc.c psymtab
Static symbol `get_ttype_entry_for' only found in raise-gcc.c psymtab
Static symbol `db_region_for' only found in raise-gcc.c psymtab
Static symbol `get_ip_from_context' only found in raise-gcc.c psymtab
Static symbol `db_phases' only found in raise-gcc.c psymtab
Static symbol `read_encoded_value' only found in raise-gcc.c psymtab
Static symbol `read_sleb128' only found in raise-gcc.c psymtab
Static symbol `read_uleb128' only found in raise-gcc.c psymtab
Static symbol `size_of_encoded_value' only found in raise-gcc.c psymtab
Global symbol `system__wch_stw__get_next_code__get_utf_32' only found in
s-wchstw.adb psymtab
Global symbol `system__wch_stw__get_next_code__get_utf_32' only found in
s-wchstw.adb psymtab
Global symbol `system__wch_stw__get_next_code__get_utf_32' only found in
s-wchstw.adb psymtab
Global symbol `system__wch_stw__get_next_code__get_utf_32' only found in
s-wchstw.adb psymtab
Global symbol `system__wch_stw__get_next_code__get_utf_32__get_utf_byte' only
found in s-wchstw.adb psymtab
Global symbol `system__memory__c_free' only found in s-memory.adb psymtab
Global symbol `system__memory__c_malloc' only found in s-memory.adb psymtab
Global symbol `system__memory__c_realloc' only found in s-memory.adb psymtab
Global symbol `system__exception_table__get_registered_exceptions__get_all'
only found in s-exctab.adb psymtab
Global symbol `system__exception_table__get_registered_exceptions__get_all'
only found in s-exctab.adb psymtab
Global symbol `system__exception_table__get_registered_exceptions__get_one'
only found in s-exctab.adb psymtab
Global symbol `system__exception_table__registered_exceptions_count__count_all'
only found in s-exctab.adb psymtab
Global symbol `system__exception_table__registered_exceptions_count__count_all'
only found in s-exctab.adb psymtab
Global symbol
`system__exception_table__registered_exceptions_count__count_item' only found
in s-exctab.adb psymtab
(gdb) FAIL: gdb.ada/maint_with_ada.exp: maintenance check-psymtabs
...

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

[Bug symtab/25256] maint check-psymtab: Inline function only found in psymtab

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=25256

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> When calling maint check-psymtab in this executable, we get:
> ...
> $ gdb a.out
> Reading symbols from a.out...
> (gdb) maint check-psymtab
> Static symbol `foo' only found in inline.c psymtab
> ...

Using a bit more debugging, we get:
...
$ gdb -batch -iex "set complaints 100" a.out -ex "maint check-psymtab"
During symbol reading: cannot get low and high bounds for subprogram DIE at
0x114
Static symbol `foo' only found in inline.c psymtab
...

So, the reason the foo symbol is not in the full symtab, is here in
read_func_scope:
...
  /* Ignore functions with missing or invalid low and high pc attributes.  */
  if (dwarf2_get_pc_bounds (die, &lowpc, &highpc, cu, NULL)
      <= PC_BOUNDS_INVALID)
    {
      attr = dwarf2_attr (die, DW_AT_external, cu);
      if (!attr || !DW_UNSND (attr))
        complaint (_("cannot get low and high bounds "
                     "for subprogram DIE at %s"),
                   sect_offset_str (die->sect_off));
      return;
    }
...

Tentative patch that fixes the error message by making sure the corresponding
partial symbol is not created:
...
vries@delia:/data/gdb_versions/devel/src> git diff
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 1d4397dfab..299f532088 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -8445,7 +8445,7 @@ add_partial_subprogram (struct partial_die_info *pdi,
            }
         }

-      if (pdi->has_pc_info || (!pdi->is_external && pdi->may_be_inlined))
+      if (pdi->has_pc_info)
        {
           if (!pdi->is_declaration)
            /* Ignore subprogram DIEs that do not have a name, they are
...

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

[Bug symtab/25256] maint check-psymtab: Inline function only found in psymtab

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=25256

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
patch submitted:
https://sourceware.org/pipermail/gdb-patches/2020-March/166491.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 symtab/25256] maint check-psymtab: Inline function only found in psymtab

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=25256

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 with test-case committed at
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5707e24baa2f557d54e09641d69843111834cb9b
, marking resolved-fixed.

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