[Bug gdb/24549] New: D_AT_main_subprogram ignored with cc-with-gdb-index/cc-with-debug-names

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

[Bug gdb/24549] New: D_AT_main_subprogram ignored with cc-with-gdb-index/cc-with-debug-names

konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24549

            Bug ID: 24549
           Summary: D_AT_main_subprogram ignored with
                    cc-with-gdb-index/cc-with-debug-names
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ Filed earlier as "[RFC] How to fix gdb.dwarf2/main-subprogram.exp with
cc-with-gdb-index/cc-with-debug-names" (
https://sourceware.org/ml/gdb-patches/2019-05/msg00157.html ). ]

DW_AT_main_subprogram is supported in normal mode (in
read_partial_die), and tested by test-case gdb.dwarf2/main-subprogram.exp.

DW_AT_main_subprogram is currently not supported in -readnow mode, but
I've submitted a fix for that (in read_func_scope) see PR24517 -
"DW_AT_main_subprogram ignored with readnow".

Still, the test-case gdb.dwarf2/main-subprogram.exp fails with
executables that contain an index, either .gdb_index or .debug_names
(which is exercised by target boards cc-with-gdb-index and
cc-with-debug-names).

The test-case does not contain a DW_AT_main_subprogram in the compilation unit
DIE, as it should.  The test-case needs to be fixed up, and likewise gcc (
gcc#90422 - "DW_AT_main_subprogram not added to CU DIE" (
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90422 )).

But even with the test-case fixed, gdb does not handle the
DW_AT_main_subprogram in the CU DIE.

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

[Bug gdb/24549] DW_AT_main_subprogram ignored with cc-with-gdb-index/cc-with-debug-names

konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24549

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|D_AT_main_subprogram        |DW_AT_main_subprogram
                   |ignored with                |ignored with
                   |cc-with-gdb-index/cc-with-d |cc-with-gdb-index/cc-with-d
                   |ebug-names                  |ebug-names

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

[Bug gdb/24549] DW_AT_main_subprogram ignored with cc-with-gdb-index/cc-with-debug-names

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24549

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca,
                   |                            |tromey at sourceware dot org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, this looks worse than I thought.

This is not specific to using the start command. When we load a file, we want
to known the initial language, which we set based on ... the main symbol.

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

[Bug gdb/24549] DW_AT_main_subprogram ignored with cc-with-gdb-index/cc-with-debug-names

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24549

--- Comment #2 from Simon Marchi <simark at simark dot ca> ---
If we want it to work with index files, I guess the index format will need to
be changed to include this flag, won't it?

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

[Bug gdb/24549] DW_AT_main_subprogram ignored with cc-with-gdb-index/cc-with-debug-names

konrad.schwarz at siemens dot com
In reply to this post by konrad.schwarz at siemens dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=24549

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Simon Marchi from comment #2)
> If we want it to work with index files, I guess the index format will need
> to be changed to include this flag, won't it?

In absence of the GCC bug fix, it's in principle possible to fix this in GDB by
scanning all CUs until a DW_TAG_subprogram DIE with DW_AT_main_subprogram flag
is found, but that might take a lot of time, and I imagine it will reduce the
usefulness of the index to a point that it makes more sense to extend the index
format.

Assuming that the GCC bug is fixed, it's possible to fix this in GDB by
scanning only the CU attributes for each CU to find the DW_AT_main_subprogram
attribute flag. Then if found, scan the CU itself to find the actual
DW_TAG_subprogram DIE with DW_AT_main_subprogram flag. If that CU is large,
that will still take time to scan, so having this information available in the
index would speed that up.

So I'd say, agreed, adding this info to index files is a good idea.

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